protected void GridCustomerView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { string id = e.Keys[0].ToString(); controller.DeleteCustomer(id); e.Cancel = true; GridCustomerView.CancelEdit(); Bind(); }
protected void GridCustomerView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { CustomerViewModel model = new CustomerViewModel(); model.Adress = e.NewValues["Adress"].ToString(); model.Country = e.NewValues["Country"].ToString(); model.CustomerNr = e.NewValues["CustomerNr"] == null ? 0 : (int)e.NewValues["CustomerNr"]; model.EMail = e.NewValues["EMail"].ToString(); model.FirstName = e.NewValues["FirstName"].ToString(); model.LastName = e.NewValues["LastName"].ToString(); model.MobilePhone = e.NewValues["MobilePhone"].ToString(); model.Phone = e.NewValues["Phone"].ToString(); model.Place = e.NewValues["Place"].ToString(); model.Salutation = e.NewValues["Salutation"].ToString(); model.ZipCode = e.NewValues["ZipCode"].ToString(); controller.AddCustomer(model); e.Cancel = true; GridCustomerView.CancelEdit(); Bind(); }
protected void GridCustomerView_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { var list = (List <CustomerViewModel>)GridCustomerView.DataSource; CustomerViewModel model = list.Find(m => m.id == e.Keys[0].ToString()); model.Adress = e.NewValues["Adress"].ToString(); model.Country = e.NewValues["Country"].ToString(); model.CustomerNr = e.NewValues["CustomerNr"] == null ? 0 : (int)e.NewValues["CustomerNr"]; model.EMail = e.NewValues["EMail"].ToString(); model.FirstName = e.NewValues["FirstName"].ToString(); model.LastName = e.NewValues["LastName"].ToString(); model.MobilePhone = e.NewValues["MobilePhone"].ToString(); model.Phone = e.NewValues["Phone"].ToString(); model.Place = e.NewValues["Place"].ToString(); model.Salutation = e.NewValues["Salutation"].ToString(); model.ZipCode = e.NewValues["ZipCode"].ToString(); controller.UpdateCustomer(model); e.Cancel = true; GridCustomerView.CancelEdit(); Bind(); }