protected void Button1_Click(object sender, EventArgs e) { ItemCategory uIItemCategory = new ItemCategory(); uIItemCategory.Category = this.CategoryTextBox.Text; uIItemCategory.Description = this.DescriptionTextBox.Text; //object Class = uICustomer; int ActionType = 1; Facade newFacade = new Facade(uIItemCategory, ActionType); newFacade.ProcessRequest(); if (Page.IsValid) { SuccessLabel.Text = "You have successfully added an Item Category on the FFR's website"; } else { SuccessLabel.Text = "Failed to add an Item Category on FFR's website, please verify you have entered all necessary information."; } //deploy project //CustomerManager cm = new CustomerManager(); //cm.Insert(uICustomer); /*XmlWriterSettings xmlSetting = new XmlWriterSettings(); xmlSetting.Indent = true; string xmlFileName = "CustomerTest.xml"; //XmlWriter xmlWriter = XmlWriter.Create("@C:, xmlSetting); XmlWriter xmlWriter = XmlWriter..Create(xmlFileName, xmlSetting); xmlWriter.WriteStartDocument(); xmlWriter.WriteComment("This Xml is generated when a customer registers on FFR's site"); xmlWriter.WriteStartElement("Customer"); xmlWriter.WriteElementString("ObjectType", "Customer"); xmlWriter.WriteElementString("ActionType", "1"); xmlWriter.WriteElementString("FirstName", this.FirstNameTextBox.Text); xmlWriter.WriteElementString("LastName", this.LastNameTextBox.Text); xmlWriter.WriteElementString("City", this.CityTextBox.Text); xmlWriter.WriteElementString("State", this.StateTextBox.Text); xmlWriter.WriteElementString("Street", this.StreetTextBox.Text); xmlWriter.WriteElementString("Zip", this.StateTextBox.Text); xmlWriter.WriteElementString("Phone", this.PhoneTextBox.Text); xmlWriter.WriteElementString("Email", this.EmailTextBox.Text); xmlWriter.WriteEndElement(); xmlWriter.WriteEndDocument(); xmlWriter.Flush(); xmlWriter.Close(); Facade newFacade = new Facade(xmlWriter, xmlFileName); newFacade.ProcessRequest(); xmlWriter.Dispose(); xmlFileName = "";*/ }
public void UpdateItemCategory() { FFREntities ffrDb = new FFREntities(); ItemCategory itemCategory = new ItemCategory(); itemCategory.Category = "Update"; itemCategory.Description = "Update"; ffrDb.ItemCategories.Add(itemCategory); ffrDb.SaveChanges(); ItemCategory updateItemCategory = (from d in ffrDb.ItemCategories where d.Category == "Update" select d).Single(); updateItemCategory.Description = "Item Category has been updated"; ffrDb.SaveChanges(); }
public void DeleteItemCategory() { FFREntities ffrDb = new FFREntities(); ItemCategory itemCategory = new ItemCategory(); itemCategory.Category = "Delete"; itemCategory.Description = "Delete"; ffrDb.ItemCategories.Add(itemCategory); ffrDb.SaveChanges(); ItemCategory deleteItemCategory = (from d in ffrDb.ItemCategories where d.Category == "Delete" select d).Single(); ffrDb.ItemCategories.Remove(deleteItemCategory); ffrDb.SaveChanges(); }