//**************************************************************** // // The UpdateBtn_Click event handler on this Page is used to either // create or update a contact. It uses the Nairc.KPWPortal.ContactsDB() // data component to encapsulate all data functionality. // //**************************************************************** protected void UpdateBtn_Click(Object sender, EventArgs e) { // Only Update if Entered data is Valid if (Page.IsValid == true) { IDesktopModulesFacade facade = new DesktopModulesFacade(); PortalContact contact = new PortalContact(); contact.ModuleID =moduleId; contact.ItemID =itemId; contact.CreatedByUser =Context.User.Identity.Name; contact.Name =NameField.Text; contact.Role =RoleField.Text; contact.Email =EmailField.Text; contact.Contact1 = Contact1Field.Text; contact.Contact2 = Contact2Field.Text; if (itemId == 0) { // Add the contact within the contacts table facade.AddContact(contact); } else { // Update the contact within the contacts table facade.UpdateContact(contact); } // Redirect back to the portal home page Response.Redirect((String) ViewState["UrlReferrer"]); } }
public void UpdateContactTest() { //void UpdateContact(int moduleId, int itemId, String userName, String name, String role, String email, // String contact1, String contact2) DesktopModulesFacade facade = new DesktopModulesFacade(); PortalContact contact = new PortalContact(); contact.ModuleID = 0; contact.ItemID = 0; contact.CreatedByUser = "******"; contact.Name = "n"; contact.Role = "r"; contact.Email = "e"; contact.Contact1 = "c1"; contact.Contact2 = "c2"; facade.UpdateContact(contact); }