public ActionResult Display(string receiptId, string status, string receiptNumber)
        {
            string permissions = "";
            int    stat        = 0;

            if (HasPermission("[receipt]", ref permissions, ref stat))
            {
                return(RedirectToAction("AccessDeny"));
            }
            ViewBag.permissions = permissions;
            ViewBag.stat        = stat;
            ViewBag.Title       = "اطلاعات فیش پرداختی";
            BankReceipt tk = new BankReceipt();

            try
            {
                tk.Id            = long.Parse(receiptId);
                tk               = tk.GetOne();
                tk.ReceiptNumber = receiptNumber;
                tk.Statuse       = int.Parse(status);
                tk.Update();
                if (tk.Statuse == 2)
                {
                    Order ord = new Order();
                    ord.Id = tk.OrderId;
                    ord    = ord.GetOne();
                    CustomerToken token = new CustomerToken();
                    token.Count            = ord.Count;
                    token.CustomerId       = tk.CustomerId;
                    token.OrderId          = tk.OrderId;
                    token.RialPrice        = ord.Rial;
                    token.DollarPrice      = ord.Dollar;
                    token.UroPrice         = ord.Uro;
                    token.PondPrice        = ord.Pond;
                    token.Action           = 1;
                    token.ActionBy         = 1;
                    token.ActionCustomerId = 0;
                    token.Date             = DateTime.Now;
                    token.Add();
                }
                return(RedirectToAction("", "Receipt"));
            }
            catch (Exception ex)
            {
                ErrorLog log = new ErrorLog();
                log.Description = ex.Message;
                if (ex.InnerException != null)
                {
                    log.Description += ";" + ex.Message;
                }
                log.ErrorDate = DateTime.Now;
                log.Add();
            }
            return(View(tk));
        }
Example #2
0
        public ActionResult View(long Id, string status)
        {
            string permissions = "";
            int    stat        = 0;

            if (HasPermission("[payrequest]", ref permissions, ref stat))
            {
                return(RedirectToAction("AccessDeny"));
            }
            ViewBag.permissions = permissions;
            ViewBag.stat        = stat;

            ViewBag.Title = "درخواست های واریز";
            PayRequest tk = new PayRequest();

            try
            {
                tk.Id     = Id;
                tk        = tk.GetOne();
                tk.Status = int.Parse(status);
                if (status == "2")
                {
                    tk.PayDate = DateTime.Now;
                }
                tk.Update();

                CustomerToken token = new CustomerToken();
                token.Count            = tk.Count;
                token.CustomerId       = tk.CustomerId;
                token.PayRequestId     = tk.Id;
                token.RialPrice        = tk.Rial;
                token.DollarPrice      = tk.Dollar;
                token.UroPrice         = tk.Uro;
                token.PondPrice        = tk.Pond;
                token.Action           = 2;
                token.ActionBy         = 4;
                token.ActionCustomerId = 0;
                token.Date             = DateTime.Now;
                token.Add();
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ErrorLog log = new ErrorLog();
                log.Description = ex.Message;
                if (ex.InnerException != null)
                {
                    log.Description += ";" + ex.Message;
                }
                log.ErrorDate = DateTime.Now;
                log.Add();
            }
            return(View(tk));
        }
Example #3
0
        public ActionResult Transfer(string count, string reciver_code, string code, string state)
        {
            ViewBag.Title = "انتقال توکن";
            try
            {
                ViewBag.state = int.Parse(state);
                if (state == "2")
                {
                    reciver_code = code;
                }
                ViewBag.code = reciver_code;
                bool     valid = true;
                Customer rc    = new Customer();
                Dictionary <string, string> paramter = new Dictionary <string, string>();
                paramter.Add("UserCode", reciver_code);
                List <Customer> lst = rc.GetAll(paramter);
                if (lst.Count != 1)
                {
                    ViewBag.DangerMessage = "شخصی با شناسه مورد نظر شما یافت نشد";
                    valid = false;
                }
                else
                {
                    ViewBag.transfer_user_name = lst[0].FirstName + " " + lst[0].LastName;
                    ViewBag.state = 2;
                }
                rc = lst[0];

                Customer customer = new Customer();
                customer.Id = long.Parse(Session["customer_id"].ToString());
                customer    = customer.GetOne();

                if (long.Parse(count) > customer.TokenCount)
                {
                    ViewBag.DangerMessage = "موجودی فعلی حساب شما " + customer.TokenCount + " واحد می باشد";
                    valid = false;
                }
                if (state == "1")
                {
                    valid = false;
                }
                if (valid)
                {
                    Setting set = new Setting();
                    set.Id = 1;
                    set    = set.GetOne();

                    CustomerToken token = new CustomerToken();
                    token.Count            = long.Parse(count);
                    token.CustomerId       = rc.Id;
                    token.OrderId          = 0;
                    token.RialPrice        = set.Rial;
                    token.DollarPrice      = set.Dollar;
                    token.UroPrice         = set.Uro;
                    token.PondPrice        = set.Pond;
                    token.Action           = 1;
                    token.ActionBy         = 3;
                    token.ActionCustomerId = customer.Id;
                    token.Date             = DateTime.Now;
                    token.Add();

                    token                  = new CustomerToken();
                    token.Count            = long.Parse(count);
                    token.CustomerId       = customer.Id;
                    token.OrderId          = 0;
                    token.RialPrice        = set.Rial;
                    token.DollarPrice      = set.Dollar;
                    token.UroPrice         = set.Uro;
                    token.PondPrice        = set.Pond;
                    token.Action           = 2;
                    token.ActionBy         = 2;
                    token.ActionCustomerId = rc.Id;
                    token.Date             = DateTime.Now;
                    token.Add();

                    return(RedirectToAction("TransferDone", "token"));
                }
            }
            catch (Exception ex)
            {
                ErrorLog log = new ErrorLog();
                log.Description = ex.Message;
                if (ex.InnerException != null)
                {
                    log.Description += ";" + ex.Message;
                }
                log.ErrorDate  = DateTime.Now;
                log.CustomerId = long.Parse(Session["customer_id"].ToString());
                log.Add();
            }
            return(View());
        }