Beispiel #1
0
        public ActionResult Programs_Destroy([DataSourceRequest] DataSourceRequest request, Program program)
        {
            string userId = User.Identity.Name;

            if (ModelState.IsValid)
            {
                var entity = new Program
                {
                    programID            = program.programID,
                    name                 = program.name,
                    type                 = program.type,
                    description          = program.description,
                    minAge               = program.minAge,
                    maxAge               = program.maxAge,
                    displayAge           = program.displayAge,
                    feeStructure         = program.feeStructure,
                    registrationRequired = program.registrationRequired,
                    registrationFee      = program.registrationFee,
                    frequencyType        = program.frequencyType,
                    frequency            = program.frequency,
                    specialCriteria      = program.specialCriteria,
                    locationID           = program.locationID
                };

                db.Programs.Attach(entity);
                db.Programs.Remove(entity);

                try
                {
                    db.SaveChanges();
                }
                catch (Exception ee)
                {
                    string    mes = ee.InnerException.Message;
                    Exception d   = new Exception();
                    object    f   = ee.InnerException.Data;
                    f = ee.InnerException.HelpLink;
                    f = ee.InnerException.HResult;
                    f = ee.InnerException.Source;
                    f = ee.HelpLink;
                    f = ee.HResult;
                    f = ee.Source;
                    f = ee.Data;
                    string          tem       = ee.StackTrace;
                    StaticProcessVO processVO = new StaticProcessVO(tem.ToString());
                }


                var             parkName = db.Locations.Where(s => s.locationID == entity.locationID).Select(s => s.name).First();
                StaticProcessVO procesVO = new StaticProcessVO("Program ID: " + entity.programID.ToString() + " : Program Name: " + entity.name.ToString() + " for " + parkName.ToString() + " Deleted by " + userId);
            }

            return(Json(new[] { program }.ToDataSourceResult(request, ModelState)));
        }
Beispiel #2
0
        public ActionResult Programs_Create([DataSourceRequest] DataSourceRequest request, programViewModel program)
        {
            if (ModelState.IsValid)
            {
                var entity = new Program
                {
                    locationID        = long.Parse(program.parkName),
                    programCategoryID = int.Parse(program.programCategoryName),
                    name        = program.name,
                    type        = program.type,
                    description = program.description,
                    //minAge = program.minAge,
                    //maxAge = program.maxAge,
                    displayAge           = program.displayAge,
                    feeStructure         = program.feeStructure,
                    registrationRequired = false,
                    registrationFee      = program.registrationFee,
                    frequencyType        = program.frequencyType,
                    frequency            = program.frequency,
                    specialCriteria      = program.specialCriteria,
                };

                db.Programs.Add(entity);
                try
                {
                    db.SaveChanges();
                }
                catch (Exception ee)
                {
                    string    mes = ee.InnerException.Message;
                    Exception d   = new Exception();
                    object    f   = ee.InnerException.Data;
                    f = ee.InnerException.HelpLink;
                    f = ee.InnerException.HResult;
                    f = ee.InnerException.Source;
                    f = ee.HelpLink;
                    f = ee.HResult;
                    f = ee.Source;
                    f = ee.Data;
                    string          tem       = ee.StackTrace;
                    StaticProcessVO processVO = new StaticProcessVO(tem.ToString());
                }

                program.programID = entity.programID;
                StaticProcessVO procesVO = new StaticProcessVO(entity.programID.ToString() + "added");
            }

            return(Json(new[] { program }.ToDataSourceResult(request, ModelState)));
        }