public DashboardMemberSegment GetDashboardMemberSegmentData(string GroupId, string OutletId, string connstr) { DashboardMemberSegment dashboardMemberSegment = new DashboardMemberSegment(); using (var context = new BOTSDBContext(connstr)) { dashboardMemberSegment = context.Database.SqlQuery <DashboardMemberSegment>("sp_BOTS_DashboardMemberSegment @pi_GroupId, @pi_Date, @pi_OutletId", new SqlParameter("@pi_GroupId", GroupId), new SqlParameter("@pi_Date", DateTime.Now.ToString("yyyy-MM-dd")), new SqlParameter("@pi_OutletId", OutletId)).FirstOrDefault <DashboardMemberSegment>(); DateTime?FromDate; if (!string.IsNullOrEmpty(OutletId)) { OutletId = OutletId + "01"; FromDate = context.TransactionMasters.Where(x => x.CounterId == OutletId).OrderBy(y => y.Datetime).Select(z => z.Datetime).FirstOrDefault(); } else { FromDate = context.TransactionMasters.OrderBy(y => y.Datetime).Select(z => z.Datetime).FirstOrDefault(); } if (FromDate.HasValue) { dashboardMemberSegment.FromDate = FromDate.Value.ToString("MM-dd-yyyy"); dashboardMemberSegment.ToDate = DateTime.Now.ToString("MM-dd-yyyy"); } } return(dashboardMemberSegment); }
public JsonResult GetMemberSegmentResult(string OutletId) { List <object> lstData = new List <object>(); List <long> dataList = new List <long>(); var userDetails = (CustomerLoginDetail)Session["UserSession"]; try { List <string> lstDates = new List <string>(); DashboardMemberSegment dataMemberSegment = new DashboardMemberSegment(); dataMemberSegment = DR.GetDashboardMemberSegmentData(userDetails.GroupId, OutletId, userDetails.connectionString); dataList.Add(dataMemberSegment.NoofMember_Total); dataList.Add(dataMemberSegment.NoofMember_Repeat); dataList.Add(dataMemberSegment.NoofMember_NeverRedeem); dataList.Add(dataMemberSegment.NoofMember_RecentlyEnrolled); dataList.Add(dataMemberSegment.NoofMember_OnlyOnce); lstDates.Add(dataMemberSegment.FromDate); lstDates.Add(dataMemberSegment.ToDate); lstData.Add(dataList); lstData.Add(lstDates); } catch (Exception ex) { newexception.AddException(ex, userDetails.GroupId); } //lstMember = RR.GetMemberList(SearchText); return(new JsonResult() { Data = lstData, JsonRequestBehavior = JsonRequestBehavior.AllowGet, MaxJsonLength = Int32.MaxValue }); }
public JsonResult GetMemberSegmentResult(string GroupId, string OutletId) { List <object> lstData = new List <object>(); List <long> dataList = new List <long>(); DashboardMemberSegment dataMemberSegment = new DashboardMemberSegment(); try { List <string> lstDates = new List <string>(); string connectionString = CR.GetCustomerConnString(GroupId); dataMemberSegment = DR.GetDashboardMemberSegmentData(GroupId, OutletId, connectionString); } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(new JsonResult() { Data = dataMemberSegment, JsonRequestBehavior = JsonRequestBehavior.AllowGet, MaxJsonLength = Int32.MaxValue }); }
public Object GetMemberSegmentResult(string GroupId, string OutletId) { if (User.Identity.IsAuthenticated) { List <object> lstData = new List <object>(); List <long> dataList = new List <long>(); DashboardMemberSegment dataMemberSegment = new DashboardMemberSegment(); try { List <string> lstDates = new List <string>(); string connectionString = CR.GetCustomerConnString(GroupId); dataMemberSegment = DR.GetDashboardMemberSegmentData(GroupId, OutletId, connectionString); } catch (Exception ex) { newexception.AddException(ex, GroupId); } return(new { Data = dataMemberSegment, MaxJsonLength = Int32.MaxValue }); } return("Invalid Token or Expired"); }