Пример #1
0
        public static bool Save(Model.Dmgl.Jd_xmdj m)
        {
            int r = 0;

            try
            {
                if (String.IsNullOrEmpty(m.Pkid))
                {
                    m.Pkid = ("DJ" + Guid.NewGuid().ToString().Replace("-", "").ToUpper()).Substring(0, 32);
                    r      = BLL.Dmgl.Insert <Model.Dmgl.Jd_xmdj>(m);
                }
                else
                {
                    r = BLL.Dmgl.Update <Model.Dmgl.Jd_xmdj>(m);
                }
                if (r > 0)
                {
                    BLL.Globals.SystemCode.RefreshDtJd_xmdj();
                }
                return(r > 0);
            }
            catch (Exception err)
            {
                if (err.Message.IndexOf("唯一") > 0)
                {
                    throw new Exception("等级名称已存在 !");
                }
                else
                {
                    throw err;
                }
            }
        }
Пример #2
0
 private void ShowUI()
 {
     if (!IsAdd)
     {
         Model.Dmgl.Jd_xmdj m = BLL.Dmgl.GetEntity <Model.Dmgl.Jd_xmdj>(Pkid);
         if (String.IsNullOrEmpty(m.Pkid))
         {
             PageContext.RegisterStartupScript(Alert.GetShowInParentReference("页面参数不正确 !", "打开失败", MessageBoxIcon.Error) + ActiveWindow.GetHideReference());
             return;
         }
         this.hfdPkid.Text          = Pkid;
         this.ddlZbbh.SelectedValue = m.Zbbh;
         this.tbxMc.Text            = m.Djmc;
     }
 }
Пример #3
0
        protected bool Save()
        {
            try
            {
                Model.Dmgl.Jd_xmdj m      = new Model.Dmgl.Jd_xmdj();
                string             errMsg = "";
                string             bmbh   = TStar.Web.Globals.Account.DeptPkid;
                string             zbbh   = this.ddlZbbh.SelectedValue;
                string             djmc   = this.tbxMc.Text.Trim();

                if (this.ddlZbbh.SelectedIndex == 0)
                {
                    errMsg += "请选择指标名称 !\n";
                }
                if (String.IsNullOrEmpty(djmc))
                {
                    errMsg += "请输入等级名称 !\n";
                }
                else if (BLL.Dmgl.Exists <Model.Dmgl.Jd_xmdj>(Pkid, new string[] { "Bmbh", "Zbbh", "Djmc" }, new string[] { bmbh, zbbh, djmc }))
                {
                    errMsg += "输入的等级名称已存在 !\n";
                }
                if (errMsg.Length > 0)
                {
                    Alert.Show(errMsg, "保存提示", MessageBoxIcon.Warning);
                    return(false);
                }

                m.Pkid = Pkid;
                m.Bmbh = bmbh;
                m.Zbbh = zbbh;
                m.Djmc = djmc;
                BLL.Jcgl.Jd_xmdj.Save(m);

                return(true);
            }
            catch (Exception err)
            {
                Alert.Show(err.Message, "保存失败", MessageBoxIcon.Error);
                return(false);
            }
        }