Esempio n. 1
0
        protected void GridUnitOfferView_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            var listSaP = (List <UnitOfferViewModel>)GridUnitOfferView.DataSource;
            UnitOfferViewModel model = listSaP.Find(m => m.id == e.Keys[0].ToString());

            model.IsAutoStopBooking = (bool)e.NewValues["IsAutoStopBooking"];
            model.OfferCode         = e.NewValues["OfferCode"].ToString() ?? string.Empty;
            //model.SiteCode = e.NewValues["SiteCode"].ToString() ?? string.Empty;
            model.OfferCount       = e.NewValues["OfferCount"] == null ? 0 : (int)e.NewValues["OfferCount"];
            model.OfferDescription = e.NewValues["OfferDescription"].ToString() ?? string.Empty;
            // model.OfferDescriptionTranslate = (Dictionary<string,string>) e.NewValues["OfferDescriptionTranslate"];
            model.OfferTitel = e.NewValues["OfferTitel"].ToString() ?? string.Empty;
            // model.OfferTitelTranslate = (Dictionary<string, string>)e.NewValues["OfferTitelTranslate"];
            model.ProviderNotice   = e.NewValues["ProviderNotice"].ToString() ?? string.Empty;
            model.TourOperatorCode = e.NewValues["TourOperatorCode"].ToString() ?? string.Empty;
            model.UnitCode         = e.NewValues["UnitCode"].ToString() ?? e.NewValues["UnitCode"].ToString();

            if (model.UnitCode != null)
            {
                model.SiteCode = controller.GetSiteCode(model.UnitCode);
            }

            //bool contains = controller.ContainsOfferCode(model.OfferCode);

            //if (!contains)
            //{
            controller.UpdateUnitOffer(model);
            //}
            e.Cancel = true;
            GridUnitOfferView.CancelEdit();

            Bind();
        }
Esempio n. 2
0
        protected void GridUnitOfferView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            UnitOfferViewModel model = new UnitOfferViewModel();


            model.IsAutoStopBooking = (bool)e.NewValues["IsAutoStopBooking"];
            model.OfferCode         = e.NewValues["OfferCode"].ToString() ?? string.Empty;
            //model.SiteCode = e.NewValues["SiteCode"].ToString()?? string.Empty;
            model.OfferCount       = e.NewValues["OfferCount"] == null? 0:(int)e.NewValues["OfferCount"];
            model.OfferDescription = e.NewValues["OfferDescription"].ToString() ?? string.Empty;
            // model.OfferDescriptionTranslate = (Dictionary<string,string>) e.NewValues["OfferDescriptionTranslate"];
            model.OfferTitel = e.NewValues["OfferTitel"].ToString() ?? string.Empty;
            // model.OfferTitelTranslate = (Dictionary<string, string>)e.NewValues["OfferTitelTranslate"];
            model.ProviderNotice   = e.NewValues["ProviderNotice"].ToString() ?? string.Empty;
            model.TourOperatorCode = e.NewValues["TourOperatorCode"].ToString() ?? string.Empty;
            model.UnitCode         = e.NewValues["UnitCode"].ToString() ?? e.NewValues["UnitCode"].ToString();


            if (model.UnitCode != null)
            {
                model.SiteCode = controller.GetSiteCode(model.UnitCode);
            }


            bool contains = controller.ContainsOfferCode(model.OfferCode);

            if (!contains)
            {
                controller.AddUnitOffer(model);
            }
            e.Cancel = true;
            GridUnitOfferView.CancelEdit();

            Bind();
        }
Esempio n. 3
0
        protected void GridUnitOfferView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string id = e.Keys[0].ToString();

            controller.DeleteUnitOffer(id);
            e.Cancel = true;
            GridUnitOfferView.CancelEdit();

            Bind();
        }