public void SendEmailNotification(string sNumber, string id, string dpAmount, string status, string bsDate) { DepositModel depositModel = new DepositModel(); int depositId = ValidationUtility.ToInteger(id); double depositAmount = ValidationUtility.ToDouble(dpAmount); int storeNumber = ValidationUtility.ToInteger(sNumber); DateTime businessDate = ValidationUtility.ToDate(bsDate); depositModel.SendEmail(storeNumber, depositId, depositAmount, status, businessDate); }
public JsonResult GetDepositList(string selectedDate) { ArrayList collection = new ArrayList(); DepositModel depositModel = new DepositModel(); DateTime formatedDate; if (!ValidationUtility.IsNull(selectedDate)) { formatedDate = ValidationUtility.ToDate(selectedDate); } else { formatedDate = DateTime.Now; } ArrayList storeList = null; UserContext cont = (UserContext)Session["UserContext"]; if (!ValidationUtility.IsNull(cont) && ValidationUtility.IsEqual(cont.Role, "Corporate")) { storeList = ValidationUtility.GetCorporateUserAssignActiveStore(cont.Id, true); } else { // storeList = ValidationUtility.GetStoreList(true); storeList = ValidationUtility.GetActiveStoreList(true); } collection.Add(depositModel.GetWeeklyDepositAmount(formatedDate, storeList)); collection.Add(depositModel.GetDepositWeekInfo(formatedDate)); return Json(collection, JsonRequestBehavior.AllowGet); }
public JsonResult UpdateDepositStatus(string id, string status) { string error = ""; string msg = ""; try { DepositModel depositModel = new DepositModel(); int Id = ValidationUtility.ToInteger(id); depositModel.UpdaqteDepositModel(Id, status); error = "Success"; msg = "Status Changed Successfully"; } catch (Exception ex) { error = "Error"; msg = "Status is not Changed "; log.Error("Exception in UpdateDepositStatus ",ex); } ResponseDTO resDTO = new ResponseDTO { Error = error, Message = msg }; return Json(resDTO, JsonRequestBehavior.AllowGet); }
//This method is use for update depoisit amount of last business date public void UpdateDeposit() { log.Info(" UpdateDeposit Method is Called now for Deposit "+DateTime.Now); DepositModel dmodel = new DepositModel(); // ArrayList storeList = dmodel.GetStoreList(); ArrayList storeList = ValidationUtility.GetActiveStoreList(true); foreach (StoreDTO storeDTO in storeList) { DateTime lastDayDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(-1); DepositDTO depositDTO1 = GetBankDepositListFromLocalDB(lastDayDate, storeDTO); if (!ValidationUtility.IsNull(depositDTO1)) { DataTable dt = GetEachStoreDepositAmount(storeDTO.ConnectionString, lastDayDate); if (!ValidationUtility.IsNull(dt)) { DateTime businessDate = new DateTime(); for (int i = 0; i < dt.Rows.Count; i++) { double depositAmount = 0; businessDate = ValidationUtility.ToDate(dt.Rows[i]["BusinessDate"].ToString()); if (businessDate.Date.Equals(lastDayDate.Date)) { depositAmount = ValidationUtility.ToDouble(dt.Rows[i]["DepositInBank"].ToString()); DepositAmount dammount = new DepositAmount { DepositBankAmount = depositAmount, BusinessDate = businessDate, WeekOfDay = businessDate.DayOfWeek.ToString() }; Update(dammount, storeDTO.Id); } } } } // Add Week deposit ammount else { DataTable dt = GetEachStoreDepositAmount(storeDTO.ConnectionString, lastDayDate); ArrayList ammountList = new ArrayList(); if (!ValidationUtility.IsNull(dt)) { List<DepositAmount> depositAmmountList = new List<DepositAmount>(); DateTime businessDate = new DateTime(); for (int i = 0; i < dt.Rows.Count; i++) { double depositAmount = 0; businessDate = ValidationUtility.ToDate(dt.Rows[i]["BusinessDate"].ToString()); if (businessDate.Date <= ValidationUtility.GetActualWeekStartDate(lastDayDate).AddDays(7).Date) { depositAmount = ValidationUtility.ToDouble(dt.Rows[i]["DepositInBank"].ToString()); DepositAmount dammount = new DepositAmount { DepositBankAmount = depositAmount, BusinessDate = businessDate }; depositAmmountList.Add(dammount); } } DepositDTO depositDTO = new DepositDTO { StoreId = storeDTO.Id, DepositAmount = depositAmmountList }; dmodel.InsertDepositAmount(depositDTO); } } } log.Info(" UpdateDeposit Method Call is finish " + DateTime.Now); }
// Get Bank Deposit Amount from local data base of week wise public DepositDTO GetBankDepositListFromLocalDB(DateTime selectDate, StoreDTO storeDTO) { // ArrayList allDepositList = new ArrayList(); ArrayList weekday = new ArrayList(); DateTime weekStartDate = ValidationUtility.GetActualWeekStartDate(selectDate); DateTime weekEndDate = weekStartDate.AddDays(6); DataBaseUtility db = new DataBaseUtility(); DepositModel dmodel = new DepositModel(); // ArrayList StoreList = dmodel.GetStoreList(); ArrayList StoreList = ValidationUtility.GetActiveStoreList(true); List<DepositAmount> depositAmmountList = GetDepositAmountLocalDB(weekStartDate, weekEndDate, storeDTO.Id); DepositDTO dto = null; if (depositAmmountList != null && depositAmmountList.Count > 0) { dto = new DepositDTO { DepositAmount = depositAmmountList, StoreId = storeDTO.StoreNumber }; //allDepositList.Add(dto); } return dto; }