Beispiel #1
0
 protected void GridRegionView_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
 {
     if (GridRegionView.IsNewRowEditing)
     {
         GridRegionView.DoRowValidation();
     }
 }
Beispiel #2
0
        protected void GridRegionView_RowDeleting1(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string id = e.Keys[0].ToString();

            controller.DeleteRegion(id);

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

            Bind();
        }
Beispiel #3
0
        protected void GridRegionView_RowInserting1(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            RegionViewModel model = new RegionViewModel();

            model.RegionId            = e.NewValues["RegionId"] == null ? 0 : (int)e.NewValues["RegionId"];
            model.RegionName          = e.NewValues["RegionName"].ToString();
            model.CountryId           = e.NewValues["CountryId"] == null ? 0 : (int)e.NewValues["CountryId"];
            model.ImageGalleryPath    = (e.NewValues["ImageGalleryPath"] == null) ? string.Empty : e.NewValues["ImageGalleryPath"].ToString();
            model.ImageThumbnailsPath = (e.NewValues["ImageThumbnailsPath"] == null) ? string.Empty : e.NewValues["ImageThumbnailsPath"].ToString();

            controller.AddRegion(model);

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

            Bind();
        }
Beispiel #4
0
        protected void GridRegionView_RowUpdating1(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            var             listSaP = (List <RegionViewModel>)GridRegionView.DataSource;
            RegionViewModel model   = listSaP.Find(m => m.Id == e.Keys[0].ToString());

            model.RegionId            = e.NewValues["RegionId"] == null ? 0 : (int)e.NewValues["RegionId"];
            model.RegionName          = e.NewValues["RegionName"].ToString();
            model.CountryId           = e.NewValues["CountryId"] == null ? 0 : (int)e.NewValues["CountryId"];
            model.ImageGalleryPath    = (e.NewValues["ImageGalleryPath"] == null) ? string.Empty : e.NewValues["ImageGalleryPath"].ToString();
            model.ImageThumbnailsPath = (e.NewValues["ImageThumbnailsPath"] == null) ? string.Empty : e.NewValues["ImageThumbnailsPath"].ToString();


            controller.UpdateRegion(model);

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

            Bind();
        }
Beispiel #5
0
 protected void GridRegionView_DataBinding(object sender, EventArgs e)
 {
     GridRegionView.ForceDataRowType(typeof(RegionViewModel));
 }
Beispiel #6
0
 private void Bind()
 {
     GridRegionView.DataSource = controller.Init();
     GridRegionView.DataBind();
 }