Exemplo n.º 1
0
 //删除
 protected void ButtonDelete_Click(object sender, EventArgs e)
 {
     foreach (RepeaterItem ri in RepList.Items)
     {
         CheckBox cb = ((CheckBox)ri.FindControl("CheckBoxChoose"));
         int      ID = Convert.ToInt32(((HiddenField)ri.FindControl("HiddenFieldID")).Value);
         if (cb.Checked == true)
         {
             SystemService.DictionaryTypeService.Delete(ID);
         }
     }
     CachesHelper.RemoveCache(DataToCacheHelper.CacheNames.AllDictionaries.ToStr());
     //重新加载
     LoadDataBind();
 }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            idc = DescriptionAttributeHelper.GetEnumDescriptions <DataToCacheHelper.CacheNames>();
        }


        string name = Request["name"];

        if (!string.IsNullOrEmpty(name))
        {
            CachesHelper.RemoveCache(name);
            MessageDiv.InnerHtml = CommonClass.Alert("清理成功");
        }
    }
    //保存
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        TB_Admin_Resources model = new TB_Admin_Resources();

        if (ViewState["id"] != null)
        {
            model = AdminService.ResourcesService.Get(ViewState["id"]);
        }

        model.ResourceName = TbResourceName.Text;
        model.ParentID     = DDLParent.SelectedValue.ToInt();
        model.Url          = TbUrl.Text;
        model.Creater      = AdminUserName;
        model.OrderBy      = TbOrderBy.Text.ToInt();
        model.IsShow       = CheckIsShow.Checked;
        model.AddDate      = DateTime.Now;

        IAdmin_Resources Resources = AdminService.ResourcesService;

        if (ViewState["id"] == null)
        {
            if (Resources.Insert(model) == 1)
            {
                CachesHelper.RemoveCache(DataToCacheHelper.CacheNames.AllResources.ToStr());
                MessageDiv.InnerHtml = CommonClass.Reload("数据修改成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据添加失败");
            }
        }
        else
        {
            if (Resources.Update(model) == 1)
            {
                CachesHelper.RemoveCache(DataToCacheHelper.CacheNames.AllResources.ToStr());
                MessageDiv.InnerHtml = CommonClass.Reload("数据修改成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据修改失败");
            }
        }
    }
Exemplo n.º 4
0
    //保存
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        TB_System_Dictionary model = new TB_System_Dictionary();

        if (ViewState["id"] != null)
        {
            model = SystemService.DictionaryService.Get(ViewState["id"]);
            if (model.Code != TbCode.Text.TrimEnd())
            {
                List <Expression> express = new List <Expression>();
                express.Add(new Expression("Code", "=", TbCode.Text.TrimEnd()));
                express.Add(new Expression("TypeCode", "=", model.TypeCode));
                var list = SystemService.DictionaryService.Search(express);
                if (list.Count > 0)
                {
                    MessageDiv.InnerHtml = CommonClass.Alert("当前标识已存在,请重新输入");
                    return;
                }
            }
        }
        else
        {
            List <Expression> express = new List <Expression>();
            express.Add(new Expression("Code", "=", TbCode.Text.TrimEnd()));
            express.Add(new Expression("TypeCode", "=", DDLModel.SelectedValue));
            var list = SystemService.DictionaryService.Search(express);
            if (list.Count > 0)
            {
                MessageDiv.InnerHtml = CommonClass.Alert("当前标识已存在,请重新输入");
                return;
            }
        }

        model.TypeCode = DDLModel.SelectedValue;
        model.Name     = TbName.Text.Trim();
        model.Code     = TbCode.Text;
        model.Remark   = TbRemark.Text;
        model.OrderBy  = TbOrderBy.Text.ToInt();
        model.Creater  = AdminUserName;
        model.AddDate  = DateTime.Now;
        ISystem_Dictionary Dictionary = SystemService.DictionaryService;

        if (ViewState["id"] == null)
        {
            if (Dictionary.Insert(model) == 1)
            {
                CachesHelper.RemoveCache(DataToCacheHelper.CacheNames.AllDictionaries.ToStr());
                MessageDiv.InnerHtml = CommonClass.Reload("数据添加成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据添加失败");
            }
        }
        else
        {
            if (Dictionary.Update(model) == 1)
            {
                CachesHelper.RemoveCache(DataToCacheHelper.CacheNames.AllDictionaries.ToStr());
                MessageDiv.InnerHtml = CommonClass.Reload("数据修改成功");
            }
            else
            {
                MessageDiv.InnerHtml = CommonClass.Alert("数据修改失败");
            }
        }
    }