コード例 #1
0
 public void addUpdate()
 {
     try
     {
         this.dbo = new DB_OPT();
         this.dbo.Open();
         if (((this.CompanyPk.Value.Trim() == "") || (this.txtBankName.Text.Trim() == "")) || (this.txtBankNum.Text.Trim() == ""))
         {
             Const.ShowMessage("带*的数据必须填写!", this.Page);
         }
         else
         {
             this.bmd = new BankDal();
             this.bmd.BankName = this.txtBankName.Text.Trim();
             this.bmd.BankNum = this.txtBankNum.Text.Trim();
             this.bmd.BankNumMan = this.txtBankNumMan.Text.Trim();
             this.bmd.Discription = this.txtDiscription.Text.Trim();
             this.bmd.pk_corp = this.CompanyPk.Value.Trim();
             if (base.Request["PK"] != null)
             {
                 this.bmd.BankPK = base.Request["PK"].ToString();
                 Const.UpdateSuccess(this.bmd.Update(this.dbo), this.Page);
             }
             else
             {
                 Const.AddSuccess(this.bmd.Add(this.dbo), this.Page);
             }
         }
     }
     catch (Exception exception)
     {
         this.el = new ExceptionLog.ExceptionLog();
         this.el.ErrClassName = base.GetType().ToString();
         this.el.ErrMessage = exception.Message.ToString();
         this.el.ErrMethod = "addUpdate()";
         this.el.WriteExceptionLog(true);
         Const.OpenErrorPage("操作失败,请联系管理员!", this.Page);
     }
     finally
     {
         if (this.dbo != null)
         {
             this.dbo.Close();
         }
     }
 }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.Master.ButtonsPushDown = new ButtonsHandler(this.Buttons);
     if (!base.IsPostBack)
     {
         if (this.Session["user"] == null)
         {
             Const.GoLoginPath_OpenWindow(this.Page);
         }
         else
         {
             string userName = ((UserModel)this.Session["User"]).UserName;
             string power = ((UserModel)this.Session["User"]).Power;
             ButtonsModel model = new ButtonsModel(userName)
             {
                 IfAdd = false,
                 IfUpdate = false,
                 IfDelete = false,
                 IfLook = false,
                 IfSearch = false,
                 IfRefresh = true,
                 IfHuiZong = false,
                 IfPutOut = false,
                 IfSet = false,
                 IfExit = true
             };
             this.Master.btModel = model;
             if ((base.Request["PK"] != null) && (base.Request["PK"].ToString() != ""))
             {
                 if (PowerClass.IfHasPower(userName, power, PowerNum.BankCardUpdate))
                 {
                     model.IfSave = true;
                     this.Master.LBTitle = "乡镇财政资金监管信息系统 - 修改单位帐户信息";
                     this.Master.TitlePic = "修改单位帐户信息";
                     try
                     {
                         try
                         {
                             this.dbo = new DB_OPT();
                             this.dbo.Open();
                             this.bmd = new BankDal();
                             DataSet list = new DataSet();
                             list = this.bmd.GetList("BankPK='" + base.Request["PK"].ToString() + "'", this.dbo);
                             this.txtCompany.Text = list.Tables[0].Rows[0]["Name"].ToString();
                             this.CompanyPk.Value = list.Tables[0].Rows[0]["pk_corp"].ToString();
                             this.txtBankName.Text = list.Tables[0].Rows[0]["BankName"].ToString();
                             this.txtBankNum.Text = list.Tables[0].Rows[0]["BankNum"].ToString();
                             this.txtDiscription.Text = list.Tables[0].Rows[0]["Discription"].ToString();
                             this.txtBankNumMan.Text = list.Tables[0].Rows[0]["BankNumMan"].ToString();
                         }
                         catch (Exception exception)
                         {
                             this.el = new ExceptionLog.ExceptionLog();
                             this.el.ErrClassName = base.GetType().ToString();
                             this.el.ErrMessage = exception.Message.ToString();
                             this.el.ErrMethod = "Page_Load()";
                             this.el.WriteExceptionLog(true);
                             Const.OpenErrorPage("获取数据失败,请联系管理员!", this.Page);
                         }
                         return;
                     }
                     finally
                     {
                         if (this.dbo != null)
                         {
                             this.dbo.Close();
                         }
                     }
                 }
                 Const.SorryForPower(this.Page);
             }
             else if (PowerClass.IfHasPower(userName, power, PowerNum.BankCardAdd))
             {
                 model.IfSave = true;
                 this.Master.LBTitle = "乡镇财政资金监管信息系统 - 新增单位帐户信息";
                 this.Master.TitlePic = "新增单位帐户信息";
             }
             else
             {
                 Const.SorryForPower(this.Page);
             }
         }
     }
 }
コード例 #3
0
 public void delete()
 {
     if (this.gvResult.SelectedIndex < 0)
     {
         Const.ShowMessage("请选择一行数据再操作!", this.Page);
     }
     else
     {
         try
         {
             this.dbo = new DB_OPT();
             this.bmd = new BankDal();
             this.dbo.Open();
             this.bmd.BankPK = ((Label)this.gvResult.Rows[this.gvResult.SelectedIndex].Cells[0].FindControl("labBankPK")).Text.Trim();
             this.bmd.Delete(this.dbo);
             if (this.Master.PageIndex > 1)
             {
                 this.pageind = this.Master.PageIndex;
             }
             this.ShowData(this.Master.StrSelect);
         }
         catch (Exception exception)
         {
             this.el = new ExceptionLog.ExceptionLog();
             this.el.ErrClassName = base.GetType().ToString();
             this.el.ErrMessage = exception.Message.ToString();
             this.el.ErrMethod = "delete()";
             this.el.WriteExceptionLog(true);
             Const.OpenErrorPage("操作失败,请联系管理员!", this.Page);
         }
         finally
         {
             if (this.dbo != null)
             {
                 this.dbo.Close();
             }
         }
     }
 }