protected void btnSave_Click(object sender, EventArgs e) { string BankId = lblBank.Text; string BankName = txtBankName.Text; string BankBranch = txtBankBranch.Text; string BankBranchCode = txtBankBranchCode.Text; string BankTelePhoneNnumber = txtBankTelephoneNumber.Text; string BankEmailAddress = txtBankEmailAddress.Text; Models.MBank mv = new Models.MBank(); mv.id = BankId; mv.Name = BankName; mv.Branch = BankBranch; mv.BranchCode = BankBranchCode; mv.TelephoneNumber = BankTelePhoneNnumber; mv.EmailAddress = BankEmailAddress; Classes.CBank ccv = new Classes.CBank(); if (ccv.Update(mv) < 0) { ShowFailMessage(); } else { ShowSuccessMessage(); BindData(); } }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { string BankName = txtBankName.Text; string BankBranch = txtBankBranch.Text; string BankBranchCode = txtBankBranchCode.Text; string BankTelePhoneNnumber = txtBankTelephoneNumber.Text; string BankEmailAddress = txtBankEmailAddress.Text; Models.MBank mv = new Models.MBank(); mv.Name = BankName; mv.Branch = BankBranch; mv.BranchCode = BankBranchCode; mv.TelephoneNumber = BankTelePhoneNnumber; mv.EmailAddress = BankEmailAddress; Classes.CBank ccv = new Classes.CBank(); if (ccv.Save(mv) < 0) { ShowFailMessage(); } else { ShowSuccessMessage(); ClearTextBoxes(Page); } } }
private void BindDropDown() { Classes.CBank cv = new Classes.CBank(); Dictionary <int, string> VendorData = new Dictionary <int, string>(); List <Models.MBank> get = new List <Models.MBank>(); get = cv.GetAll(); VendorData.Add(-1, "Please Select"); for (int i = 0; i < get.Count; i++) { VendorData.Add(Convert.ToInt32(get[i].id), get[i].Name + " Branch: " + get[i].BranchCode); } ddlBankId.DataTextField = "Value"; ddlBankId.DataValueField = "Key"; ddlBankId.DataSource = VendorData; ddlBankId.DataBind(); }
private void BindData() { Classes.CBank cb = new Classes.CBank(); grdBank.DataSource = cb.GetAll(); grdBank.DataBind(); }