static public TestReferralSource BuildSourceFromDataBaseData(string idReferral) { using (NpgsqlConnection connection = Global.GetSqlConnection()) { string findPatient = "SELECT id_source_lpu_case_mis, id_referral_source_mo_mis, id_source_lpu FROM public.referral WHERE id_referral = '" + idReferral + "' ORDER BY id_referral DESC LIMIT 1"; NpgsqlCommand person = new NpgsqlCommand(findPatient, connection); using (NpgsqlDataReader personFromDataBase = person.ExecuteReader()) { ReferralSource p = new ReferralSource(); while (personFromDataBase.Read()) { //referral_creation_date должен быть тут в Date! if (personFromDataBase["id_source_lpu_case_mis"] != DBNull.Value) { p.IdCaseMis = Convert.ToString(personFromDataBase["id_source_lpu_case_mis"]); } if (personFromDataBase["id_referral_source_mo_mis"] != DBNull.Value) { p.IdReferralMis = Convert.ToString(personFromDataBase["id_referral_source_mo_mis"]); } TestReferralSource pers = new TestReferralSource(p); if (personFromDataBase["id_source_lpu"] != DBNull.Value) { pers.lpu = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(personFromDataBase["id_source_lpu"])); } return(pers); } } } return(new TestReferralSource(null)); }
public static ReferralSource GetHRMetroLocationByMetroLocationID(int MetroLocationID) { ReferralSource referralSource = new ReferralSource(); SqlReferralSourceProvider sqlReferralSourceProvider = new SqlReferralSourceProvider(); referralSource = sqlReferralSourceProvider.GetReferralSourceByMetroLocationID(MetroLocationID); return referralSource; }
public static TestReferralSource BuildSourceFromDataBaseData(string idReferral) { using (NpgsqlConnection connection = Global.GetSqlConnection()) { string findPatient = "SELECT id_source_lpu_case_mis, id_referral_source_mo_mis, id_source_lpu FROM public.referral WHERE id_referral = '" + idReferral + "' ORDER BY id_referral DESC LIMIT 1"; NpgsqlCommand person = new NpgsqlCommand(findPatient, connection); using (NpgsqlDataReader personFromDataBase = person.ExecuteReader()) { ReferralSource p = new ReferralSource(); while (personFromDataBase.Read()) { //referral_creation_date должен быть тут в Date! if (personFromDataBase["id_source_lpu_case_mis"] != DBNull.Value) p.IdCaseMis = Convert.ToString(personFromDataBase["id_source_lpu_case_mis"]); if (personFromDataBase["id_referral_source_mo_mis"] != DBNull.Value) p.IdReferralMis = Convert.ToString(personFromDataBase["id_referral_source_mo_mis"]); TestReferralSource pers = new TestReferralSource(p); if (personFromDataBase["id_source_lpu"] != DBNull.Value) pers.lpu = TestCoding.BuildCodingFromDataBaseData(Convert.ToString(personFromDataBase["id_source_lpu"])); return pers; } } } return new TestReferralSource(null); }
public static ReferralSource GetReferralSourceByReferralSourceID(int ReferralSourceID) { ReferralSource referralSource = new ReferralSource(); SqlReferralSourceProvider sqlReferralSourceProvider = new SqlReferralSourceProvider(); referralSource = sqlReferralSourceProvider.GetReferralSourceByReferralSourceID(ReferralSourceID); return referralSource; }
public IHttpActionResult PutReferralSource(int id, ReferralSource referralSource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != referralSource.ReferralSourceId) { return(BadRequest()); } db.Entry(referralSource).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ReferralSourceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
internal void UpdateTestReferralSource(ReferralSource s) { if ((s.Doctors != null) && (s.Doctors.Length != 0)) { if (this.doctors == null) { docs = new List <TestDoctor>(); } foreach (Doctor i in s.Doctors) { docs.Add(new TestDoctor(i)); } } if ((s.MainDiagnosis != null) && (s.MainDiagnosis.Length != 0)) { if (this.mainDiagnosis == null) { diag = new List <TestMainDiagnosis>(); } foreach (MainDiagnosis i in s.MainDiagnosis) { diag.Add(new TestMainDiagnosis(i)); } } if (s.Lpu != null) { lpu = new TestCoding(s.Lpu); } }
public TestReferralSource(ReferralSource r) { if (r != null) { sourse = r; } else { sourse = new ReferralSource(); } if ((sourse.Doctors != null) && (sourse.Doctors.Length != 0)) { docs = new List <TestDoctor>(); foreach (Doctor i in sourse.Doctors) { docs.Add(new TestDoctor(i)); } } if ((sourse.MainDiagnosis != null) && (sourse.MainDiagnosis.Length != 0)) { diag = new List <TestMainDiagnosis>(); foreach (MainDiagnosis i in sourse.MainDiagnosis) { diag.Add(new TestMainDiagnosis(i)); } } if (sourse.Lpu != null) { lpu = new TestCoding(sourse.Lpu); } }
public static ReferralSource GetHRMetroLocationByMetroLocationID(int MetroLocationID) { ReferralSource referralSource = new ReferralSource(); SqlReferralSourceProvider sqlReferralSourceProvider = new SqlReferralSourceProvider(); referralSource = sqlReferralSourceProvider.GetReferralSourceByMetroLocationID(MetroLocationID); return(referralSource); }
public static ReferralSource GetReferralSourceByReferralSourceID(int ReferralSourceID) { ReferralSource referralSource = new ReferralSource(); SqlReferralSourceProvider sqlReferralSourceProvider = new SqlReferralSourceProvider(); referralSource = sqlReferralSourceProvider.GetReferralSourceByReferralSourceID(ReferralSourceID); return(referralSource); }
public ActionResult DeleteConfirmed(int id) { ReferralSource referralSource = db.ReferralSources.Find(id); db.ReferralSources.Remove(referralSource); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,value")] ReferralSource referralSource) { if (ModelState.IsValid) { db.Entry(referralSource).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(referralSource)); }
public ReferralSource GetReferralSourceInfoBySourceCode(string facility, string sourceCode) { string commandString = @"SELECT SYSTEM.table_referral_sources.ref_source_add_str1, SYSTEM.table_referral_sources.ref_source_add_str2, SYSTEM.table_referral_sources.ref_source_add_city, SYSTEM.table_referral_sources.ref_source_add_state, SYSTEM.table_referral_sources.ref_source_add_zip, SYSTEM.table_referral_sources.ref_source_phone FROM SYSTEM.table_referral_sources WHERE table_referral_sources.FACILITY=? AND table_referral_sources.REF_SOURCE_CODE=?"; ReferralSource referralSource = new ReferralSource() { Code = sourceCode }; using (OdbcConnection connection = new OdbcConnection(_connectionStringCollection.PM)) { OdbcCommand command = new OdbcCommand(commandString, connection); command.Parameters.Add(new OdbcParameter("FACILITY", facility)); command.Parameters.Add(new OdbcParameter("SOURCECODE", sourceCode)); try { connection.Open(); using (var reader = command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { referralSource.Address1 = GetStringValue(reader, "ref_source_add_str1"); referralSource.Address2 = GetStringValue(reader, "ref_source_add_str2"); referralSource.City = GetStringValue(reader, "ref_source_add_city"); referralSource.State = GetStringValue(reader, "ref_source_add_state"); referralSource.PostalCode = GetStringValue(reader, "ref_source_add_zip"); referralSource.PhoneNumber = GetStringValue(reader, "ref_source_phone"); } } } } catch (OdbcException ex) { logger.Error(ex, "GetReferralSourceInfoBySourceCode: Could not connect to ODBC data source. See error message. Data Source: {systemDsn}. Error: {errorMessage}", _connectionStringCollection.PM, ex.Message); throw; } catch (Exception ex) { logger.Error(ex, "GetReferralSourceInfoBySourceCode: An unexpected error occurred. Error Type: {errorType}. Error: {errorMessage}", ex.GetType(), ex.Message); throw; } } return(referralSource); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { var results = new List <ValidationResult>(); if (ReferralSource.Contains("TV") && string.IsNullOrEmpty(OtherSource)) { results.Add(new ValidationResult("You selected TV. Please describe more in Other Source.")); } return(results); }
public TestReferralSource(ReferralSource r) { sourse = r ?? new ReferralSource(); if (sourse.Doctors != null) foreach (Doctor i in sourse.Doctors) docs.Add(new TestDoctor(i)); if (sourse.MainDiagnosis != null) foreach (MainDiagnosis i in sourse.MainDiagnosis) diag.Add(new TestMainDiagnosis(i)); lpu = new TestCoding(sourse.Lpu); }
public ActionResult Create([Bind(Include = "id,value")] ReferralSource referralSource) { if (ModelState.IsValid) { db.ReferralSources.Add(referralSource); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(referralSource)); }
public IHttpActionResult GetReferralSource(int id) { ReferralSource referralSource = db.ReferralSources.Find(id); if (referralSource == null) { return(NotFound()); } return(Ok(referralSource)); }
public IHttpActionResult PostReferralSource(ReferralSource referralSource) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ReferralSources.Add(referralSource); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = referralSource.ReferralSourceId }, referralSource)); }
public IHttpActionResult DeleteReferralSource(int id) { ReferralSource referralSource = db.ReferralSources.Find(id); if (referralSource == null) { return(NotFound()); } db.ReferralSources.Remove(referralSource); db.SaveChanges(); return(Ok(referralSource)); }
// GET: ReferralSources/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ReferralSource referralSource = db.ReferralSources.Find(id); if (referralSource == null) { return(HttpNotFound()); } return(View(referralSource)); }
public ActionResult <List <ReferralSource> > ReferralSource(string subSourceCode) { List <ReferralSource> Result = new List <ReferralSource>(); var qryDayCenters = from DC in DBContext.CM_S_DAYCENTER join DCE in DBContext.CM_S_DAYCENTER_EXT_AUS on new { DC.COMPANY_CODE, DC.DIVISION_CODE, DC.SHOP_CODE, DC.DAYCENTER_CODE } equals new { DCE.COMPANY_CODE, DCE.DIVISION_CODE, DCE.SHOP_CODE, DCE.DAYCENTER_CODE } into Ext select new { DayCenter = DC, DayCenterExt = Ext.SingleOrDefault() }; foreach (var item in qryDayCenters.Where(E => E.DayCenterExt.LOCATION_TYPE == subSourceCode).OrderBy(E => E.DayCenter.DAYCENTER_DESCR)) { ReferralSource model = EntityMapper.Map <ReferralSource, CM_S_DAYCENTER>(DBContext, item.DayCenter, item.DayCenterExt); Result.Add(model); } return(Result); }
public bool UpdateReferralSource(ReferralSource referralSource) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateReferralSource", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ReferralSourceID", SqlDbType.Int).Value = referralSource.ReferralSourceID; cmd.Parameters.Add("@ReferralSourceName", SqlDbType.NVarChar).Value = referralSource.ReferralSourceName; cmd.Parameters.Add("@ReferralType", SqlDbType.NVarChar).Value = referralSource.ReferralType; cmd.Parameters.Add("@ReferralStyle", SqlDbType.NVarChar).Value = referralSource.ReferralStyle; cmd.Parameters.Add("@ReferralStation", SqlDbType.NVarChar).Value = referralSource.ReferralStation; cmd.Parameters.Add("@MetroLocationID", SqlDbType.Int).Value = referralSource.MetroLocationID; connection.Open(); int result = cmd.ExecuteNonQuery(); return(result == 1); } }
public TestReferralSource(ReferralSource r) { sourse = r ?? new ReferralSource(); if (sourse.Doctors != null) { foreach (Doctor i in sourse.Doctors) { docs.Add(new TestDoctor(i)); } } if (sourse.MainDiagnosis != null) { foreach (MainDiagnosis i in sourse.MainDiagnosis) { diag.Add(new TestMainDiagnosis(i)); } } lpu = new TestCoding(sourse.Lpu); }
public ReferralSource GetReferralSourceFromReader(IDataReader reader) { try { ReferralSource referralSource = new ReferralSource ( DataAccessObject.IsNULL <int>(reader["ReferralSourceID"]), DataAccessObject.IsNULL <string>(reader["ReferralSourceName"]), DataAccessObject.IsNULL <string>(reader["ReferralType"]), DataAccessObject.IsNULL <string>(reader["ReferralStyle"]), DataAccessObject.IsNULL <string>(reader["ReferralStation"]), DataAccessObject.IsNULL <int>(reader["MetroLocationID"]) ); return(referralSource); } catch (Exception ex) { return(null); } }
public TestReferralSource(ReferralSource r) { if (r != null) sourse = r; else sourse = new ReferralSource(); if ((sourse.Doctors != null) && (sourse.Doctors.Length != 0)) { docs = new List<TestDoctor>(); foreach (Doctor i in sourse.Doctors) docs.Add(new TestDoctor(i)); } if ((sourse.MainDiagnosis != null) && (sourse.MainDiagnosis.Length != 0)) { diag = new List<TestMainDiagnosis>(); foreach (MainDiagnosis i in sourse.MainDiagnosis) diag.Add(new TestMainDiagnosis(i)); } if (sourse.Lpu != null) lpu = new TestCoding(sourse.Lpu); }
protected override OpResult _Store(ReferralSource _obj) { if (_obj == null) { return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "ReferralSource object cannot be created as it is null")); } if (Exists(_obj)) { ExecuteNonQuery(GetQuery_UpdateQuery(_obj)); return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Updated, _obj)); } ExecuteNonQuery(GetQuery_InsertQuery(_obj)); if (_obj.ReferralSourceID == null) { _obj.ReferralSourceID = DbMgr.GetLastInsertID(); } _obj.FromDb = true; return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj)); }
private DbInsertStatement GetQuery_InsertQuery(ReferralSource _obj) { Dictionary <string, DbFieldEntry> fields = GetFields(_obj); return(DbMgr.CreateInsertClause("ReferralSources", fields)); }
public ReferralSource GetReferralSourceFromReader(IDataReader reader) { try { ReferralSource referralSource = new ReferralSource ( DataAccessObject.IsNULL<int>(reader["ReferralSourceID"]), DataAccessObject.IsNULL<string>(reader["ReferralSourceName"]), DataAccessObject.IsNULL<string>(reader["ReferralType"]), DataAccessObject.IsNULL<string>(reader["ReferralStyle"]), DataAccessObject.IsNULL<string>(reader["ReferralStation"]), DataAccessObject.IsNULL<int>(reader["MetroLocationID"]) ); return referralSource; } catch(Exception ex) { return null; } }
public JsonResult Create(ReferralSourceModel model) { if (!HasContextRole(new string[] { "CRO", "CEO", "DBD", "AVP" })) { return(Json(new { Status = Constant.RESPONSE_ERROR, Description = "Unauthorized." })); } if (ModelState.IsValid) { if (model.Sites == null || model.Sites.Where(p => p.Selected == true).Count() <= 0) { return(Json(new { Status = Constant.RESPONSE_ERROR, Description = "Please select at least one site to associate the referral source to." })); } using (var transaction = _dataContext.Database.BeginTransaction()) { if (_dataContext.ReferralSources.Where(p => p.FullName == model.FullName && p.Deleted == false).Count() <= 0) { ReferralSource entity = new ReferralSource() { FullName = model.FullName, ShortName = model.ShortName, BedCount = model.BedCount, OperationalICUBedCount = model.OperationalICUBedCount, CCUBedCount = model.CCUBedCount, SkilledNursingBedCount = model.SkilledNursingBedCount, SICUBedCount = model.SICUBedCount, RehabBedCount = model.RehabBedCount, ConfirmedBedsCodingICURevCodes = model.ConfirmedBedsCodingICURevCodes, ICUBedCount = model.ICUBedCount, LTACHBedCount = model.LTACHBedCount, MICUBedCount = model.MICUBedCount, NeuroICUBedCount = model.NeuroICUBedCount, ReferralSourceTypeId = model.ReferralSourceTypeId }; _dataContext.ReferralSources.Add(entity); _dataContext.SaveChanges(); foreach (var site in model.Sites.Where(p => p.Selected == true)) { CHGSiteReferralSource siteReferralSource = new CHGSiteReferralSource() { CHGSiteId = site.CHGSiteId, ReferralSource = entity }; _dataContext.CHGSiteReferralSources.Add(siteReferralSource); } _dataContext.SaveChanges(); if (model.ElectronicReferralTypes != null) { foreach (var electronicReferralType in model.ElectronicReferralTypes.Where(p => p.Selected == true)) { ReferralSourceElectronicReferralType item = new ReferralSourceElectronicReferralType() { ElectronicReferralTypeId = electronicReferralType.ElectronicReferralTypeId, ReferralSource = entity }; _dataContext.ReferralSourceElectronicReferralTypes.Add(item); } } _dataContext.SaveChanges(); if (model.CommercialPayorTypes != null) { foreach (var commercialPayorType in model.CommercialPayorTypes.Where(p => p.Selected == true)) { ReferralSourceCommercialPayorType item = new ReferralSourceCommercialPayorType() { CommercialPayorTypeId = commercialPayorType.CommercialPayorTypeId, ReferralSource = entity }; _dataContext.ReferralSourceCommercialPayorTypes.Add(item); } } _dataContext.SaveChanges(); if (model.ManagedMedicarePayorTypes != null) { foreach (var ManagedMedicarePayorType in model.ManagedMedicarePayorTypes.Where(p => p.Selected == true)) { ReferralSourceManagedMedicarePayorType item = new ReferralSourceManagedMedicarePayorType() { ManagedMedicarePayorTypeId = ManagedMedicarePayorType.ManagedMedicarePayorTypeId, ReferralSource = entity }; _dataContext.ReferralSourceManagedMedicarePayorTypes.Add(item); } } _dataContext.SaveChanges(); ApprovalProcess(entity.ReferralSourceId); transaction.Commit(); return(Json(new { Status = Constant.RESPONSE_OK, Description = "Referral source created successfully." })); } else { return(Json(new { Status = Constant.RESPONSE_ERROR, Description = "The referral source with the same full name already exists. Please enter a different name." })); } } } return(Json(new { Status = Constant.RESPONSE_ERROR, Description = "One or more fields failed validation." })); }
internal void UpdateTestReferralSource(ReferralSource s) { if ((s.Doctors != null) && (s.Doctors.Length != 0)) { if (this.doctors == null) docs = new List<TestDoctor>(); foreach (Doctor i in s.Doctors) docs.Add(new TestDoctor(i)); } if ((s.MainDiagnosis != null) && (s.MainDiagnosis.Length != 0)) { if (this.mainDiagnosis == null) diag = new List<TestMainDiagnosis>(); foreach (MainDiagnosis i in s.MainDiagnosis) diag.Add(new TestMainDiagnosis(i)); } if (s.Lpu != null) lpu = new TestCoding(s.Lpu); }
public bool UpdateReferralSource(ReferralSource referralSource) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateReferralSource", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ReferralSourceID", SqlDbType.Int).Value = referralSource.ReferralSourceID; cmd.Parameters.Add("@ReferralSourceName", SqlDbType.NVarChar).Value = referralSource.ReferralSourceName; cmd.Parameters.Add("@ReferralType", SqlDbType.NVarChar).Value = referralSource.ReferralType; cmd.Parameters.Add("@ReferralStyle", SqlDbType.NVarChar).Value = referralSource.ReferralStyle; cmd.Parameters.Add("@ReferralStation", SqlDbType.NVarChar).Value = referralSource.ReferralStation; cmd.Parameters.Add("@MetroLocationID", SqlDbType.Int).Value = referralSource.MetroLocationID; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
private DbUpdateStatement GetQuery_UpdateQuery(ReferralSource _obj) { return(DbMgr.CreateUpdateClause("ReferralSources", GetFields(_obj), "ReferralSourceID", _obj.ReferralSourceID)); }
public static int InsertReferralSource(ReferralSource referralSource) { SqlReferralSourceProvider sqlReferralSourceProvider = new SqlReferralSourceProvider(); return sqlReferralSourceProvider.InsertReferralSource(referralSource); }
public static bool UpdateReferralSource(ReferralSource referralSource) { SqlReferralSourceProvider sqlReferralSourceProvider = new SqlReferralSourceProvider(); return(sqlReferralSourceProvider.UpdateReferralSource(referralSource)); }
public static int InsertReferralSource(ReferralSource referralSource) { SqlReferralSourceProvider sqlReferralSourceProvider = new SqlReferralSourceProvider(); return(sqlReferralSourceProvider.InsertReferralSource(referralSource)); }
public static bool UpdateReferralSource(ReferralSource referralSource) { SqlReferralSourceProvider sqlReferralSourceProvider = new SqlReferralSourceProvider(); return sqlReferralSourceProvider.UpdateReferralSource(referralSource); }