Esempio n. 1
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);
            }
        }