using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CallCenterApi.BLL
{
    /// <summary>
    /// 履职信息记录表
    /// </summary>
    public partial class T_Bus_PerformDutiesRecords
    {
        private readonly CallCenterApi.DAL.T_Bus_PerformDutiesRecords dal = new CallCenterApi.DAL.T_Bus_PerformDutiesRecords();
        public T_Bus_PerformDutiesRecords()
        { }
        #region  Method

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(CallCenterApi.Model.T_Bus_PerformDutiesRecords model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(CallCenterApi.Model.T_Bus_PerformDutiesRecords model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int F_ID)
        {

            return dal.Delete(F_ID);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool DeleteList(string F_IDlist)
        {
            return dal.DeleteList(F_IDlist);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CallCenterApi.Model.T_Bus_PerformDutiesRecords GetModel(int F_ID)
        {

            return dal.GetModel(F_ID);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<CallCenterApi.Model.T_Bus_PerformDutiesRecords> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<CallCenterApi.Model.T_Bus_PerformDutiesRecords> DataTableToList(DataTable dt)
        {
            List<CallCenterApi.Model.T_Bus_PerformDutiesRecords> modelList = new List<CallCenterApi.Model.T_Bus_PerformDutiesRecords>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                CallCenterApi.Model.T_Bus_PerformDutiesRecords model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            return dal.GetRecordCount(strWhere);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
        }

        #endregion  Method

        #region  ExtensionMethod
        public int AddInfo(Model.T_Bus_PerformDuties model, string user, string guid)
        {
            Model.T_Bus_PerformDutiesRecords resmodel = new Model.T_Bus_PerformDutiesRecords();
            resmodel.F_WorkOrderId = model.F_WorkOrderId;
            resmodel.F_AssignedId = model.F_AssignedId;
            resmodel.F_VisitId = model.F_VisitId;
            resmodel.F_File = model.F_File;
            resmodel.F_State = model.F_State;
            resmodel.F_Result = model.F_Result;
            resmodel.F_IsAudit = model.F_IsAudit;
            resmodel.F_IsDelete = model.F_IsDelete;
            resmodel.F_CreateDeptId = model.F_CreateDeptId;
            resmodel.F_CreateTime = model.F_CreateTime;
            resmodel.F_CreateUser = model.F_CreateUser;
            resmodel.F_AuditReason = model.F_AuditReason;
            resmodel.F_AuditTime = model.F_AuditTime;
            resmodel.F_AuditUser = model.F_AuditUser;
            resmodel.F_DeleteTime = model.F_DeleteTime;
            resmodel.F_DeleteUser = model.F_DeleteUser;
            resmodel.F_PerId = model.F_Id;
            resmodel.F_Guid = guid;
            resmodel.F_ReUser = user;
            resmodel.F_ReTime = DateTime.Now;
            return dal.Add(resmodel);
        }

        #endregion  ExtensionMethod
    }
}
