Esempio n. 1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                tblAccountsMasterDTO tblaccountmasterdto = new tblAccountsMasterDTO();
                if (AccountId > 0)
                {
                    tblaccountmasterdto.AccountId = AccountId;
                }
                tblaccountmasterdto.AccountName = textaccountname.Text;
                if (rbBank.Checked)
                {
                    tblaccountmasterdto.AccountType = "2";
                }
                else
                {
                    tblaccountmasterdto.AccountType = "1";
                }

                tblaccountmasterdto.AccountNo      = Convert.ToString(textaccountno.Text);
                tblaccountmasterdto.Addrees        = textaddress.Text;
                tblaccountmasterdto.PhoneNo        = textphoneno.Text;
                tblaccountmasterdto.OpeningBalance = Convert.ToDouble(textopeningbal.Text);
                tblaccountmasterdto.OpeningDate    = accountdate.Value;
                tblaccountmasterdto.Description    = textdescription.Text;
                var result = AccountsMasterBusinessLogic.Save(tblaccountmasterdto);
                if (AccountId > 0)
                {
                    this.Close();
                }
                cleandata();
            }
        }
Esempio n. 2
0
 public ActionResult Save(tblAccountsMasterDTO tblAccountsMasterDTO)
 {
     if (ModelState.IsValid)
     {
         var resultCheckDuplicateAccount = AccountsMasterBusinessLogic.CheckDuplicateAccount(tblAccountsMasterDTO.AccountName, tblAccountsMasterDTO.AccountId);
         if (resultCheckDuplicateAccount)
         {
             ModelState.AddModelError("AccountName", "Account name already exists.");
         }
         else
         {
             var result = AccountsMasterBusinessLogic.Save(tblAccountsMasterDTO);
             if (result > 0)
             {
                 return(RedirectToAction("Index"));
             }
         }
     }
     return(View(tblAccountsMasterDTO));
 }