Esempio n. 1
0
        public ActionResult PostTest1(ApplyInvoiceModel invoice,int sid=0)
        {
            var model = new UpdateMergeModel()
            {
                BusinessID = 100001,
                PTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                Sid = sid,
                MergeMode = 1
            };
            model.Pkey = Utility.GetMD5(32, "wdOQNd80fwylicuG" + model.BusinessID + model.Sid + model.PTime); // "sssssss";
            model.MergeOrderList = new List<MergeOrderInvoice>(){
                new MergeOrderInvoice()
                {
                    BankId = invoice.BankId,
                    FullName = "ceshi",
                    IdCard = "123455432112345543",
                    InvoicePrice = invoice.InvoicePrice,
                    IsFetch = 1,
                    MemberID = "999222",
                    BookPrice = invoice.BookPrice
                }
            };
            var output = JsonConvert.SerializeObject(model);
            var request = WebRequest.Create("http://www.invoice.com/invoiceapi/UpdateMerge/");
            request.Method = "POST";
            var bty = Encoding.UTF8.GetBytes(output);
            request.ContentType = "text/json";
            request.ContentLength = bty.Length;
            var stream = request.GetRequestStream();
            stream.Write(bty, 0, bty.Length);
            stream.Close();

            var responseReader = new StreamReader(request.GetResponse().GetResponseStream());
            var returnValue = responseReader.ReadToEnd();
            ViewBag.model = invoice;
            ViewBag.msg = returnValue;
            return View("PostTest1");
        }
Esempio n. 2
0
        public ActionResult PostTest(ApplyInvoiceModel invoice, string bankid1 = "", int invoicePrice1 = 0, int bookPrice1=0)
        {
            var model = new ApplyInvoiceModel
            {
                BusinessID = 100001,
                //InvoiceKey1 = "yhhk2014083130014826",
                //InvoiceKey2 = "",
                InvoicePrice = invoice.InvoicePrice,
                //Remark = "",
                //InvoiceTitle = "北京东大正保",
                InvoiceTypeID = invoice.InvoiceTypeID,
                //Phone = "15889299944",
                PTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                //PostPrice = 100,
                BankId = invoice.BankId,
                //BookPrice = invoice.BookPrice,
                //IsFetch = 1,

            };
            if (model.InvoiceTypeID == 100006)
            {
                //model.UnitBankAccount = "32141234124342342";
                //model.UnitBankName = "中国银行";
                //model.UnitRegAddress = "学院国际";
                //model.UnitRegPhone = "15211111111";
                //model.UnitTaxpayerNumber = "32322";
            }
            model.Pkey = Utility.GetMD5(32, "wdOQNd80fwylicuG" + model.BusinessID + model.InvoicePrice + model.Phone + model.PTime); // "sssssss";
            //model.PostAddress = "北京东大正保";
            model.PostTypeID = 3;
            model.ReceiveMan = "李娜";
            model.Zip = "100000";
            model.ExpressTypeID = 3;
            model.AddressType = 1;
            model.UnitName = "正保技科";
            //model.MergeMode = invoice.MergeMode;
            //model.MergeOrderList = new List<MergeOrderInvoice>();
            //model.MergeOrderList = new List<MergeOrderInvoice>(){
            //    new MergeOrderInvoice()
            //    {
            //        BankId =bankid1,
            //        FullName = "ceshi",
            //        InvoicePrice = invoicePrice1,
            //        IsFetch = 1,
            //        MemberID = "999222",
            //        BookPrice = bookPrice1
            //    }
            //};
            var output = JsonConvert.SerializeObject(model);
            var request = WebRequest.Create("http://www.invoice.com/invoiceapi/apply/");
            request.Method = "POST";
            var bty = Encoding.UTF8.GetBytes(output);
            request.ContentType = "text/json";
            request.ContentLength = bty.Length;
            var stream = request.GetRequestStream();
            stream.Write(bty, 0, bty.Length);
            stream.Close();

            var responseReader = new StreamReader(request.GetResponse().GetResponseStream());
            var returnValue = responseReader.ReadToEnd();
            ViewBag.msg = returnValue;
            return View("PostTest1");
        }