Пример #1
0
 private void frmCurrency_Load(object sender, EventArgs e)
 {
     Program.eButton     = Program.Button.None;
     oSelectedCcy        = frmCurrencyList.oSelectedCcy;
     txt_Code.Text       = oSelectedCcy.Code;
     txt_Name.Text       = oSelectedCcy.Name;
     txt_ISOCode.Text    = oSelectedCcy.NumberCode.ToString();
     txt_Code.Enabled    = false;
     txt_Name.Enabled    = false;
     txt_ISOCode.Enabled = false;
 }
Пример #2
0
        private void sbtnOK_Click(object sender, EventArgs e)
        {
            if (Program.eButton == Program.Button.New)
            {
                oCurrency = new Account.Common.Entities.Currency_Info();
            }
            else if (Program.eButton == Program.Button.Edit)
            {
                oCurrency = oSelectedCcy;
            }
            oCurrency.Code       = txt_Code.Text;
            oCurrency.Name       = txt_Name.Text;
            oCurrency.NumberCode = Convert.ToInt32(txt_ISOCode.Text);

            int result = -1;

            if (Program.eButton == Program.Button.New)
            {
                result = Account.UIProviders.UICurrency.Insert(oCurrency);
            }
            else if (Program.eButton == Program.Button.Edit)
            {
                result = Account.UIProviders.UICurrency.Update(oCurrency);
            }
            if (result == 0)
            {
                MessageBox.Show("Cập nhật thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txt_Code.Enabled    = false;
                txt_Name.Enabled    = false;
                txt_ISOCode.Enabled = false;
                if (Program.eButton == Program.Button.New)
                {
                    frmCurrencyList.lstCurrencyInfo.Add(oCurrency);
                }
                else if (Program.eButton == Program.Button.Edit)
                {
                    frmCurrencyList.lstCurrencyInfo.Remove(oSelectedCcy);
                    frmCurrencyList.lstCurrencyInfo.Insert(frmCurrencyList.lstCurrencyInfo.Count, oCurrency);
                }
            }
            else
            {
                MessageBox.Show(Account.UIProviders.UICurrency.ValidationMessage, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Пример #3
0
 private void sbtnDetail_Click(object sender, EventArgs e)
 {
     if (gridView1.FocusedRowHandle < 0)
     {
         return;
     }
     else
     {
         string Code = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gcolCode).ToString();
         for (int i = 0; i < lstCurrencyInfo.Count; i++)
         {
             if (lstCurrencyInfo[i].Code == Code)
             {
                 oSelectedCcy = lstCurrencyInfo[i];
                 frmCurrency ofrm = new frmCurrency();
                 ofrm.ShowDialog();
                 SetDataSource();
                 break;
             }
         }
     }
 }
Пример #4
0
        private void Save_Account()
        {
            if (oAccountInfo == null)
            {
                return;
            }

            oAccountInfo.Reference = txt_Ref.Text;
            oAccountInfo.Name      = txt_Name.Text.Trim();
            if (oSelectedCustomer != null)
            {
                oAccountInfo.Customer_ID = oSelectedCustomer.ID;
            }
            if (oSelectedAccountGL != null)
            {
                oAccountInfo.Account_GL = oSelectedAccountGL.Account_ID;
            }
            if (oSelectedBranch != null)
            {
                oAccountInfo.Branch_ID = oSelectedBranch.ID;
            }
            ////oAccountInfo.Open_Date = dtOpenDate.DateTime;
            ////oAccountInfo.Last_Date = dtLastDate.DateTime;

            if (cbo_Approved.SelectedIndex == 0)
            {
                oAccountInfo.Approved     = true;
                oAccountInfo.ApprovedTime = dtApprovedTime.DateTime;
            }
            else
            {
                oAccountInfo.Approved     = false;
                oAccountInfo.ApprovedTime = DateTime.MinValue;
            }

            if (cbo_Closed.SelectedIndex == 0)
            {
                oAccountInfo.Closed      = true;
                oAccountInfo.Closed_date = dtClosedDate.DateTime;
            }
            else
            {
                oAccountInfo.Closed = false;
            }

            if (oSelectedCate != null)
            {
                oAccountInfo.Categories = oSelectedCate.ID;
            }
            oSelectedCcy            = Program.FindCcy(cbo_Ccy.SelectedValue.ToString());
            oAccountInfo.UserCreate = Program.CurrentUser.User_ID;

            if (oSelectedCcy != null)
            {
                oAccountInfo.Ccy = oSelectedCcy.Code;
            }
            try
            {
                if (Program.eButton == Program.Button.Edit)
                {
                    Update_Account();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            this.Close();
        }
Пример #5
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";
            }
        }