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); }