📄 odbaaaaa.a
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using MODEL;
using DBManage;
using IDAL;
namespace SQLServerDAL
{
public class MeetingInfoService:IMeetingInfoService
{
#region IBaseService<MeetingInfo> 成员
private static List<MeetingInfo> GetModelsFromDataSet(DataSet ds)
{
List<MeetingInfo> ls = new List<MeetingInfo>();
foreach (DataRow row in ds.Tables[0].Rows)
{
MeetingInfo model = new MeetingInfo();
model.MeetingId= Convert.ToInt32(row[0]);
model.MeetingName= Convert.ToString(row[1]);
ls.Add(model);
}
return ls;
}
public int AddModel(MeetingInfo model)
{
string sql = string.Format("insert into MeetingInfo values('{0}')", model.MeetingName);
return DBOperate.UpdateModel(sql);
}
public int DeleteModelById(int id)
{
string where = " MeetingId=" + id;
return DeleteModelByWhere(where);
}
public int DeleteModelByWhere(string where)
{
string sql = string.Format("delete MeetingInfo");
if (!string.IsNullOrEmpty(where))
{
sql = sql + " where " + where;
}
return DBOperate.UpdateModel(sql);
}
public int UpdateModel(MeetingInfo model)
{
string something = string.Format(" MeetingName='{0}' ", model.MeetingName);
string where = string.Format(" MeetingId={0} ", model.MeetingId);
return UpdateSomethingByWhere(something, where);
}
public int UpdateSomethingByWhere(string something, string where)
{
string sql = "update MeetingInfo set " + something;
if (!string.IsNullOrEmpty(where))
{
sql = sql + " where " + where;
}
return DBOperate.UpdateModel(sql);
}
public List<MeetingInfo> GetAllModels()
{
DataSet ds = DBOperate.GetModels("MeetingInfo", "");
return GetModelsFromDataSet(ds);
}
public MeetingInfo GetModelById(int id)
{
DataSet ds = DBOperate.GetModels("MeetingInfo", "MeetingId=" + id);
return GetModelsFromDataSet(ds)[0];
}
public List<MeetingInfo> GetModelByForeignKey(int ForeignKeyID)
{
throw new Exception("The method or operation is not implemented.");
}
public List<MeetingInfo> GetModels(string strWhere)
{
DataSet ds = DBOperate.GetModels("MeetingInfo", strWhere);
return GetModelsFromDataSet(ds);
}
public List<MeetingInfo> GetModels(int pageIndex, int pageSize, string orderColumnsName, string strWhere)
{
DataSet ds = DBOperate.GetModels("MeetingInfo", pageIndex, pageSize, orderColumnsName, strWhere);
return GetModelsFromDataSet(ds);
}
public List<MeetingInfo> GetModels(int pageIndex, int pageSize, string orderColumnsName)
{
return GetModels(pageIndex, pageSize, orderColumnsName, "");
}
public List<MeetingInfo> GetModels(int pageIndex, string orderColumnsName)
{
return GetModels(pageIndex, 10, orderColumnsName, "");
}
public List<MeetingInfo> GetModels(int pageIndex, int pageSize)
{
return GetModels(pageIndex, pageSize, "MeetingId", "");
}
public List<MeetingInfo> GetModels(int pageIndex)
{
return GetModels(pageIndex, 10, "MeetingId", "");
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -