protected void btnDelete_Click(object sender, EventArgs e) { CustomerModule customerModule = new CustomerModule(); if (ViewState["id"] != null) { customerModule.Delete(ViewState["id"].ToString()); gvCustomer.DataSource = odsCustomer; gvCustomer.DataBind(); } else { lblError.Visible = true; lblError.Text = "PLEASE SELECT CUSTOMER"; } }
private void InsertCustomer() { InventorySystem.Business.Customer customer = new InventorySystem.Business.Customer(); CustomerModule customerModule = new CustomerModule(); if (ViewState["id"] != null) customer.Id = Convert.ToInt32(ViewState["id"]); customer.Name = txtCustName.Text; customer.Company = txtCustCompName.Text; customer.Address = txtCustAddress.Text; customer.Website = txtCustWebsite.Text; customer.Remarks = txtCustRemarks.Text; customer.Email = txtCustEmail.Text; customer.Fax = txtCustFaxNo.Text; customer.PostCode = txtCustPostalCode.Text; //customer.Country = txtCustCountry.Text; customer.Country = ddlCountry.TextField; customer.PhoneNo = txtCustPhoneNo.Text; customer.Rating = RatingExample.CurrentRating; customerModule.Save(customer); }