コード例 #1
0
        public ActionResult List(int pageNum = 0)
        {
            if (Request.IsAuthenticated)
            {
                CUser  clUser = new CUser(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath());
                STUser stUser;
                string msg;
                clUser.GetRecordByUserId(LocalData.UserId(), out stUser, out msg);
                if (!stUser.oldpass)
                {
                    STTransactVP param;
                    if (Session["TRANSACTPARAM"] != null)
                    {
                        param = (STTransactVP)Session["TRANSACTPARAM"];
                    }
                    else
                    {
                        param = new STTransactVP();
                    }

                    if (!SharedModel.IsConnect(LocalData.CSDbTransacts1(), out msg) &&
                        !SharedModel.IsConnect(LocalData.CSDbTransacts2(), out msg))
                    {
                        ViewData["ERROR"] = "No connection to DB";
                        ViewData["MSG"]   = msg;

                        //return RedirectToAction("Index", "Error");
                        return(View("Index"));
                    }
                    else
                    {
                        string[] arr = new[] { "'", "\"", "--" };
                        if (CheckerField.CheckField(arr, param.maskedpan, param.maskedpos))
                        {
                            ViewData["MSG"] = "One or more fields contain invalid characters.";
                            return(View("Errors"));
                        }
                        else
                        {
                            List <TransactModels> lst = TransactModelsRepository.Instance.GetListTransact(param);
                            ViewData["PageNum"]    = pageNum;
                            ViewData["ItemsCount"] = lst.Count;
                            ViewData["PageSize"]   = pageSize;
                            ViewData["STRPARAM"]   = param.strdata;

                            return(View(TransactModelsRepository.Instance.GetListTransact(pageSize, pageNum, param)));
                        }
                    }
                }
                else
                {
                    return(RedirectToAction("ChangePassword", "Account"));
                }
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
コード例 #2
0
        public List <TransactModels> GetListTransact(STTransactVP param)
        {
            List <TransactModels> ret = new List <TransactModels>();
            TransactModels        item;

            List <STTransact> data = new List <STTransact>();
            string            msg;

            CTransact clTransact = new CTransact(LocalData.UserId(), LocalData.CSDbTransacts1(), LocalData.CSDbTransacts2(),
                                                 LocalData.LogPath());

            try
            {
                int retvalue = clTransact.GetData(param, out data, out msg);

                foreach (STTransact row in data)
                {
                    item = new TransactModels();

                    item.Amount    = row.amount;
                    item.Country   = row.country;
                    item.Currency  = row.currency;
                    item.LocalTime = row.ltime.ToString("yyyy-MM-dd HH:mm:ss");
                    item.Pan       = row.pan;
                    item.Pos       = row.pos;
                    item.Product   = row.product;
                    item.Quantity  = row.quantity;

                    ret.Add(item);
                }
            }
            catch (Exception ex) { msg = ex.Message; }
            return(ret);
        }