/// <summary> /// Action to open referral listing page /// </summary> /// <returns></returns> public ActionResult viewreferrals() { Referral objReferral = new Referral(); try { DataSet ds = objDBGHC_PatientReferral.GHC_PatientReferral_GetAll("dDateAdded", "DESC"); if (ds != null && ds.Tables[1] != null) { List<GHC_PatientReferralData> sList = new List<GHC_PatientReferralData>(); foreach (DataRow row in ds.Tables[1].Rows) { var nRecord = new GHC_PatientReferralData(); nRecord.sReferralSource = Methods.CorrectDBNull(row["sReferralSource"]); nRecord.dReferralDate = (Methods.CorrectDBNull(row["dReferralDate"].ToString()) != "") ? (DateTime?)Convert.ToDateTime(Convert.ToDateTime(Methods.CorrectDBNull(row["dReferralDate"])).ToShortDateString()) : null ; nRecord.sClientName = Methods.CorrectDBNull(row["sClientName"]); nRecord.sReferralPhone = Methods.CorrectDBNull(row["sReferralPhone"]); nRecord.nReferralID = Methods.doInt(row["nReferralID"]); sList.Add(nRecord); } objReferral.objGHC_PatientReferralDataList = sList; } return View(objReferral); } catch (Exception ex) { CommonRepository.LogError(sController, "viewreferrals", ex.ToString()); Session[Helpers.CommonConstants.Message] = Messages.GetMessage("[Error]"); Session[Helpers.CommonConstants.MessageType] = "2"; return RedirectToAction("index", "dashboard"); } }
/// <summary> /// Action to open referral in edit mode /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult createreferral(string id = "0") { try { Referral objReferralinfo = new Referral(); int nReferralId = Methods.doInt(Methods.base64Decode(id)); var Referal = new GHC_PatientReferralData(); if (nReferralId > 0) { // GET REFERRAL INFORMATION string sSQL = "Select * from GHC_PatientReferral where nReferralID = " + nReferralId + " "; DataRow dr = DBMethods.GetInfoById(sSQL); if (dr != null) { Referal.nReferralID = Methods.doInt(dr["nReferralID"]); Referal.sContactNo = Methods.CorrectDBNull(dr["sContactNo"]); Referal.sOtherImportantContacts = Methods.CorrectDBNull(dr["sOtherImportantContacts"]); Referal.dReferralDate = (Methods.CorrectDBNull(dr["dReferralDate"].ToString()) != "") ? (DateTime?)Convert.ToDateTime(Convert.ToDateTime(Methods.CorrectDBNull(dr["dReferralDate"])).ToShortDateString()) : null; Referal.sReferralSource = Methods.CorrectDBNull(dr["sReferralSource"]); Referal.sReferralPhone = Methods.CorrectDBNull(dr["sReferralPhone"]); Referal.sReferralFax = Methods.CorrectDBNull(dr["sReferralFax"]); Referal.sReferralAddress = Methods.CorrectDBNull(dr["sReferralAddress"]); Referal.sClientName = Methods.CorrectDBNull(dr["sClientName"]); Referal.dDateOfBirth = (Methods.CorrectDBNull(dr["dDateOfBirth"].ToString()) != "") ? (DateTime?)Convert.ToDateTime(Convert.ToDateTime(Methods.CorrectDBNull(dr["dDateOfBirth"])).ToShortDateString()) : null; Referal.bGender = Methods.doBoolean(dr["bGender"]); Referal.sEthnicity = Methods.CorrectDBNull(dr["sEthnicity"]); Referal.sMedicaidNo = Methods.CorrectDBNull(dr["sMedicaidNo"]); Referal.sResidingWith = Methods.CorrectDBNull(dr["sResidingWith"]); Referal.sSocialSecurityNo = Methods.CorrectDBNull(dr["sSocialSecurityNo"]); Referal.sAddress = Methods.CorrectDBNull(dr["sAddress"]); Referal.sEmail = Methods.CorrectDBNull(dr["sEmail"]); Referal.sNameOfLegalGuardian = Methods.CorrectDBNull(dr["sNameOfLegalGuardian"]); Referal.sPresentingConcerns = Methods.CorrectDBNull(dr["sPresentingConcerns"]); Referal.sDiagnosis = Methods.CorrectDBNull(dr["sDiagnosis"]); Referal.sServicesRequested = Methods.CorrectDBNull(dr["sServicesRequested"]); Referal.sLocationOfServices = Methods.CorrectDBNull(dr["sLocationOfServices"]); Referal.sTypeOfInsurance = Methods.CorrectDBNull(dr["sTypeOfInsurance"]); Referal.sPolicyNo = Methods.CorrectDBNull(dr["sPolicyNo"]); Referal.sGroupNo = Methods.CorrectDBNull(dr["sGroupNo"]); Referal.sPhoneNo = Methods.CorrectDBNull(dr["sPhoneNo"]); } } objReferralinfo.objGHC_PatientReferralData = Referal; return View(objReferralinfo); } catch (Exception ex) { CommonRepository.LogError(sController, "createreferral", ex.ToString()); Session[Helpers.CommonConstants.Message] = Messages.GetMessage("[Error]"); Session[Helpers.CommonConstants.MessageType] = "2"; return RedirectToAction("viewreferrals"); } }
public ActionResult createreferral(Referral objReferral, FormCollection form) { try { Referral objReferralData = new Referral(); if (!ModelState.IsValid) { var sErrors = (from s in ModelState where s.Value.Errors.Count > 0 select s.Value.Errors).ToList(); string sErrorMsg = string.Empty; foreach (var obj in sErrors) obj.ToList().ForEach(a => sErrorMsg += "<br/>" + a.ErrorMessage); Session[Helpers.CommonConstants.Message] = sErrorMsg.Remove(0, 5); Session[Helpers.CommonConstants.MessageType] = "2"; return RedirectToAction("createreferral"); } int nReturn = 0; int nReferralId = Methods.doInt(form["hdnReferralID"]); if (Methods.CorrectDBNull(Request["txtReferralDate"]) != "") objReferral.objGHC_PatientReferralData.dReferralDate = Methods.doStringToDate(Request["txtReferralDate"]); if (Methods.CorrectDBNull(Request["txtBirthDate"]) != "") objReferral.objGHC_PatientReferralData.dDateOfBirth = Methods.doStringToDate(Request["txtBirthDate"]); if (nReferralId > 0) { // Edit Referral objReferral.objGHC_PatientReferralData.nReferralID = nReferralId; objGHC_PatientReferralData.nReferralID = Methods.doInt(objReferral.objGHC_PatientReferralData.nReferralID); objGHC_PatientReferralData.sContactNo = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sContactNo); objGHC_PatientReferralData.sOtherImportantContacts = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sOtherImportantContacts); objGHC_PatientReferralData.dReferralDate = Convert.ToDateTime(objReferral.objGHC_PatientReferralData.dReferralDate); objGHC_PatientReferralData.sReferralSource = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sReferralSource); objGHC_PatientReferralData.sReferralPhone = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sReferralPhone); objGHC_PatientReferralData.sReferralFax = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sReferralFax); objGHC_PatientReferralData.sReferralAddress = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sReferralAddress); objGHC_PatientReferralData.sClientName = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sClientName); objGHC_PatientReferralData.dDateOfBirth = Convert.ToDateTime(objReferral.objGHC_PatientReferralData.dDateOfBirth); objGHC_PatientReferralData.bGender = Methods.doBoolean(objReferral.objGHC_PatientReferralData.bGender); objGHC_PatientReferralData.sEthnicity = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sEthnicity); objGHC_PatientReferralData.sMedicaidNo = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sMedicaidNo); objGHC_PatientReferralData.sResidingWith = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sResidingWith); objGHC_PatientReferralData.sSocialSecurityNo = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sSocialSecurityNo); objGHC_PatientReferralData.sAddress = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sAddress); objGHC_PatientReferralData.sEmail = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sEmail); objGHC_PatientReferralData.sNameOfLegalGuardian = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sNameOfLegalGuardian); objGHC_PatientReferralData.sPresentingConcerns = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sPresentingConcerns); objGHC_PatientReferralData.sDiagnosis = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sDiagnosis); objGHC_PatientReferralData.sServicesRequested = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sServicesRequested); objGHC_PatientReferralData.sLocationOfServices = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sLocationOfServices); objGHC_PatientReferralData.sTypeOfInsurance = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sTypeOfInsurance); objGHC_PatientReferralData.sPolicyNo = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sPolicyNo); objGHC_PatientReferralData.sGroupNo = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sGroupNo); objGHC_PatientReferralData.sPhoneNo = Methods.CorrectDBNull(objReferral.objGHC_PatientReferralData.sPhoneNo); objGHC_PatientReferralData.dDateModified = DateTime.Now; objGHC_PatientReferralData.nModifiedBy = Methods.nUserID; nReturn = objDBGHC_PatientReferral.GHC_PatientReferral_Update(objGHC_PatientReferralData); if (nReturn > 1) { Session[Helpers.CommonConstants.Message] = Messages.GetMessage("[Update]", "Referral"); Session[Helpers.CommonConstants.MessageType] = "1"; return RedirectToAction("viewreferrals"); } else { throw new Exception(); } } return RedirectToAction("createreferral", new { @id = Methods.base64Encode(nReferralId.ToString()) }); } catch (Exception ex) { CommonRepository.LogError(sController, "createreferral", ex.ToString()); Session[Helpers.CommonConstants.Message] = Messages.GetMessage("[Error]"); Session[Helpers.CommonConstants.MessageType] = "2"; return RedirectToAction("viewreferrals"); } }
private void ValidateReferral(Referral objModel) { if (objModel.objGHC_PatientReferralData.dReferralDate == null || objModel.objGHC_PatientReferralData.dReferralDate.ToString().Trim().Length == 0) { ModelState.AddModelError("Date of Referral", "Date of Referral is required"); } if (objModel.objGHC_PatientReferralData.sReferralSource == null || objModel.objGHC_PatientReferralData.sReferralSource.ToString().Trim().Length == 0) { ModelState.AddModelError("Referral Source", "Referral Source"); } }