//[ActionName("AAddressView")] public ActionResult AAddressView() { try { ViewData["Message"] = " "; ApplicantAddressBusinessLayer aaBL = new ApplicantAddressBusinessLayer(); Applicant_Address aaModel = new Applicant_Address(); UpdateModel(aaModel); aaBL.InsertAppAddData(aaModel.street_address, aaModel.city, aaModel.state, aaModel.zipcode, aaModel.applicant_id); //Session["bname"] = buModel.business_name; ViewData["Message"] = "Applicant Address Data is submitted Successfully"; return(RedirectToRoute(new { controller = "Payroll", action = "PayrollView", bname = Session["bname"] })); //return View(buModel); } catch { ViewData["Message"] = "Processing Failed"; ApplicantAddressDataAccess.sqlcon.Close(); return(View()); } }
public ActionResult AAddressView(string aname) { ApplicantAddressBusinessLayer aaBl = new ApplicantAddressBusinessLayer(); Applicant_Address aaModel = aaBl.GetAppAdddata(aname); return(View(aaModel)); }
public Applicant_Address GetAppAdddata(string aname) { ApplicantAddressDataAccess aaDL = new ApplicantAddressDataAccess(); SqlDataReader sdr = aaDL.ReadAppAddDetail(aname); Applicant_Address aaModel = new Applicant_Address(); if (sdr.Read()) { aaModel.applicant_id = Convert.ToInt32(sdr["applicant_id"]); aaModel.role = Convert.ToString(sdr["role"]); aaModel.ssn = Convert.ToInt32(sdr["ssn"]); } ApplicantAddressDataAccess.sqlcon.Close(); return(aaModel); }
public ActionResult AAddressView(Applicant_Address app_address) { if (ModelState.IsValid) //checking model is valid or not { DataAccessLayer objDB = new DataAccessLayer(); string result = objDB.InsertAData(app_address); ViewData["result"] = result; ModelState.Clear(); //clearing model //return View(); return(RedirectToAction("PayrollView", "Payroll", new { bname = @Session["business_name"] })); } else { ModelState.AddModelError("", "Error in saving data"); return(View()); } }
public ActionResult AAddressView(string aname) { Applicant_Address applicantaddObj = new Applicant_Address(); using (SqlConnection con = new SqlConnection("Data Source=RAHUL\\SQLEXPRESS01;Initial Catalog=Commercial;Integrated Security=True")) { string sqlQuery = "select * from APPLICANT where first_name='" + aname + "'"; con.Open(); SqlCommand sqlCmd = new SqlCommand(sqlQuery, con); SqlDataReader sdr = sqlCmd.ExecuteReader(); if (sdr.Read()) { applicantaddObj.applicant_id = Convert.ToInt32(sdr["applicant_id"]); applicantaddObj.role = Convert.ToString(sdr["role"]); applicantaddObj.ssn = Convert.ToInt32(sdr["ssn"]); } con.Close(); } return(View(applicantaddObj)); }
public string InsertAData(Applicant_Address app_add) { string result = ""; using (SqlConnection con = new SqlConnection("Data Source=RAHUL\\SQLEXPRESS01;Initial Catalog=Commercial;Integrated Security=True")) { string query = "INSERT INTO APPLICANT_ADDRESS(street_address,city,state,zipcode,applicant_id) VALUES(@saddress, @city, @state, @zipcode, @applicant_id)"; using (SqlCommand cmd = new SqlCommand(query, con)) { cmd.Connection = con; // opening connection con.Open(); cmd.Parameters.AddWithValue("@saddress", app_add.street_address); cmd.Parameters.AddWithValue("@city", app_add.city); cmd.Parameters.AddWithValue("@state", app_add.state); cmd.Parameters.AddWithValue("@zipcode", app_add.zipcode); cmd.Parameters.AddWithValue("@applicant_id", app_add.applicant_id); cmd.ExecuteNonQuery(); } con.Close(); } return(result); }