📄 ndbaaaaa.b
字号:
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 ManualSignService:IManualSignService
{
#region IBaseService<ManualSign> 成员
private static List<ManualSign> GetModelsFromDataSet(DataSet ds)
{
List<ManualSign> ls = new List<ManualSign>();
foreach (DataRow row in ds.Tables[0].Rows)
{
ManualSign model = new ManualSign();
model.SignId = Convert.ToInt32(row[0]);
model.UserId = Convert.ToString(row[1]);
model.SignTime = Convert.ToDateTime(row[2]);
model.SignDesc = Convert.ToString(row[3]);
model.SignTag = Convert.ToInt32(row[4]);
ls.Add(model);
}
return ls;
}
public int AddModel(ManualSign model)
{
string sql = string.Format("insert into ManualSign values('{0}','{1}','{2}','{3}')", model.UserId,model.SignTime,model.SignDesc,model.SignTag);
return DBOperate.UpdateModel(sql);
}
public int DeleteModelById(int id)
{
string where = " SignId=" + id;
return DeleteModelByWhere(where);
}
public int DeleteModelByWhere(string where)
{
string sql = string.Format("delete ManualSign");
if (!string.IsNullOrEmpty(where))
{
sql = sql + " where " + where;
}
return DBOperate.UpdateModel(sql);
}
public int UpdateModel(ManualSign model)
{
string something = string.Format(" UserId='{0}',SignTime='{1}',SignDesc='{2}',SignTag='{3}' ", model.UserId, model.SignTime, model.SignDesc, model.SignTag);
string where = string.Format(" SignId={0} ", model.SignId);
return UpdateSomethingByWhere(something, where);
}
public int UpdateSomethingByWhere(string something, string where)
{
string sql = "update ManualSign set " + something;
if (!string.IsNullOrEmpty(where))
{
sql = sql + " where " + where;
}
return DBOperate.UpdateModel(sql);
}
public List<ManualSign> GetAllModels()
{
DataSet ds = DBOperate.GetModels("ManualSign", "");
return GetModelsFromDataSet(ds);
}
public ManualSign GetModelById(int id)
{
DataSet ds = DBOperate.GetModels("ManualSign", "SignId=" + id);
return GetModelsFromDataSet(ds)[0];
}
public List<ManualSign> GetModelByForeignKey(int ForeignKeyID)
{
throw new Exception("The method or operation is not implemented.");
}
public List<ManualSign> GetModels(string strWhere)
{
DataSet ds = DBOperate.GetModels("ManualSign", strWhere);
return GetModelsFromDataSet(ds);
}
public List<ManualSign> GetModels(int pageIndex, int pageSize, string orderColumnsName, string strWhere)
{
DataSet ds = DBOperate.GetModels("ManualSign", pageIndex, pageSize, orderColumnsName, strWhere);
return GetModelsFromDataSet(ds);
}
public List<ManualSign> GetModels(int pageIndex, int pageSize, string orderColumnsName)
{
return GetModels(pageIndex, pageSize, orderColumnsName, "");
}
public List<ManualSign> GetModels(int pageIndex, string orderColumnsName)
{
return GetModels(pageIndex, 10, orderColumnsName, "");
}
public List<ManualSign> GetModels(int pageIndex, int pageSize)
{
return GetModels(pageIndex, pageSize, "SignId", "");
}
public List<ManualSign> GetModels(int pageIndex)
{
return GetModels(pageIndex, 10, "SignId", "");
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -