Ejemplo n.º 1
0
        /// <summary>
        /// 设定不启用
        /// </summary>
        /// <param name="DicCateID"></param>
        /// <returns></returns>
        public static bool SetUnUsed(int ID)
        {
            M_DicCategory model = new M_DicCategory();
            string        sql   = " update " + model.TbName + " set IsUsed=0 where DicCateID=" + ID;

            return(SqlHelper.ExecuteSql(sql));
        }
Ejemplo n.º 2
0
        public static bool DelCate(string ids)
        {
            M_DicCategory model = new M_DicCategory();

            SafeSC.CheckIDSEx(ids);
            return(SqlHelper.ExecuteSql("DELETE FROM " + model.TbName + " WHERE " + model.PK + " IN(" + ids + ")"));
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txtCategoryName.Text.Trim()))
            {
                int DicCateID = DataConverter.CLng(this.HdnDicCateID.Value);

                if (DicCateID > 0)
                {
                    M_DicCategory info = B_DataDicCategory.GetDicCate(DicCateID);
                    info.CategoryName = this.txtCategoryName.Text.Trim();
                    B_DataDicCategory.Update(info);
                }
                else
                {
                    M_DicCategory info = new M_DicCategory();
                    info.DicCateID    = 0;
                    info.CategoryName = this.txtCategoryName.Text.Trim();
                    info.IsUsed       = true;
                    B_DataDicCategory.AddCate(info);
                }
                this.txtCategoryName.Text = "";
                this.HdnDicCateID.Value   = "0";
                this.btnSave.Text         = "添加";
                dBind();
            }
        }
Ejemplo n.º 4
0
        public ContentResult DictCate_API()
        {
            string action = GetParam("action");
            string ids    = GetParam("ids");

            switch (action)
            {
            case "del":
                B_DataDicCategory.DelCate(ids);
                break;

            case "use":
                B_DataDicCategory.SetUsedByArr(ids, true);
                break;

            case "unuse":
                B_DataDicCategory.SetUsedByArr(ids, false);
                break;

            case "save":    //新增或修改
            {
                string name = GetParam("name");
                if (string.IsNullOrEmpty(name))
                {
                    return(Content(Failed.ToString()));
                }
                if (Mid > 0)
                {
                    M_DicCategory info = B_DataDicCategory.GetDicCate(Mid);
                    info.CategoryName = name;
                    B_DataDicCategory.Update(info);
                }
                else
                {
                    M_DicCategory info = new M_DicCategory();
                    info.DicCateID    = 0;
                    info.CategoryName = name;
                    info.IsUsed       = true;
                    B_DataDicCategory.AddCate(info);
                }
            }
            break;
            }
            return(Content(Success.ToString()));
        }
 protected void Lnk_Click(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "Del")
     {
         string Id = e.CommandArgument.ToString();
         B_DataDicCategory.DelCate(DataConverter.CLng(Id));
         dBind();
     }
     if (e.CommandName == "Edit")
     {
         string        Id   = e.CommandArgument.ToString();
         M_DicCategory info = B_DataDicCategory.GetDicCate(DataConverter.CLng(Id));
         this.txtCategoryName.Text = info.CategoryName;
         this.HdnDicCateID.Value   = Id;
         this.btnSave.Text         = "修改";
     }
     if (e.CommandName == "DicList")
     {
         Response.Redirect("Dictionary.aspx?CateID=" + e.CommandArgument.ToString());
     }
 }
Ejemplo n.º 6
0
        public static bool DelCate(int ID)
        {
            M_DicCategory model = new M_DicCategory();

            return(Sql.Del(model.TbName, model.PK + "=" + ID));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public static bool Update(M_DicCategory model)
 {
     return(Sql.UpdateByIDs(model.TbName, model.PK, model.DicCateID.ToString(), BLLCommon.GetFieldAndPara(model), model.GetParameters()));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 添加数据字典分类
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public static bool AddCate(M_DicCategory model)
 {
     return(Sql.insertID(model.TbName, model.GetParameters(), BLLCommon.GetParas(model), BLLCommon.GetFields(model)) > 0);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public static bool Update(M_DicCategory model)
 {
     return(DBCenter.UpdateByID(model, model.DicCateID));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 添加数据字典分类
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public static bool AddCate(M_DicCategory model)
 {
     return(DBCenter.Insert(model) > 0);
 }