Esempio n. 1
0
        public ActionResult PrequalifiedApplications()
        {
            var nvOdata     = WsConfig.ODataObj();
            var preqlflines = nvOdata.PrequalifiedSuppliers.Where(r => r.Contact_No == Convert.ToString(Session["contactNo"]) && r.Pre_Qualified == false);

            return(View(preqlflines));
        }
Esempio n. 2
0
        public ActionResult AcceptedPreQualification()
        {
            var nvOdata      = WsConfig.ODataObj();
            var acceptedPreq = nvOdata.PrequalifiedSuppliers.Where(r => r.Contact_No == Convert.ToString(Session["contactNo"]) && r.Pre_Qualified == true);

            return(View(acceptedPreq));
        }
Esempio n. 3
0
        public ActionResult SupplierCategory()
        {
            var nvOdata       = WsConfig.ODataObj();
            var supplierlines = nvOdata.SupplyCategoryHeader.Where(r => r.Fiscal_Year == Convert.ToString(Session["currentYear"])).ToList();

            return(View(supplierlines));
        }
Esempio n. 4
0
        public JsonResult SelectedPosta(string postcode)
        {
            var nvOdata = WsConfig.ODataObj();
            var mycity  = nvOdata.postcodes.Where(c => c.Code == postcode).ToList();
            var result  = mycity.FirstOrDefault();

            if (result != null)
            {
                return(Json(result.City, JsonRequestBehavior.AllowGet));
            }
            return(Json("notfound", JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        private static List <SelectListItem> Country()
        {
            var nvOdata   = WsConfig.ODataObj();
            var myCountry = nvOdata.Countries.ToList();
            List <SelectListItem> countryitems = myCountry.Select(nchi => new SelectListItem
            {
                Text  = nchi.Code,
                Value = nchi.Name
            }).ToList();

            return(countryitems);
        }
Esempio n. 6
0
        private static List <SelectListItem> PostalCode()
        {
            var nvOdata    = WsConfig.ODataObj();
            var myPostcode = nvOdata.postcodes.ToList();
            List <SelectListItem> postalitems = myPostcode.Select(posta => new SelectListItem
            {
                Text  = posta.Code,
                Value = posta.Code
            }).ToList();

            return(postalitems);
        }
Esempio n. 7
0
        private static List <SelectListItem> SupplierCategories()
        {
            var nvOdata      = WsConfig.ODataObj();
            var mySupplyCats = nvOdata.SupplierCategories.ToList();
            List <SelectListItem> supplierItems = mySupplyCats.Select(supplier => new SelectListItem
            {
                Text  = supplier.Description,
                Value = supplier.Category_Code
            }).ToList();

            return(supplierItems);
        }
Esempio n. 8
0
        //protected void GetmeYears()
        //{
        //    // Clear items:
        //    ddlYears.Items.Clear();
        //    // Add default item to the list
        //    ddlYears.Items.Add("--Select Year--");
        //    // Start loop
        //    for (int i = 0; i < 20; i++)
        //    {
        //        // For each pass add an item
        //        // Add a number of years (negative, which will subtract) to current year
        //        ddlYears.Items.Add(DateTime.Now.AddYears(-i).Year.ToString());
        //    }

        //}

        private static List <SelectListItem> FiscalYear()
        {
            var nvOdata = WsConfig.ODataObj();
            var myYears = nvOdata.FiscalYears.ToList();
            List <SelectListItem> yearItems = myYears.Select(myyear => new SelectListItem
            {
                Text  = myyear.Code,
                Value = myyear.Code
            }).ToList();

            return(yearItems);
        }
Esempio n. 9
0
        public JsonResult CheckLogin(string myUsername, string myPassword)
        {
            try
            {
                var nvOdata = WsConfig.ODataObj();
                if (string.IsNullOrWhiteSpace(myUsername))
                {
                    return(Json("UsernameEmpty", JsonRequestBehavior.AllowGet));
                }
                if (string.IsNullOrWhiteSpace(myPassword))
                {
                    return(Json("PasswordEmpty", JsonRequestBehavior.AllowGet));
                }

                var loginresult = nvOdata.PortalUsers.Where(o => o.Email == myUsername);
                var result      = loginresult.FirstOrDefault();
                if (result != null)
                {
                    Session["userNo"] = result.CustomerNo;
                    if (result.Password != EncryptP(myPassword))
                    {
                        return(Json("PasswordMismatched", JsonRequestBehavior.AllowGet));
                    }

                    var contactDetails = nvOdata.contacts.Where(m => m.E_Mail == myUsername).ToList().SingleOrDefault();
                    if (contactDetails != null)
                    {
                        //set Sessions here
                        Session["name"]        = contactDetails.Name;
                        Session["email"]       = contactDetails.E_Mail;
                        Session["password"]    = contactDetails.password;
                        Session["contactNo"]   = contactDetails.No;
                        Session["currentYear"] = WsConfig.EProcWebRef.GetCurrentYear();
                    }
                    //check if the are in Vendor table
                    var vendorcollection = nvOdata.Vendors.Where(t => t.Primary_Contact_No == (string)Session["contactNo"]).ToList();

                    if (result.isAdmin == true && result.ActivatedAsVendor == true)
                    {
                        Session["isAdmin"] = "administrator";

                        foreach (var vend in vendorcollection)
                        {
                            Session["vendorNo"] = vend.No;
                        }
                        CountApplicationsInfo((string)Session["vendorNo"]);
                        return(Json("Loginadmin", JsonRequestBehavior.AllowGet));
                    }
                    if (result.isAdmin == false && result.ActivatedAsVendor == true)
                    {
                        Session["isAdmin"] = "customer";
                        foreach (var vend in vendorcollection)
                        {
                            Session["vendorNo"] = vend.No;
                        }
                        return(Json("Logincustomer", JsonRequestBehavior.AllowGet));
                    }

                    if (result.isAdmin == false && result.ActivatedAsVendor == false)
                    {
                        Session["isAdmin"]  = "contact";
                        Session["vendorNo"] = null;
                        return(Json("Logincontact", JsonRequestBehavior.AllowGet));
                    }
                }
                return(Json("InvalidLogin", JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(ex.Message, JsonRequestBehavior.AllowGet));
            }
        }