예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void InsertOrUpdate(object sender, DirectEventArgs e)
        {
            try
            {
                var bankController = new BankController();
                var bank           = new hr_Bank
                {
                    AccountNumber = txtAccountNumber.Text,
                    AccountName   = txtAccountName.Text
                };

                if (!string.IsNullOrEmpty(hdfBankId.Text))
                {
                    bank.BankId = Convert.ToInt32(hdfBankId.Text);
                }
                bank.Note = txt_Note.Text;
                if (!string.IsNullOrEmpty(hdfEmployeeSelectedId.Text))
                {
                    bank.RecordId = Convert.ToInt32(hdfEmployeeSelectedId.Text);
                }
                bank.CreatedDate = DateTime.Now;
                bank.EditedDate  = DateTime.Now;
                bank.IsInUsed    = chk_IsInUsed.Checked;
                var bankModel = new BankModel(bank);
                if (e.ExtraParams["Command"] == "Update")
                {
                    if (!string.IsNullOrEmpty(hdfKeyRecord.Text))
                    {
                        bankModel.Id = Convert.ToInt32(hdfKeyRecord.Text);
                        bankController.Update(bankModel);
                    }
                }
                else
                {
                    bankController.Insert(bank);
                }

                if (e.ExtraParams["Close"] == "True")
                {
                    wdBank.Hide();
                }

                //reload data
                gridBank.Reload();
            }
            catch (Exception ex)
            {
                ExtNet.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show();
            }
        }
예제 #2
0
        public BankModel(hr_Bank bank)
        {
            _bank = bank ?? new hr_Bank();

            Id            = _bank.Id;
            RecordId      = _bank.RecordId;
            IsInUsed      = _bank.IsInUsed;
            AccountName   = _bank.AccountName;
            AccountNumber = _bank.AccountNumber;
            Note          = _bank.Note;
            BankId        = _bank.BankId;

            CreatedDate = _bank.CreatedDate;
            EditedDate  = _bank.EditedDate;
        }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="bank"></param>
 public void Insert(hr_Bank bank)
 {
     hr_BankServices.Create(bank);
 }