public JsonResult GetManagerBonusList(string selectDate) { ManagerBonusModel managerBonusModel = new ManagerBonusModel(); ArrayList list = new ArrayList(); DateTime formatedDate; if (!ValidationUtility.IsNull(selectDate)) { formatedDate = ValidationUtility.ToDate(selectDate); } else { formatedDate = DateTime.Now; } UserContext cont = (UserContext)Session["UserContext"]; if (!ValidationUtility.IsNull(cont)) { int sId = managerBonusModel.GetStoredId(cont.Id); ArrayList storeList = ValidationUtility.GetStoreList(true); ArrayList goalStoreList = new ArrayList(); foreach (StoreDTO storDTO in storeList) { if (storDTO.Id == sId) { goalStoreList.Add(storDTO); break; } } ManagerBonusDTO managerBonusDTO = managerBonusModel.CalculateManagerBonus(formatedDate, goalStoreList); ManagerBonusDTO returnManagerBonusDTO = managerBonusModel.GetActualBounus(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); if (ValidationUtility.IsNull(returnManagerBonusDTO)) { // Add managerBonusModel.AddBounus(managerBonusDTO, false); } else { // update managerBonusModel.UpdateActualValue(managerBonusDTO); } ManagerBonusDTO actualBonusDTO = managerBonusModel.GetActualBounus(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); list.Add(actualBonusDTO); ManagerBonusDTO zeroBasisDTO = managerBonusModel.GetZeroBasisList(managerBonusDTO.StoreId, managerBonusDTO.FirstDateOFMonth, managerBonusDTO.LastDateOFMonth); list.Add(zeroBasisDTO); // list = managerBonusModel.GetManagerBonus(sId, endDateOfMonth); } return Json(list, JsonRequestBehavior.AllowGet); }