Ejemplo n.º 1
0
        protected void EditPayment(int id)
        {
            PaymentObject payment = payDal.GetPaymentById(id);

            TextBox_payment.Text = payment.payment;
            TextBox_Service.Text = payment.service;
            TextBox_price.Text   = payment.price.ToString("#.##");
        }
Ejemplo n.º 2
0
        protected void UpdatePayment(int id)
        {
            PaymentObject payment = new PaymentObject();

            payment.payment = TextBox_payment.Text;
            payment.service = TextBox_Service.Text;
            payment.price   = decimal.Parse(TextBox_price.Text);

            payDal.UppdatePayment(payment, id);
            Response.Redirect("~/Admin/List_Payment.aspx");
        }
Ejemplo n.º 3
0
        protected void AddNewPayment()
        {
            PaymentObject payment = new PaymentObject();

            payment.payment = TextBox_payment.Text;
            payment.service = TextBox_Service.Text;
            payment.price   = decimal.Parse(TextBox_price.Text);

            payDal.AddPayment(payment);
            Response.Redirect("~/Admin/List_Payment.aspx");
        }
Ejemplo n.º 4
0
        public void SerialializeTest()
        {
            //var order = UnifiedOrder.CreateJsapi();
            //order.FeeType = FeeType.CNY;
            //var xml = order.ToXml();
            //Console.WriteLine(1);
            var d = PaymentObject.DoSign(
                "appid=wxd8b64943ac261c4c&attach=RC201606161652410000000022&body=会员卡0000000000000001充值0.01元&detail=会员卡0000000000000001充值0.01&device_info=WEB&fee_type=CNY&mch_id=1327313401&nonce_str=00027497064e495eb91c92d8afa517e3&notify_url=http://weixintest.ecard.chihank.com/000000002/Payment/Payment/Notify&openid=oS7mJwK6jQZoBs2ZAPN3NSFmvxLg&out_trade_no=RC201606161652410000000022&spbill_create_ip=59.40.231.46&time_expire=20160617165305&time_start=20160616165241&total_fee=1&trade_type=JSAPI&key=1234881IKyudkeoi484fjklj98rt3489jt4i");

            Assert.AreEqual("5EE82CFAB5397E9D9543BEABE95CA0FD", d);
        }
Ejemplo n.º 5
0
        public ActionResult Index()
        {
            List <TipsData> tipsData = DataLogic.GetDataForPresentation();

            List <TipsData> tipsDataWithPaymentFalse =
                (from hits in tipsData
                 where hits.HasPayed == false
                 select hits).ToList();

            string latestUpdate = BusinessLogic.GetRandomValue("PayedLatestUpdate");
            string sendSms      = BusinessLogic.GetRandomValue("SendSms");

            PaymentObject paymentObject = new PaymentObject(tipsDataWithPaymentFalse, latestUpdate, sendSms);

            //return View(tipsDataWithPaymentFalse.ToList());
            return(View(paymentObject));
        }
Ejemplo n.º 6
0
        public ActionResult Index(PaymentObject model)
        {
            List <int> newPayments = new List <int>();

            BusinessLogic.UpdateRandomValue("PayedLatestUpdate", model.LatestDate);
            BusinessLogic.UpdateRandomValue("SendSms", model.SendSms);

            foreach (TipsData data in model.Tipsdata)
            {
                if ((bool)data.HasPayed)
                {
                    newPayments.Add(data.Id);
                }
            }

            DataLogic.SaveUpdatedPaymentStatus(newPayments);

            return(Index());
        }
Ejemplo n.º 7
0
        public IEnumerable <PaymentObject> GetPayments()
        {
            var payments = new List <PaymentObject>();

            using (var fs = new FileStream("./Data/payments.pdat", FileMode.OpenOrCreate))
            {
                if (fs.Length > 0)
                {
                    var br    = new BinaryReader(fs);
                    var count = br.ReadInt32();
                    for (var i = 0; i < count; i++)
                    {
                        var payment = new PaymentObject();
                        payment.time  = br.ReadInt64();
                        payment.value = br.ReadDouble();
                        payments.Add(payment);
                    }
                }
            }

            return(payments.ToArray());
        }
        // GET: /<controller>/
        public IActionResult Payment()
        {
            List <PaymentObject> payments = new List <PaymentObject>();
            PaymentObject        payment  = new PaymentObject();

            payment.Name       = "Contant";
            payment.Identifier = "contant";
            payments.Add(payment);

            payment            = new PaymentObject();
            payment.Name       = "PayPal";
            payment.Identifier = "paypal";
            payments.Add(payment);

            payment            = new PaymentObject();
            payment.Name       = "Credit Card";
            payment.Identifier = "creditcard";
            payments.Add(payment);

            ViewData["payments"] = payments;
            return(View());
        }
        public async Task <IActionResult> Payment(PaymentViewModel model)
        {
            List <PaymentObject> payments = new List <PaymentObject>();
            PaymentObject        payment  = new PaymentObject();

            payment.Name       = "Contant";
            payment.Identifier = "contant";
            payments.Add(payment);

            payment            = new PaymentObject();
            payment.Name       = "PayPal";
            payment.Identifier = "paypal";
            payments.Add(payment);

            payment            = new PaymentObject();
            payment.Name       = "Credit Card";
            payment.Identifier = "creditcard";
            payments.Add(payment);

            ViewData["payments"] = payments;
            HttpContext.Session.SetString("payment_provider", model.provider);

            if (model.provider == "contant")
            {
                HttpContext.Response.Redirect("/reserve/success");
            }
            else if (model.provider == "paypal")
            {
                HttpContext.Response.Redirect("/reserve/paypal");
            }
            else if (model.provider == "creditcard")
            {
                HttpContext.Response.Redirect("/reserve/creditcard");
            }

            return(View("~/Views/Shared/_Redirect.cshtml"));
        }
Ejemplo n.º 10
0
        public void BuildCart()
        {
            Product pruDal = new Product();

            tableFill.InnerHtml = @"<h4>Kundkorgen är tom</h4>";

            HiddenField hdnID = (HiddenField)Page.Master.FindControl("Cart");
            OrderObject cart  = (OrderObject)Session["Cart"];

            Button_checkout.Visible = false;
            Button1.Visible         = false;

            if (!string.IsNullOrWhiteSpace(hdnID.Value))
            {
                cart = JsonConvert.DeserializeObject <OrderObject>(hdnID.Value);

                Session["Cart"] = cart;
            }


            List <ProductObject> deletes = new List <ProductObject>();

            cart.priceGroup = pricegroup;

            if (cart.products.Count > 0)
            {
                Button_checkout.Visible = true;
                Button1.Visible         = true;
                Button_upd.Visible      = false;
                StringBuilder str = new StringBuilder();
                str.Append("<table class=\"table table-striped\">");
                str.Append(@"<tr>
                              <th>Art.nr</th>
                                <th>Artikel</th>
                                <th>Attribut</th>
                                <th>Pris</th>
                                <th>Antal</th>
                                <th>Summa</th>
                                <th></th>
                                </tr>");



                foreach (ProductObject product in cart.products)
                {
                    if (product.quantity > 0)
                    {
                        decimal price = product.priceB2C;
                        if (pricegroup != 1)
                        {
                            price = product.priceB2B;
                        }

                        string atr = string.Empty;

                        Dictionary <string, string> atribbut = pruDal.GetAttribute(product);

                        if (atribbut != null)
                        {
                            foreach (KeyValuePair <string, string> val in atribbut)
                            {
                                atr += val.Value + ", ";
                            }
                        }

                        str.Append($@"<tr>
                              <td>{product.artNr}</td>
                                <td>{product.name}</td>
                                <td>{atr}</td>
                                <td>{price.ToString("#.##")}kr</td>
                                <td><input id='{product.ID}' class='quantity btn-p' style='width: 70px;' type='number' value='{product.quantity}' min='0'/></td>
                                <td>{(product.quantity * price).ToString("#.##")}kr</td>
                                <td><button id='{product.ID}' class='delete btn-p'><span class='glyphicon glyphicon-remove' aria-hidden='true'></span></button></td>
                                </tr>");
                    }
                    else
                    {
                        deletes.Add(product);
                    }
                }
                str.Append("</table>");
                tableFill.InnerHtml = str.ToString();
            }

            foreach (ProductObject delete in deletes)
            {
                cart.products.Remove(delete);
            }

            if (cart.paymentID > 0)
            {
                Payment       pay       = new Payment();
                PaymentObject payObject = pay.GetPaymentById(cart.paymentID);
                cart.paymentPrice = payObject.price;
            }

            if (cart.carrierID > 0)
            {
                Carrier       car           = new Carrier();
                CarrierObject carrierObject = car.GetCarrierById(cart.carrierID);
                cart.carrierPrice = carrierObject.price;
            }


            cart.priceGroup = pricegroup;
            cart.sum        = cart.CalculatePrice();

            Session["Cart"] = cart;
        }
Ejemplo n.º 11
0
        public void DoSignTest()
        {
            var data = "appid=wxd930ea5d5a258f4f&body=test&device_info=1000&mch_id=10000100&nonce_str=ibuaiVcKdpRxkhJA";

            Assert.AreEqual("9A0A8659F005D6984697E2CA0A9CF3B7", PaymentObject.DoSign(data));
        }
Ejemplo n.º 12
0
        public void Insert(int PaymentObjectType,int ObjectAccountKey,DateTime DateCreated)
        {
            PaymentObject item = new PaymentObject();

            item.PaymentObjectType = PaymentObjectType;

            item.ObjectAccountKey = ObjectAccountKey;

            item.DateCreated = DateCreated;

            item.Save(UserName);
        }
Ejemplo n.º 13
0
        public void Update(long PaymentObjectKey,int PaymentObjectType,int ObjectAccountKey,DateTime DateCreated)
        {
            PaymentObject item = new PaymentObject();
            item.MarkOld();
            item.IsLoaded = true;

            item.PaymentObjectKey = PaymentObjectKey;

            item.PaymentObjectType = PaymentObjectType;

            item.ObjectAccountKey = ObjectAccountKey;

            item.DateCreated = DateCreated;

            item.Save(UserName);
        }