예제 #1
0
        // GET: /Monitoring/Location/Delete/
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                throw new ArgumentNullException("LocationID");
            }

            string ret;

            try
            {
                var service = new RMS.Centralize.WebSite.Proxy.LocationService().locationService;

                var updatedBy = new BasePage().UserName;

                var result = service.Delete(id.Value, updatedBy);

                ret = result.IsSuccess ? "1" : "0";
            }
            catch (Exception ex)
            {
                ret = "0";
                new RMSWebException(this, "0500", "Delete failed. " + ex.Message, ex, true);
            }



            return(Json(ret));
        }
예제 #2
0
        // GET: /Monitoring/Location/Update/
        public ActionResult Update(int?id, string m, string locationCode, string locationName, bool?mondayEnable, bool?mondayWholeDay, DateTime?mondayStart,
                                   DateTime?mondayEnd, bool?tuesdayEnable, bool?tuesdayWholeDay, DateTime?tuesdayStart, DateTime?tuesdayEnd, bool?wednesdayEnable,
                                   bool?wednesdayWholeDay, DateTime?wednesdayStart, DateTime?wednesdayEnd, bool?thursdayEnable, bool?thursdayWholeDay, DateTime?thursdayStart,
                                   DateTime?thursdayEnd, bool?fridayEnable, bool?fridayWholeDay, DateTime?fridayStart, DateTime?fridayEnd, bool?saturdayEnable,
                                   bool?saturdayWholeDay, DateTime?saturdayStart, DateTime?saturdayEnd, bool?sundayEnable, bool?sundayWholeDay, DateTime?sundayStart,
                                   DateTime?sundayEnd, bool?activeList)
        {
            if (string.IsNullOrEmpty(locationCode))
            {
                throw new ArgumentNullException("LocationCode");
            }
            if (string.IsNullOrEmpty(locationName))
            {
                throw new ArgumentNullException("LocationName");
            }

            if (m == "e" && id == null)
            {
                throw new ArgumentNullException("id");
            }

            try
            {
                var updatedBy = new BasePage().UserName;

                var service = new RMS.Centralize.WebSite.Proxy.LocationService().locationService;
                var result  = service.Update(id, m, locationCode, locationName
                                             , mondayEnable ?? false, mondayWholeDay ?? false, mondayStart, mondayEnd
                                             , tuesdayEnable ?? false, tuesdayWholeDay ?? false, tuesdayStart, tuesdayEnd
                                             , wednesdayEnable ?? false, wednesdayWholeDay ?? false, wednesdayStart, wednesdayEnd
                                             , thursdayEnable ?? false, thursdayWholeDay ?? false, thursdayStart, thursdayEnd
                                             , fridayEnable ?? false, fridayWholeDay ?? false, fridayStart, fridayEnd
                                             , saturdayEnable ?? false, saturdayWholeDay ?? false, saturdayStart, saturdayEnd
                                             , sundayEnable ?? false, sundayWholeDay ?? false, sundayStart, sundayEnd
                                             , activeList ?? false, updatedBy);

                var ret = new
                {
                    status = (result.IsSuccess) ? 1 : 0,
                    error  = (result.IsSuccess) ? "" : result.ErrorMessage
                };

                return(Json(ret));
            }
            catch (Exception ex)
            {
                var ret = new
                {
                    status = 0,
                    error  = ex.Message
                };

                new RMSWebException(this, "0500", "Update failed. " + ex.Message, ex, true);

                return(Json(ret));
            }
        }
예제 #3
0
        // GET: /Monitoring/Location/Get/
        public ActionResult Get(int?id)
        {
            if (id == null)
            {
                throw new ArgumentNullException("LocationID");
            }

            try
            {
                var service = new RMS.Centralize.WebSite.Proxy.LocationService().locationService;

                var result = service.Get(id.Value);


                var ret = new
                {
                    status       = (result.IsSuccess) ? 1 : 0,
                    LocationID   = result.Location.LocationId,
                    LocationCode = result.Location.LocationCode,
                    Locationname = result.Location.LocationName,
                    data         = JsonConvert.SerializeObject(result.Location, Formatting.Indented, new JsonSerializerSettings()
                    {
                        ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                    })
                };
                return(Json(ret));
            }
            catch (Exception ex)
            {
                var ret = new
                {
                    status = -1,
                    error  = ex.Message
                };
                new RMSWebException(this, "0500", "Get failed. " + ex.Message, ex, true);

                return(Json(ret));
            }
        }