Пример #1
0
        public JsonResponse <bool> InsertUserBeatDetailsInfo(long userID, List <UserBeatDTO> userBeatCollection, string MarketOffDays, string CoverageType)
        {
            JsonResponse <bool> response = new JsonResponse <bool>();
            string offDays      = System.Web.HttpUtility.HtmlEncode(MarketOffDays);
            string coverageType = System.Web.HttpUtility.HtmlEncode(CoverageType);

            try
            {
                if (userBeatCollection != null && userBeatCollection.Count > 0)
                {
                    userBeatCollection.ForEach(k =>
                    {
                        k.MarketOffDays = offDays;
                        CoverageType    = coverageType;
                    });
                    int status = UserBeatInstance.InsertUserBeatDetailsInfo(userID, userBeatCollection);
                    response.SingleResult = false;
                    switch (status)
                    {
                    case 1:
                        response.Message      = Messages.BeatExecuted;
                        response.SingleResult = true;
                        break;

                    case -1:
                        string employeeName = UserBusinessInstance.GetSeniorName(userBeatCollection[0].UserID);
                        if (String.IsNullOrEmpty(employeeName))
                        {
                            employeeName = "Senior";
                        }
                        response.Message = String.Format("You have already submitted your beat which is pending for approval with {0}. In case you want to re-submit your beat request ask {1} to reject existing beat.", employeeName, employeeName);
                        break;

                    case -2:
                        response.Message = "Beat already submitted and approved for month.";
                        break;

                    default:
                        response.Message = Messages.BeatNotExecuted;
                        break;
                    }
                }
                else
                {
                    response.Message = Messages.BeatNotSelected;
                }
                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
            }
            return(response);
        }
Пример #2
0
        public JsonResponse <UserBeatDTO> GetBeatDetails(int statusID, long userID)
        {
            JsonResponse <UserBeatDTO> response = new JsonResponse <UserBeatDTO>();

            try
            {
                ExceptionEngine.AppExceptionManager.Process(() =>
                {
                    response.Result    = UserBeatInstance.GetBeatDetails(statusID).ToList();
                    response.IsSuccess = true;
                }, AspectEnums.ExceptionPolicyName.ServiceExceptionPolicy.ToString());
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
            }
            return(response);
        }
Пример #3
0
        public JsonResponse <bool> IsBeatDeleted(int statusID, long userID)
        {
            JsonResponse <bool> response = new JsonResponse <bool>();

            try
            {
                ExceptionEngine.AppExceptionManager.Process(() =>
                {
                    response.Message   = UserBeatInstance.DeleteUsersBeat(statusID);
                    response.IsSuccess = true;
                }, AspectEnums.ExceptionPolicyName.ServiceExceptionPolicy.ToString());
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
            }
            return(response);
        }