protected void ImageBtnSave_Click(object sender, ImageClickEventArgs e)
 {
     this.mpmodel = MakeUtil.getRequestDataToModel<MainPageFeaturesModel>(Request, typeof(MainPageFeaturesModel), -1);
     try
     {
         if (mpmodel.SchoolNo == "")
         {
             throw new Exception("请选择学校");
         }
         var flcount = mpmodel.Features.Split(',').Count();
         if (flcount > mpmodel.FeaturesNum)
         {
             throw new Exception("功能数量过多");
         }
         var qmlist = new List<QueryModel>();
         qmlist.Add(MakeUtil.getQueryModel("SchoolNo", "'", SqlWhere.WhereOperator.Equal, mpmodel.SchoolNo));
         var model = _mainPageFeaturesEbi.getModel(qmlist);
         if (model.Evenid <= 0)
         {
             _mainPageFeaturesEbi.add(mpmodel);
         }
         else
         {
             mpmodel.Evenid = model.Evenid;
             _mainPageFeaturesEbi.update(mpmodel);
         }
         MakeUtil.addOperationNote(Request.UserHostAddress, UserId.Trim(), "主页功能设置", mpmodel.SchoolNo);
         Script.alertMsg("修改成功", Page);
         this.DataBind();
     }
     catch (Make.Exp.MakeException mEx)
     {
         Script.alertMsg(mEx.Message, this.Page);
         this.DataBind();
     }
     catch (Exception mEx)
     {
         Script.alertMsg(mEx.Message, this.Page);
         this.DataBind();
     }
 }
Exemplo n.º 2
0
        public void add(MainPageFeaturesModel mainpagefeatures)
        {
            SqlConnection cn = null;
            SqlTransaction tc = null;
            try
            {
                cn = DbHelperSQL.getConnection();
                tc = DbHelperSQL.startTransaction(cn);

                //执行新增写进数据库
            mainpagefeaturesDal.add(cn, tc, mainpagefeatures);

                DbHelperSQL.commitTransaction(tc);
            }
            catch (Exception dalEx)
            {
                DbHelperSQL.rollBackTransaction(tc);
                throw new MakeException(ExpSort.数据库, dalEx.Message);
            }
            finally
            {
                DbHelperSQL.closeConnection(cn);
            }
        }
Exemplo n.º 3
0
 public bool update(SqlConnection cn, SqlTransaction tc, MainPageFeaturesModel model)
 {
     return DbHelperSQL.updateModel<MainPageFeaturesModel>(model, "MainPageFeatures", "Evenid", model.Evenid.ToString(), "'", cn, tc);
 }
Exemplo n.º 4
0
 public bool add(SqlConnection cn, SqlTransaction tc, MainPageFeaturesModel model)
 {
     return DbHelperSQL.insertModel<MainPageFeaturesModel>(model, "MainPageFeatures", cn, tc);
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        SchoolNo = MakeUtil.getStringFromRequestByName(Request, "SchoolNo", -1);

        if (IsPostBack)
        {
            var qmlist = new List<QueryModel>();
            qmlist.Add(MakeUtil.getQueryModel("SchoolNo", "'", SqlWhere.WhereOperator.Equal, SchoolNo));
            mpmodel = _mainPageFeaturesEbi.getModel(qmlist);
            this.DataBind();
        }
    }