public ActionResult Cardhistory(WebLookupCard WebCard)
        {
            try
            {
                //CardHistoryModel PCardHistory = new CardHistoryModel();

                List <WebHistory> TCardHistory       = new List <WebHistory>();
                IHistoryDAO       tHistoryRepository = new HistoryDAO();

                List <CardHistory> cHistory = tHistoryRepository.GetCardHistory(WebCard.CardNumber);
                foreach (CardHistory ch in cHistory)
                {
                    WebHistory HI = new WebHistory();
                    HI.ID            = ch.ID.ToString();
                    HI.When          = ch.When.ToShortDateString();
                    HI.MerchantName  = ch.MerchWhere;
                    HI.TransType     = ch.Transaction;
                    HI.Amount        = ch.Amount.ToString();
                    HI.PointsGranted = ch.PointsGranted.ToString();
                    HI.Reward        = ch.RewardGranted;
                    HI.Text          = ch.Text;
                    TCardHistory.Add(HI);
                }
                TempData["ToDisplay"] = TCardHistory;
                return(RedirectToAction("LookUpHistory"));
            }
            catch (Exception Ex)
            {
                ModelState.AddModelError("", Common.StandardExceptionErrorMessage(Ex));
            }
            return(View());
        }
Exemple #2
0
        public WebHistory GetWEBHistory(string CPno)
        {
            try
            {
                SqlParameter[] sqlparam;
                sqlparam    = new SqlParameter[2];
                sqlparam[0] = new SqlParameter("@Flag", "1");
                sqlparam[1] = new SqlParameter("@CpNo", CPno);
                DataTable         ds  = CommonFunction.GetDataTable("USP_GET_HistoryForWeb", sqlparam, "");
                List <WebHistory> lst = new List <WebHistory>();
                WebHistory        wh  = new WebHistory();


                if (ds != null && ds.Rows.Count > 0)
                {
                    DataTable dt = ds;
                    foreach (DataRow dr in dt.Rows)
                    {
                        WebHistory Model = new WebHistory();
                        CommonFunction.ReflectSingleData(Model, dr);
                        lst.Add(Model);
                    }
                }

                wh.hlst = lst;
                return(wh);
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
        public ActionResult ShowHistory(int page = 0)
        {
            MerchantHistoryModel ToShow = new MerchantHistoryModel();

            ToShow.MHistory = new List <WebHistory>();
            String ID = GetFromIDCookie();

            if (ID == null)
            {
                return(RedirectToAction("SelectMerchantForEdit"));
            }
            if (ID.Length < 1)
            {
                return(RedirectToAction("SelectMerchantForEdit"));
            }
            int mID    = Convert.ToInt32(ID);
            int hcount = 0;

            ToShow.PageIndex = page;
            try
            {
                IHistoryDAO tHistoryDAO = new HistoryDAO();

                List <CardHistory> cHistory = tHistoryDAO.GetMerchantHistory(mID, page, 15);
                foreach (CardHistory ch in cHistory)
                {
                    WebHistory HI = new WebHistory();
                    HI.ID         = ch.ID.ToString();
                    HI.When       = ch.When.ToShortDateString();
                    HI.CardNumber = ch.CardNumber;
                    HI.TransType  = ch.Transaction;
                    HI.Amount     = ch.Amount.ToString();
                    if (ch.PointsGranted != null)
                    {
                        HI.PointsGranted = ch.PointsGranted.ToString();
                    }
                    ToShow.MHistory.Add(HI);
                    hcount++;
                }
            }
            catch (Exception Ex)
            {
                ModelState.AddModelError("", Common.StandardExceptionErrorMessage(Ex));
            }
            ToShow.HasPreviousPage = (page > 0);
            ToShow.HasNextPage     = (hcount == 15);
            return(View(ToShow));
        }