/// <summary> /// Delete customer and reload the grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnDelete_Click(object sender, EventArgs e) { //Call DAL to delete SQLiteNHibernate.NHib.DataAccess DAL = new NHib.DataAccess(); DAL.DeleteCustomer(Convert.ToInt32(HFCustomerID.Value)); //Set the message on the parent page ((_Default)this.Page).SetMessage("Deleted - Customer ID: " + HFCustomerID.Value + " " + HFName.Value); HFCustomerID.Value = string.Empty; HFName.Value = string.Empty; //Reload the grid LoadCustomerGrid(); }
protected void BtnSave_Click(object sender, EventArgs e) { //Call DAL to delete SQLiteNHibernate.NHib.DataAccess DAL = new NHib.DataAccess(); DAL.SaveCustomer(null, TxtFirst.Text, TxtLast.Text, TxtAddress.Text, TxtCity.Text, TxtState.Text, TxtZip.Text); //Display success ((_Default)this.Page).SetMessage("Customer Saves: " + TxtFirst.Text + " " + TxtLast.Text); //Call the load method on the parent page ((_Default)this.Page).LoadGrid(); TxtFirst.Text = string.Empty; TxtLast.Text = string.Empty; TxtAddress.Text = string.Empty; TxtCity.Text = string.Empty; TxtState.Text = string.Empty; TxtZip.Text = string.Empty; }
/// <summary> /// Load Customer Grid /// </summary> public void LoadCustomerGrid() { SQLiteNHibernate.NHib.DataAccess DAL = new NHib.DataAccess(); GridCustomers.DataSource = DAL.GetCustomers(); GridCustomers.DataBind(); }