protected override void AttachChildControls() { this.litReferralRegisterresults = (Literal)this.FindControl("litReferralRegisterresults"); this.litRefuseReason = (Literal)this.FindControl("litRefuseReason"); this.hidIsTrueOrFalse = (HtmlInputHidden)this.FindControl("hidIsTrueOrFalse"); PageTitle.AddSiteNameTitle("我要成为分销员"); ReferralInfo referralInfo = Users.GetReferralInfo(HiContext.Current.UserId); if (referralInfo != null) { if (referralInfo.ReferralStatus == 2) { this.Page.Response.Redirect("/user/PopularizeGift.aspx"); } else if (referralInfo.ReferralStatus == 1) { this.litReferralRegisterresults.Text = "您提交的申请正在审核中,请耐心等待审核结果。"; this.hidIsTrueOrFalse.Value = "1"; } else if (referralInfo.ReferralStatus == 3) { this.litReferralRegisterresults.Text = ""; if (!string.IsNullOrEmpty(referralInfo.RefusalReason)) { this.litRefuseReason.Text = "理由:" + referralInfo.RefusalReason; } this.hidIsTrueOrFalse.Value = "0"; } } else { this.Page.Response.Redirect("/user/ReferralRegisterAgreement.aspx"); } }
/// <summary> Creates an LdapResponse using an LdapException. /// Used to wake up the user following an abandon. /// Note: The abandon doesn't have to be user initiated /// but may be the result of error conditions. /// /// Referral information is available if this connection created solely /// to follow a referral. /// /// </summary> /// <param name="ex"> The exception /// /// </param> /// <param name="activeReferral"> The referral actually used to create the /// connection /// </param> public LdapResponse(InterThreadException ex, ReferralInfo activeReferral) { exception = ex; this.activeReferral = activeReferral; return; }
private EMKServise.ReferralInfo ConvertReferralInfo(ReferralInfo c) { if ((object)c != null) { EMKServise.ReferralInfo eri = new EMKServise.ReferralInfo(); eri.HospitalizationOrder = c.HospitalizationOrder; if (c.IdReferralMis != "") { eri.IdReferralMis = c.IdReferralMis; } eri.IdReferralType = c.IdReferralType; if (c.IssuedDateTime != DateTime.MinValue) { eri.IssuedDateTime = c.IssuedDateTime; } if (c.MkbCode != "") { eri.MkbCode = c.MkbCode; } if (c.Reason != "") { eri.Reason = c.Reason; } return(eri); } else { return(null); } }
protected override void AttachChildControls() { this.txtRealName = (TextBox)this.FindControl("txtRealName"); this.txtAddress = (TextBox)this.FindControl("txtAddress"); this.regionText = (HtmlInputHidden)this.FindControl("regionText"); this.region = (HtmlInputHidden)this.FindControl("region"); this.hdLink = (HiddenField)this.FindControl("hdLink"); this.txtEmail = (TextBox)this.FindControl("txtEmail"); this.txtPhone = (TextBox)this.FindControl("txtPhone"); this.hidValidateRealName = (HtmlInputHidden)this.FindControl("hidValidateRealName"); this.hidValidatePhone = (HtmlInputHidden)this.FindControl("hidValidatePhone"); this.hidValidateEmail = (HtmlInputHidden)this.FindControl("hidValidateEmail"); this.hidValidateAddress = (HtmlInputHidden)this.FindControl("hidValidateAddress"); this.hidIsPromoterValidatePhone = (HtmlInputHidden)this.FindControl("hidIsPromoterValidatePhone"); this.hdRegisterBecomePromoter = (HtmlInputHidden)this.FindControl("hdRegisterBecomePromoter"); this.hidOldBanner = (HtmlInputHidden)this.FindControl("hidOldBanner"); this.txtShopName = (TextBox)this.FindControl("txtShopName"); PageTitle.AddSiteNameTitle("分销员申请表单"); if (!this.Page.IsPostBack) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings.RegisterBecomePromoter) { MemberInfo user = HiContext.Current.User; MemberProcessor.ReferralRequest(HiContext.Current.UserId, user.RealName, user.CellPhone, user.TopRegionId, user.RegionId, user.Address, user.Email, "", ""); this.hdRegisterBecomePromoter.Value = "/appshop/SplittinRule.aspx"; Users.ClearUserCache(HiContext.Current.UserId, ""); } else { string promoterNeedInfo = masterSettings.PromoterNeedInfo; MemberInfo user2 = Users.GetUser(); ReferralInfo referralInfo = Users.GetReferralInfo(HiContext.Current.UserId); if (referralInfo != null && referralInfo.ReferralStatus != 0 && this.Page.Request.QueryString["again"] != "1") { this.Page.Response.Redirect($"/{HiContext.Current.GetClientPath}/ReferralRegisterresults.aspx"); } ReferralExtInfo referralExtInfo = new ReferralExtInfo(); if (referralInfo != null) { this.txtShopName.Text = referralInfo.ShopName; this.hidOldBanner.Value = referralInfo.BannerUrl; referralExtInfo = MemberProcessor.GetReferralExtInfo(referralInfo.RequetReason); } this.hdLink.Value = Globals.FullPath("/appshop/ReferralRegisterresults.aspx"); string fullRegion = RegionHelper.GetFullRegion((referralExtInfo.RegionId > 0) ? referralExtInfo.RegionId : user2.RegionId, " ", true, 0); this.txtAddress.Text = (string.IsNullOrEmpty(referralExtInfo.Address) ? user2.Address : referralExtInfo.Address); this.txtRealName.Text = (string.IsNullOrEmpty(referralExtInfo.RealName) ? user2.RealName : referralExtInfo.RealName); this.txtEmail.Text = (string.IsNullOrEmpty(referralExtInfo.Email) ? user2.Email : referralExtInfo.Email); this.txtPhone.Text = (string.IsNullOrEmpty(referralExtInfo.CellPhone) ? user2.CellPhone : referralExtInfo.CellPhone); this.hidValidateRealName.Value = (promoterNeedInfo.Contains("1") ? "1" : ""); this.hidValidatePhone.Value = (promoterNeedInfo.Contains("2") ? "1" : ""); this.hidValidateEmail.Value = (promoterNeedInfo.Contains("3") ? "1" : ""); this.hidValidateAddress.Value = (promoterNeedInfo.Contains("4") ? "1" : ""); this.hidIsPromoterValidatePhone.Value = (masterSettings.IsPromoterValidatePhone ? "1" : ""); this.regionText.SetWhenIsNotNull(fullRegion); this.region.SetWhenIsNotNull(((referralExtInfo.RegionId > 0) ? referralExtInfo.RegionId : user2.RegionId).ToString()); } } }
/// <summary> Returns the next result as an LdapEntry. /// /// If automatic referral following is disabled or if a referral /// was not followed, next() will throw an LdapReferralException /// when the referral is received. /// /// </summary> /// <returns> The next search result as an LdapEntry. /// /// </returns> /// <exception> LdapException A general exception which includes an error /// message and an Ldap error code. /// </exception> /// <exception> LdapReferralException A referral was received and not /// followed. /// </exception> public virtual LdapEntry next() { if (completed && (entryIndex >= entryCount) && (referenceIndex >= referenceCount)) { throw new ArgumentOutOfRangeException("LdapSearchResults.next() no more results"); } // Check if the enumeration is empty and must be reloaded resetVectors(); object element = null; // Check for Search References & deliver to app as they come in // We only get here if not following referrals/references if (referenceIndex < referenceCount) { string[] refs = (string[])(references[referenceIndex++]); LdapReferralException rex = new LdapReferralException(ExceptionMessages.REFERENCE_NOFOLLOW); rex.setReferrals(refs); throw rex; } else if (entryIndex < entryCount) { // Check for Search Entries and the Search Result element = entries[entryIndex++]; if (element is LdapResponse) { // Search done w/bad status if (((LdapResponse)element).hasException()) { LdapResponse lr = (LdapResponse)element; ReferralInfo ri = lr.ActiveReferral; if (ri != null) { // Error attempting to follow a search continuation reference LdapReferralException rex = new LdapReferralException(ExceptionMessages.REFERENCE_ERROR, lr.Exception); rex.setReferrals(ri.ReferralList); rex.FailedReferral = ri.ReferralUrl.ToString(); throw rex; } } // Throw an exception if not success ((LdapResponse)element).chkResultCode(); } else if (element is LdapException) { throw (LdapException)element; } } else { // If not a Search Entry, Search Result, or search continuation // we are very confused. // LdapSearchResults.next(): No entry found & request is not complete throw new LdapException(ExceptionMessages.REFERRAL_LOCAL, new object[] { "next" }, LdapException.LOCAL_ERROR, null); } return((LdapEntry)element); }
protected override void AttachChildControls() { this.txtRealName = (TextBox)this.FindControl("txtRealName"); this.txtAddress = (TextBox)this.FindControl("txtAddress"); this.btnReferral = ButtonManager.Create(this.FindControl("btnReferral")); this.dropRegionsSelect = (RegionSelector)this.FindControl("dropRegions"); this.txtEmail = (TextBox)this.FindControl("txtEmail"); this.txtPhone = (TextBox)this.FindControl("txtPhone"); this.hidValidateRealName = (HtmlInputHidden)this.FindControl("hidValidateRealName"); this.hidValidatePhone = (HtmlInputHidden)this.FindControl("hidValidatePhone"); this.hidValidateEmail = (HtmlInputHidden)this.FindControl("hidValidateEmail"); this.hidValidateAddress = (HtmlInputHidden)this.FindControl("hidValidateAddress"); this.hidIsPromoterValidatePhone = (HtmlInputHidden)this.FindControl("hidIsPromoterValidatePhone"); this.txtPhoneCode = (TextBox)this.FindControl("txtPhoneCode"); this.txtNumber = (TextBox)this.FindControl("txtNumber"); this.txtShopName = (TextBox)this.FindControl("txtShopName"); this.btnReferral.Click += this.btnReferral_Click; PageTitle.AddSiteNameTitle("分销员申请表单"); if (!this.Page.IsPostBack) { MemberInfo user = HiContext.Current.User; ReferralInfo referralInfo = Users.GetReferralInfo(HiContext.Current.UserId); int referralUserId = user.ReferralUserId; int.TryParse(HttpContext.Current.Request.QueryString["ReferralUserId"], out referralUserId); if (referralInfo != null && referralInfo.ReferralStatus != 2 && referralInfo.ReferralStatus == 3 && this.Page.Request.QueryString["again"] != "1" && referralUserId <= 0) { this.Page.Response.Redirect("/user/ReferralRegisterresults.aspx", true); } if (user.IsReferral()) { this.Page.Response.Redirect("/user/PopularizeGift.aspx"); } ReferralExtInfo referralExtInfo = new ReferralExtInfo(); if (referralInfo != null) { referralExtInfo = MemberProcessor.GetReferralExtInfo(referralInfo.RequetReason); this.txtShopName.Text = referralInfo.ShopName; } string fullRegion = RegionHelper.GetFullRegion((referralExtInfo.RegionId > 0) ? referralExtInfo.RegionId : user.RegionId, " ", true, 0); this.txtAddress.Text = (string.IsNullOrEmpty(referralExtInfo.Address) ? user.Address : referralExtInfo.Address); this.txtRealName.Text = (string.IsNullOrEmpty(referralExtInfo.RealName) ? user.RealName : referralExtInfo.RealName); this.txtEmail.Text = (string.IsNullOrEmpty(referralExtInfo.Email) ? user.Email : referralExtInfo.Email); this.txtPhone.Text = (string.IsNullOrEmpty(referralExtInfo.CellPhone) ? user.CellPhone : referralExtInfo.CellPhone); this.dropRegionsSelect.SetSelectedRegionId(user.RegionId); SiteSettings masterSettings = SettingsManager.GetMasterSettings(); string promoterNeedInfo = masterSettings.PromoterNeedInfo; if (!string.IsNullOrEmpty(promoterNeedInfo)) { this.hidValidateRealName.Value = (promoterNeedInfo.Contains("1") ? "1" : ""); this.hidValidatePhone.Value = (promoterNeedInfo.Contains("2") ? "1" : ""); this.hidValidateEmail.Value = (promoterNeedInfo.Contains("3") ? "1" : ""); this.hidValidateAddress.Value = (promoterNeedInfo.Contains("4") ? "1" : ""); this.hidIsPromoterValidatePhone.Value = (masterSettings.IsPromoterValidatePhone ? "1" : ""); } } }
public static TestReferralInfo BuildPersonFromDataBaseData(string idReferral) { using (NpgsqlConnection connection = Global.GetSqlConnection()) { string findPatient = "SELECT comment, priority_comment, referral_paper_date, id_referral_type, id_profile_med_service, referral_reason FROM public.referral WHERE id_referral = '" + idReferral + "' ORDER BY public.referral.id_referral DESC LIMIT 1"; NpgsqlCommand person = new NpgsqlCommand(findPatient, connection); using (NpgsqlDataReader personFromDataBase = person.ExecuteReader()) { ReferralInfo p = new ReferralInfo(); while (personFromDataBase.Read()) { p.IdMq = idReferral; //что делать с mqReferralStatus? if (personFromDataBase["comment"] != DBNull.Value) p.Comment = Convert.ToString(personFromDataBase["comment"]); if (personFromDataBase["referral_paper_date"] != DBNull.Value) p.Date = Convert.ToDateTime(personFromDataBase["referral_paper_date"]); if (personFromDataBase["priority_comment"] != DBNull.Value) p.Priority = Convert.ToString(personFromDataBase["priority_comment"]); if (personFromDataBase["referral_reason"] != DBNull.Value) p.Reason = Convert.ToString(personFromDataBase["referral_reason"]); TestReferralInfo pers = new TestReferralInfo(p); pers.cancellation = TestCancellation.BuildCancellationFromDataBaseData(idReferral); if (personFromDataBase["id_referral_type"] != DBNull.Value) pers.referralType = TestCoding.BuildCodingFromDataBaseData( Convert.ToString(personFromDataBase["id_referral_type"])); if (personFromDataBase["id_profile_med_service"] != DBNull.Value) pers.profileMedService = TestCoding.BuildCodingFromDataBaseData( Convert.ToString(personFromDataBase["id_profile_med_service"])); using (NpgsqlConnection connection2 = Global.GetSqlConnection()) { string findIdMq = "SELECT id_mq_referral_status FROM public.referral, public.referral_status WHERE public.referral.id_referral = '" + idReferral + "' AND public.referral.id_referral = public.referral_status.id_referral ORDER BY public.referral_status.id_referral_status DESC LIMIT 1"; NpgsqlCommand com = new NpgsqlCommand(findIdMq, connection2); using (NpgsqlDataReader reader = com.ExecuteReader()) { while (reader.Read()) { if (reader["id_mq_referral_status"] != DBNull.Value) pers.mqReferralStatus = TestCoding.BuildCodingFromDataBaseData( Convert.ToString(reader["id_mq_referral_status"])); } } } return pers; } } } return null; }
public TestReferralInfo(ReferralInfo r) { info = r ?? new ReferralInfo(); cancellation = new TestCancellation(info.Cancellation); if (info.MqReferralStatus != null) mqReferralStatus = new TestCoding(info.MqReferralStatus); if (info.ProfileMedService != null) profileMedService = new TestCoding(info.ProfileMedService); if (info.ReferralType != null) referralType = new TestCoding(info.ReferralType); }
protected override void AttachChildControls() { this.divRecruitmentAgreement = (HtmlGenericControl)this.FindControl("divRecruitmentAgreement"); this.litReferralRegisterAgreement = (Literal)this.FindControl("litReferralRegisterAgreement"); this.hidApplyCondition = (HtmlInputHidden)this.FindControl("hidApplyCondition"); this.hidApplyReferralNeedAmount = (HtmlInputHidden)this.FindControl("hidApplyReferralNeedAmount"); this.hidExpenditure = (HtmlInputHidden)this.FindControl("hidExpenditure"); MemberInfo user = HiContext.Current.User; this.hidExpenditure.Value = user.Expenditure.F2ToString("f2"); this.hidApplyCondition.Value = HiContext.Current.SiteSettings.ApplyReferralCondition.ToString(); this.hidApplyReferralNeedAmount.Value = HiContext.Current.SiteSettings.ApplyReferralNeedAmount.F2ToString("f2"); ReferralInfo referralInfo = Users.GetReferralInfo(user.UserId); if (this.divRecruitmentAgreement != null && !HiContext.Current.SiteSettings.OpenRecruitmentAgreement) { this.divRecruitmentAgreement.Visible = false; } int referralUserId = user.ReferralUserId; int.TryParse(HttpContext.Current.Request.QueryString["ReferralUserId"], out referralUserId); bool flag = false; if (this.Page.Request.QueryString["again"] != null && this.Page.Request.QueryString["again"] == "1") { flag = true; } if (referralInfo != null) { if (referralInfo.ReferralStatus != 2 && !flag && referralUserId <= 0 && !HiContext.Current.SiteSettings.RegisterBecomePromoter) { this.Page.Response.Redirect("/user/ReferralRegisterresults.aspx"); } else if (referralInfo.ReferralStatus == 2) { this.Page.Response.Redirect("/user/PopularizeGift.aspx"); } else if (referralInfo.ReferralStatus == 3 && HiContext.Current.SiteSettings.RegisterBecomePromoter && MemberProcessor.ReferralRequest(HiContext.Current.UserId, "", "", 0, 0, "", "", "", "")) { Users.ClearUserCache(user.UserId, user.SessionId); this.Page.Response.Redirect("/user/PopularizeGift.aspx", true); } } else if (HiContext.Current.SiteSettings.RegisterBecomePromoter && MemberProcessor.AddRegisterReferral(user.UserId, ReferralApplyStatus.Audited)) { Users.ClearUserCache(user.UserId, user.SessionId); this.Page.Response.Redirect("/user/PopularizeGift.aspx"); } PageTitle.AddSiteNameTitle("我要成为分销员"); this.litReferralRegisterAgreement.Text = HiContext.Current.SiteSettings.ReferralIntroduction; }
protected override void AttachChildControls() { this.litReferralRegisterresults = (Literal)this.FindControl("litReferralRegisterresults"); this.litRefuseReasons = (Literal)this.FindControl("litRefuseReasons"); this.divWaitReview = (HtmlGenericControl)this.FindControl("divWaitReview"); this.divRefuseReasons = (HtmlGenericControl)this.FindControl("divRefuseReasons"); this.divRefuseReasonsText = (HtmlGenericControl)this.FindControl("divRefuseReasonsText"); this.divBtnToRegister = (HtmlGenericControl)this.FindControl("divBtnToRegister"); PageTitle.AddSiteNameTitle("我要成为分销员"); ReferralInfo referralInfo = Users.GetReferralInfo(HiContext.Current.UserId); if (referralInfo != null) { if (referralInfo.ReferralStatus == 2) { this.Page.Response.Redirect("/appshop/Referral.aspx"); } else if (referralInfo.ReferralStatus == 1) { this.litReferralRegisterresults.Text = "您提交的申请正在审核中..."; if (this.divRefuseReasons != null) { HtmlGenericControl htmlGenericControl = this.divRefuseReasons; HtmlGenericControl htmlGenericControl2 = this.divBtnToRegister; bool visible = htmlGenericControl2.Visible = false; htmlGenericControl.Visible = visible; } } else if (referralInfo.ReferralStatus == 3) { this.divWaitReview.Visible = false; this.litReferralRegisterresults.Text = "您提交的申请被拒绝了..."; if (string.IsNullOrEmpty(referralInfo.RefusalReason.Trim())) { this.divRefuseReasonsText.Visible = false; } else { this.litRefuseReasons.Text = "拒绝理由:" + referralInfo.RefusalReason; } } } else { this.Page.Response.Redirect("/appshop/ReferralRegisterAgreement.aspx"); } }
public TestReferralInfo(ReferralInfo r) { info = r ?? new ReferralInfo(); cancellation = new TestCancellation(info.Cancellation); if (info.MqReferralStatus != null) { mqReferralStatus = new TestCoding(info.MqReferralStatus); } if (info.ProfileMedService != null) { profileMedService = new TestCoding(info.ProfileMedService); } if (info.ReferralType != null) { referralType = new TestCoding(info.ReferralType); } }
public void UpdateTestReferralInfo(ReferralInfo r) { if (r != null) { if (r.Comment != null) { this.info.Comment = r.Comment; } if (r.Date != null) { this.info.Date = r.Date; } if (r.IdMq != null) { this.info.IdMq = r.IdMq; } if (r.Priority != null) { this.info.Priority = r.Priority; } if (r.Reason != null) { this.info.Reason = r.Reason; } if (r.Cancellation != null) { this.cancellation = new TestCancellation(r.Cancellation); } if (r.MqReferralStatus != null) { this.mqReferralStatus = new TestCoding(r.MqReferralStatus); } if (r.ProfileMedService != null) { this.mqReferralStatus = new TestCoding(r.ProfileMedService); } if (r.ReferralType != null) { this.referralType = new TestCoding(r.ReferralType); } } }
private async Task ProcessReferral(int roundId) { try { var endTime = GetRoundEndDate(roundId); var beginTime = GetRoundStartDate(roundId); List <IGrouping <string, ApplicationUser> > referralGroups; Log.Message(LogLevel.Info, $"[ProcessReferral] - Processing referrals for period round {roundId} ({beginTime} - {endTime})"); using (var context = DataContextFactory.CreateContext()) { referralGroups = await context.Users .Where(x => x.Referrer != "System") .GroupBy(x => x.Referrer) .ToListNoLockAsync(); } Log.Message(LogLevel.Info, $"[ProcessReferral] - {referralGroups.Count()} referral users found, processing..."); using (var context = ExchangeDataContextFactory.CreateContext()) { var tradepairs = await context.TradePair.Where(x => x.CurrencyId1 == Constant.DOTCOIN_ID).ToListNoLockAsync(); var tradeHistoryGroups = await context.TradeHistory .Where(x => x.Timestamp >= beginTime && x.Timestamp <= endTime) .Select(x => new { BaseId = x.TradePair.CurrencyId2, UserId = x.UserId, ToUserId = x.ToUserId, Fee = x.Fee }) .GroupBy(x => x.BaseId) .ToListNoLockAsync(); Log.Message(LogLevel.Info, $"[ProcessReferral] - {tradeHistoryGroups.Count()} referral users found, processing..."); foreach (var referralGroup in referralGroups) { var tradeFees = 0m; //var activeFees = 0m; var userName = referralGroup.Key; var userIds = referralGroup.Select(x => new Guid(x.Id)).ToList(); var user = await context.Users.FirstOrDefaultNoLockAsync(x => x.UserName == userName); if (user == null) { continue; } var processedUsers = new List <Guid>(); foreach (var tradeHistoryGroup in tradeHistoryGroups) { var totalfee = 0m; foreach (var userId in userIds) { var fee = tradeHistoryGroup.Where(x => x.UserId == userId || x.ToUserId == userId).Sum(x => x.Fee); if (fee == 0) { //Log.Message(LogLevel.Info, $"[ProcessReferral] - No fees for found for round, Base: {tradeHistoryGroup.Key}, UserId: {userId}"); continue; } totalfee += fee; processedUsers.Add(userId); Log.Message(LogLevel.Info, $"[ProcessReferral] - Fees for found for round, Base: {tradeHistoryGroup.Key}, Fees: {fee}, UserId: {userId}"); } // convert fee to DOT var tradepair = tradepairs.FirstOrDefault(x => x.CurrencyId2 == tradeHistoryGroup.Key); if (tradepair != null && tradepair.LastTrade > 0 && totalfee > 0) { var tfee = ((totalfee / tradepair.LastTrade) / 100m) * Constant.REFERRAL_TRADEPERCENT; tradeFees += tfee; Log.Message(LogLevel.Info, $"[ProcessReferral] - Trade fees for user calculated, Base Market: {tradepair.CurrencyId2}, Fee: {totalfee}, Total DOT: {tfee}"); } } var refInfo = await context.ReferralInfo.FirstOrDefaultNoLockAsync(x => x.RoundId == roundId && x.UserId == user.Id); if (refInfo == null) { refInfo = new ReferralInfo { UserId = user.Id, RoundId = roundId, Status = ReferralStatus.Active, TransferId = 0, Timestamp = DateTime.UtcNow }; context.ReferralInfo.Add(refInfo); } if (refInfo.Status == ReferralStatus.Active) { refInfo.LastUpdate = DateTime.UtcNow; refInfo.RefCount = referralGroup.Count(); refInfo.ActivityAmount = 0; // userIds.Count * Constant.REFERRAL_ACTIVEBONUS; refInfo.TradeFeeAmount = tradeFees; Log.Message(LogLevel.Info, $"[ProcessReferral] - Updated referral information for user {user.UserName}, Refs: {refInfo.RefCount}, Activity: {refInfo.ActivityAmount}, TradeFee: {refInfo.TradeFeeAmount}"); } } Log.Message(LogLevel.Info, "[ProcessReferral] - Saving changes"); await context.SaveChangesAsync(); Log.Message(LogLevel.Info, "[ProcessReferral] - Changes saved"); } } catch (Exception ex) { Log.Exception("[ProcessReferral] - An exception occurred processing Referral items.", ex); } }
private EMKServise.ReferralInfo ConvertReferralInfo(ReferralInfo c) { if ((object)c != null) { EMKServise.ReferralInfo eri = new EMKServise.ReferralInfo(); eri.HospitalizationOrder = c.HospitalizationOrder; if (c.IdReferralMis != "") eri.IdReferralMis = c.IdReferralMis; eri.IdReferralType = c.IdReferralType; if (c.IssuedDateTime != DateTime.MinValue) eri.IssuedDateTime = c.IssuedDateTime; if (c.MkbCode != "") eri.MkbCode = c.MkbCode; if (c.Reason != "") eri.Reason = c.Reason; return eri; } else return null; }
public void UpdateTestReferralInfo(ReferralInfo r) { if (r != null) { if (r.Comment != null) this.info.Comment = r.Comment; if (r.Date != null) this.info.Date = r.Date; if (r.IdMq != null) this.info.IdMq = r.IdMq; if (r.Priority != null) this.info.Priority = r.Priority; if (r.Reason != null) this.info.Reason = r.Reason; if (r.Cancellation != null) this.cancellation = new TestCancellation(r.Cancellation); if (r.MqReferralStatus != null) this.mqReferralStatus = new TestCoding(r.MqReferralStatus); if (r.ProfileMedService != null) this.mqReferralStatus = new TestCoding(r.ProfileMedService); if (r.ReferralType != null) this.referralType = new TestCoding(r.ReferralType); } }
static public TestReferralInfo BuildPersonFromDataBaseData(string idReferral) { using (NpgsqlConnection connection = Global.GetSqlConnection()) { string findPatient = "SELECT comment, priority_comment, referral_paper_date, id_referral_type, id_profile_med_service, referral_reason FROM public.referral WHERE id_referral = '" + idReferral + "' ORDER BY public.referral.id_referral DESC LIMIT 1"; NpgsqlCommand person = new NpgsqlCommand(findPatient, connection); using (NpgsqlDataReader personFromDataBase = person.ExecuteReader()) { ReferralInfo p = new ReferralInfo(); while (personFromDataBase.Read()) { p.IdMq = idReferral; //что делать с mqReferralStatus? if (personFromDataBase["comment"] != DBNull.Value) { p.Comment = Convert.ToString(personFromDataBase["comment"]); } if (personFromDataBase["referral_paper_date"] != DBNull.Value) { p.Date = Convert.ToDateTime(personFromDataBase["referral_paper_date"]); } if (personFromDataBase["priority_comment"] != DBNull.Value) { p.Priority = Convert.ToString(personFromDataBase["priority_comment"]); } if (personFromDataBase["referral_reason"] != DBNull.Value) { p.Reason = Convert.ToString(personFromDataBase["referral_reason"]); } TestReferralInfo pers = new TestReferralInfo(p); pers.cancellation = TestCancellation.BuildCancellationFromDataBaseData(idReferral); if (personFromDataBase["id_referral_type"] != DBNull.Value) { pers.referralType = TestCoding.BuildCodingFromDataBaseData( Convert.ToString(personFromDataBase["id_referral_type"])); } if (personFromDataBase["id_profile_med_service"] != DBNull.Value) { pers.profileMedService = TestCoding.BuildCodingFromDataBaseData( Convert.ToString(personFromDataBase["id_profile_med_service"])); } using (NpgsqlConnection connection2 = Global.GetSqlConnection()) { string findIdMq = "SELECT id_mq_referral_status FROM public.referral, public.referral_status WHERE public.referral.id_referral = '" + idReferral + "' AND public.referral.id_referral = public.referral_status.id_referral ORDER BY public.referral_status.id_referral_status DESC LIMIT 1"; NpgsqlCommand com = new NpgsqlCommand(findIdMq, connection2); using (NpgsqlDataReader reader = com.ExecuteReader()) { while (reader.Read()) { if (reader["id_mq_referral_status"] != DBNull.Value) { pers.mqReferralStatus = TestCoding.BuildCodingFromDataBaseData( Convert.ToString(reader["id_mq_referral_status"])); } } } } return(pers); } } } return(null); }
/// <summary> /// Creates an LdapResponse using an LdapException. /// Used to wake up the user following an abandon. /// Note: The abandon doesn't have to be user initiated /// but may be the result of error conditions. /// Referral information is available if this connection created solely /// to follow a referral. /// </summary> /// <param name="ex"> /// The exception. /// </param> /// <param name="activeReferral"> /// The referral actually used to create the /// connection. /// </param> public LdapResponse(InterThreadException ex, ReferralInfo activeReferral) { _exception = ex; ActiveReferral = activeReferral; }
public static List <JobInfo> GetJobWithReferrals(int id) { List <JobInfo> list = new List <JobInfo>(); Dictionary <int, JobInfo> jobDictionary = new Dictionary <int, JobInfo>(); Dictionary <string, JobReferral> jobReferralDictionary = new Dictionary <string, JobReferral>(); List <JobReferral> referralList = new List <JobReferral>(); List <ReferralInfo> referralInfo = new List <ReferralInfo>(); DataProvider.ExecuteCmd(GetConnection, "dbo.ProductJob_Referral" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@personId", id); }, map : delegate(IDataReader reader, short set) { JobInfo job = new JobInfo(); switch (set) { case 0: JobInfo j = new JobInfo(); int startingIndex = 0; j.Id = reader.GetSafeInt32(startingIndex++); j.PersonId = reader.GetSafeInt32(startingIndex++); j.CompanyId = reader.GetSafeInt32(startingIndex++); j.CompanyName = reader.GetSafeString(startingIndex++); j.CompanyLocation = reader.GetSafeString(startingIndex++); j.CompanyIndustry = reader.GetSafeString(startingIndex++); j.Title = reader.GetSafeString(startingIndex++); j.Description = reader.GetSafeString(startingIndex++); j.Type = reader.GetSafeString(startingIndex++); j.Salary = reader.GetSafeInt32(startingIndex++); j.isHighlighted = reader.GetSafeBool(startingIndex++); j.isFeatured = reader.GetSafeBool(startingIndex++); j.Referral = new List <JobReferral>(); list.Add(j); jobDictionary.Add(j.Id, j); break; case 1: JobReferral jr = new JobReferral(); int ord = 0; jr.Id = reader.GetSafeInt32(ord++); jr.JobId = reader.GetSafeInt32(ord++); jr.CandidateId = reader.GetSafeInt32(ord++); jr.CandidateGuid = reader.GetSafeString(ord++); jr.CandidateFirstName = reader.GetSafeString(ord++); jr.CandidateLastName = reader.GetSafeString(ord++); jr.Favorite = reader.GetSafeBool(ord++); string key = string.Format("{0}_{1}", jr.JobId, jr.CandidateId); if (jobReferralDictionary.ContainsKey(key)) { ReferralInfo ri = new ReferralInfo(); ri.Message = reader.GetSafeString(ord++); ri.ReferrerId = reader.GetSafeInt32(ord++); ri.ReferrerGuid = reader.GetSafeString(ord++); ri.ReferrerFirstName = reader.GetSafeString(ord++); ri.ReferrerLastName = reader.GetSafeString(ord++); ri.Accepted = reader.GetSafeBool(ord++); ri.Hidden = reader.GetSafeBool(ord++); ri.UserNotified = reader.GetSafeBool(ord++); jobReferralDictionary[key].ReferralInfo.Add(ri); } else { if (jobDictionary.ContainsKey(jr.JobId)) { jobDictionary[jr.JobId].Referral.Add(jr); jobReferralDictionary.Add(key, jr); ReferralInfo ri = new ReferralInfo(); ri.Message = reader.GetSafeString(ord++); ri.ReferrerId = reader.GetSafeInt32(ord++); ri.ReferrerGuid = reader.GetSafeString(ord++); ri.ReferrerFirstName = reader.GetSafeString(ord++); ri.ReferrerLastName = reader.GetSafeString(ord++); ri.Accepted = reader.GetSafeBool(ord++); ri.Hidden = reader.GetSafeBool(ord++); ri.UserNotified = reader.GetSafeBool(ord++); if (jobReferralDictionary[key].ReferralInfo == null) { jobReferralDictionary[key].ReferralInfo = new List <ReferralInfo>(); } jobReferralDictionary[key].ReferralInfo.Add(ri); } } break; } }); return(list); }