using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CallCenterApi.BLL
{
///
/// T_Ask_QuestionCategory
///
public partial class T_Ask_QuestionCategory
{
private readonly CallCenterApi.DAL.T_Ask_QuestionCategory dal = new CallCenterApi.DAL.T_Ask_QuestionCategory();
public T_Ask_QuestionCategory()
{ }
#region Method
///
/// 是否存在该记录
///
public bool Exists(int F_CategoryId)
{
return dal.Exists(F_CategoryId);
}
///
/// 增加一条数据
///
public int Add(CallCenterApi.Model.T_Ask_QuestionCategory model)
{
return dal.Add(model);
}
///
/// 更新一条数据
///
public bool Update(CallCenterApi.Model.T_Ask_QuestionCategory model)
{
return dal.Update(model);
}
///
/// 删除一条数据
///
public bool Delete(int F_CategoryId)
{
return dal.Delete(F_CategoryId);
}
///
/// 删除一条数据
///
public bool DeleteList(string F_CategoryIdlist)
{
return dal.DeleteList(F_CategoryIdlist);
}
///
/// 得到一个对象实体
///
public CallCenterApi.Model.T_Ask_QuestionCategory GetModel(int F_CategoryId)
{
return dal.GetModel(F_CategoryId);
}
///
/// 获得数据列表
///
public DataSet GetList(string strWhere)
{
return dal.GetList(strWhere);
}
///
/// 获得前几行数据
///
public DataSet GetList(int Top, string strWhere, string filedOrder)
{
return dal.GetList(Top, strWhere, filedOrder);
}
///
/// 获得数据列表
///
public List GetModelList(string strWhere)
{
DataSet ds = dal.GetList(strWhere);
return DataTableToList(ds.Tables[0]);
}
///
/// 获得数据列表
///
public List DataTableToList(DataTable dt)
{
List modelList = new List();
int rowsCount = dt.Rows.Count;
if (rowsCount > 0)
{
CallCenterApi.Model.T_Ask_QuestionCategory model;
for (int n = 0; n < rowsCount; n++)
{
model = new CallCenterApi.Model.T_Ask_QuestionCategory();
if (dt.Rows[n]["F_CategoryId"] != null && dt.Rows[n]["F_CategoryId"].ToString() != "")
{
model.F_CategoryId = int.Parse(dt.Rows[n]["F_CategoryId"].ToString());
}
if (dt.Rows[n]["F_CategoryNumber"] != null && dt.Rows[n]["F_CategoryNumber"].ToString() != "")
{
model.F_CategoryNumber = dt.Rows[n]["F_CategoryNumber"].ToString();
}
if (dt.Rows[n]["F_CategoryName"] != null && dt.Rows[n]["F_CategoryName"].ToString() != "")
{
model.F_CategoryName = dt.Rows[n]["F_CategoryName"].ToString();
}
if (dt.Rows[n]["F_CategoryEName"] != null && dt.Rows[n]["F_CategoryEName"].ToString() != "")
{
model.F_CategoryEName = dt.Rows[n]["F_CategoryEName"].ToString();
}
if (dt.Rows[n]["F_Layer"] != null && dt.Rows[n]["F_Layer"].ToString() != "")
{
model.F_Layer = int.Parse(dt.Rows[n]["F_Layer"].ToString());
}
if (dt.Rows[n]["F_ParentId"] != null && dt.Rows[n]["F_ParentId"].ToString() != "")
{
model.F_ParentId = int.Parse(dt.Rows[n]["F_ParentId"].ToString());
}
if (dt.Rows[n]["F_CategoryType"] != null && dt.Rows[n]["F_CategoryType"].ToString() != "")
{
model.F_CategoryType = int.Parse(dt.Rows[n]["F_CategoryType"].ToString());
}
if (dt.Rows[n]["F_CanDelete"] != null && dt.Rows[n]["F_CanDelete"].ToString() != "")
{
model.F_CanDelete = int.Parse(dt.Rows[n]["F_CanDelete"].ToString());
}
if (dt.Rows[n]["F_IsCommon"] != null && dt.Rows[n]["F_IsCommon"].ToString() != "")
{
model.F_IsCommon = int.Parse(dt.Rows[n]["F_IsCommon"].ToString());
}
if (dt.Rows[n]["F_Sort"] != null && dt.Rows[n]["F_Sort"].ToString() != "")
{
model.F_Sort = int.Parse(dt.Rows[n]["F_Sort"].ToString());
}
if (dt.Rows[n]["F_Expand1"] != null && dt.Rows[n]["F_Expand1"].ToString() != "")
{
model.F_Expand1 = dt.Rows[n]["F_Expand1"].ToString();
}
if (dt.Rows[n]["F_Expand2"] != null && dt.Rows[n]["F_Expand2"].ToString() != "")
{
model.F_Expand2 = dt.Rows[n]["F_Expand2"].ToString();
}
if (dt.Rows[n]["F_CreateOn"] != null && dt.Rows[n]["F_CreateOn"].ToString() != "")
{
model.F_CreateOn = DateTime.Parse(dt.Rows[n]["F_CreateOn"].ToString());
}
if (dt.Rows[n]["F_CreateBy"] != null && dt.Rows[n]["F_CreateBy"].ToString() != "")
{
model.F_CreateBy = int.Parse(dt.Rows[n]["F_CreateBy"].ToString());
}
if (dt.Rows[n]["F_DeleteFlag"] != null && dt.Rows[n]["F_DeleteFlag"].ToString() != "")
{
model.F_DeleteFlag = int.Parse(dt.Rows[n]["F_DeleteFlag"].ToString());
}
modelList.Add(model);
}
}
return modelList;
}
///
/// 获得数据列表
///
public DataSet GetAllList()
{
return GetList("");
}
///
/// 分页获取数据列表
///
public int GetRecordCount(string strWhere)
{
return dal.GetRecordCount(strWhere);
}
///
/// 分页获取数据列表
///
public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
{
return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
}
///
/// 分页获取数据列表
///
//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
//{
//return dal.GetList(PageSize,PageIndex,strWhere);
//}
#endregion Method
}
}