protected void btnSearch_Click(object sender, EventArgs e) { try { if (chbBirthdate.Checked || chbFirstname.Checked || chbGender.Checked) { HealthFacility hf = HealthFacility.GetHealthFacilityById(CurrentEnvironment.LoggedUser.HealthFacilityId); odsChild.SelectParameters.Clear(); odsChild.SelectParameters.Add("birthdateFlag", chbBirthdate.Checked.ToString()); odsChild.SelectParameters.Add("firstnameFlag", chbFirstname.Checked.ToString()); odsChild.SelectParameters.Add("genderFlag", chbGender.Checked.ToString()); odsChild.SelectParameters.Add("healthFacilityId", hf.Id.ToString()); gvChild.DataSource = odsChild; gvChild.DataBind(); lblWarning.Visible = false; } else { lblWarning.Visible = true; } } catch (Exception ex) { } }
protected void btnSearch_Click(object sender, EventArgs e) { string wsearch = txtName.Text.Replace("'", @"''"); string csearch = txtCode.Text; string where; where = @" UPPER(""NAME"") like '%" + wsearch.ToUpper() + @"%' AND UPPER(""CODE"") like '%" + csearch.ToUpper() + "%'"; int hfId = CurrentEnvironment.LoggedUser.HealthFacilityId; string _hfId = (string)Request.QueryString["id"]; if (!String.IsNullOrEmpty(_hfId)) { int.TryParse(_hfId, out hfId); } HealthFacility hf = HealthFacility.GetHealthFacilityById(hfId); if (!hf.TopLevel) { string s = HealthFacility.GetAllChildsForOneHealthFacility(hf.Id); where += string.Format(" AND (\"ID\" in ({0})) ", s); } odsHealthFacility.SelectParameters.Clear(); odsHealthFacility.SelectParameters.Add("where", where); }
/// <summary> /// Manually requests an order be created from <paramref name="from"/> to <paramref name="to"/> in the Requested state /// </summary> /// <param name="from">The <see cref="T:GIIS.DataLayer.HealthFacility"/> from which the order is originating (where stock originates)</param> /// <param name="to">The <see cref="T:GIIS.DataLayer.HealthFacility"/> to which the order is destined (where stock will end up)</param> /// <param name="orderDate">The date that the order is to take place</param> /// <returns>A constructed <see cref="T:GIIS.DataLayer.TransferOrderHeader"/> containing the constructed order items</returns> /// <remarks> /// Callers of this function will need to make subsequent calls to <see cref="M:GIIS.BusinessLogic.OrderManagementLogic.AddOrderLine(GIIS.DataLayer.TransferOrderHeader, System.String, System.String, System.Int32, GIIS.DataLayer.Uom) "/> function /// to add order lines. /// </remarks> public TransferOrderHeader RequestOrder(HealthFacility from, HealthFacility to, DateTime orderDate, Int32 modifiedBy) { if (from == null) { throw new ArgumentNullException("from"); } else if (to == null) { throw new ArgumentNullException("to"); } else if (orderDate == default(DateTime)) { throw new ArgumentException("orderDate"); } // Create the header TransferOrderHeader retVal = new TransferOrderHeader() { ModifiedBy = modifiedBy, ModifiedOn = DateTime.Now, OrderFacilityFrom = from.Code, OrderFacilityTo = to.Code, OrderSchedReplenishDate = orderDate, OrderStatus = (int)OrderStatusType.Requested, RevNum = 0 }; // Save retVal.OrderNum = TransferOrderHeader.Insert(retVal); return(retVal); }
protected void btnSearch_Click(object sender, EventArgs e) { string wsearch = txtName.Text.Replace("'", @"''"); string csearch = txtCode.Text.Replace("'", @"''"); string s = string.Empty; string sessionvar = "_healthfacility_" + CurrentEnvironment.LoggedUser.HealthFacilityId.ToString(); if (Session[sessionvar] != null) { s = Session[sessionvar].ToString(); } else { s = HealthFacility.GetAllChildsForOneHealthFacility(CurrentEnvironment.LoggedUser.HealthFacilityId); } odsHealthFacility.SelectParameters.Clear(); odsHealthFacility.SelectParameters.Add("name", wsearch.ToUpper()); odsHealthFacility.SelectParameters.Add("code", csearch.ToUpper()); odsHealthFacility.SelectParameters.Add("hfid", s); gvHealthFacility.DataSourceID = "odsHealthFacility"; gvHealthFacility.DataBind(); }
protected void rblLeaf_SelectedIndexChanged(object sender, EventArgs e) { if (rblLeaf.SelectedIndex == 0) { ddlHealthFacility.Visible = true; lblHealthFacility.Visible = true; string where = string.Empty; if (!(CurrentEnvironment.LoggedUser.HealthFacilityId == 1)) { string s = HealthFacility.GetAllChildsForOneHealthFacility(CurrentEnvironment.LoggedUser.HealthFacilityId, true); where = string.Format(@"AND ""ID"" in ( {0})", s); } odsHealthF.SelectParameters.Clear(); odsHealthF.SelectParameters.Add("ids", where); odsHealthF.DataBind(); } else { ddlHealthFacility.Visible = false; lblHealthFacility.Visible = false; if (ddlHealthFacility.Items.Count > 0) { ddlHealthFacility.SelectedIndex = 0; } } }
public static PharmaceuticalPrescription Create(PrescriptionIdentifier identifier, HealthcareProvider prescriber, Patient patient, HealthFacility healthFacility, IEnumerable <PrescribedMedication> prescribedMedications, DateTime createdOn, Alpha2LanguageCode languageCode, DateTime?delivrableAt = null) { var prescription = new PharmaceuticalPrescription ( identifier, prescriber, patient, healthFacility, prescribedMedications, languageCode, PrescriptionStatus.Created, createdOn, delivrableAt ); prescription.AddEvent(new PharmaceuticalPrescriptionCreated(identifier.Identifier, createdOn)); return(prescription); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { List <int> months = new List <int>(); for (int i = 1; i <= 12; i++) { months.Add(i); } MonthDropdown.DataSource = months; MonthDropdown.DataBind(); MonthDropdown.SelectedIndex = (DateTime.Now.Month - 1); Dictionary <string, int> facilities = new Dictionary <string, int>(); foreach (HealthFacility h in HealthFacility.GetHealthFacilityList().OrderBy(x => x.Name)) { facilities.Add(h.Name, h.Id); } HealthFacilityDropdown.DataSource = facilities; HealthFacilityDropdown.DataTextField = "key"; HealthFacilityDropdown.DataValueField = "value"; HealthFacilityDropdown.DataBind(); } UpdateHyperLink(null, null); }
/// <summary> /// Updates Vaccination Event with default data /// </summary> /// <param name="ve">Vaccination Event to be updated</param> /// <returns></returns> public VaccinationEvent RemoveVaccinationEvent(VaccinationEvent ve, int userId) { if (ve == null) { throw new ArgumentNullException("ve"); } if (userId <= 0) { throw new ArgumentException("userId"); } int lotid = ve.VaccineLotId; HealthFacility facility = ve.HealthFacility; ve.VaccineLotId = 0; ve.VaccineLotText = String.Empty; ve.VaccinationDate = ve.ScheduledDate; ve.Notes = String.Empty; ve.VaccinationStatus = false; ve.NonvaccinationReasonId = 0; ve.HealthFacilityId = ve.Appointment.ScheduledFacilityId; ve.ModifiedOn = DateTime.Now; ve.ModifiedBy = userId; int i = VaccinationEvent.Update(ve); if (i > 0) { RescheduleNextDose(ve, true); //update balance StockManagementLogic sml = new StockManagementLogic(); int update = sml.ClearBalance(facility, lotid); } return(ve); }
protected Prescription(PrescriptionIdentifier identifier, HealthcarePractitioner prescriber, Patient patient, HealthFacility healthFacility, Alpha2LanguageCode languageCode, PrescriptionStatus status, DateTime createdOn, DateTime?delivrableAt = null, EntityState entityState = EntityState.Added, IEnumerable <IDomainEvent> events = null) : base(entityState, events) { Condition.Requires(identifier, nameof(identifier)).IsNotNull(); Condition.Requires(prescriber, nameof(prescriber)).IsNotNull(); Condition.Requires(patient, nameof(patient)).IsNotNull(); Condition.Requires(healthFacility, nameof(healthFacility)).IsNotNull(); Condition.Requires(status, nameof(status)).IsNotNull(); Condition.Requires(languageCode, nameof(languageCode)).IsNotNull(); this.Identifier = identifier; this.Prescriber = prescriber; this.Patient = patient; this.HealthFacility = healthFacility; this.Status = status; this.CreatedOn = createdOn; this.DelivrableAt = delivrableAt; this.LanguageCode = languageCode; }
/// <summary> /// Gets the current health facility balance for <paramref name="facility"/> of item with <paramref name="gtin"/> or creates if necessary /// </summary> /// <param name="facility">The facility to query for current balance</param> /// <param name="gtin">The GTIN of the item to retrieve the balance for</param> /// <param name="lot">The lot number to retrieve the balance</param> /// <returns></returns> private HealthFacilityBalance GetCurrentBalance(HealthFacility facility, String gtin, String lot) { if (facility == null) { throw new ArgumentNullException("facility"); } else if (String.IsNullOrEmpty(gtin)) { throw new ArgumentNullException("gtin"); } else if (String.IsNullOrEmpty(lot)) { throw new ArgumentNullException("lot"); } // Current balance HealthFacilityBalance balance = HealthFacilityBalance.GetHealthFacilityBalanceByHealthFacilityCode(facility.Code).Find(o => o.Gtin == gtin && o.LotNumber == lot); if (balance == null) { balance = new HealthFacilityBalance() { Balance = 0, Gtin = gtin, HealthFacilityCode = facility.Code, LotNumber = lot }; HealthFacilityBalance.Insert(balance); } return(balance); }
/// <summary> /// Update an order /// </summary> protected void btnUpdateAndOrder_Click(object sender, EventArgs e) { // Update the balance // TODO: This should be in a BLL object eventually this.btnUpdateBalance_Click(sender, e); try { int hfId; if (Request.QueryString["hfId"] != null) { hfId = int.Parse(Request.QueryString["hfId"].ToString()); } else { hfId = CurrentEnvironment.LoggedUser.HealthFacilityId; } OrderManagementLogic oml = new OrderManagementLogic(); var orderData = oml.RequestOrderFromDrp(HealthFacility.GetHealthFacilityById(hfId), CurrentEnvironment.LoggedUser.Id); // Redirect to the transfer order we created Response.Redirect(String.Format("{0}?OrderNum={1}", "TransferOrderDetail.aspx", orderData.OrderNum)); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); lblSuccess.Visible = false; lblError.Visible = true; } }
protected void btnSearch_Click(object sender, EventArgs e) { string wsearch = txtName.Text.Replace("'", @"''"); string csearch = txtCode.Text.Replace("'", @"''"); string s = string.Empty; string hf = string.Empty; if (Session["_healthfacility"] != null) { hf = Session["_healthfacility"].ToString(); } if (!string.IsNullOrEmpty(hf)) { s = HealthFacility.GetAllChildsForOneHealthFacility(int.Parse(hf)); } odsHealthFacility.SelectParameters.Clear(); odsHealthFacility.SelectParameters.Add("name", wsearch.ToUpper()); odsHealthFacility.SelectParameters.Add("code", csearch.ToUpper()); odsHealthFacility.SelectParameters.Add("hfid", s); Session["HealthFacilityList-Name"] = wsearch; Session["HealthFacilityList-Code"] = csearch; Session["HealthFacilityList-HFID"] = s; }
protected void ddlItem_SelectedIndexChanged(object sender, EventArgs e) { if ((CurrentEnvironment.LoggedUser != null)) { int hfId = CurrentEnvironment.LoggedUser.HealthFacilityId; string _hfId = (string)Request.QueryString["hfId"]; if (!String.IsNullOrEmpty(_hfId)) { int.TryParse(_hfId, out hfId); } string s = HealthFacility.GetAllChildsForOneHealthFacility(hfId); string where = string.Format(@" AND (""VACCINATION_EVENT"".""HEALTH_FACILITY_ID"" in ({0})) ", s); string tmp = where; HttpContext.Current.Session["VaccinationActivityReport-TempWhere"] = tmp; int year = int.Parse(ddlYear.SelectedValue); if (year != -1) { where += string.Format(@" AND EXTRACT(YEAR FROM ""VACCINATION_EVENT"".""VACCINATION_DATE"")::INTEGER = {0} ", year); } HttpContext.Current.Session["VaccinationActivityReport-Where"] = where; string language = CurrentEnvironment.Language; int languageId = int.Parse(language); DataTable dt = VaccinationActivity.GetVaccinationActivity(languageId, where, Session["__Months"].ToString(), int.Parse(ddlItem.SelectedValue)); DataTable source = GetDataTable(dt, tmp, languageId); string url = VaccinationActivityReportGraphHelper.GetUrl(source, this.lblTitle.Text); iActivityReport.Text = String.Format("<img src='{0}' alt='' />", url.Replace(" ", "")); } }
public async Task <string> CreateHealthFacility(IDocumentSession session) { var values = new Dictionary <string, object> { { "Name", "Clinique du pied" }, { "Address", new { StreetNumber = 2241, Route = "Asselin Street", Place = "Longueuil", Region = "QC", Country = "Canada" } }, { "Phones", new[] { new { Value = "5146072767", Use = "main", System = "phone" }, new { Value = "5555555555", Use = "main", System = "fax" } } }, { "BathroomCount", 2 } }; var healthFacility = new HealthFacility("pharmacy") { Values = values }; session.Store(healthFacility); await session.SaveChangesAsync(); return(healthFacility.Id); }
protected void btnSearch_Click(object sender, EventArgs e) { DateTime dateto = new DateTime(); DateTime datefrom = new DateTime(); string format = ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString(); if (!string.IsNullOrEmpty(txtBirthdateFrom.Text)) { datefrom = DateTime.ParseExact(txtBirthdateFrom.Text, format, CultureInfo.CurrentCulture); } if (!string.IsNullOrEmpty(txtBirthdateTo.Text)) { dateto = DateTime.ParseExact(txtBirthdateTo.Text, format, CultureInfo.CurrentCulture); } string s = string.Empty, hf = string.Empty; if (Session["_hfChildSearch"] != null) { hf = Session["_hfChildSearch"].ToString(); } if (!string.IsNullOrEmpty(hf) && hf != "1") { s = HealthFacility.GetAllChildsForOneHealthFacility(int.Parse(hf)); } Session["_systemIdChildListNew"] = txtSystemId.Text.Replace("'", @"''").ToUpper(); Session["_idFieldsChildListNew"] = txtIdFields.Text.Replace("'", @"''").ToUpper(); Session["_barcodeIdChildListNew"] = txtBarcode.Text.Replace("'", @"''").ToUpper(); Session["_tempIdChildListNew"] = txtTempId.Text.Replace("'", @"''").ToUpper(); Session["_firstname1ChildListNew"] = txtFirstname1.Text.Replace("'", @"''").ToUpper(); Session["_lastname1ChildListNew"] = txtLastname1.Text.Replace("'", @"''").ToUpper(); Session["_motherfirstname1ChildListNew"] = txtMotherFirstname.Text.Replace("'", @"''").ToUpper(); Session["_motherlastname1ChildListNew"] = txtMotherLastname.Text.Replace("'", @"''").ToUpper(); Session["_birthdateFromChildListNew"] = datefrom.ToString("yyyy-MM-dd"); Session["_birthdateToChildListNew"] = dateto.ToString("yyyy-MM-dd"); Session["_healthCenterIdChildListNew"] = s.ToString(); if (ddlBirthplace.SelectedIndex > 0) { Session["_birthplace"] = ddlBirthplace.SelectedValue.ToString(); } Session["_statusChildListNew"] = ddlStatus.SelectedValue; if (HttpContext.Current.Session["_barcodeIdChildListNew"] != null) { if (!String.IsNullOrEmpty(HttpContext.Current.Session["_barcodeIdChildListNew"].ToString())) { //redirect to child page Child child = Child.GetChildByBarcode(HttpContext.Current.Session["_barcodeIdChildListNew"].ToString()); if (child != null) { ClearSession(); Response.Redirect(string.Format("Child.aspx?id={0}", child.Id)); } } } Response.Redirect("ChildListNewSearch.aspx"); }
/// <summary> /// Allocate stock /// </summary> /// <param name="facility">The facility in which to allocate stock</param> /// <param name="gtin">The GTIN of the stock to be allocated</param> /// <param name="lot">The lot number of stock to be allocated</param> /// <param name="qty">The amount of stock to be allocated</param> /// <returns>The <see cref="T:GIIS.DataLayer.ItemTransaction"/> representing the allocation</returns> public ItemTransaction Allocate(HealthFacility facility, String gtin, String lot, Int32 qty, TransferOrderDetail orderLine, Int32 modifiedBy) { // Sanity check if (facility == null) { throw new ArgumentNullException("facility"); } else if (String.IsNullOrEmpty(gtin)) { throw new ArgumentNullException("gtin"); } else if (String.IsNullOrEmpty(lot)) { throw new ArgumentNullException("lot"); } // Adjustment type TransactionType allocationType = TransactionType.GetTransactionTypeList().FirstOrDefault(o => o.Name == "Allocation"); if (allocationType == null) { throw new InvalidOperationException("Cannot find transaction type 'Allocation'"); } // Get current balance and ensure we have enough to do the balance var balance = this.GetCurrentBalance(facility, gtin, lot); //if (qty > 0 && balance.Balance < qty) // throw new InvalidOperationException(String.Format("Cannot de-allocate more stock than is available (Request: {0}, Available:{1}, GTIN: {2})", qty, balance, ItemLot.GetItemLotByGtin(gtin).ItemObject.Name)); //else if (qty < 0 && balance.Allocated < -qty) // throw new InvalidOperationException("Cannot de-allocate more stock than is currently allocated"); // Create an item transaction ItemTransaction retVal = new ItemTransaction() { Gtin = gtin, GtinLot = lot, HealthFacilityCode = facility.Code, ModifiedBy = modifiedBy, ModifiedOn = DateTime.Now, RefId = orderLine != null?orderLine.OrderNum.ToString() : null, RefIdNum = orderLine != null ? orderLine.OrderDetailNum : 0, TransactionDate = DateTime.Now, TransactionQtyInBaseUom = qty, TransactionTypeId = allocationType.Id }; // Update the balance //balance.Balance -= qty; balance.Allocated += qty; // Save HealthFacilityBalance.Update(balance); retVal.Id = ItemTransaction.Insert(retVal); return(retVal); }
public static PharmaceuticalPrescription Create(PrescriptionIdentifier identifier, HealthcareProvider prescriber, Patient patient, HealthFacility healthFacility, IEnumerable <PrescribedMedication> prescribedMedications, Alpha2LanguageCode languageCode, DateTime?delivrableAt = null) { return(Create(identifier, prescriber, patient, healthFacility, prescribedMedications, DateTime.Now, languageCode, delivrableAt)); }
/// <summary> /// Performs a stock count for the specified <paramref name="gtin"/> at <paramref name="facility"/> /// </summary> /// <param name="facility">The facility in which the count occurred</param> /// <param name="gtin">The GTIN of the item being counted</param> /// <param name="lot">The lot number of the item being counted</param> /// <param name="count">The count of items</param> /// <returns>The <see cref="T:GIIS.DataLayer.ItemTransaction"/> representing the count</returns> public ItemTransaction StockCount(HealthFacility facility, String gtin, String lot, UInt32 count, Int32 modifiedBy, DateTime date) { // Validate if (facility == null) { throw new ArgumentNullException("facility"); } else if (String.IsNullOrEmpty(gtin)) { throw new ArgumentNullException("gtin"); } else if (String.IsNullOrEmpty(lot)) { throw new ArgumentNullException("lot"); } // Stock Count TransactionType stockCountType = TransactionType.GetTransactionTypeList().FirstOrDefault(o => o.Name == "Stock Count"); if (stockCountType == null) { throw new InvalidOperationException("Cannot find transaction type 'Stock Count'"); } // Balance var balance = this.GetCurrentBalance(facility, gtin, lot); // Now we want to create transaction for count operation ItemTransaction retVal = new ItemTransaction() { Gtin = gtin, GtinLot = lot, HealthFacilityCode = facility.Code, ModifiedBy = modifiedBy, ModifiedOn = DateTime.Now, TransactionDate = date, TransactionQtyInBaseUom = count, TransactionTypeId = stockCountType.Id }; // Overwrite the values int qty = (int)(balance.Balance - count); if (qty > 0) { Adjust(facility, gtin, lot, qty, AdjustmentReason.GetAdjustmentReasonById(99), modifiedBy, date); } balance.StockCount = balance.Balance = count; // Save HealthFacilityBalance.Update(balance); int i = ItemTransaction.Insert(retVal); return(ItemTransaction.GetItemTransactionById(i)); }
protected bool gtinExists(string gtin) { if (HealthFacility.GetHealthFacilityByName(gtin) != null) { lblSuccess.Visible = false; lblWarning.Visible = true; lblError.Visible = false; return(true); } return(false); }
//za json(Sys updateer) public async Task UpdateFacility(HealthFacility healthFacilities) { if (healthFacilities != null) { await _repository.UpdateFacility(healthFacilities); } else { throw new Exception("Facility is null"); } }
protected bool codeExists(string code) { if (HealthFacility.GetHealthFacilityByCode(code) != null) { lblSuccess.Visible = false; lblWarning.Visible = true; lblError.Visible = false; return(true); } return(false); }
protected void btnUpdateBalance_Click(object sender, EventArgs e) { try { int hfId = CurrentEnvironment.LoggedUser.HealthFacilityId; string _hfId = (string)Request.QueryString["hfId"]; if (!String.IsNullOrEmpty(_hfId)) { int.TryParse(_hfId, out hfId); } foreach (GridViewRow gr in gvHealthFacilityBalance.Rows) { if (gr.RowType == DataControlRowType.DataRow) { TextBox txtQty = (TextBox)gr.FindControl("txtQty"); if (!string.IsNullOrEmpty(txtQty.Text)) { UInt32 qty = UInt32.Parse(txtQty.Text.Trim()); string gtin = gr.Cells[1].Text; string lotno = gr.Cells[3].Text; DateTime date = DateTime.ParseExact(txtDate.Text, ConfigurationDate.GetConfigurationDateById(int.Parse(Configuration.GetConfigurationByName("DateFormat").Value)).DateFormat.ToString(), CultureInfo.CurrentCulture); HealthFacility hf = HealthFacility.GetHealthFacilityById(hfId); StockManagementLogic sml = new StockManagementLogic(); ItemTransaction st = sml.StockCount(hf, gtin, lotno, qty, CurrentEnvironment.LoggedUser.Id, date); int i = st.Id; if (i > 0) { lblSuccess.Visible = true; lblError.Visible = false; } else { lblSuccess.Visible = false; lblError.Visible = true; } } } } odsHealthFacilityBalance.SelectParameters.Clear(); odsHealthFacilityBalance.SelectParameters.Add("id", hfId.ToString()); odsHealthFacilityBalance.DataBind(); } catch (Exception ex) { lblSuccess.Visible = false; lblError.Visible = true; } }
public async Task UpdateFacility(HealthFacility healthFacility) { var Facility = await _context.HealthFacilities.Where(x => x.Id == healthFacility.Id).FirstOrDefaultAsync(); Facility.Address = healthFacility.Address; Facility.Email = healthFacility.Email; Facility.Municipality = healthFacility.Municipality; Facility.Name = healthFacility.Name; Facility.Phone = healthFacility.Phone; Facility.Type = healthFacility.Type; await _context.SaveChangesAsync(); }
public void AllocationTest() { StockManagementLogic stockLogic = new StockManagementLogic(); // Assertion of initial stock balances HealthFacilityBalance balance = HealthFacilityBalance.GetHealthFacilityBalanceByHealthFacilityCode("HF888").Find(o => o.Gtin == TestData.GTIN_UNDER_TEST); int preBalance = (int)balance.Allocated; stockLogic.Allocate(HealthFacility.GetHealthFacilityByCode("HF888"), TestData.GTIN_UNDER_TEST, balance.LotNumber, 100, null, 1); // Get the new balance balance = HealthFacilityBalance.GetHealthFacilityBalanceByHealthFacilityCode("HF888").Find(o => o.Gtin == TestData.GTIN_UNDER_TEST); Assert.AreEqual(preBalance + 100, balance.Allocated); }
//Healthcare workers public void GetProcessedHealthcareWorkersFromJSON() { try { var client = new WebClient(); var jsonW = client.DownloadString(@"http://www.otvorenipodatoci.gov.mk/datastore/dump/5b661887-685b-4189-b6bb-9b52eb8ace16?format=json"); var jsonResponseW = JObject.Parse(jsonW); var recordsW = JArray.Parse(jsonResponseW.GetValue("records").ToString()); foreach (var rec in recordsW) { dynamic obj = JsonConvert.DeserializeObject(rec.ToString()); var Name = Convert.ToString(obj[4]); var Branch = Convert.ToString(obj[2]); var FacilityName = Convert.ToString(obj[1]); var Title = Convert.ToString(obj[3]); HealthFacility facility = _repo.GetFacilityJSON(Convert.ToString(FacilityName)); if (facility != null && facility != default) { HealthFacility Facility = new HealthFacility( facility.Name, facility.Municipality, facility.Address, facility.Type, facility.Email, facility.Phone ); HealthcareWorker healthcareWorker = new HealthcareWorker(Name, Branch, Facility, Title); _service.AddWorker(healthcareWorker); } else { HealthFacility Facility = new HealthFacility( Convert.ToString(FacilityName), "", "", Convert.ToString(Branch), "", "" ); HealthcareWorker healthcareWorker = new HealthcareWorker(Name, Branch, Facility, Title); _service.AddWorker(healthcareWorker); } } } catch (Exception e) { _logger.LogInformation(e.Message); } }
private void BindByHealthFacilityMonthYear(int healthfacilityid, int month, int year) { DateTime monthDate = new DateTime(year, month, DateTime.DaysInMonth(year, month)); int maximumRows = int.MaxValue; int startRowIndex = 0; gvVaccinationEvent.DataSource = VaccinationEvent.GetMonthlyPlan(ref maximumRows, ref startRowIndex, healthfacilityid, monthDate); gvVaccinationEvent.DataBind(); string s = HealthFacility.GetAllChildsForOneHealthFacility(healthfacilityid); gvTotalVaccinesRequired.DataSource = VaccineQuantity.GetQuantityMonthlyPlan(s, monthDate); gvTotalVaccinesRequired.DataBind(); }
public string[] GetSubVaccinationPoints(string prefixText, int count) { //-----I defined a parameter instead of passing value directly to //prevent SQL injection--------// Trie hfTrie = (Trie)Context.Cache["SubVPTrie"]; if (hfTrie == null) { String query = @"select ""ID"", ""NAME"" from ""HEALTH_FACILITY"" Where ""VACCINATION_POINT"" = true AND ""IS_ACTIVE"" = true "; // ""NAME"" ilike '" + prefixText.ToLower() + "%'"; //cmd.Parameters.AddWithValue("@myParameter", "%" + prefixText + "%"); HealthFacility hf = HealthFacility.GetHealthFacilityById(CurrentEnvironment.LoggedUser.HealthFacilityId); if (!hf.TopLevel) { string s = HealthFacility.GetAllChildsForOneHealthFacility(hf.Id); query += String.Format(@" AND ""ID"" in ({0})", s); } DataTable dt = DBManager.ExecuteReaderCommand(query, CommandType.Text, null); hfTrie = new Trie(); foreach (DataRow row in dt.Rows) { hfTrie.Add(row[1].ToString() + "," + row[0].ToString()); } Context.Cache["SubVPTrie"] = hfTrie; } //Then return List of string(txtItems) as result List <string> txtItems = new List <string>(); // String dbValues; txtItems = hfTrie.GetCompletionList(prefixText, count); List <string> list = new List <string>(); for (int i = 0; i < txtItems.Count; i++) { int indx = txtItems[i].IndexOf(","); string f = txtItems[i].Substring(0, indx); string l = txtItems[i].Substring(indx + 1); list.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(f, l)); } //foreach (DataRow row in dt.Rows) //{ // txtItems.Add(AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(row[1].ToString(), row[0].ToString())); //} return(list.ToArray()); }
protected void btnSearch_Click(object sender, EventArgs e) { if ((CurrentEnvironment.LoggedUser != null)) { int hfId = CurrentEnvironment.LoggedUser.HealthFacilityId; string _hfId = Request.QueryString["hfId"].ToString(); if (!String.IsNullOrEmpty(_hfId)) { int.TryParse(_hfId, out hfId); } string s = HealthFacility.GetAllChildsForOneHealthFacility(hfId); string where = string.Format(" AND (\"ADMINISTRATION_ID\" in ({0})) ", s); if (!string.IsNullOrEmpty(txtFirstName.Text)) { where += string.Format(@" AND UPPER(""FIRSTNAME"") LIKE '%{0}%' ", txtFirstName.Text.Replace("'", @"''").ToUpper()); } if (!string.IsNullOrEmpty(txtLastname.Text)) { where += string.Format(@" AND UPPER(""LASTNAME"") LIKE '%{0}%' ", txtLastname.Text.Replace("'", @"''").ToUpper()); } if (domicileId != null) { where += string.Format(@" AND ""DOMICILE_ID"" = {0} ", domicileId); } int year = int.Parse(ddlYear.SelectedValue); if (year != -1) { where += string.Format(@" AND EXTRACT(YEAR FROM to_date(""BIRTHDATE"", get_date_format())) = {0} ", year); } //domicileId = null; //string language = CurrentEnvironment.Language; //int languageId = int.Parse(language); //gvRegister.DataSource = Register.GetRegister(languageId, where); //gvRegister.DataBind(); Session["_whereRegister"] = where; Response.Redirect(Request.RawUrl); } }
protected void ddlHealthFacilityFrom_SelectedIndexChanged(object sender, EventArgs e) { if (CurrentEnvironment.LoggedUser != null) { HealthFacility currentHealhFacility = CurrentEnvironment.LoggedUser.HealthFacility; if (currentHealhFacility != null) { //load health facility from List <HealthFacility> healthFacilityListTo = HealthFacility.GetHealthFacilityListByTypeId(currentHealhFacility.TypeId); List <HealthFacility> healthFacilityListTo1 = HealthFacility.GetHealthFacilityByParentId(CurrentEnvironment.LoggedUser.HealthFacilityId); healthFacilityListTo.AddRange(healthFacilityListTo1); HealthFacility tmp = null; foreach (HealthFacility hf in healthFacilityListTo) { if (hf.Code == ddlHealthFacilityFrom.SelectedValue) { tmp = hf; } } if (tmp != null) { healthFacilityListTo.Remove(tmp); } ddlHealthFacilityTo.DataSource = healthFacilityListTo; //apply disable logic on health facility to if (currentHealhFacility.Parent != null) { if (ddlHealthFacilityFrom.SelectedValue == currentHealhFacility.Parent.Code) { ddlHealthFacilityTo.SelectedValue = currentHealhFacility.Code; ddlHealthFacilityTo.Enabled = false; } else { ddlHealthFacilityTo.Enabled = true; } } ddlHealthFacilityTo.DataBind(); } } }
/// <summary> /// Performs rollback of stock transaction for a vaccination event /// </summary> /// <param name="facility">The healthfacility where the vaccination event happened</param> /// <param name="vaccineLotId">The vaccine lot that was used in the vaccination event</param> public int ClearBalance(HealthFacility facility, int vaccineLotId) { if (vaccineLotId > 0) { ItemLot il = ItemLot.GetItemLotById(vaccineLotId); HealthFacilityBalance hb = HealthFacilityBalance.GetHealthFacilityBalance(facility.Code, il.Gtin, il.LotNumber); if (hb != null) { hb.Used -= 1; hb.Balance += 1; int i = HealthFacilityBalance.Update(hb); return(i); } } return(-1); }