예제 #1
0
 private void sbtnClose_Click(object sender, EventArgs e)
 {
     oAccountInfo = frmAccountList.oSelectedAccount;
     if (Account.UIProviders.UIAccount.Close_Auth(oAccountInfo.Account_ID) != 0)
     {
         MessageBox.Show(Account.UIProviders.UIAccount.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     else
     {
         if (MessageBox.Show("Bạn có chắc chắn đóng tài khoản này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             if (Account.UIProviders.UIAccount.Close(oAccountInfo.Account_ID) == 0)
             {
                 MessageBox.Show("Tài khoản đã đóng xong\n", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 int index = frmAccountList.lstAccountInfo.IndexOf(frmAccountList.oSelectedAccount);
                 frmAccountList.lstAccountInfo.RemoveAt(index);
                 oAccountInfo.Closed = true;
                 frmAccountList.lstAccountInfo.Insert(index, oAccountInfo);
                 this.Close();
             }
             else
             {
                 MessageBox.Show(Account.UIProviders.UIAccount.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
         }
     }
 }
예제 #2
0
 private void txt_Account_ID_LostFocus(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txt_Account_ID.Text))
     {
         return;
     }
     else
     {
         Account.Common.Entities.Account_Info acInfo = Account.UIProviders.UIAccount.GetAccountByID(txt_Account_ID.Text);
         if (acInfo == null)
         {
             MessageBox.Show("Không tìm thấy mã tài khoản này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txt_Account_ID.Text = string.Empty;
             sbtnOK.Enabled      = false;
             txt_Account_ID.Focus();
             return;
         }
         else
         {
             txt_Name.Text  = acInfo.Name;
             txt_Ccy.Text   = acInfo.Ccy;
             sbtnOK.Enabled = true;
             return;
         }
     }
 }
예제 #3
0
 private void sbtnLocked_Click(object sender, EventArgs e)
 {
     oAccountInfo = frmAccountList.oSelectedAccount;
     if (oAccountInfo.Locked == false)
     {
         if (Account.UIProviders.UIAccount.Lock_Auth(oAccountInfo.Account_ID) != 0)
         {
             MessageBox.Show(Account.UIProviders.UIAccount.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         else
         {
             if (MessageBox.Show("Bạn có chắc chắn tạm khóa khoản này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 if (Account.UIProviders.UIAccount.Lock(oAccountInfo.Account_ID) == 0)
                 {
                     MessageBox.Show("Tài khoản đã khóa xong\n Để định khoản lại được bạn cần bỏ khóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     int index = frmAccountList.lstAccountInfo.IndexOf(frmAccountList.oSelectedAccount);
                     frmAccountList.lstAccountInfo.RemoveAt(index);
                     oAccountInfo.Locked = true;
                     frmAccountList.lstAccountInfo.Insert(index, oAccountInfo);
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show(Account.UIProviders.UIAccount.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     return;
                 }
             }
         }
     }
     else
     {
         if (Account.UIProviders.UIAccount.UnLock_Auth(oAccountInfo.Account_ID) != 0)
         {
             MessageBox.Show(Account.UIProviders.UIAccount.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         else
         {
             if (MessageBox.Show("Bạn có chắc chắn bỏ khóa khoản này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 if (Account.UIProviders.UIAccount.UnLock(oAccountInfo.Account_ID) == 0)
                 {
                     MessageBox.Show("Tài khoản đã được bỏ khóa xong\n Bạn đã có thể định khoản được", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     int index = frmAccountList.lstAccountInfo.IndexOf(frmAccountList.oSelectedAccount);
                     frmAccountList.lstAccountInfo.RemoveAt(index);
                     oAccountInfo.Locked = false;
                     frmAccountList.lstAccountInfo.Insert(index, oAccountInfo);
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show(Account.UIProviders.UIAccount.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     return;
                 }
             }
         }
     }
 }
예제 #4
0
 private void sbtnEdit_Click(object sender, EventArgs e)
 {
     Program.eButton = Program.Button.Edit;
     oAccountInfo    = frmAccountList.oSelectedAccount;
     if (Account.UIProviders.UIAccount.Update_Auth(oAccountInfo) != 0)
     {
         MessageBox.Show(Account.UIProviders.UIAccount.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     Enable(true);
     // Chỉ cho phép sửa tên tài khoản.
     txt_Name.Enabled = true;
     txt_Name.Focus();
 }
예제 #5
0
 private void sbtnDel_Click(object sender, EventArgs e)
 {
     Program.eButton = Program.Button.Del;
     oAccountInfo    = frmAccountList.oSelectedAccount;
     if (MessageBox.Show("Bạn có chắc chắn xóa tài khoản này không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (Account.UIProviders.UIAccount.Delete(oAccountInfo.Account_ID) != 0)
         {
             MessageBox.Show(Account.UIProviders.UIAccount.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         else
         {
             frmAccountList.lstAccountInfo.Remove(oAccountInfo);
             Program.eButton = Program.Button.None;
             this.Close();
         }
     }
 }
예제 #6
0
 private void sbtnOK_Click(object sender, EventArgs e)
 {
     if (CheckValidData())
     {
         Account.Common.Entities.Account_Info acInfo = new Account.Common.Entities.Account_Info();
         acInfo.Account_ID = Account.UIProviders.UIAccount.GenerateId(lookUEdit_Branch.Text, lookUEdit_Categories.Text, txt_CustomerId.Text);
         if (!string.IsNullOrEmpty(txt_Ref.Text))
         {
             acInfo.Reference = txt_Ref.Text;
         }
         acInfo.Name        = txt_Name.Text;
         acInfo.Branch_ID   = lookUEdit_Branch.Text;
         acInfo.Categories  = lookUEdit_Categories.Text;
         acInfo.Customer_ID = txt_CustomerId.Text;
         acInfo.CreditDebit = (Account.Common.Utilities.AccountType)Enum.Parse(typeof(Account.Common.Utilities.AccountType), txt_CreditDebit.Text);
         acInfo.Ccy         = txt_Ccy.Text;
         acInfo.Account_GL  = txt_AccountGL.Text;
         acInfo.Approved    = false;
         acInfo.Closed      = false;
         acInfo.Locked      = false;
         acInfo.Open_Date   = DateTime.Now;
         acInfo.Last_Date   = DateTime.Now;
         acInfo.UserCreate  = Program.CurrentUser.User_ID;
         if (Account.UIProviders.UIAccount.Insert(acInfo) != 0)
         {
             MessageBox.Show(Account.UIProviders.UIAccount.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         else
         {
             MessageBox.Show("Mở tài khoản: " + acInfo.Account_ID + " thành công\nBước tiếp theo bạn cần duyệt tài khoản", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
             this.Dispose();
         }
     }
     else
     {
         return;
     }
 }
예제 #7
0
 private void sbtnDetail_Click(object sender, EventArgs e)
 {
     if (gridView1.FocusedRowHandle < 0)
     {
         return;
     }
     else
     {
         string Account_ID = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gcolID).ToString();
         for (int i = 0; i < lstAccountInfo.Count; i++)
         {
             if (lstAccountInfo[i].Account_ID == Account_ID)
             {
                 oSelectedAccount = lstAccountInfo[i];
                 frmAccount ofrm = new frmAccount();
                 ofrm.ShowDialog();
                 SetDataSource();
                 break;
             }
         }
     }
 }
예제 #8
0
        private void Detail_Account(Account.Common.Entities.Account_Info oCurAccount)
        {
            txt_AccountID.Text = oCurAccount.Account_ID;
            txt_Ref.Text       = oCurAccount.Reference;
            txt_Name.Text      = oCurAccount.Name;
            oSelectedCustomer  = Program.FindCustomer(oCurAccount.Customer_ID);
            if (oSelectedCustomer != null)
            {
                txt_CustomerID.Text = oSelectedCustomer.ID;
            }

            oSelectedAccountGL = Program.FindAccount_GL(oCurAccount.Account_GL);
            if (oSelectedAccountGL != null)
            {
                lookUEdit_Account_GL.EditValue = oSelectedAccountGL.Account_ID;
                lookUEdit_Account_GL.Text      = oSelectedAccountGL.Name;
            }
            oSelectedBranch = Program.FindBranch(oCurAccount.Branch_ID);
            if (oSelectedBranch != null)
            {
                lookUEdit_BranchID.EditValue = oSelectedBranch.ID;
                txt_BranchName.Text          = oSelectedBranch.Name;
            }
            dtOpenDate.EditValue     = oCurAccount.Open_Date;
            dtLastDate.EditValue     = oCurAccount.Last_Date;
            dtApprovedTime.EditValue = oCurAccount.ApprovedTime;
            if (oCurAccount.Approved == true)
            {
                cbo_Approved.SelectedIndex = 0;
            }
            else
            {
                cbo_Approved.SelectedIndex = 1;
            }

            dtClosedDate.EditValue = oCurAccount.Closed_date;
            if (oCurAccount.Closed == true)
            {
                cbo_Closed.SelectedIndex = 0;
            }
            else
            {
                cbo_Closed.SelectedIndex = 1;
            }
            if (oCurAccount.Locked == true)
            {
                cbo_Locked.SelectedIndex = 0;
            }
            else
            {
                cbo_Locked.SelectedIndex = 1;
            }
            oSelectedCate = Program.FindCategories(oCurAccount.Categories);
            if (oSelectedCate != null)
            {
                lookUEdit_Categories.EditValue = oSelectedCate.ID;
                lookUEdit_Categories.Text      = oSelectedCate.Name;
            }
            txt_UserCreate.Text = oCurAccount.UserCreate;

            txt_bCredit.EditValue = oCurAccount.b_Credit;
            for (int i = 0; i < arrAccType.Length; i++)
            {
                if (arrAccType[i].ToString() == oCurAccount.CreditDebit.ToString())
                {
                    cbo_CreditDebit.SelectedIndex = i;
                    break;
                }
            }
            oSelectedCcy = Program.FindCcy(oCurAccount.Ccy);
            if (oSelectedCcy != null)
            {
                cbo_Ccy.SelectedValue = oSelectedCcy;
                cbo_Ccy.SelectedValue = oSelectedCcy.Code;
            }

            txt_dCredit.EditValue     = oCurAccount.d_Credit;
            txt_dDebit.EditValue      = oCurAccount.d_Debit;
            txt_qCredit.EditValue     = oCurAccount.q_Credit;
            txt_qDebit.EditValue      = oCurAccount.q_Debit;
            txt_mCredit.EditValue     = oCurAccount.m_Credit;
            txt_mDebit.EditValue      = oCurAccount.m_Debit;
            txt_yCredit.EditValue     = oCurAccount.y_Credit;
            txt_yDebit.EditValue      = oCurAccount.y_Debit;
            txt_AmountBlock.EditValue = oCurAccount.Amount_Blocked;
            txt_Bal.EditValue         = oCurAccount.Balance;
            txt_BalAvai.EditValue     = oCurAccount.BalanceAvaiable;
            if (oCurAccount.Locked == true)
            {
                sbtnLocked.Text = "Bỏ khóa";
            }
            else
            {
                sbtnLocked.Text = "Khóa";
            }
        }