Example #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Request.QueryString["pageId"]))
            {
                Maticsoft.BLL.tAbout BLL = new Maticsoft.BLL.tAbout();
                int pageId = int.Parse(Request.QueryString["pageId"]);
                Maticsoft.Model.tAbout menu = BLL.GetModel(pageId);
                if (BLL.GetList(string.Format(" Title='{0}' and Id<>{1} ", txtName.Text, pageId)).Tables[0].Rows.Count >= 1)
                {
                    Alert.ShowInTop("该名称已经存在!"); return;
                }

                menu.Id    = pageId;
                menu.Title = txtName.Text.ToString().Trim();

                menu.Sort = Convert.ToInt32(txtSort.Text.ToString().Trim());

                if (BLL.Update(menu) == true)
                {
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                }
                else
                {
                    Alert.ShowInTop("操作失败!");
                }
            }
            else
            {
                Maticsoft.BLL.tAbout   BLL  = new Maticsoft.BLL.tAbout();
                Maticsoft.Model.tAbout menu = new Maticsoft.Model.tAbout();
                if (BLL.GetList(string.Format(" Title='{0}' ", txtName.Text)).Tables[0].Rows.Count >= 1)
                {
                    Alert.ShowInTop("该名称已经存在!"); return;
                }

                menu.Title = txtName.Text.ToString().Trim();
                menu.Sort  = Convert.ToInt32(txtSort.Text.ToString().Trim());

                if (BLL.Add(menu) >= 1)
                {
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                }
                else
                {
                    Alert.ShowInTop("操作失败!");
                }
            }
        }