Ejemplo n.º 1
0
        //新增
        private void Add()
        {
            if (!CheckInput())
            {
                return;
            }

            try
            {
                //从页面上取值
                var samplingTemp = GetSysCodeFromPage(1);
                if (!SysCommon_DictExists(samplingTemp))
                {
                    var    res        = BLL.Add(samplingTemp);
                    string strContent = string.Empty;

                    ShowMsg(res > 0, "保存成功");
                }
                else
                {
                    ShowMsg(false, "此名称已存在");
                }
            }
            catch (Exception ex)
            {
                ////MS.Authority.clsAuth.AddLogErrorFromBS(Module_Id, string.Format("类:{0},方法:{1},错误信息:{2}, 详细:{3}", ex.TargetSite.DeclaringType.ToString(), ex.TargetSite.Name.ToString(), ex.Message, ex.StackTrace));
                throw ex;
            }
        }
Ejemplo n.º 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (CheckInput())
         {
             Common_DictModel model = new Common_DictModel();
             model = GetData();
             bool result = false;
             if (string.IsNullOrEmpty(common_dict_id))//添加
             {
                 if (bll.Exists(model, 1))
                 {
                     ClientScript.RegisterStartupScript(this.GetType(), "fildSave", "<script type='text/javascript'>parent.div_PopEdit('2','已存在同名数据更新项!');</script>");
                     return;
                 }
                 else
                 {
                     result = bll.Add(model) > 0 ? true : false;
                 }
             }
             else//修改
             {
                 if (bll.Exists(model, 2))
                 {
                     ClientScript.RegisterStartupScript(this.GetType(), "fildSave", "<script type='text/javascript'>parent.div_PopEdit('2','已存在同名数据更新项!');</script>");
                     return;
                 }
                 else
                 {
                     result = bll.Update(model) > 0 ? true : false;
                 }
             }
             if (result)
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "fildSave", "<script type='text/javascript'>parent.div_PopEdit('1','保存成功!','" + model.Common_Dict_ID + "');</script>");
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "fildSave", "<script type='text/javascript'>parent.div_PopEdit('2','保存失败!');</script>");
             }
         }
     }
     catch (Exception ex)
     {
         new BLL_clsAuth().AddLogErrorFromBS(Module_Id, string.Format("类:{0},方法:{1},错误信息:{2}, 详细:{3}", ex.TargetSite.DeclaringType.ToString(), ex.TargetSite.Name.ToString(), ex.Message, ex.StackTrace));
         throw ex;
     }
 }