Exemplo n.º 1
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you want to Update Creent Record ", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
     {
         AccountType.AccountCreationDataType _Savedata = new AccountType.AccountCreationDataType();
         string respond = SetDataToCLass(out _Savedata);
         if (MyAccount.ExistAccountCreation(_Savedata.AccountID))
         {
             if (respond == "True")
             {
                 respond = MyAccount.UpdateAccountCreation(_Savedata);
                 if (respond == "True")
                 {
                     MessageBox.Show("Record Saved Successfully", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     LoadExistingAccount();
                     LoadExtAccountInHiaraky();
                 }
                 else
                 {
                     MessageBox.Show(respond, "E r r o r", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                 }
             }
             else
             {
                 MessageBox.Show(respond, "E r r o r", MessageBoxButtons.OK, MessageBoxIcon.Stop);
             }
         }
         else
         {
             MessageBox.Show("No account Number in the system, Use Save Button to Add new account delatails", "E r r o r", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         }
     }
 }
Exemplo n.º 2
0
        private void DisplayExtData(string AccNo)
        {
            AccountType.AccountCreationDataType _Savedata = new AccountType.AccountCreationDataType();
            string respond = MyAccount.GetExistAccountCreation(AccNo, out _Savedata);

            InitializeScreen();
            ComboboxItem cmb = new ComboboxItem();

            if (respond == "True")
            {
                txtAccID.Text = _Savedata.AccountID.ToString();
                txtAccountDescription.Text = _Savedata.AccountName;
                cmbAccountType.Text        = cmb.GetReleventTextFromID(cmbAccountType, _Savedata.MainAccType.ToString(), true);
                if (_Savedata.IsSubAccount == 1)
                {
                    chkIsSubaccount.CheckState = CheckState.Checked;
                    cmbMainAccount.Text        = cmb.GetReleventTextFromID(cmbMainAccount, _Savedata.MainAccountID.ToString(), true);
                }
                else
                {
                    chkIsSubaccount.CheckState = CheckState.Unchecked;
                }
                cmbCurrenyType.Text   = cmb.GetReleventTextFromID(cmbCurrenyType, _Savedata.Currency, true);
                cmbBankAccountNo.Text = _Savedata.BankAccountNo;
                cmbAccStatus.Text     = cmb.GetReleventTextFromID(cmbAccStatus, _Savedata.AccountStatus.ToString(), true);
            }
        }
Exemplo n.º 3
0
        private string SetDataToCLass(out AccountType.AccountCreationDataType _Savedata)
        {
            ComboboxItem cmb = new ComboboxItem();

            _Savedata               = new AccountType.AccountCreationDataType();
            _Savedata.AccountID     = txtAccID.Text;
            _Savedata.AccountName   = txtAccountDescription.Text;
            _Savedata.AccountStatus = int.Parse(cmb.GetReleventTextFromID(cmbAccStatus, cmbAccStatus.Text, false));
            _Savedata.BankAccountNo = cmbBankAccountNo.Text;
            _Savedata.CreatedUser   = Program.AccountStatic.UserName;
            _Savedata.Currency      = cmbCurrenyType.Text;
            if (chkIsSubaccount.CheckState == CheckState.Checked)
            {
                _Savedata.IsSubAccount  = 1;
                _Savedata.MainAccountID = cmb.GetReleventTextFromID(cmbMainAccount, cmbMainAccount.Text, false);
            }
            else
            {
                _Savedata.IsSubAccount  = 0;
                _Savedata.MainAccountID = "0";
            }
            _Savedata.lastaccdate = DateTime.Today;
            _Savedata.MainAccType = int.Parse(cmb.GetReleventTextFromID(cmbAccountType, cmbAccountType.Text, false));
            _Savedata.CompanyID   = Program.AccountStatic.CompanyID;
            return("True");
        }
Exemplo n.º 4
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you want to Create ?", "Create New Ledgers", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
     {
         progressBar1.Value = 0; progressBar1.Maximum = dgvList.Rows.Count;
         foreach (DataGridViewRow r in dgvList.Rows)
         {
             if (r.Cells["dgv_Select"].Value == "1")
             {
                 AccountType.AccountCreationDataType _Savedata = new AccountType.AccountCreationDataType();
                 string respond = "";
                 respond = SetDataToClass(r, out _Savedata);
                 if (respond == "True")
                 {
                     if (!Myaccount.ExistAccountCreation(_Savedata.AccountID))
                     {
                         respond = Myaccount.SaveAccountCreation(_Savedata);
                     }
                     if (respond != "True")
                     {
                         Program.VerningMessage(respond);
                     }
                 }
             }
             progressBar1.Value = r.Index + 1;
         }
         Program.InformationMessage("Account Saved Successfully");
         progressBar1.Value = 0;
     }
 }
Exemplo n.º 5
0
        private string SetDataToClass(DataGridViewRow r, out AccountType.AccountCreationDataType _Savedata)
        {
            _Savedata = new AccountType.AccountCreationDataType();
            try
            {
                if (btnSupplier.Checked)
                {
                    if (txtCurrency.Text == "USD")
                    {
                        _Savedata.AccountID     = "20005-" + r.Cells["dgvList_ID"].Value.ToString();
                        _Savedata.MainAccountID = "20005";
                    }
                    else
                    {
                        _Savedata.AccountID     = "20000-" + r.Cells["dgvList_ID"].Value.ToString();
                        _Savedata.MainAccountID = "20000";
                    }

                    _Savedata.AccountName    = r.Cells["dgvList_Name"].Value.ToString();
                    _Savedata.AccountStatus  = 1;
                    _Savedata.BankAccountNo  = "";
                    _Savedata.CompanyID      = Program.AccountStatic.CompanyID;
                    _Savedata.CreatedUser    = Program.AccountStatic.UserName;
                    _Savedata.Currency       = txtCurrency.Text;
                    _Savedata.CurrencySymble = txtCurrency.Text;
                    _Savedata.IsSubAccount   = 1;

                    _Savedata.MainAccType = 6;
                }
                else if (btnCustomer.Checked)
                {
                    _Savedata.AccountID      = "10105-" + r.Cells["dgvList_ID"].Value.ToString();
                    _Savedata.AccountName    = r.Cells["dgvList_Name"].Value.ToString();
                    _Savedata.AccountStatus  = 1;
                    _Savedata.BankAccountNo  = "";
                    _Savedata.CompanyID      = Program.AccountStatic.CompanyID;
                    _Savedata.CreatedUser    = Program.AccountStatic.UserName;
                    _Savedata.Currency       = txtCurrency.Text;
                    _Savedata.CurrencySymble = txtCurrency.Text;
                    _Savedata.IsSubAccount   = 1;
                    _Savedata.MainAccountID  = "10105";
                    _Savedata.MainAccType    = 2;
                }
                return("True");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }