Пример #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <DigiPower.Onlinecol.Standard.Model.T_Role_MDL> DataTableToList(DataTable dt)
        {
            List <DigiPower.Onlinecol.Standard.Model.T_Role_MDL> modelList = new List <DigiPower.Onlinecol.Standard.Model.T_Role_MDL>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                DigiPower.Onlinecol.Standard.Model.T_Role_MDL model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new DigiPower.Onlinecol.Standard.Model.T_Role_MDL();
                    if (dt.Rows[n]["RoleID"].ToString() != "")
                    {
                        model.RoleID = int.Parse(dt.Rows[n]["RoleID"].ToString());
                    }
                    if (dt.Rows[n]["CompanyID"].ToString() != "")
                    {
                        model.CompanyID = int.Parse(dt.Rows[n]["CompanyID"].ToString());
                    }
                    model.RoleName    = dt.Rows[n]["RoleName"].ToString();
                    model.Description = dt.Rows[n]["Description"].ToString();
                    model.RoleCode    = dt.Rows[n]["RoleCode"].ToString();
                    model.RoleType    = dt.Rows[n]["RoleType"].ToString();

                    if (dt.Rows[n]["ForCompanyType"].ToString() != "")
                    {
                        model.ForCompanyType = int.Parse(dt.Rows[n]["ForCompanyType"].ToString());
                    }
                    if (dt.Rows[n]["Del"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Del"].ToString() == "1") || (dt.Rows[n]["Del"].ToString().ToLower() == "true"))
                        {
                            model.Del = true;
                        }
                        else
                        {
                            model.Del = false;
                        }
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(DigiPower.Onlinecol.Standard.Model.T_Role_MDL model)
 {
     dal.Update(model);
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(DigiPower.Onlinecol.Standard.Model.T_Role_MDL model)
 {
     return(dal.Add(model));
 }