コード例 #1
0
        public async Task <IActionResult> WholesalerUpdate(WholesalerModel wm)
        {
            ServiceReference_Wholesaler.Wholesaler w = await whole.findWholesalerByIdAsync(wm.WholesalerId);

            //ServiceReference_ContactPerson.ContactPerson c = await cp.findContactPersonbySalerIdAsync(wm.WholesalerId);
            w.WholesalerId = wm.WholesalerId;
            w.Fullname     = wm.Fullname;
            w.Email        = wm.Email;
            w.Phone        = wm.Phone;
            w.AddressWS    = wm.AddressWS;
            w.CountryId    = wm.CountryId;
            w.Website      = wm.Website;
            w.StatusWS     = wm.StatusWS;
            //c.ContactPersonId = wm.ContactPersonId;
            //c.WholesalerId = wm.WholesalerId;
            //c.Fullname = wm.CompanyName;
            //c.Email = wm.CEmail;
            //c.Phone = wm.CPhone;
            //c.StatusCP = wm.StatusCP;
            bool _boolean = await whole.updateWholesalerAsync(w);

            //bool _bool = await cp.updateContactPersonAsync(c);
            if (_boolean)
            {
                flag    = "success";
                message = "Update wholesaler success";
            }
            else
            {
                flag    = "error";
                message = "Update wholesaler fail.";
            }
            return(RedirectToAction("WholesalerEdit/" + w.WholesalerId));
        }
コード例 #2
0
        public async Task <IActionResult> WholesalerEdit(string id)
        {
            ServiceReference_Wholesaler.Wholesaler w = await whole.findWholesalerByIdAsync(id);

            //ServiceReference_ContactPerson.ContactPerson c = await cp.findContactPersonbySalerIdAsync(id);
            ServiceReference_Country.Country[] lst_countries = await co.getAllCountryAsync();

            WholesalerModel wm = new WholesalerModel()
            {
                coutries     = lst_countries,
                WholesalerId = w.WholesalerId,
                Fullname     = w.Fullname,
                Email        = w.Email,
                Phone        = w.Phone,
                AddressWS    = w.AddressWS,
                CountryId    = w.CountryId,
                Website      = w.Website,
                StatusWS     = w.StatusWS,
                //ContactPersonId = c.ContactPersonId,
                //CompanyName = c.Fullname,
                //CEmail = c.Email,
                //CPhone = c.Phone,
                //StatusCP = c.StatusCP
            };

            ViewBag.flag    = flag;
            ViewBag.message = message;
            flag            = "";
            message         = "";
            return(View(wm));
        }
コード例 #3
0
        public async Task <IActionResult> WholesalerSave(WholesalerModel wm)
        {
            ServiceReference_Wholesaler.Wholesaler       w = new ServiceReference_Wholesaler.Wholesaler();
            ServiceReference_ContactPerson.ContactPerson c = new ServiceReference_ContactPerson.ContactPerson();
            w.WholesalerId = wm.WholesalerId;
            w.Fullname     = wm.Fullname;
            w.Email        = wm.Email;
            w.Phone        = wm.Phone;
            w.AddressWS    = wm.AddressWS;
            w.CountryId    = wm.CountryId;
            w.Website      = wm.Website;
            w.StatusWS     = wm.StatusWS;
            c.WholesalerId = await whole.getWholesalerIdAsync(wm.CountryId);

            c.Fullname = wm.CompanyName;
            c.Email    = wm.CEmail;
            c.Phone    = wm.CPhone;
            c.StatusCP = wm.StatusCP;
            bool _boolean = await whole.createWholesalerAsync(w);

            bool _bool = await cp.createContactPersonAsync(c);

            if (_boolean && _bool)
            {
                flag    = "success";
                message = "Add new wholesaler success";
            }
            else
            {
                flag    = "error";
                message = "Add new wholesaler fail.";
            }
            return(RedirectToAction("WholesalerCreate"));
        }
コード例 #4
0
        public async Task <IActionResult> Account(string msg)
        {
            ApplicationUser user = await _userManager.GetUserAsync(HttpContext.User);

            _id = await getWholesalerId(user.Email);

            ViewBag.active = "account";
            if (!String.IsNullOrEmpty(msg))
            {
                ViewBag.msg = msg;
            }

            if (!String.IsNullOrEmpty(_id))
            {
                ServiceReference_Wholesaler.Wholesaler w = await ws.findWholesalerByIdAsync(_id);

                ServiceReference_Country.Country[] lst_countries = await country.getAllCountryAsync();

                ServiceReference_PurchaseOrder.PurchaseOrder[] orders = await po.findPurchaseOrderByWSIdAsync(_id);

                ServiceReference_Wholesaler.Wholesaler[] lst_ws = await ws.getAllWholesalerAsync();

                WholesalerModel ws_model = new WholesalerModel
                {
                    salerbyId    = w,
                    WholesalerId = w.WholesalerId,
                    Fullname     = w.Fullname,
                    Email        = w.Email,
                    Phone        = w.Phone,
                    AddressWS    = w.AddressWS,
                    CountryId    = w.CountryId,
                    Website      = w.Website,
                    StatusWS     = w.StatusWS,
                    coutries     = lst_countries,
                    pOdersbyWSId = orders,
                    wholesalers  = lst_ws
                };
                return(View(ws_model));
            }

            return(View());
        }
コード例 #5
0
        public async Task <IActionResult> WS_Invoice(string searchString, string podId)
        {
            ViewData["CurrentFilter"] = searchString;

            if (!String.IsNullOrEmpty(searchString))
            {
                return(RedirectToAction("Category", "Home", new { searchString }));
            }
            if (!String.IsNullOrEmpty(_id))
            {
                ServiceReference_Wholesaler.Wholesaler wsbyId = await ws.findWholesalerByIdAsync(_id);

                ServiceReference_Country.Country[] lst_countries = await country.getAllCountryAsync();

                ServiceReference_PurchaseOrder.PurchaseOrder[] orders = await po.findPurchaseOrderByWSIdAsync(_id);

                ServiceReference_PurchaseOrderDetail.PurchaseOrderDetail[] orderdetails = null;
                ServiceReference_Invoice.Invoice[] invoices = null;
                if (!String.IsNullOrEmpty(podId))
                {
                    orderdetails = await pod.findPurchaseOrderDetailbypIdAsync(podId);

                    invoices = await inc.findInvoicebyPurchaseIdAsync(podId);
                }

                WholesalerModel ws_model = new WholesalerModel
                {
                    salerbyId        = wsbyId,
                    coutries         = lst_countries,
                    pOdersbyWSId     = orders,
                    pOderDetail      = orderdetails,
                    getInvoicebyWSId = invoices
                };
                return(View(ws_model));
            }

            return(View());
        }