Exemple #1
0
 protected void GridPlaceView_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
 {
     if (GridPlaceView.IsNewRowEditing)
     {
         GridPlaceView.DoRowValidation();
     }
 }
Exemple #2
0
        protected void GridPlaceView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string id = e.Keys[0].ToString();

            controller.DeletePlace(id);

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

            Bind();
        }
Exemple #3
0
        protected void GridPlaceView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            PlaceViewModel model = new PlaceViewModel();

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

            controller.AddPlace(model);

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

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

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

            controller.UpdatePlace(model);

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

            Bind();
        }
Exemple #5
0
 protected void GridPlaceView_DataBinding(object sender, EventArgs e)
 {
     GridPlaceView.ForceDataRowType(typeof(PlaceViewModel));
 }
Exemple #6
0
 private void Bind()
 {
     GridPlaceView.DataSource = controller.Init();
     GridPlaceView.DataBind();
 }