private void SaveVendors() { int _vendorId = AlwaysConvert.ToInt(HiddenVendorId.Value); _Vendor = VendorDataSource.Load(_vendorId); _Vendor.Name = VendorName.Text; _Vendor.Email = Email.Text.Replace(" ", ""); _Vendor.Save(); }
protected void Page_Init(object sender, System.EventArgs e) { _VendorId = AlwaysConvert.ToInt(Request.QueryString["VendorId"]); _Vendor = VendorDataSource.Load(_VendorId); if (_Vendor == null) { Response.Redirect("Default.aspx"); } Caption.Text = string.Format(Caption.Text, _Vendor.Name); InstructionText.Text = string.Format(InstructionText.Text, _Vendor.Name); BindVendors(); }
protected void VendorGrid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("EditVendor")) { string[] data = ((string)e.CommandArgument).Split(':'); _VendorId = AlwaysConvert.ToInt(data[0]); HiddenVendorId.Value = _VendorId.ToString(); _Vendor = VendorDataSource.Load(_VendorId); VendorName.Text = _Vendor.Name; Email.Text = _Vendor.Email; ModalPopupExtender.Show(); EditAjax.Update(); } }
protected void Page_Load(object sender, System.EventArgs e) { _VendorId = AlwaysConvert.ToInt(Request.QueryString["VendorId"]); _Vendor = VendorDataSource.Load(_VendorId); if (_Vendor == null) { Response.Redirect("Default.aspx"); } Caption.Text = string.Format(Caption.Text, _Vendor.Name); FindAssignProducts1.AssignmentValue = _VendorId; FindAssignProducts1.OnAssignProduct += new AssignProductEventHandler(FindAssignProducts1_AssignProduct); FindAssignProducts1.OnLinkCheck += new AssignProductEventHandler(FindAssignProducts1_LinkCheck); FindAssignProducts1.OnCancel += new EventHandler(FindAssignProducts1_CancelButton); }
protected void DeleteButton_Click(object sender, System.EventArgs e) { if (VendorList.SelectedIndex != 0) { int newVendorId = AlwaysConvert.ToInt(VendorList.SelectedValue); Vendor newVendor = VendorDataSource.Load(newVendorId); if (newVendor != null) { foreach (Product product in _Vendor.Products) { product.VendorId = newVendorId; } _Vendor.Products.Save(); } } _Vendor.Delete(); Response.Redirect("Default.aspx"); }