예제 #1
0
 protected void GridCustomerViewTmp_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
 {
     if (GridCustomerViewTmp.IsNewRowEditing)
     {
         GridCustomerViewTmp.DoRowValidation();
     }
 }
예제 #2
0
        protected void GridCustomerViewTmp_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string id = e.Keys[0].ToString();

            controller.DeleteCustomer(id);

            e.Cancel = true;
            GridCustomerViewTmp.CancelEdit();

            Bind();
        }
예제 #3
0
        protected void GridCustomerViewTmp_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;
            GridCustomerViewTmp.CancelEdit();

            Bind();
        }
예제 #4
0
        protected void GridCustomerViewTmp_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            var list = (List <CustomerViewModel>)GridCustomerViewTmp.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;
            GridCustomerViewTmp.CancelEdit();

            Bind();
        }
예제 #5
0
 private void Bind()
 {
     GridCustomerViewTmp.DataSource = controller.Init();
     GridCustomerViewTmp.DataBind();
 }