Ejemplo n.º 1
0
        protected void btn_Conform_Click(object sender, EventArgs e)
        {
            try
            {
                int.Parse(this.txt_orderFlag.Text.Trim());
            }
            catch
            {
                this.lb_Info.Text = "排序号必须为数字";
                return;
            }
            Function fl = new Function();

            fl.Description = this.txt_Description.Text.Trim();
            fl.FunctionName = this.txt_FunctionName.Text.Trim();
            fl.OrderFlag = int.Parse(this.txt_orderFlag.Text.Trim());
            fl.UrlPath = this.txt_UrlPath.Text.Trim();

            if (this.ddlParentFunction.SelectedValue.Equals(""))
            {
                fl.ParentFunctionId = null;
            }
            else
            {
                fl.ParentFunctionId = new Guid(this.ddlParentFunction.SelectedValue);
            }

            if (this.Hidden1.Value == "")//新增
            {
                if (Function.AddFunction(fl))
                {
                    this.lb_Info.Text = "新增成功";
                }
                else
                {
                    this.lb_Info.Text = "新增失败";
                }
            }
            else//更新
            {
                fl.FunctionID = new Guid(this.Hidden1.Value);
                if (Function.UpdateFunction(fl))
                {
                    this.lb_Info.Text = "更新成功";
                }
                else
                {
                    this.lb_Info.Text = "更新失败";
                }
            }
            this.tr_FunctionInfo.Visible = false;
            this.BindFunction();
        }