protected void GridCustomerEmailView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { List <CustomerContact> contacts = (List <CustomerContact>)GridCustomerEmailView.DataSource; string id = e.Keys[0].ToString(); CustomerContact contact = contacts.Find(m => m.Id == id); contacts.Remove(contact); var model = controller.GetCustomer(modelid); model.Contacts = contacts; controller.UpdateCustomer(model); e.Cancel = true; GridNoteView.CancelEdit(); GridCustomerEmailView.DataSource = contacts; GridCustomerEmailView.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Uri u = HttpContext.Current.Request.Url; modelid = HttpUtility.ParseQueryString(u.Query).Get("id"); var layoutmodel = controller.GetCustomerLayout(modelid); FormLayoutCustomer.DataSource = layoutmodel; FormLayoutCustomer.DataBind(); var modelbookingprocess = controller.GetBookingProcessesByCustomerId(layoutmodel.CustomerNr); GridBookingProcessView.DataSource = modelbookingprocess; GridBookingProcessView.DataBind(); var model = controller.GetCustomer(modelid); GridNoteView.DataSource = model.Notes; GridNoteView.DataBind(); GridCustomerEmailView.DataSource = model.Contacts; GridCustomerEmailView.DataBind(); }
protected void GridCustomerEmailView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { List <CustomerContact> contacts = (List <CustomerContact>)GridCustomerEmailView.DataSource; var newValue = e.NewValues; CustomerContact contact = new CustomerContact(); contact.Email = newValue["Email"].ToString(); contacts.Add(contact); var model = controller.GetCustomer(modelid); model.Contacts = contacts; controller.UpdateCustomer(model); var Model = controller.GetCustomer(modelid); e.Cancel = true; GridCustomerEmailView.CancelEdit(); GridCustomerEmailView.DataSource = Model.Contacts; GridCustomerEmailView.DataBind(); }