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

namespace HySoft.BaseCallCenter.BLL
{
    /// <summary>
    /// T_Form_FormInfo
    /// </summary>
    public partial class T_Form_FormInfo
    {
        private readonly HySoft.BaseCallCenter.DAL.T_Form_FormInfo dal = new HySoft.BaseCallCenter.DAL.T_Form_FormInfo();
        public T_Form_FormInfo()
        { }
        #region  Method
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int F_FormId)
        {
            return dal.Exists(F_FormId);
        }

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

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

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

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

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HySoft.BaseCallCenter.Model.T_Form_FormInfo GetModel(int F_FormId)
        {

            return dal.GetModel(F_FormId);
        }

        /// <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<HySoft.BaseCallCenter.Model.T_Form_FormInfo> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<HySoft.BaseCallCenter.Model.T_Form_FormInfo> DataTableToList(DataTable dt)
        {
            List<HySoft.BaseCallCenter.Model.T_Form_FormInfo> modelList = new List<HySoft.BaseCallCenter.Model.T_Form_FormInfo>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                HySoft.BaseCallCenter.Model.T_Form_FormInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new HySoft.BaseCallCenter.Model.T_Form_FormInfo();
                    if (dt.Rows[n]["F_FormId"] != null && dt.Rows[n]["F_FormId"].ToString() != "")
                    {
                        model.F_FormId = int.Parse(dt.Rows[n]["F_FormId"].ToString());
                    }
                    if (dt.Rows[n]["F_FormName"] != null && dt.Rows[n]["F_FormName"].ToString() != "")
                    {
                        model.F_FormName = dt.Rows[n]["F_FormName"].ToString();
                    }
                    if (dt.Rows[n]["F_FormTable"] != null && dt.Rows[n]["F_FormTable"].ToString() != "")
                    {
                        model.F_FormTable = dt.Rows[n]["F_FormTable"].ToString();
                    }
                    if (dt.Rows[n]["F_FormType"] != null && dt.Rows[n]["F_FormType"].ToString() != "")
                    {
                        model.F_FormType = dt.Rows[n]["F_FormType"].ToString();
                    }
                    if (dt.Rows[n]["F_FormDes"] != null && dt.Rows[n]["F_FormDes"].ToString() != "")
                    {
                        model.F_FormDes = dt.Rows[n]["F_FormDes"].ToString();
                    }
                    if (dt.Rows[n]["F_FormUrl"] != null && dt.Rows[n]["F_FormUrl"].ToString() != "")
                    {
                        model.F_FormUrl = dt.Rows[n]["F_FormUrl"].ToString();
                    }
                    if (dt.Rows[n]["F_EntityId"] != null && dt.Rows[n]["F_EntityId"].ToString() != "")
                    {
                        model.F_EntityId = int.Parse(dt.Rows[n]["F_EntityId"].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_CreateName"] != null && dt.Rows[n]["F_CreateName"].ToString() != "")
                    {
                        model.F_CreateName = dt.Rows[n]["F_CreateName"].ToString();
                    }
                    if (dt.Rows[n]["F_ModifyOn"] != null && dt.Rows[n]["F_ModifyOn"].ToString() != "")
                    {
                        model.F_ModifyOn = DateTime.Parse(dt.Rows[n]["F_ModifyOn"].ToString());
                    }
                    if (dt.Rows[n]["F_ModifyBy"] != null && dt.Rows[n]["F_ModifyBy"].ToString() != "")
                    {
                        model.F_ModifyBy = int.Parse(dt.Rows[n]["F_ModifyBy"].ToString());
                    }
                    if (dt.Rows[n]["F_ModifyName"] != null && dt.Rows[n]["F_ModifyName"].ToString() != "")
                    {
                        model.F_ModifyName = dt.Rows[n]["F_ModifyName"].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());
                    }
                    if (dt.Rows[n]["F_ColumnCount"] != null && dt.Rows[n]["F_ColumnCount"].ToString() != "")
                    {
                        model.F_ColumnCount = int.Parse(dt.Rows[n]["F_ColumnCount"].ToString());
                    }
                    if (dt.Rows[n]["F_DBTableName"] != null && dt.Rows[n]["F_DBTableName"].ToString() != "")
                    {
                        model.F_DBTableName = dt.Rows[n]["F_DBTableName"].ToString();
                    }
                    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);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  Method
    }
}

