using RMYY_CallCenter_Api.Dal;
using RMYY_CallCenter_Api.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RMYY_CallCenter_Api.Bll
{
   public  class T_Wowo_repairyqbll
    {
        private readonly T_Wowo_repairyqdal dal = new T_Wowo_repairyqdal();
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Addrepairitems(RMYY_CallCenter_Api.Model.T_Wowo_repairyq model)
        {
            return dal.Addrepairitems(model);
        }
        #region 修改
        /// <summary>
        /// 修改一条院区信息
        /// </summary>
        public bool Updaterepair(RMYY_CallCenter_Api.Model.T_Wowo_repairyq model)
        {
            return dal.Updaterepair(model);
        }

        #endregion
        #region 删除
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Deleterepair(int id)
        {

            return dal.Deleterepair(id);
        }
        #endregion
        #region 查询
        /// <summary>
        /// 获取院区信息
        /// </summary>
        public List<T_Wowo_repairyq> GetListall()
        {
            //DataSet ds = dal.GetListall();
            //return DataTableToList(ds.Tables[0]);
            return dal.GetListall();
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public List<T_Wowo_repairyq> GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            DataSet ds= dal.GetListByPage(strWhere, orderby, startIndex, endIndex);

            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<RMYY_CallCenter_Api.Model.T_Wowo_repairyq> DataTableToList(DataTable dt)
        {
            List<RMYY_CallCenter_Api.Model.T_Wowo_repairyq> modelList = new List<RMYY_CallCenter_Api.Model.T_Wowo_repairyq>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                RMYY_CallCenter_Api.Model.T_Wowo_repairyq 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 RMYY_CallCenter_Api.Model.T_Wowo_repairyq GetModel(int id)
        {
            return dal.GetModel(id);
        }

        #endregion
    }
}
