Beispiel #1
0
        public ActionResult Index(ApplyPassport A)
        {
            var username = Request.Cookies["UserName"].Value.ToString();

            ViewBag.CountryDD = null;
            Service1Client PVMS = new Service1Client();

            Country[]             D = PVMS.FetchCountries();
            List <SelectListItem> CountrynewList = new List <SelectListItem>();

            CountrynewList.Clear();
            CountrynewList.Add(new SelectListItem {
                Text = "Select Country", Value = "-1"
            });
            for (var i = 0; i < D.Length; i++)
            {
                CountrynewList.Add(new SelectListItem {
                    Text = D[i].CountryName, Value = D[i].CountryId.ToString()
                });
            }
            ViewBag.CountryDD = CountrynewList.ToList();
            if (checkForApplyPassportValidation(A))
            {
                return(View());
            }
            int userId = DbOperation.FetchIdByUserName(username);

            if (DbOperation.CheckUserHaveApplyPassport(userId))
            {
                return(Redirect("/ApplyPassportError"));
            }
            else
            {
                A.UserId = userId;
                bool successful = DbOperation.ApplyPassportNew(A);
                if (successful)
                {
                    var json = DbOperation.fetchApplyPassportbyUserId(userId);
                    Session["PassportNumber"] = json[0].PassportNumber;
                    Session["Amount"]         = json[0].Amount;
                    Session["successMsg"]     = "<b>Need the passport number while giving payment? Please note down your Id \n </b> \n" + json[0].PassportNumber + ".Passport application cost is Rs." + json[0].Amount;

                    return(Redirect("/ApplyPassportSuccess"));
                }
                else
                {
                    return(View());
                }
            }
        }