예제 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CustomList <CmnBankAccount> lstCmnBankAccount = BankAccountList;
                if (lstCmnBankAccount.Count == 0)
                {
                    CmnBankAccount newBankAccount = new CmnBankAccount();
                    lstCmnBankAccount.Add(newBankAccount);
                }
                SetDataFromControlToObj(ref lstCmnBankAccount);

                if (!CheckUserAuthentication(lstCmnBankAccount))
                {
                    return;
                }
                manager.SaveBankAccount(ref lstCmnBankAccount);
                ((PageBase)this.Page).SuccessMessage = (StaticInfo.SavedSuccessfullyMsg);
            }
            catch (SqlException ex)
            {
                ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getSqlExceptionMessage(ex));
            }
            catch (Exception ex)
            {
                ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex));
            }
        }
예제 #2
0
 private void SetDataFromControlToObj(ref CustomList <CmnBankAccount> lstBankAccount)
 {
     try
     {
         CmnBankAccount obj = lstBankAccount[0];
         if (ddlCostCenter.SelectedValue != "")
         {
             obj.CostCenterID = ddlCostCenter.SelectedValue.ToInt();
         }
         if (ddlBranchOrUnit.SelectedValue != "")
         {
             obj.BranchOrUnitID = ddlBranchOrUnit.SelectedValue.ToInt();
         }
         obj.AccountNo   = txtAccountNo.Text;
         obj.AccountName = txtAccountName.Text;
         if (ddlAccountType.SelectedValue != "")
         {
             obj.AccountTypeID = ddlAccountType.SelectedValue.ToInt();
         }
         if (ddlBankBranch.SelectedValue != "")
         {
             obj.BankBranchID = ddlBankBranch.SelectedValue.ToInt();
         }
         if (ddlUserName.SelectedValue != "")
         {
             obj.UserID = ddlUserName.SelectedValue.ToInt();
         }
         if (ddlCOA.SelectedValue != "")
         {
             obj.COAID = ddlCOA.SelectedValue.ToInt();
         }
         obj.IsCompany = chkIsCompanyAccount.Checked;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
예제 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack.IsFalse())
     {
         InitializeCombo();
         BankAccountList = new CustomList <CmnBankAccount>();
     }
     else
     {
         Page.ClientScript.GetPostBackEventReference(this, String.Empty);
         String eventTarget = Request["__EVENTTARGET"].IsNullOrEmpty() ? String.Empty : Request["__EVENTTARGET"];
         if (Request["__EVENTTARGET"] == "SearchBankAccount")
         {
             BankAccountList = new CustomList <CmnBankAccount>();
             CmnBankAccount searchBankAccount = Session[STATIC.StaticInfo.SearchSessionVarName] as CmnBankAccount;
             BankAccountList.Add(searchBankAccount);
             if (searchBankAccount.IsNotNull())
             {
                 PopulateBankAccountInformation(searchBankAccount);
             }
         }
     }
 }
예제 #4
0
 private void PopulateBankAccountInformation(CmnBankAccount bankAccount)
 {
     try
     {
         if (bankAccount.CostCenterID != 0)
         {
             ddlCostCenter.SelectedValue = bankAccount.CostCenterID.ToString();
         }
         if (bankAccount.BranchOrUnitID != 0)
         {
             ddlBranchOrUnit.SelectedValue = bankAccount.BranchOrUnitID.ToString();
         }
         txtAccountNo.Text   = bankAccount.AccountNo;
         txtAccountName.Text = bankAccount.AccountName;
         if (bankAccount.AccountTypeID != 0)
         {
             ddlAccountType.SelectedValue = bankAccount.AccountTypeID.ToString();
         }
         if (bankAccount.BankBranchID != 0)
         {
             ddlBankBranch.SelectedValue = bankAccount.BankBranchID.ToString();
         }
         if (bankAccount.UserID != 0)
         {
             ddlUserName.SelectedValue = bankAccount.UserID.ToString();
         }
         if (bankAccount.COAID != 0)
         {
             ddlCOA.SelectedValue = bankAccount.COAID.ToString();
         }
         chkIsCompanyAccount.Checked = bankAccount.IsCompany;
     }
     catch (Exception ex)
     {
         throw (ex);
     }
 }
예제 #5
0
 public CustomList <CmnBankAccount> GetAllCmnBankAccount()
 {
     return(CmnBankAccount.GetAllCmnBankAccount());
 }