public ActionResult NewHospitalDetails(string txtHospitalID, string txtHospitalName, string txtAddress, string txtEmail, string txtContact1, string txtContact2, string ddlPrimaryMark) { try { UserDetailsModel udModel = (UserDetailsModel)Session["userModel"]; HospitalDetailsModel HDModel = new HospitalDetailsModel(); HDModel.hospitalID = Int32.Parse(txtHospitalID); HDModel.hospitalName = txtHospitalName; HDModel.address = txtAddress; HDModel.emailID = txtEmail; HDModel.contact1 = Int64.Parse(txtContact1); HDModel.contact2 = Int64.Parse(txtContact2); HDModel.primaryMark = ddlPrimaryMark; HDModel.userID = udModel.userId; if (HDModel.primaryMark.Equals("Yes")) { UDBusiness.UpdatePrimaryMarkEF(udModel.userId, HDModel.hospitalID); } //UDBusiness.SetHospitalDetails(HDModel); UDBusiness.SetHospitalDetailsEF(HDModel); } catch (Exception ex) { WriteLog write = new WriteLog(); string message = ex.Message; write.WriteLogMessage(message); string strMsg = UDBusiness.IngnoreSpecialCharacter(message); string script = "<script language=\"javascript\" type=\"text/javascript\">alert('" + strMsg + "');</script>"; Response.Write(script); } return(RedirectToAction("Index")); }
public void SetHospitalDetails(HospitalDetailsModel HDModel) { con = new SqlConnection(cs); con.Open(); SqlCommand cmd = new SqlCommand("spSetHospitalData", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("hospitalID", HDModel.hospitalID); cmd.Parameters.AddWithValue("hospitalName", HDModel.hospitalName); cmd.Parameters.AddWithValue("address", HDModel.address); cmd.Parameters.AddWithValue("email", HDModel.emailID); cmd.Parameters.AddWithValue("contact1", HDModel.contact1); cmd.Parameters.AddWithValue("contact2", HDModel.contact2); cmd.Parameters.AddWithValue("primaryMark", HDModel.primaryMark); cmd.Parameters.AddWithValue("userID", HDModel.userID); cmd.ExecuteNonQuery(); con.Close(); }
public void AddNewHositalEF(HospitalDetailsModel hospital) { using (var dbContext = new HealthcareDBEntities()) { var newHospital = new UserHospital { HospitalID = hospital.hospitalID, HospitalName = hospital.hospitalName, Address = hospital.address, EmailID = hospital.emailID, ContactNumber1 = hospital.contact1, ContactNumber2 = hospital.contact2, PrimaryMark = hospital.primaryMark, UserID = hospital.userID }; dbContext.UserHospitals.Add(newHospital); dbContext.SaveChanges(); } }
public void SetHospitalDetails(HospitalDetailsModel HDModel) { UDDataAccess.SetHospitalDetails(HDModel); }
//Enity FrameWork public void SetHospitalDetailsEF(HospitalDetailsModel hospital) { var accessLayer = new AccessLayer(); accessLayer.AddNewHositalEF(hospital); }