protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.CdModel = new CompanyDataModel();
     }
 }
 protected void ImageBtnSave_Click(object sender, EventArgs e)
 {
     this.CdModel = MakeUtil.getRequestDataToModel<CompanyDataModel>(Request, typeof(CompanyDataModel), -1);
     try
     {
         bll.add(CdModel);
         MakeUtil.addOperationNote(Request.UserHostAddress, UserId.Value.Trim(), "公司资料新增", cdModel.CompanyNo);
         Script.alertMsg("新增成功", Page);
         Script.scriptRedirect("CompanyData-New.aspx", this.Page);
     }
     catch (Make.Exp.MakeException mEx)
     {
         Script.alertMsg(mEx.Message, this.Page);
         this.DataBind();
     }
 }
 public bool add(CompanyDataModel model)
 {
     SqlConnection cn = null;
     SqlTransaction tc = null;
     IList<QueryModel> qmList = new List<QueryModel>();
     try
     {
         cn = DbHelperSQL.getConnection();
         tc = DbHelperSQL.startTransaction(cn);
         qmList.Add(MakeUtil.getQueryModel("CompanyNo", "'", SqlWhere.WhereOperator.Equal, model.CompanyNo));
         if (dal.getModel(cn, tc, qmList).CompanyNo != "")
         {
             DbHelperSQL.rollBackTransaction(tc);
             throw new MakeException(ExpSort.普通, "公司编号:" + model.CompanyNo + "已被占用,新增失败");
         }
         if (dal.add(cn, tc, model))
         {
             DbHelperSQL.commitTransaction(tc);
             return true;
         }
         else
         {
             DbHelperSQL.rollBackTransaction(tc);
             throw new MakeException(ExpSort.普通, "新增失败");
         }
     }
     catch (SqlException sqlEx)
     {
         DbHelperSQL.rollBackTransaction(tc);
         throw new MakeException(ExpSort.数据库, "发生了数据库错误,请检查数据库是否正常运行");
     }
     finally
     {
         DbHelperSQL.closeConnection(cn);
     }
 }
 public bool updata(SqlConnection cn, SqlTransaction tc, CompanyDataModel model)
 {
     return DbHelperSQL.updateModel<CompanyDataModel>(model, "CompanyData", "CompanyNo", model.CompanyNo, "'", cn, tc);
 }
 public bool add(SqlConnection cn, SqlTransaction tc, CompanyDataModel model)
 {
     return DbHelperSQL.insertModel<CompanyDataModel>(model, "CompanyData", cn, tc);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         IList<QueryModel> qmList = new List<QueryModel>();
         qmList.Add(MakeUtil.getQueryModel("CompanyNo", "'", SqlWhere.WhereOperator.Equal, this.PrimaryKey));
         this.cdModel = bllCDE.getModel(qmList);
         if (this.cdModel.CompanyNo == "")
         {
             Script.alertMsg("没找公司资料:" + cdModel.CompanyName, this.Page);
             Script.closeDivWin(this.Page, "CompanyDataModify" + PrimaryKey);
             return;
         }
         this.DataBind();
     }
 }