public ActionResult CreateNewAccount(NewAccountRequestView model, HttpPostedFileBase Image)
        {
            CustomerDAL customerDALobject = new CustomerDAL();
               // ModelState.Clear();

            CommonDAL obj = new CommonDAL();
            ViewBag.cityList = obj.GetCityList();

            if (Image == null)
            {
                ViewBag.message = "Please upload image first ! ";
                return View(model);
            }

            if (customerDALobject.AddNewAccountRequest(model))
            {
                ViewBag.message = "Request Submitted. Thank You !";
                return View(model);
            }

            else
            {
                ViewBag.message = "Oops... Error in submitting request.";
                return View(model);
            }
        }
Exemple #2
0
        public bool AddNewAccountRequest(NewAccountRequestView request)
        {
            bool result = false;

            using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Database1ConnectionString"].ToString()))
            {
                int requestID;

                SqlCommand command = new SqlCommand("SELECT COUNT(RequestID) FROM NewAccountRequest ", connection);
                connection.Open();
                SqlDataReader reader = command.ExecuteReader();

                if (reader.HasRows )
                {
                    reader.Read();
                    requestID = Convert.ToInt16(reader[0]) + 1;
                }
                else
                    requestID = 1;

                reader.Close();

                command.CommandText = String.Format("SELECT CustomerName FROM Customer WHERE CustomerID = " + request.CustomerID);
                reader = command.ExecuteReader();
                reader.Read();

                string customerName = reader[0].ToString();
                reader.Close();

                command.CommandText = String.Format("INSERT INTO NewAccountRequest(RequestID, BranchCode, CustomerID, SubmissionDate, Status, AddressProof, CustomerName) VALUES('{0}', '{1}', '{2}', '{3}', 'S', '{4}', '{5}') ", requestID, request.Branch, request.CustomerID, DateTime.Now.ToString(), request.AddresProof, customerName);

                if (command.ExecuteNonQuery() > 0)
                    result = true;

            }
            return result;
        }
        public ActionResult CreateNewAccount()
        {
            string result = (new CommonDAL()).CheckValidation("Customer", this.Session);

            if (result.Equals("LogIn"))
                return RedirectToAction("Login", "CommonBiz");
            else if (result.Equals("Unauthorised"))
                return RedirectToAction("Unauthorised", "CommonBiz");

            CommonDAL obj = new CommonDAL();
            NewAccountRequestView model = new NewAccountRequestView();

            var customerID = (Session["User"] as UserRole).customerID;

            ViewBag.cityList = obj.GetCityList();

            model.CustomerID = customerID;
            return View(model);
        }