コード例 #1
0
        public JsonResult GetMaspFromMahd(string MaHD)
        {
            HopdongNCCModel model = new HopdongNCCModel();
            string          masp  = model.GetMaSP(MaHD);

            return(Json(masp, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult GetMaspFromMahd(int maHd)
        {
            var model = new HopdongNCCModel();
            var masp  = model.GetMaSP(maHd);

            return(Json(masp, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        // GET: AdminB2B
        public ActionResult Taohopdong()
        {
            HopdongNCCModel Ncc = new HopdongNCCModel();

            ViewBag.TenNCC = new SelectList(Ncc.getDsNhaCC(), "MaNCC", "TenNCC");
            ViewBag.MaSP   = new SelectList(Ncc.getDsSanPham(), "ID", "TenSP");
            return(View());
        }
コード例 #4
0
        // GET: AdminB2B
        public ActionResult Taohopdong()
        {
            var Ncc = new HopdongNCCModel();

            ViewBag.TenNCC = new SelectList(Ncc.getDsNhaCC(), "NhaCungCapId", "TenNcc");
            ViewBag.MaSP   = new SelectList(Ncc.getDsSanPham(), "Id", "TenSP");
            return(View());
        }
コード例 #5
0
        public JsonResult Xacnhanthanhtoan(string MaHD)
        {
            HopdongNCCModel modelNCC = new HopdongNCCModel();

            if (modelNCC.SetTTThanhtoan(MaHD, true))
            {
                return(Json("success", JsonRequestBehavior.AllowGet));
            }

            return(Json("faill", JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
        public JsonResult Xacnhanthanhtoan(int maHd)
        {
            var modelNCC = new HopdongNCCModel();

            if (modelNCC.SetTTThanhtoan(maHd, true))
            {
                return(Json("success", JsonRequestBehavior.AllowGet));
            }

            return(Json("faill", JsonRequestBehavior.AllowGet));
        }
コード例 #7
0
        // Xác nhận giao hàng
        public ActionResult XemXacNhanGiaoHang(string doiTacID)
        {
            ManagerObiect.DoitacID  = doiTacID;
            ManagerObiect.configAPI = new ConfigAPIModel().getConfig(doiTacID);
            if (ManagerObiect.configAPI == null)
            {
                return(RedirectToAction("ConfigAPI", new { MaNCC = doiTacID }));
            }
            HopdongNCCModel model = new HopdongNCCModel();

            ViewBag.doitac = doiTacID;
            ViewBag.HD     = new SelectList(model.getMaHD(doiTacID), "Mahd", "Mahd");
            return(View());
        }
コード例 #8
0
        public ActionResult Taohopdong(HopDongNCC a)
        {
            HopdongNCCModel Ncc = new HopdongNCCModel();

            if (ModelState.IsValid)
            {
                string MaHD;
                if ((MaHD = Ncc.ThemmoiHopDongNCC(a)) != "")
                {
                    ConfigAPI a1 = new ConfigAPI();
                    a1.MaNCC = a.MaNCC;
                    return(View("ConfigAPI", a1));
                }
            }

            ViewBag.TenNCC = new SelectList(Ncc.getDsNhaCC(), "MaNCC", "TenNCC");
            ViewBag.MaSP   = new SelectList(Ncc.getDsSanPham(), "ID", "TenSP");
            return(View(a));
        }
コード例 #9
0
        public ActionResult Taohopdong(HopDongNcc hopDong)
        {
            var Ncc = new HopdongNCCModel();

            if (ModelState.IsValid)
            {
                string MaHD;
                if (Ncc.ThemmoiHopDongNCC(hopDong) != 0)
                {
                    var a1 = new ConfigAPI();
                    a1.NhaCungCapId = hopDong.NccId;
                    return(View("ConfigAPI", a1));
                }
            }

            ViewBag.TenNCC = new SelectList(Ncc.getDsNhaCC(), "NhaCungCapId", "TenNcc");
            ViewBag.MaSP   = new SelectList(Ncc.getDsSanPham(), "Id", "TenSP");
            return(View(hopDong));
        }
コード例 #10
0
        public ActionResult XemXacNhanGiaoHang(Hopdong a, string access_token, string username, string password, string doitac)
        {
            NhaCungCapModel modelNCC = new NhaCungCapModel();
            HopdongNCCModel modelhd  = new HopdongNCCModel();

            ViewBag.doitac = doitac;
            ViewBag.HD     = new SelectList(modelhd.getMaHD(doitac), "Mahd", "Mahd");
            if (!modelNCC.Checkthanhtoan(a.order_id))
            {
                ModelState.AddModelError("", "Hợp đồng này lúc trước chưa thanh toán");
                return(View(a));
            }

            if (access_token == "" || access_token == null)
            {
                if ((username != "" && password != "") && (username != null && password != null))
                {
                    using (HttpClient client = new HttpClient())
                    {
                        client.DefaultRequestHeaders.Accept.Clear();
                        client.DefaultRequestHeaders.Accept.Add(
                            new MediaTypeWithQualityHeaderValue("application/json")
                            );
                        string authInfo = username + ":" + password;
                        authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
                        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", authInfo);
                        var model = new
                        {
                            supplier_key     = a.supplier_key,
                            order_id         = a.order_id,
                            product_id       = a.product_id,
                            product_quantity = a.product_quantity,
                            product_date     = a.product_date
                        };
                        HttpResponseMessage response = client.PostAsJsonAsync(
                            ManagerObiect.configAPI.LinkXacNhanGiaoHang,
                            model
                            ).Result;
                        if (response.StatusCode == HttpStatusCode.OK)
                        {
                            ModelState.AddModelError("", "Đã ghi nhận thành công");
                            modelhd.SetXacnhangiaohang(a.order_id);
                        }
                        else
                        {
                            ViewBag.thongbao = "Thất bại " + response.Content.ReadAsStringAsync().Result;
                            ModelState.AddModelError("", ViewBag.thongbao);
                        }
                    }
                }
                else
                {
                    ViewBag.thongbao = "Thông tin nhập không chính xác";
                    return(View(a));
                }
            }
            else
            {
                using (HttpClient client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(
                        new MediaTypeWithQualityHeaderValue("application/json")
                        );
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", access_token);
                    var model = new
                    {
                        supplier_key     = a.supplier_key,
                        order_id         = a.order_id,
                        product_id       = a.product_id,
                        product_quantity = a.product_quantity,
                        product_date     = a.product_date
                    };
                    HttpResponseMessage response = client.PostAsJsonAsync(
                        ManagerObiect.configAPI.LinkXacNhanGiaoHang,
                        model
                        ).Result;
                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        ModelState.AddModelError("", "Đã ghi nhận thành công");
                        modelhd.SetXacnhangiaohang(a.order_id);
                    }
                    else
                    {
                        ViewBag.thongbao = "Thất bại " + response.Content.ReadAsStringAsync().Result;
                        ModelState.AddModelError("", ViewBag.thongbao);
                    }
                }
            }
            return(View(a));
        }