protected void bnSavePopup_Click(object sender, EventArgs e)
        {
            string message;
            var    cge = new CarGroupEntity
            {
                Id         = int.Parse(hfCarGroupId.Value),
                CarClassId = int.Parse(ddlCarClass.SelectedValue),
                //Using the Selected Text here, one day the Car Group table will change to use Ids then this can change to selectedValue
                CarGroupGold            = ddlGoldUpgrade.SelectedItem.Text,
                CarGroupFiveStar        = ddlFiveStarUpgrade.SelectedItem.Text,
                CarGroupPlatinum        = ddlPlatinum.SelectedItem.Text,
                CarGroupPresidentCircle = ddlPresidentCircle.SelectedItem.Text,
                Active = cbActive.Checked
            };

            using (var dataAccess = new MappingSingleUpdate())
            {
                message = dataAccess.UpdateCarGroup(cge);
            }
            if (message == string.Empty)
            {
                var parameters = new List <string> {
                    AdminMappingEnum.CarGroup.ToString(), UpdateCarGroupSuccess
                };
                RaiseBubbleEvent(this, new CommandEventArgs(App.Site.Administration.Mappings.Mappings.MappingUpdate, parameters));
            }
            else
            {
                lblMessage.Text = message;
                ShowPopup();
            }
        }
Exemple #2
0
        public string UpdateCarGroup(CarGroupEntity cge)
        {
            var carGroupDbEntry = DataContext.CAR_GROUPs.Single(d => d.car_group_id == cge.Id);

            carGroupDbEntry.car_class_id              = cge.CarClassId;
            carGroupDbEntry.car_group_gold            = cge.CarGroupGold;
            carGroupDbEntry.car_group_presidentCircle = cge.CarGroupPresidentCircle;
            carGroupDbEntry.car_group_platinum        = cge.CarGroupPlatinum;
            carGroupDbEntry.car_group_fivestar        = cge.CarGroupFiveStar;

            //carGroupDbEntry.CAR_CLASS.car_segment_id = cge.CarSegmentId;

            carGroupDbEntry.IsActive = cge.Active;

            var returned = SubmitDbChanges();

            return(returned);
        }