protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strCamID = Request["CampaignID"]; if (!string.IsNullOrEmpty(strCamID)) { Camp = CampaignBLL.Get(strCamID.ToInt()); try { CoopOrgGeo1ID = Camp.CoopOrg.Geo1.ID; } catch (Exception) { } CampaignDetail1.CampaignID = Camp.ID; LabelTitle1.Text = "KẾT QUẢ XÉT NGHIỆM SÀNG LỌC"; GridView1.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strCamID = Request["CampaignID"]; if (!string.IsNullOrEmpty(strCamID)) { Camp = CampaignBLL.Get(strCamID.ToInt()); try { CoopOrgGeo1ID = Camp.CoopOrg.Geo1.ID; } catch (Exception) { } CampaignDetail1.CampaignID = Camp.ID; LabelTitle1.Text = "KẾT QUẢ XÉT NGHIỆM SÀNG LỌC"; GridView1.DataBind(); GridViewPackSum.DataSource = Camp.CollectedDonations.GroupBy(r => r.OrgVolume) .Select(r => new { Volume = r.Key, Count = r.Count(), }); GridViewPackSum.DataBind(); } } }
protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e) { e.Result = CampaignBLL.Get(new List <Guid>() { ProvinceID }, From, To, Campaign.TypeX.Short_run); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strCamID = Request["CampaignID"]; string rptType = Request["RptType"]; if (!string.IsNullOrEmpty(strCamID) && !string.IsNullOrEmpty(rptType)) { RptType = (ReportType)rptType.ToInt(); Camp = CampaignBLL.Get(strCamID.ToInt()); try { CoopOrgGeo1ID = Camp.CoopOrg.Geo1.ID; } catch (Exception) { } CampaignDetail1.CampaignID = Camp.ID; switch (RptType) { case ReportType.FourPosInCam: LabelTitle1.Text = "Danh sách kết quả xét nghiệm"; //LabelTitle2.Text = "Dương tính (Không bao gồm HIV)"; foreach (DataControlField item in GridView1.Columns) { if (item.HeaderText == "HIV") { item.Visible = false; } } break; case ReportType.NegInCam: LabelTitle1.Text = "Danh sách kết quả xét nghiệm"; //LabelTitle2.Text = "Âm tính"; break; case ReportType.HIVInCam: LabelTitle1.Text = "Danh sách kết quả xét nghiệm"; //LabelTitle2.Text = "Dương tính (Bao gồm HIV)"; break; default: break; } GridView1.DataBind(); divNote.Visible = (RptType == ReportType.HIVInCam) && IsSpecialProvince(); } } }
protected void LinqDataSourceUnCollect_Selecting(object sender, LinqDataSourceSelectEventArgs e) { if (CampaignDetail1.CampaignID > 0) { e.Result = CampaignBLL.Get(CampaignDetail1.CampaignID).Donations.Where(r => r.OrgPackID == null); } else { e.Cancel = true; } }
public void Count() { List <int> camIDL = CampaignBLL.Get(new List <Guid>() { ProvinceID }, From, To, Campaign.TypeX.Short_run).Select(r => r.ID).ToList(); this.Visible = camIDL.Count != 0; //Calc4Component(camIDL, TestDef.Component.Full, Pack.StatusX.Collected, lblFullNonTR, lblFullPos, lblFullNeg, lblFullDeliver, lblFullExpire, lblFullDelete); //Calc4Component(camIDL, TestDef.Component.PlateletApheresis, Pack.StatusX.Collected, lblPlateletApheresisNonTR, lblPlateletApheresisPos, lblPlateletApheresisNeg, lblPlateletApheresisDeliver, lblPlateletApheresisExpire, lblPlateletApheresisDelete); }
protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e) { List <Donation> list = CampaignBLL.Get(CampaignDetail1.CampaignID).CollectedDonations.ToList(); e.Result = RedBloodSystem.checkingInfection.Select(r1 => new { r1.Name, PosList = list.Where(r2 => r1.Decode(r2.InfectiousMarkers) == TR.pos.Name), NAList = list.Where(r2 => r1.Decode(r2.InfectiousMarkers) == TR.na.Name), }) .Where(r => r.PosList.Count() > 0 || r.NAList.Count() > 0); }
protected void LinqDataSourcePackLock_Selecting(object sender, LinqDataSourceSelectEventArgs e) { if (CampaignDetail1.CampaignID > 0) { e.Result = CampaignBLL.Get(CampaignDetail1.CampaignID).CollectedDonations .ToList() .Where(r => r.IsTRLocked); } else { e.Cancel = true; } }
public void LoadCampaign() { Campaign e = CampaignBLL.Get(CampaignID); if (e == null) { } else { ImageCodabar.ImageUrl = BarcodeBLL.Url4Campaign(e.ID); lblName.Text = e.Name; if (e.Date != null) { lblDate.Text = e.Date.ToStringVN_Hour(); } if (e.Source != null) { lblSrc.Text = "Nguồn: " + e.Source.Name; } if (e.Est != null) { lblEst.Text = "SL: " + e.Est.Value.ToString(); } if (e.CoopOrgID != null) { lblCoopOrg.Text = "Tổ chức: " + e.CoopOrg.Name; } if (e.HostOrgID != null) { lblHostOrg.Text = "Địa điểm: " + e.HostOrg.Name; } if (!string.IsNullOrEmpty(e.ContactName)) { lblContactName.Text = "Người LH: " + e.ContactName; lblTitle.Text = "Chức vụ: " + e.ContactTitle; lblPhone.Text = "ĐT: " + e.ContactPhone; } lblNote.Text = "Ghi chú: " + e.Note; } }
public void LoadCampaign() { Campaign e = CampaignBLL.Get(CampaignID); if (e == null) { } else { imgCodabar.ImageUrl = BarcodeBLL.Url4Campaign(e.ID); txtName.Text = e.Name; if (e.Est != null) { txtEst.Text = e.Est.Value.ToString(); } if (e.Date != null) { txtDate.Text = e.Date.ToStringVN_Hour(); } ddlSource.SelectedValue = e.SourceID.ToString(); if (e.Type == Campaign.TypeX.Long_run) //Infinity campaign { chkInfiCam.Checked = true; } if (e.CoopOrgID != null) { txtCoopOrgName.Text = e.CoopOrg.Name; } if (e.HostOrgID != null) { txtHostOrgName.Text = e.HostOrg.Name; } txtContactName.Text = e.ContactName; txtContactPhone.Text = e.ContactPhone; txtContactTitle.Text = e.ContactTitle; txtNote.Text = e.Note; } }
public void LoadCampaign() { Campaign e = CampaignBLL.Get(CampaignID); if (e == null) { } else { ImageCodabar.ImageUrl = BarcodeBLL.Url4Campaign(e.ID); lblName.Text = e.Name; if (e.Date != null) { lblDate.Text = e.Date.ToStringVN_Hour(); } if (e.Source != null) { lblSrc.Text = "Nguồn: " + e.Source.Name; } if (e.Est != null) { //lblEst.Text = "SL: " + e.Est.Value.ToString(); } if (e.CoopOrgID != null) { lblCoopOrg.Text = "Đơn vị phối hợp: " + e.CoopOrg.Name; } if (e.HostOrgID != null) { lblHostOrg.Text = "Địa điểm tổ chức: " + e.HostOrg.Name; } lblNote.Text = "Ghi chú: " + e.Note; } }
protected void btnUpdate_Click(object sender, EventArgs e) { if (CampaignID == 0) { Campaign p = new Campaign(); if (LoadFromGUI(p)) { CampaignBLL.New(p); CampaignID = p.ID; } else { return; } } else { RedBloodDataContext db = new RedBloodDataContext(); Campaign p = CampaignBLL.Get(CampaignID, db); if (p == null) { return; } if (LoadFromGUI(p)) { db.SubmitChanges(); CampaignID = p.ID; } else { return; } } Page.Alert("Lưu thành công."); }
protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e) { var v = CampaignBLL.Get(new List <Guid>() { ProvinceID }, From, To, Campaign.TypeX.Short_run); e.Result = v.ToList().Select(r => new { r.ID, r.Name, Date = r.Date.HasValue ? r.Date.ToStringVN() : "", SourceName = r.Source != null ? r.Source.Name : "", CoopOrg = r.CoopOrg != null ? r.CoopOrg.Name : "", HostOrg = r.HostOrg != null ? r.HostOrg.Name : "", PacksCount = r.Donations.Count.ToString(), r.Est, CountPack350 = r.Donations.Where(r1 => r1.OrgVolume == "350").Count(), CountPack450 = r.Donations.Where(r1 => r1.OrgVolume == "450").Count(), CountPack250 = r.Donations.Where(r1 => r1.OrgVolume == "250").Count(), r.Note, }); }
//isSOD: isStartOfDate //public static void ScanExp(bool isSOD) //{ //if (!isSOD || !LogBLL.IsLog(Task.TaskX.ScanExp)) //{ // RedBloodDataContext db = new RedBloodDataContext(); // List<Pack.StatusX> statusList = new List<Pack.StatusX> { Pack.StatusX.Product }; // IQueryable<Pack> rs = db.Packs.Where(r => statusList.Contains(r.Status) && r.ExpirationDate < DateTime.Now.Date); // foreach (Pack r in rs) // { // PackStatusHistory h = PackBLL.Update(db, r, Pack.StatusX.Expired, RedBloodSystem.SODActor, ""); // if (h != null) db.PackStatusHistories.InsertOnSubmit(h); // } // db.SubmitChanges(); // LogBLL.Add(Task.TaskX.ScanExp); //} //} //isSOD: isStartOfDate //public static void CloseOrder(bool isSOD) //{ // //if (!isSOD || !LogBLL.IsLog(Task.TaskX.CloseOrder)) // //{ // // RedBloodDataContext db = new RedBloodDataContext(); // // OrderBLL.CloseOrder(db); // // db.SubmitChanges(); // // LogBLL.Add(Task.TaskX.CloseOrder); // //} //} //isSOD: isStartOfDate //public static void LockTestResult() //{ //if (!isSOD || !LogBLL.IsLog(Task.TaskX.LockEnterTestResult)) //{ // RedBloodDataContext db = new RedBloodDataContext(); // PackBLL.LockEnterTestResult(); // db.SubmitChanges(); // LogBLL.Add(Task.TaskX.LockEnterTestResult); //} //} /// <summary> /// if true, count remaining packs directly in store /// else count by sum up the remaining of previous date and total transaction in day /// </summary> /// <param name="date"></param> /// <returns></returns> //static bool IsCountDirectly(DateTime date) //{ // RedBloodDataContext db = new RedBloodDataContext(); // bool isCountDirectly = false; // //new system, no data // if (db.PackTransactions.Count() == 0) // isCountDirectly = true; // else // { // if (lastPackTransactionDate == null) throw new Exception(""); // else // { // GetLastTransactionDate(); // //All pack transactions were in the previous of the date. // if (lastPackTransactionDate.Value.Date <= date.Date) // isCountDirectly = true; // } // } // return isCountDirectly; //} public static void Find(HttpResponse Response, TextBox txtCode) { if (txtCode == null) { return; } string key = txtCode.Text.Trim(); if (key.Length == 0) { return; } string pattern = @"\d+"; Regex regx = new Regex(pattern); if (BarcodeBLL.IsValidPeopleCode(key)) { People r = PeopleBLL.GetByCode(key); if (r != null) { Response.Redirect(RedBloodSystem.Url4PeopleDetail + "key=" + r.ID.ToString()); } } else if (BarcodeBLL.IsValidDINCode(key)) { Response.Redirect(RedBloodSystem.Url4PackDetail + "key=" + BarcodeBLL.ParseDIN(key)); } else if (BarcodeBLL.IsValidCampaignCode(key)) { Campaign r = CampaignBLL.Get(BarcodeBLL.ParseCampaignID(key)); if (r != null) { Response.Redirect(RedBloodSystem.Url4CampaignDetail + "key=" + r.ID.ToString()); } } else if (BarcodeBLL.IsValidOrderCode(key)) { Order r = OrderBLL.Get(BarcodeBLL.ParseOrderID(key)); if (r != null) { Response.Redirect(RedBloodSystem.Url4Order4CR + "key=" + r.ID.ToString()); } } //TODO: Search by name else if (key.Length > 3 && key.Substring(0, 3) == "/n:") { Response.Redirect(RedBloodSystem.Url4FindPeople + "key=" + key.Substring(3).Trim()); } else if (regx.IsMatch(key) && key.Length >= BarcodeBLL.CMNDLength.ToInt()) { People r = PeopleBLL.GetByCMND(key); if (r != null) { Response.Redirect(RedBloodSystem.Url4PeopleDetail + "key=" + r.ID.ToString()); } } txtCode.Text = ""; }
public static void Importing() { //Validate database before insert List <string> importedGeo = new List <string>(); RedBloodDataContext importDB; try { importDB = new RedBloodDataContext(ConfigurationManager.ConnectionStrings["ImportingRedBlood_DBConnectionString"].ConnectionString); //try to load whatever data to test connection importDB.Sexes.ToList(); } catch (Exception ex) { throw ex; } string strImportWithInDays = ConfigurationManager.AppSettings["ImportWithInDays"]; int importWithInDays = 1; if (!string.IsNullOrEmpty(strImportWithInDays)) { importWithInDays = strImportWithInDays.ToInt(); } if (importWithInDays < 1) { importWithInDays = 1; } List <Donation> importDINList = importDB.Donations .Where(r => r.CollectedDate.HasValue && (DateTime.Now.Date - r.CollectedDate.Value.Date).Days <= importWithInDays - 1 && r.PeopleID.HasValue && r.CampaignID.HasValue ) .ToList(); RedBloodDataContext db = new RedBloodDataContext(); foreach (Donation item in importDINList) { //Validate DIN Donation innerDIN = DonationBLL.Get(item.DIN); if (innerDIN == null || innerDIN.CollectedDate.HasValue || innerDIN.PeopleID.HasValue ) { continue; } //Campaign Campaign innerCam = CampaignBLL.Get(item.CampaignID.Value); if (innerCam == null) { continue; } //People if (item.People == null) { continue; } Guid?peopleID = ImportPeople(db, item.People); if (!peopleID.HasValue || peopleID.Value == Guid.Empty) { continue; } //Import DIN DonationBLL.Assign(innerDIN.DIN, peopleID.Value, innerCam.ID, item.CollectedDate, item.Actor); //PackBLL.CreateOriginal(innerDIN.DIN, item.Pack.ProductCode, item.Volume.Value); DonationBLL.Update(innerDIN.DIN, item.BloodGroup, "ImportingFromMDF"); DonationBLL.UpdateCollector(innerDIN.DIN, item.Collector); } }
public static IEnumerable <Donation> Get(int campaignID) { return(CampaignBLL.Get(campaignID).Donations); }
public static List <Donation> GetUnLock(int campaignID) { return(CampaignBLL.Get(campaignID).CollectedDonations .ToList() .Where(r => !r.IsTRLocked).ToList()); }