Пример #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(GSSModel.Menus model)
 {
     try
     {
         dal.Add(model);
         return(true);
     }
     catch //(System.Exception ex)
     {
         return(false);
     }
 }
Пример #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <GSSModel.Menus> DataTableToList(DataTable dt)
        {
            List <GSSModel.Menus> modelList = new List <GSSModel.Menus>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                GSSModel.Menus model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new GSSModel.Menus();
                    if (dt.Rows[n]["F_MenuID"].ToString() != "")
                    {
                        model.F_MenuID = int.Parse(dt.Rows[n]["F_MenuID"].ToString());
                    }
                    model.F_Name     = dt.Rows[n]["F_Name"].ToString();
                    model.F_FormName = dt.Rows[n]["F_FormName"].ToString();
                    if (dt.Rows[n]["F_ParentID"].ToString() != "")
                    {
                        model.F_ParentID = int.Parse(dt.Rows[n]["F_ParentID"].ToString());
                    }
                    if (dt.Rows[n]["F_IsUsed"].ToString() != "")
                    {
                        if ((dt.Rows[n]["F_IsUsed"].ToString() == "1") || (dt.Rows[n]["F_IsUsed"].ToString().ToLower() == "true"))
                        {
                            model.F_IsUsed = true;
                        }
                        else
                        {
                            model.F_IsUsed = false;
                        }
                    }
                    if (dt.Rows[n]["F_Sort"].ToString() != "")
                    {
                        model.F_Sort = int.Parse(dt.Rows[n]["F_Sort"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GSSModel.Menus model)
 {
     return(dal.Update(model));
 }