//[ActionName("BAddressView")]
 public ActionResult BAddressView()
 {
     try
     {
         ViewData["Message"] = " ";
         BusinessAddressBusinessLayer baBL    = new BusinessAddressBusinessLayer();
         Business_Address             baModel = new Business_Address();
         UpdateModel(baModel);
         baBL.InsertBaData(baModel.street_address, baModel.city, baModel.state, baModel.zipcode, baModel.business_id);
         //Session["bname"] = buModel.business_name;
         ViewData["Message"] = "Business address Data is submitted Successfully";
         return(RedirectToRoute(new
         {
             controller = "Applicant_Address",
             action = "AAddressView",
             aname = Session["name"]
         }));
         //return View(buModel);
     }
     catch
     {
         ViewData["Message"] = "Processing Failed";
         BusinessAddressDataAccess.sqlcon.Close();
         return(View());
     }
 }
        public ActionResult BAddressView(string bname)
        {
            BusinessAddressBusinessLayer baBl    = new BusinessAddressBusinessLayer();
            Business_Address             baModel = baBl.Getbadata(bname);

            return(View(baModel));
        }
Пример #3
0
        public Business_Address Getbadata(string bname)
        {
            BusinessAddressDataAccess baDL    = new BusinessAddressDataAccess();
            SqlDataReader             sdr     = baDL.ReadBuAddDetail(bname);
            Business_Address          baModel = new Business_Address();

            if (sdr.Read())
            {
                baModel.business_id = Convert.ToInt32(sdr["business_id"]);
            }
            BusinessAddressDataAccess.sqlcon.Close();
            return(baModel);
        }
Пример #4
0
 public ActionResult BAddressView(Business_Address Bu_address)
 {
     if (ModelState.IsValid) //checking model is valid or not
     {
         DataAccessLayer objDB  = new DataAccessLayer();
         string          result = objDB.InsertData(Bu_address);
         ViewData["result"] = result;
         ModelState.Clear(); //clearing model
         //return View();
         return(RedirectToAction("AAddressView", "Applicant_Address", new { aname = @Session["first_name"] }));
     }
     else
     {
         ModelState.AddModelError("", "Error in saving data");
         return(View());
     }
 }
Пример #5
0
        public ActionResult BAddressView(string bname)
        {
            Business_Address businessaddObj = new Business_Address();

            using (SqlConnection con = new SqlConnection("Data Source=RAHUL\\SQLEXPRESS01;Initial Catalog=Commercial;Integrated Security=True"))
            {
                string sqlQuery = "select * from BUSINESS where business_name='" + bname + "'";
                con.Open();
                SqlCommand    sqlCmd = new SqlCommand(sqlQuery, con);
                SqlDataReader sdr    = sqlCmd.ExecuteReader();
                if (sdr.Read())
                {
                    businessaddObj.business_id = Convert.ToInt32(sdr["business_id"]);
                }
                con.Close();
            }

            return(View(businessaddObj));
        }
Пример #6
0
        public string InsertData(Business_Address Bu_add)
        {
            string result = "";

            using (SqlConnection con = new SqlConnection("Data Source=RAHUL\\SQLEXPRESS01;Initial Catalog=Commercial;Integrated Security=True"))
            {
                string query = "INSERT INTO BUSINESS_ADDRESS(street_address,city,state,zipcode,business_id) VALUES(@saddress, @city, @state, @zipcode, @business_id)";
                using (SqlCommand cmd = new SqlCommand(query, con))
                {
                    cmd.Connection = con;
                    // opening connection
                    con.Open();
                    cmd.Parameters.AddWithValue("@saddress", Bu_add.street_address);
                    cmd.Parameters.AddWithValue("@city", Bu_add.city);
                    cmd.Parameters.AddWithValue("@state", Bu_add.state);
                    cmd.Parameters.AddWithValue("@zipcode", Bu_add.zipcode);
                    cmd.Parameters.AddWithValue("@business_id", Bu_add.business_id);
                    cmd.ExecuteNonQuery();
                }
                con.Close();
            }
            return(result);
        }