Esempio n. 1
0
        public LocationResult ListLocation()
        {
            try
            {
                BSL.LocationService ls = new BSL.LocationService();
                var listLocation       = ls.List();

                var sr = new LocationResult
                {
                    IsSuccess     = true,
                    ListLocations = listLocation,
                };
                return(sr);
            }
            catch (Exception ex)
            {
                new RMSWebException(this, "0500", "ListLocation failed. " + ex.Message, ex, true);

                var sr = new LocationResult
                {
                    IsSuccess    = false,
                    ErrorMessage = "ListLocation errors. " + ex.Message
                };
                return(sr);
            }
        }
Esempio n. 2
0
        public LocationResult Search(JQueryDataTableParamModel param, string location, bool?activeList)
        {
            try
            {
                int totalRecord;

                BSL.LocationService ls = new BSL.LocationService();
                var listLocationInfos  = ls.Search(param, location, activeList, out totalRecord);

                var sr = new LocationResult
                {
                    IsSuccess         = true,
                    ListLocationInfos = listLocationInfos,
                    TotalRecords      = totalRecord
                };
                return(sr);
            }
            catch (Exception ex)
            {
                new RMSWebException(this, "0500", "Search failed. " + ex.Message, ex, true);

                var sr = new LocationResult
                {
                    IsSuccess    = false,
                    ErrorMessage = "Search errors. " + ex.Message
                };
                return(sr);
            }
        }
Esempio n. 3
0
        public Result Delete(int locationID, string updatedBy)
        {
            try
            {
                BSL.LocationService ls = new BSL.LocationService();
                var ret = ls.Delete(locationID, updatedBy);

                var sr = new Result
                {
                    IsSuccess = ret
                };
                return(sr);
            }
            catch (Exception ex)
            {
                new RMSWebException(this, "0500", "Delete failed. " + ex.Message, ex, true);

                var sr = new Result
                {
                    IsSuccess    = false,
                    ErrorMessage = "Delete errors. " + ex.Message
                };
                return(sr);
            }
        }
Esempio n. 4
0
        public LocationResult Get(int locationID)
        {
            try
            {
                BSL.LocationService ls = new BSL.LocationService();
                var location           = ls.Get(locationID);

                var sr = new LocationResult
                {
                    IsSuccess = true,
                    Location  = location,
                };
                return(sr);
            }
            catch (Exception ex)
            {
                new RMSWebException(this, "0500", "Get failed. " + ex.Message, ex, true);

                var sr = new LocationResult
                {
                    IsSuccess    = false,
                    ErrorMessage = "Get errors. " + ex.Message
                };
                return(sr);
            }
        }
Esempio n. 5
0
        public Result 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, string updatedBy)
        {
            try
            {
                if (!(string.IsNullOrEmpty(m) || m == "e"))
                {
                    throw new ArgumentException("m parameter (" + m + ") is incorrect format.", "m");
                }

                if (string.IsNullOrEmpty(m))
                {
                    BSL.LocationService ls = new BSL.LocationService();
                    var newLocation        = ls.Add(locationCode, locationName
                                                    , mondayEnable, mondayWholeDay, mondayStart, mondayEnd
                                                    , tuesdayEnable, tuesdayWholeDay, tuesdayStart, tuesdayEnd
                                                    , wednesdayEnable, wednesdayWholeDay, wednesdayStart, wednesdayEnd
                                                    , thursdayEnable, thursdayWholeDay, thursdayStart, thursdayEnd
                                                    , fridayEnable, fridayWholeDay, fridayStart, fridayEnd
                                                    , saturdayEnable, saturdayWholeDay, saturdayStart, saturdayEnd
                                                    , sundayEnable, sundayWholeDay, sundayStart, sundayEnd
                                                    , activeList, updatedBy);

                    var sr = new Result
                    {
                        IsSuccess = true,
                    };
                    return(sr);
                }
                else if (m == "e")
                {
                    if (id == null)
                    {
                        throw new ArgumentNullException("LocationID");
                    }

                    BSL.LocationService ls = new BSL.LocationService();
                    var editLocation       = ls.Update(id.Value, locationCode, locationName
                                                       , mondayEnable, mondayWholeDay, mondayStart, mondayEnd
                                                       , tuesdayEnable, tuesdayWholeDay, tuesdayStart, tuesdayEnd
                                                       , wednesdayEnable, wednesdayWholeDay, wednesdayStart, wednesdayEnd
                                                       , thursdayEnable, thursdayWholeDay, thursdayStart, thursdayEnd
                                                       , fridayEnable, fridayWholeDay, fridayStart, fridayEnd
                                                       , saturdayEnable, saturdayWholeDay, saturdayStart, saturdayEnd
                                                       , sundayEnable, sundayWholeDay, sundayStart, sundayEnd
                                                       , activeList, updatedBy);

                    var sr = new Result
                    {
                        IsSuccess = true,
                    };
                    return(sr);
                }
                var wrongParam = new Result
                {
                    IsSuccess    = false,
                    ErrorMessage = "Update errors. Please check m parameter (" + m + ")"
                };
                return(wrongParam);
            }
            catch (Exception ex)
            {
                new RMSWebException(this, "0500", "Update failed. " + ex.Message, ex, true);

                var sr = new Result
                {
                    IsSuccess    = false,
                    ErrorMessage = "Update errors. " + ex.Message
                };
                return(sr);
            }
        }