public async Task <IActionResult> Edit(int id, [Bind("ReferrerId,FirstName,LastName,OrganisationName,PhoneNumber,Email,TownCity,RoleId")] Referrer referrer) { if (id != referrer.ReferrerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(referrer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReferrerExists(referrer.ReferrerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RoleId"] = new SelectList(_context.ReferrerRole, "RoleId", "RoleName", referrer.RoleId); return(View(referrer)); }
private void CreateReferrer(string url) { var referrer = new Referrer(url); Referrers.Add(referrer); ReferralCounts.Add(new ReferralCount(referrer)); }
public async Task <IActionResult> Edit(int id, [Bind("ReferrerId,Name,Type,Phone,Office")] Referrer referrer) { if (id != referrer.ReferrerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(referrer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReferrerExists(referrer.ReferrerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(referrer)); }
public ReferrerService() { if (Referrers == null || ReferralCounts == null) { //Constructor to populate List of Referrers and Counts if the lists do not already exist Referrers = new List <Referrer>(); ReferralCounts = new List <ReferralCount>(); var referrer1 = new Referrer("https://www.google.com/"); var referrer2 = new Referrer("https://www.facebook.com/"); var referrer3 = new Referrer("https://www.amazon.com/"); var referrer4 = new Referrer("https://www.intuit.com/"); Referrers.Add(referrer1); Referrers.Add(referrer2); Referrers.Add(referrer3); Referrers.Add(referrer4); var referralCount1 = new ReferralCount(referrer1); referralCount1.Count = 15; var referralCount2 = new ReferralCount(referrer2); referralCount2.Count = 4; var referralCount3 = new ReferralCount(referrer3); referralCount3.Count = 12; var referralCount4 = new ReferralCount(referrer4); referralCount4.Count = 29; ReferralCounts.Add(referralCount1); ReferralCounts.Add(referralCount2); ReferralCounts.Add(referralCount3); ReferralCounts.Add(referralCount4); } }
protected void GrdReferrer_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label lblId = (Label)GrdReferrer.Rows[e.RowIndex].FindControl("lblId"); DropDownList ddlTitle = (DropDownList)GrdReferrer.Rows[e.RowIndex].FindControl("ddlTitle"); TextBox txtFirstname = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtFirstname"); TextBox txtMiddlename = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtMiddlename"); TextBox txtSurname = (TextBox)GrdReferrer.Rows[e.RowIndex].FindControl("txtSurname"); DropDownList ddlGender = (DropDownList)GrdReferrer.Rows[e.RowIndex].FindControl("ddlGender"); Referrer referrer = ReferrerDB.GetByID(Convert.ToInt32(lblId.Text)); if (referrer != null) { if (referrer.Person.Title.ID != Convert.ToInt32(ddlTitle.SelectedValue) || referrer.Person.Firstname != Utilities.FormatName(txtFirstname.Text) || referrer.Person.Middlename != Utilities.FormatName(txtMiddlename.Text) || referrer.Person.Surname != Utilities.FormatName(txtSurname.Text) || referrer.Person.Gender != ddlGender.SelectedValue) { PersonDB.Update(referrer.Person.PersonID, Convert.ToInt32(ddlTitle.SelectedValue), Utilities.FormatName(txtFirstname.Text), Utilities.FormatName(txtMiddlename.Text), Utilities.FormatName(txtSurname.Text), referrer.Person.Nickname, ddlGender.SelectedValue, referrer.Person.Dob, DateTime.Now); } } GrdReferrer.EditIndex = -1; FillGrid(); }
public override int GetHashCode() { unchecked { int result = (m_ObjPropertyCollection != null ? m_ObjPropertyCollection.GetHashCode() : 0); result = (result * 397) ^ (CharacterSet != null ? CharacterSet.GetHashCode() : 0); result = (result * 397) ^ (ContentEncoding != null ? ContentEncoding.GetHashCode() : 0); result = (result * 397) ^ (ContentType != null ? ContentType.GetHashCode() : 0); result = (result * 397) ^ (Headers != null ? Headers.GetHashCode() : 0); result = (result * 397) ^ IsFromCache.GetHashCode(); result = (result * 397) ^ IsMutuallyAuthenticated.GetHashCode(); result = (result * 397) ^ LastModified.GetHashCode(); result = (result * 397) ^ (Method != null ? Method.GetHashCode() : 0); result = (result * 397) ^ (OriginalReferrerUrl != null ? OriginalReferrerUrl.GetHashCode() : 0); result = (result * 397) ^ (OriginalUrl != null ? OriginalUrl.GetHashCode() : 0); result = (result * 397) ^ (ProtocolVersion != null ? ProtocolVersion.GetHashCode() : 0); result = (result * 397) ^ (Referrer != null ? Referrer.GetHashCode() : 0); result = (result * 397) ^ (ResponseUri != null ? ResponseUri.GetHashCode() : 0); result = (result * 397) ^ (Server != null ? Server.GetHashCode() : 0); result = (result * 397) ^ StatusCode.GetHashCode(); result = (result * 397) ^ (StatusDescription != null ? StatusDescription.GetHashCode() : 0); result = (result * 397) ^ (Step != null ? Step.GetHashCode() : 0); result = (result * 397) ^ (Text != null ? Text.GetHashCode() : 0); result = (result * 397) ^ (Title != null ? Title.GetHashCode() : 0); result = (result * 397) ^ DownloadTime.GetHashCode(); return(result); } }
private static void ConfirmPaket(int menu, string paket, int giga, int price, int duration = 0) { Console.WriteLine("Anda akan membeli Paket {0} {1}GB/{2}hari \n" + "dengan harga Rp.{3}? \n" + "1. Beli \n" + "99. Kembali", paket, giga, duration + 1, price); Console.Write("Jawab: "); string answer = Console.ReadLine(); switch (answer) { case "1": Console.Clear(); Paket(paket, giga, price, duration); break; case "99": Console.Clear(); Referrer referrer = ReffMenu; referrer(menu); break; default: Console.Clear(); Console.WriteLine("Tidak ada menu tersedia yang kamu pilih"); Console.WriteLine(); ConfirmPaket(menu, paket, giga, price, duration); break; } }
public static Hashtable GetHashtableByReferrer(bool incDeleted = false) { Hashtable hashtable = new Hashtable(); DataTable tbl = DBBase.ExecuteQuery(JoinedSql(incDeleted, incDeleted, incDeleted)).Tables[0]; foreach (DataRow row in tbl.Rows) { if (row["organisation_id"] == DBNull.Value) { continue; } Referrer r = ReferrerDB.Load(row); r.Person = PersonDB.Load(row, "", "person_entity_id"); r.Person.Title = IDandDescrDB.Load(row, "title_id", "descr"); Organisation o = OrganisationDB.Load(row, "", "organisation_entity_id", "organisation_is_deleted"); if (hashtable[r.ReferrerID] == null) { hashtable[r.ReferrerID] = new ArrayList(); } ((ArrayList)hashtable[r.ReferrerID]).Add(o); } return(hashtable); }
public string Insert(Referrer referrer) { try { // TODO : Move this to a cache lookup. We don't want to query on every ADD. // TODO : Expected Volumes could be immense to so we need to optimise var refType = _unitOfWork.GetRepository <ThreatType>().GetList().Items.Where(x => x.Name == Referer).SingleOrDefault(); var status = _unitOfWork.GetRepository <Status>().GetList().Items.Where(x => x.Name == Moderate).SingleOrDefault(); var threat = Mapper.Map <Threat>(referrer); threat.StatusId = status.Id; threat.TypeId = refType.Id; threat.ThreatType = refType; threat.Status = status; _unitOfWork.GetRepository <Threat>().Add(threat); _unitOfWork.SaveChanges(); return(threat.Identifier); } catch (Exception ex) { return(null); } }
public ActionResult HelpfulnessVotes_POST( [IoCModelBinder(typeof(SetIPAddressModelBinder))] HelpfulnessVoteModel voteModel) { var response = _helpfulnessVoteService.Upvote(voteModel); if (Request.IsAjaxRequest()) { return(Json(response.IsSuccess())); } TempData["productreview-response-info"] = response; return (Redirect(string.IsNullOrWhiteSpace(response.RedirectUrl) ? Referrer != null ? Referrer.ToString() : "~/" : response.RedirectUrl)); //if (CurrentRequestData.CurrentUser != null) // vote.User = CurrentRequestData.CurrentUser; //vote.IsHelpful = true; //_helpfulnessVoteService.Add(vote); //TempData["vote-submitted"] = true; //return Redirect(Referrer.ToString()); }
private List <Referrer> getReferrersFromFile(FileInfo file, DateTime day) { List <Referrer> referrers = new List <Referrer>(); XmlDocument doc = new XmlDocument(); doc.Load(file.FullName); XmlNodeList nodes = doc.SelectNodes("referrers/referrer"); foreach (XmlNode node in nodes) { Referrer refer = new Referrer() { Url = node.Attributes["url"] == null ? null : new Uri(node.Attributes["url"].InnerText), Count = node.Attributes["count"] == null ? 0 : int.Parse(node.Attributes["count"].InnerText), Day = day, PossibleSpam = node.Attributes["isSpam"] == null ? false : bool.Parse(node.Attributes["isSpam"].InnerText), ReferrerUrl = new Uri(node.InnerText), Id = Guid.NewGuid() }; refer.MarkOld(); referrers.Add(refer); } return(referrers); }
public AdminkaCrudRoutinePageConsumer(PageModel pageModel, Referrer referrer, PageRoutineFeature pageRoutineFeature, Func <User, UserContext> createUserContext, ApplicationSettings applicationSettings, IMemoryCache memoryCache, MemberTag memberTag) : base(pageModel, pageRoutineFeature, getUserAndFailedActionResultInitialisedAsync: (aspRoutineFeature) => AspNetCoreManager.GetUserAndFailedActionResultInitialisedAsync( applicationSettings, memberTag, pageModel, aspRoutineFeature, memoryCache, pageRoutineFeature), getContainerHandler: (aspRoutineFeature, getInput, user, containerFactory) => { var userContext = createUserContext(user); return(MvcAppManager.GetContainerStorageHandler( containerFactory, memberTag, aspRoutineFeature, getInput, userContext, applicationSettings, uc => uc.AuditStamp )); }) { this.Referrer = referrer; }
public static IEnumerable <Referral> GetReferrals(string fileName) { using (var rdr = new StreamReader(fileName)) { var next = new Referrer(); int state = 0; string line; while ((line = rdr.ReadLine()) != null) { switch (state) { case 0: next.ReferrerText = line; state = 1; break; case 1: next.ReferrerDescription = line; state = 2; break; case 2: next.ReferringId = int.Parse(line); yield return(next); next = new Referral(); state = 0; break; } } } }
public static async Task SetTier(BitcornContext dbContext, Referrer referrer) { var banned = await dbContext.User.Where(s => s.UserId == referrer.UserId).Select(u => u.IsBanned).FirstOrDefaultAsync(); if (banned) { return; } var stats = await dbContext.UserStat.FirstOrDefaultAsync(s => s.UserId == referrer.UserId); if (stats.TotalReferrals == null) { stats.TotalReferrals = 0; } if (stats.TotalReferrals < 50 && referrer.Tier < 1) { referrer.Tier = 0; } if (stats.TotalReferrals >= 50 && referrer.Tier < 1) { referrer.Tier = 1; } if (stats.TotalReferrals >= 500 && referrer.Tier < 2) { referrer.Tier = 2; } if (stats.TotalReferrals >= 20000 && referrer.Tier < 3) { referrer.Tier = 3; } await dbContext.SaveAsync(); }
protected void btnSetExistingReferrer_Click(object sender, EventArgs e) { Referrer referrer = ReferrerDB.GetByID(Convert.ToInt32(jsSetId.Value)); if (referrer == null) { lblId.Text = "-1"; SetErrorMessage("Error getting selected referrer. Plase contact the system administrator.<br />"); } else { lblId.Text = referrer.ReferrerID.ToString(); ddlTitle.SelectedValue = referrer.Person.Title.ID.ToString(); txtFirstname.Text = referrer.Person.Firstname; txtMiddlename.Text = referrer.Person.Middlename; txtSurname.Text = referrer.Person.Surname; if (ddlGender.Items.FindByValue(referrer.Person.Gender) == null) { ddlGender.Items.Add(new ListItem(referrer.Person.Gender == "" ? "--" : referrer.Person.Gender, referrer.Person.Gender)); } ddlGender.SelectedValue = referrer.Person.Gender; ddlTitle.Enabled = false; txtFirstname.Enabled = false; txtMiddlename.Enabled = false; txtSurname.Enabled = false; ddlGender.Enabled = false; } }
/// <summary> /// Registers click. /// </summary> /// <param name="url"> /// The url Uri. /// </param> /// <param name="referrer"> /// The referrer Uri. /// </param> private static void RegisterClick(Uri url, Uri referrer) { Referrer refer = null; if (Referrer.Referrers != null && Referrer.Referrers.Count > 0) { refer = Referrer.Referrers.Find( r => r.ReferrerUrl.Equals(referrer) && r.Url.Equals(url) && r.Day == DateTime.Today); } if (refer == null) { refer = new Referrer { Day = DateTime.Today, ReferrerUrl = referrer, Url = url, PossibleSpam = IsSpam(referrer, url) }; } refer.Count += 1; refer.Save(); }
public void ValidationInConstructor() { using (var session = Domain.OpenSession()) using (session.OpenTransaction()) { Reference reference1 = null; AssertEx.Throws <ValidationFailedException>(() => { reference1 = new Reference(); session.Validate(); }); reference1.Remove(); var reference2 = new Reference { Title = "Test" }; session.Validate(); var reference3 = new Reference("Test"); Referrer referrer2 = null; AssertEx.Throws <ValidationFailedException>(() => { referrer2 = new Referrer(); session.Validate(); }); referrer2.Remove(); var referrer3 = new Referrer { Title = "Test", Reference = reference3 }; session.Validate(); var referrer1 = new Referrer(reference3, "Test"); } }
/// <summary> /// Populates the row. /// </summary> /// <param name="tableRow"> /// The table row. /// </param> /// <param name="refer"> /// The refer. /// </param> private void PopulateRow(DataRow tableRow, Referrer refer) { tableRow["url"] = this.Server.HtmlEncode(refer.ReferrerUrl.ToString()); tableRow["shortUrl"] = this.MakeShortUrl(refer.ReferrerUrl.ToString()); tableRow["target"] = this.Server.HtmlEncode(refer.Url.ToString()); tableRow["shortTarget"] = this.MakeShortUrl(refer.Url.ToString()); tableRow["hits"] = refer.Count; }
/// <summary> /// Inserts a Referrer. /// </summary> /// <param name="referrer"> /// Must be a valid Referrer object. /// </param> public override void InsertReferrer(Referrer referrer) { Referrer.Referrers.Add(referrer); referrer.MarkOld(); var day = Referrer.Referrers.FindAll(r => r.Day.ToShortDateString() == referrer.Day.ToShortDateString()); this.WriteReferrerFile(day, referrer.Day); }
public RedirectResult Add_POST(ProductReview productReview) { _productReviewUIService.Add(productReview); TempData["review-submitted"] = true; return(Redirect(Referrer.ToString())); }
public void CanSetAndGetSimpleProperties() { var referrer = new Referrer(); referrer.ReferrerUrl = "localhost"; Assert.AreEqual("http://localhost", referrer.ReferrerUrl); UnitTestHelper.AssertSimpleProperties(referrer, "ReferrerUrl"); }
public static Referrer LoadAll(DataRow row, string staff_prefix = "", string person_prefix = "", string person_title_id = "title_id", string person_title_descr = "descr") { Referrer r = Load(row, staff_prefix); r.Person = PersonDB.Load(row, person_prefix); r.Person.Title = IDandDescrDB.Load(row, person_title_id, person_title_descr); return(r); }
public static async Task <decimal> TotalReward(BitcornContext dbContext, Referrer referrer) { await SetTier(dbContext, referrer); var referralTier = await dbContext.ReferralTier.FirstOrDefaultAsync(r => r.Tier == referrer.Tier); return(referrer.Amount * referralTier.Bonus); }
public ActionResult DeleteConfirmed(int id) { Referrer referrer = db.Referrers.Find(id); db.Referrers.Remove(referrer); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Gets a Referrer based on the Id. /// </summary> /// <param name="Id">The Referrer's Id.</param> /// <returns>A matching Referrer.</returns> public override Referrer SelectReferrer(Guid Id) { Referrer refer = Referrer.Referrers.Find(r => r.Id.Equals(Id)); if (refer == null) { refer = new Referrer(); } refer.MarkOld(); return(refer); }
public async Task <IActionResult> Create([Bind("ReferrerId,Name,Type,Phone,Office")] Referrer referrer) { if (ModelState.IsValid) { _context.Add(referrer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(referrer)); }
public ActionResult LoggedIn([IoCModelBinder(typeof(SetIPAddressModelBinder))] LoggedInUserAddCommentModel model) { if (ModelState.IsValid) { PostCommentResponse response = _commentsUiService.AddLoggedInComment(model); return(RedirectToPage(response)); } return(RedirectToPage(new PostCommentResponse { Valid = false, RedirectUrl = Referrer.ToString() })); }
public static object SelectUserProperties(User user, UserIdentity userIdentity, UserWallet userWallet, UserStat userStats, UserReferral userReferral, Referrer referrer, bool guestView) { Dictionary <string, object> output = new Dictionary <string, object>(); AppendUserOutput(output, new Type[] { typeof(int), typeof(string), typeof(DateTime?), typeof(bool) }, user, "Username"); if (!guestView) { AppendUserOutput(output, new Type[] { typeof(string) }, userIdentity); } else { output.Add("auth0Id", userIdentity.Auth0Id); output.Add("auth0Nickname", userIdentity.Auth0Nickname); //Auth0Id = userIdentity.Auth0Id, //Auth0Nickname = userIdentity.Auth0Nickname, } if (!guestView) { AppendUserOutput(output, new Type[] { typeof(decimal?), typeof(int?), typeof(string) }, userWallet); } if (!guestView) { AppendUserOutput(output, new Type[] { typeof(decimal?), typeof(int?), typeof(string) }, userStats); } if (!guestView && referrer != null) { AppendUserOutput(output, new Type[] { typeof(decimal?), typeof(int?), typeof(string), typeof(DateTime?), typeof(int) }, referrer, "userId"); } if (!guestView && userReferral != null) { AppendUserOutput(output, new Type[] { typeof(decimal), typeof(int), typeof(string), typeof(int) }, userReferral, "userId"); } return(output); }
public AdminkaCrudRoutinePageConsumer( PageModel pageModel, Referrer referrer, [CallerMemberName] string member = null) : this(pageModel, referrer, AspNetCoreManager.SetAndGetPageRoutineFeature(pageModel, referrer), u => MvcAppManager.SetAndGetUserContext(pageModel, u), (ApplicationSettings)pageModel.HttpContext.RequestServices.GetService(typeof(ApplicationSettings)), (IMemoryCache)pageModel.HttpContext.RequestServices.GetService(typeof(IMemoryCache)), new MemberTag(pageModel.GetType().Namespace, pageModel.GetType().Name, member)) { }
protected ActionResult RedirectToPage(ICommentResponseInfo response) { TempData["comment-response-info"] = response; var url = string.IsNullOrWhiteSpace(response.RedirectUrl) ? Referrer != null ? Referrer.ToString() : "~/" : response.RedirectUrl; return (Redirect(url + "#comments")); }
public static BulkLetterSendingQueueAdditionalLetter GetFileInfo(Letter.FileFormat fileFormat, Booking booking, Patient patient, HealthCard hc, Letter.TreatmentLetterType treatmentLetterType, Booking.InvoiceType invType, int fieldID, int siteID, int staffID, Referrer referrer, bool keepInHistory, int letterPrintHistorySendMethodID) { // 1. Add to healthcardaction int healthCardActionID = -1; if (treatmentLetterType == Letter.TreatmentLetterType.First || treatmentLetterType == Letter.TreatmentLetterType.Last || treatmentLetterType == Letter.TreatmentLetterType.LastWhenReplacingEPC) healthCardActionID = HealthCardActionDB.Insert(hc.HealthCardID, Letter.GetHealthCardActionTypeID(treatmentLetterType), DateTime.Now); // 2.create document and put it in history int letterID = Letter.GetLetterIDByTreatmentLetterTypeAndInvoiceType(treatmentLetterType, invType, fieldID, siteID); if (letterID == -1) return null; string lettersDir = Letter.GetLettersDirectory(); if (!Directory.Exists(lettersDir)) throw new CustomMessageException("Letters directory doesn't exist"); Letter letter = LetterDB.GetByID(letterID); bool useDefaultDocs = letter.Organisation == null ? true : !LetterDB.OrgHasdocs(letter.Organisation.OrganisationID); string sourceTemplatePath = lettersDir + (useDefaultDocs ? @"Default\" + letter.Site.SiteID + @"\" : letter.Organisation.OrganisationID + @"\") + letter.Docname; if (!File.Exists(sourceTemplatePath)) throw new CustomMessageException("File doesn't exist: " + Path.GetFileName(sourceTemplatePath)); // get temp directory string tmpLettersDirectory = Letter.GetTempLettersDirectory(); if (!Directory.Exists(tmpLettersDirectory)) throw new CustomMessageException("Temp letters directory doesn't exist"); return new BulkLetterSendingQueueAdditionalLetter( -1, -1, letter.LetterID, keepInHistory && Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["StoreLettersHistoryInDB"]), keepInHistory && Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["StoreLettersHistoryInFlatFile"]), letterPrintHistorySendMethodID, Letter.GetLettersHistoryDirectory(booking.Organisation.OrganisationID), letter.Docname.Replace(".dot", ".doc"), siteID, booking.Organisation.OrganisationID, booking.BookingID, patient.PatientID, -1, // register_referrer_id_to_use_instead_of_patients_reg_ref staffID, healthCardActionID, sourceTemplatePath, tmpLettersDirectory + letter.Docname.Replace(".dot", ".doc"), true, "", "" ); }
/// <summary> /// Updates an existing Referrer in the data store specified by the provider. /// </summary> /// <param name="referrer"> /// The referrer to update. /// </param> public abstract void UpdateReferrer(Referrer referrer);
/// <summary> /// Inserts a new Referrer into the data store specified by the provider. /// </summary> /// <param name="referrer"> /// The referrer to insert. /// </param> public abstract void InsertReferrer(Referrer referrer);
/// <summary> /// Updates an existing Referrer. /// </summary> /// <param name="referrer"> /// The referrer to update. /// </param> public static void UpdateReferrer(Referrer referrer) { LoadProviders(); provider.UpdateReferrer(referrer); }
/// <summary> /// Persists a new Referrer in the current provider. /// </summary> /// <param name="referrer"> /// The referrer to insert. /// </param> public static void InsertReferrer(Referrer referrer) { LoadProviders(); provider.InsertReferrer(referrer); }
/// <summary> /// Gets all Referrers from the database. /// </summary> /// <returns>List of Referrers.</returns> public override List<Referrer> FillReferrers() { deleteOldReferrers(); List<Referrer> referrers = new List<Referrer>(); string connString = ConfigurationManager.ConnectionStrings[connStringName].ConnectionString; string providerName = ConfigurationManager.ConnectionStrings[connStringName].ProviderName; DbProviderFactory provider = DbProviderFactories.GetFactory(providerName); using (DbConnection conn = provider.CreateConnection()) { conn.ConnectionString = connString; conn.Open(); using (DbCommand cmd = conn.CreateCommand()) { string sqlQuery = "SELECT ReferrerId, ReferralDay, ReferrerUrl, ReferralCount, Url, IsSpam " + "FROM " + tablePrefix + "Referrers "; cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; using (DbDataReader rdr = cmd.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { Referrer refer = new Referrer() { Id = rdr.GetGuid(0), Day = rdr.GetDateTime(1), ReferrerUrl = new Uri(rdr.GetString(2)), Count = rdr.GetInt32(3), Url = rdr.IsDBNull(4) ? null : new Uri(rdr.GetString(4)), PossibleSpam = rdr.IsDBNull(5) ? false : rdr.GetBoolean(5) }; referrers.Add(refer); refer.MarkOld(); } } } } } return referrers; }
/// <summary> /// Adds a new Referrer to the database. /// </summary> /// <param name="referrer"> /// Referrer to add. /// </param> public override void InsertReferrer(Referrer referrer) { var referrers = Referrer.Referrers; referrers.Add(referrer); using (var conn = this.CreateConnection()) { if (conn.HasConnection) { var sqlQuery = string.Format("INSERT INTO {0}Referrers (BlogId, ReferrerId, ReferralDay, ReferrerUrl, ReferralCount, Url, IsSpam) VALUES ({1}BlogId, {1}ReferrerId, {1}ReferralDay, {1}ReferrerUrl, {1}ReferralCount, {1}Url, {1}IsSpam)", this.tablePrefix, this.parmPrefix); using (var cmd = conn.CreateTextCommand(sqlQuery)) { this.AddReferrersParametersToCommand(referrer, conn, cmd); cmd.ExecuteNonQuery(); } } } }
/// <summary> /// The add referrers parameters to command. /// </summary> /// <param name="referrer"> /// The referrer. /// </param> /// <param name="conn"> /// The connection. /// </param> /// <param name="cmd"> /// The command. /// </param> private void AddReferrersParametersToCommand(Referrer referrer, DbConnectionHelper conn, DbCommand cmd) { var parms = cmd.Parameters; parms.Add(conn.CreateParameter("BlogId", Blog.CurrentInstance.Id.ToString())); parms.Add(conn.CreateParameter("ReferrerId", referrer.Id.ToString())); parms.Add(conn.CreateParameter(FormatParamName("ReferralDay"), referrer.Day)); parms.Add(conn.CreateParameter(FormatParamName("ReferrerUrl"), (referrer.ReferrerUrl != null ? (object)referrer.ReferrerUrl.ToString() : DBNull.Value))); parms.Add(conn.CreateParameter(FormatParamName("ReferralCount"), referrer.Count)); parms.Add(conn.CreateParameter(FormatParamName("Url"), (referrer.Url != null ? (object)referrer.Url.ToString() : DBNull.Value))); parms.Add(conn.CreateParameter(FormatParamName("IsSpam"), referrer.PossibleSpam)); }
public ActionResult FinishRegister(UserProfilePoco model) { if (ModelState.IsValid) { var user = new Users { Name = model.Name, Nickname = model.Nickname, Email = model.Email, Phone = model.Phone, Country = model.Country, City = model.City, BirthDay = model.BirthDay, Password = model.Password }; if (Request.Cookies["owner"] != null) { user.OwnerId = Convert.ToInt64(Request.Cookies["owner"].Value); var owner = _usersService.GetById((long)user.OwnerId); if (owner != null) { // Если в куках есть информация о реферальном url, то добавляем эту информацию в статистику var hostCookie = Request.Cookies["Host"]; if (hostCookie != null) { var host = hostCookie["shortHost"]; var fullHostUrl = hostCookie["fullHostUrl"]; var entity = new Referrer { Host = host, FullReferrerUrl = fullHostUrl, Date = DateTime.Now, IsDeleted = false, OwnerId = owner.Id, Registered = true }; _statService.AddReferrer(entity); } } } _usersService.Insert(user); return RedirectToAction("LogOn", "Account"); } return this.View("RegisterForm"); }
/// <summary> /// Adds a new Referrer to the database. /// </summary> /// <param name="referrer"> /// Referrer to add. /// </param> public override void InsertReferrer(Referrer referrer) { var referrers = Referrer.Referrers; referrers.Add(referrer); var connString = ConfigurationManager.ConnectionStrings[this.connStringName].ConnectionString; var providerName = ConfigurationManager.ConnectionStrings[this.connStringName].ProviderName; var provider = DbProviderFactories.GetFactory(providerName); using (var conn = provider.CreateConnection()) { if (conn == null) { return; } conn.ConnectionString = connString; conn.Open(); using (var cmd = conn.CreateCommand()) { var sqlQuery = string.Format("INSERT INTO {0}Referrers (ReferrerId, ReferralDay, ReferrerUrl, ReferralCount, Url, IsSpam) VALUES (@ReferrerId, @ReferralDay, @ReferrerUrl, @ReferralCount, @Url, @IsSpam)", this.tablePrefix); if (this.parmPrefix != "@") { sqlQuery = sqlQuery.Replace("@", this.parmPrefix); } cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; this.AddReferrersParametersToCommand(referrer, provider, cmd); cmd.ExecuteNonQuery(); } } }
/// <summary> /// Persists a new Referrer in the current provider. /// </summary> /// <param name="referrer"> /// The referrer to insert. /// </param> public static void InsertReferrer(Referrer referrer) { Provider.InsertReferrer(referrer); }
/// <summary> /// Updates a Referrer. /// </summary> /// <param name="referrer"> /// Must be a valid Referrer object. /// </param> public override void UpdateReferrer(Referrer referrer) { var day = Referrer.Referrers.FindAll(r => r.Day.ToShortDateString() == referrer.Day.ToShortDateString()); this.WriteReferrerFile(day, referrer.Day); }
/// <summary> /// Updates an existing Referrer. /// </summary> /// <param name="referrer"> /// The referrer to update. /// </param> public static void UpdateReferrer(Referrer referrer) { Provider.UpdateReferrer(referrer); }
/// <summary> /// Saves an existing Referrer to the database. /// </summary> /// <param name="referrer">Referrer to be saved.</param> public override void UpdateReferrer(Referrer referrer) { List<Referrer> referrers = Referrer.Referrers; referrers.Remove(referrer); referrers.Add(referrer); string connString = ConfigurationManager.ConnectionStrings[connStringName].ConnectionString; string providerName = ConfigurationManager.ConnectionStrings[connStringName].ProviderName; DbProviderFactory provider = DbProviderFactories.GetFactory(providerName); using (DbConnection conn = provider.CreateConnection()) { conn.ConnectionString = connString; conn.Open(); using (DbCommand cmd = conn.CreateCommand()) { string sqlQuery = "UPDATE " + tablePrefix + "Referrers " + "SET ReferralDay = @ReferralDay, " + "ReferrerUrl = @ReferrerUrl, " + "ReferralCount = @ReferralCount, " + "Url = @Url, " + "IsSpam = @IsSpam " + "WHERE ReferrerId = @ReferrerId"; if (parmPrefix != "@") sqlQuery = sqlQuery.Replace("@", parmPrefix); cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; addReferrersParametersToCommand(referrer, provider, cmd); cmd.ExecuteNonQuery(); } } }
protected static BulkLetterSendingQueueAdditionalLetter[] GetFilesInfo(Booking booking, Letter.FileFormat fileFormat, Patient patient, HealthCard hc, int fieldID, Referrer referrer, bool keepInHistory, bool needToGenerateFirstLetter, bool needToGenerateLastLetter, bool needToGenerateTreatmentLetter, int siteID, int staffID, int letterPrintHistorySendMethodID) { System.Collections.ArrayList lettersList = new System.Collections.ArrayList(); if (needToGenerateFirstLetter) lettersList.Add(GetFileInfo(fileFormat, booking, patient, hc, Letter.TreatmentLetterType.First, Booking.InvoiceType.Medicare, fieldID, siteID, staffID, null, keepInHistory, letterPrintHistorySendMethodID)); if (needToGenerateLastLetter) lettersList.Add(GetFileInfo(fileFormat, booking, patient, hc, Letter.TreatmentLetterType.Last, Booking.InvoiceType.Medicare, fieldID, siteID, staffID, null, keepInHistory, letterPrintHistorySendMethodID)); if (needToGenerateTreatmentLetter) lettersList.Add(GetFileInfo(fileFormat, booking, patient, hc, Letter.TreatmentLetterType.TreatmentNotes, Booking.InvoiceType.Medicare, fieldID, siteID, staffID, referrer, keepInHistory, letterPrintHistorySendMethodID)); return (BulkLetterSendingQueueAdditionalLetter[])lettersList.ToArray(typeof(BulkLetterSendingQueueAdditionalLetter)); }
/// <summary> /// Gets all Referrers from the database. /// </summary> /// <returns> /// List of Referrers. /// </returns> public override List<Referrer> FillReferrers() { this.DeleteOldReferrers(); var referrers = new List<Referrer>(); var connString = ConfigurationManager.ConnectionStrings[this.connStringName].ConnectionString; var providerName = ConfigurationManager.ConnectionStrings[this.connStringName].ProviderName; var provider = DbProviderFactories.GetFactory(providerName); using (var conn = provider.CreateConnection()) { if (conn != null) { conn.ConnectionString = connString; conn.Open(); using (var cmd = conn.CreateCommand()) { var sqlQuery = string.Format("SELECT ReferrerId, ReferralDay, ReferrerUrl, ReferralCount, Url, IsSpam FROM {0}Referrers ", this.tablePrefix); cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; using (var rdr = cmd.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { var refer = new Referrer { Id = rdr.GetGuid(0), Day = rdr.GetDateTime(1), ReferrerUrl = new Uri(rdr.GetString(2)), Count = rdr.GetInt32(3), Url = rdr.IsDBNull(4) ? null : new Uri(rdr.GetString(4)), PossibleSpam = rdr.IsDBNull(5) ? false : rdr.GetBoolean(5) }; referrers.Add(refer); refer.MarkOld(); } } } } } } return referrers; }
/// <summary> /// Saves an existing Referrer to the database. /// </summary> /// <param name="referrer"> /// Referrer to be saved. /// </param> public override void UpdateReferrer(Referrer referrer) { var referrers = Referrer.Referrers; referrers.Remove(referrer); referrers.Add(referrer); using (var conn = this.CreateConnection()) { if (conn.HasConnection) { var sqlQuery = string.Format("UPDATE {0}Referrers SET ReferralDay = {1}ReferralDay, ReferrerUrl = {1}ReferrerUrl, ReferralCount = {1}ReferralCount, Url = {1}Url, IsSpam = {1}IsSpam WHERE BlogId = {1}BlogId AND ReferrerId = {1}ReferrerId", this.tablePrefix, this.parmPrefix); using (var cmd = conn.CreateTextCommand(sqlQuery)) { this.AddReferrersParametersToCommand(referrer, conn, cmd); cmd.ExecuteNonQuery(); } } } }
public static Referrer[] GetReferrersOf(int organistion_id, bool showDeletedRefs = false, bool showDeletedRegRefs = false) { DataTable tbl = GetDataTable_ReferrersOf(organistion_id, showDeletedRefs, showDeletedRegRefs); Referrer[] list = new Referrer[tbl.Rows.Count]; for (int i = 0; i < tbl.Rows.Count; i++) { list[i] = ReferrerDB.Load(tbl.Rows[i]); list[i].Person = PersonDB.Load(tbl.Rows[i], "", "person_entity_id"); list[i].Person.Title = IDandDescrDB.Load(tbl.Rows[i], "title_id", "descr"); } return list; }
/// <summary> /// Gets all Referrers from the database. /// </summary> /// <returns> /// List of Referrers. /// </returns> public override List<Referrer> FillReferrers() { this.DeleteOldReferrers(); var referrers = new List<Referrer>(); using (var conn = this.CreateConnection()) { if (conn.HasConnection) { using (var cmd = conn.CreateTextCommand(string.Format("SELECT ReferrerId, ReferralDay, ReferrerUrl, ReferralCount, Url, IsSpam FROM {0}Referrers WHERE BlogId = {1}blogid ", this.tablePrefix, this.parmPrefix))) { cmd.Parameters.Add(conn.CreateParameter(FormatParamName("blogid"), Blog.CurrentInstance.Id.ToString())); using (var rdr = cmd.ExecuteReader()) { while (rdr.Read()) { var refer = new Referrer { Id = rdr.GetGuid(0), Day = rdr.GetDateTime(1), ReferrerUrl = new Uri(rdr.GetString(2)), Count = rdr.GetInt32(3), Url = rdr.IsDBNull(4) ? null : new Uri(rdr.GetString(4)), PossibleSpam = rdr.IsDBNull(5) ? false : rdr.GetBoolean(5) }; referrers.Add(refer); refer.MarkOld(); } } } } } return referrers; }
public void Portal_SavePatient(Patient patient, Referrer referrer) { dl = new DataLayer(pConnectionString); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "Portal_SavePatient"; cmd.Parameters.AddWithValue("@ID", patient.ID); cmd.Parameters.AddWithValue("@FirstName", patient.FirstName); cmd.Parameters.AddWithValue("@LastName", patient.LastName); cmd.Parameters.AddWithValue("@DateOfBirth", patient.DateOfBirth); cmd.Parameters.AddWithValue("@Gender", patient.Gender); cmd.Parameters.AddWithValue("@Ethnicity", patient.Ethnicity); cmd.Parameters.AddWithValue("@MedicaidNumber", patient.MedicaidNumber); cmd.Parameters.AddWithValue("@SocialSecurityNumber", patient.MedicaidNumber); cmd.Parameters.AddWithValue("@ResidingWithName", patient.ResidingWithName); cmd.Parameters.AddWithValue("@ResidingWithRelationship", patient.ResidingWithRelationship); cmd.Parameters.AddWithValue("@SchoolName", patient.SchoolName); cmd.Parameters.AddWithValue("@SchoolGrade", patient.SchoolName); cmd.Parameters.AddWithValue("@SchoolPhone", patient.SchoolPhone); cmd.Parameters.AddWithValue("@EmployerName", patient.EmployerName); cmd.Parameters.AddWithValue("@Occupation", patient.Occupation); cmd.Parameters.AddWithValue("@ClientOnProbation", patient.ClientOnProbation); cmd.Parameters.AddWithValue("@EmailAddress", patient.EmailAddress); cmd.Parameters.AddWithValue("@Diagnosis", patient.Diagnosis); cmd.Parameters.AddWithValue("@ServiceRequested", patient.ServiceRequested); cmd.Parameters.AddWithValue("@LocationofServices", patient.LocationofServices); cmd.Parameters.AddWithValue("@FinanciallyResponsiblePerson", patient.FinanciallyResponsiblePerson); cmd.Parameters.AddWithValue("@PaymentMethod", patient.PaymentMethod); cmd.Parameters.AddWithValue("@Email", patient.EmailAddress); cmd.Parameters.AddWithValue("@ReferralSourceName", referrer.ReferralSourceName); cmd.Parameters.AddWithValue("@ReferralSourceAgency", referrer.ReferralSourceAgency); cmd.Parameters.AddWithValue("@ReferrerPhone", referrer.ReferrerPhone); cmd.Parameters.AddWithValue("@ReferralFax", referrer.ReferralFax); cmd.Parameters.AddWithValue("@ReferralStreet", referrer.Street); cmd.Parameters.AddWithValue("@ReferralSuite", referrer.Suite); cmd.Parameters.AddWithValue("@ReferralCity", referrer.City); cmd.Parameters.AddWithValue("@ReferralState", referrer.State); cmd.Parameters.AddWithValue("@ReferralZipCode", referrer.ZipCode); cmd.Parameters.AddWithValue("@ReferralCountry", referrer.Country); cmd.Parameters.AddWithValue("@PatientStreet", patient.PatientStreet); cmd.Parameters.AddWithValue("@PatientSuite", patient.PatientSuite); cmd.Parameters.AddWithValue("@PatientCity", patient.PatientCity); cmd.Parameters.AddWithValue("@PatientState", patient.PatientState); cmd.Parameters.AddWithValue("@PatientZipCode", patient.PatientZipCode); cmd.Parameters.AddWithValue("@PatientCountry", patient.PatientCountry); dl.Execute(cmd); return; }
protected void SubmitPatient_Click(object sender, EventArgs e) { if (txtReferralFax.Text.Length > 0) { Regex objPhonePattern = new Regex(@"^(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2}(?:\-?|\ ?))[2-9]\d{2}[- ]?\d{4}$"); if (!objPhonePattern.IsMatch(txtReferralFax.Text)) { lblErrorMessage.Text = "Invalid ReferralFax entered"; txtReferralFax.Focus(); return; } } string ServiceRequested = string.Empty; foreach (ListItem oItem in chkServiceRequested.Items) { if (oItem.Selected) // if you want only selected { ServiceRequested = ServiceRequested + oItem.Value + ","; } } if (ServiceRequested.Length > 0) { ServiceRequested = ServiceRequested.Substring(0, ServiceRequested.Length - 1); } Patient patient = new Patient { FirstName = txtFirstName.Text, LastName = txtLastName.Text, DateOfBirth = DateTime.Parse(txtDateOfBirth.Text), ReferralDate = DateTime.Parse(DateofReferral.Text), Gender = drpGender.SelectedValue, Ethnicity = drpEthnicity.SelectedValue, MedicaidNumber = txtMedicaidNumber.Text, SocialSecurityNumber = SocialSecurityNumber.Text, ResidingWithName = txtResidingWithName.Text, ResidingWithRelationship = txtResidingWithRelationship.Text, SchoolName = txtSchoolName.Text, SchoolGrade = txtSchoolGrade.Text, SchoolPhone = txtSchoolPhone.Text, SchoolPhoneType = drpSchoolPhoneType.SelectedValue, EmployerName = txtEmployer.Text, Occupation = txtOccupation.Text, ClientOnProbation = chkOnProbation.Checked, Diagnosis = txtDiagnosis.Text, ServiceRequested = ServiceRequested, LocationofServices = drpLocationOfServices.SelectedValue, FinanciallyResponsiblePerson = txtFinanciallyRep.Text, PaymentMethod = drpPaymentMethods.SelectedValue, EmailAddress = txtEmailAddress.Text, PatientStreet = txtClientStreet.Text, PatientSuite = txtClientSuiteApt.Text, PatientCity = txtClientCity.Text, PatientState = drpClientState.SelectedValue, PatientCountry = drpClientCountry.SelectedValue, PatientZipCode = txtClientZipCode.Text, PresentingConcerns = txtPresentingConcerns.Text, LegalGuardian = txtLegalGUardian.Text, }; Referrer referrer = new Referrer { ReferralSourceName = txtReferrerName.Text, ReferralSourceAgency = txtReferrerAgency.Text, ReferrerPhone = txtReferralPhone.Text, ReferrerPhoneType = drptxtReferralPhoneTypes.SelectedValue, ReferralFax = txtReferralFax.Text, Street = txtReferralStreet.Text, Suite = txtReferralSuiteApt.Text, City = txtReferralCity.Text, State = drpReferralState.SelectedValue, ZipCode = txtReferralZip.Text, Country = drpReferralCountry.SelectedValue, }; try { int status = controller.Portal_SavePatient(patient, referrer, HttpContext.Current.Session["email"].ToString()); if (status == -1) { //ssn exists Helper.DisplayAlert(this, "patient with the entered ssn already exists!, record was not saved."); } if (status == 1) { //email exists Helper.DisplayAlert(this, "patient with the entered email already exists!, record was not saved."); } if (status == 0) { //success var redirectPage = ConfigurationManager.AppSettings["DashBoardPage"]; Helper.DisplayAlert(this, "patient saved successfully, you will now be directed to patients dashboard."); Helper.RegisterStartupScript(this, redirectPage); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Gets a Referrer based on an Id. /// </summary> /// <param name="id">The Referrers's Guid.</param> /// <returns>A matching Referrer</returns> public override Referrer SelectReferrer(Guid Id) { Referrer refer = Referrer.Referrers.Find(r => r.Id.Equals(Id)); if (refer == null) { refer = new Referrer(); } refer.MarkOld(); return refer; }
public ActionResult Index(string token) { var ownerUser = _usersService.GetUserByEmailHash(token); if (ownerUser != null) { if (Request.Cookies["owner"] == null) { var cookie = new HttpCookie("owner"); cookie.Value = ownerUser.Id.ToString(CultureInfo.InvariantCulture); cookie.Expires = DateTime.Now.AddHours(1); ControllerContext.HttpContext.Response.Cookies.Add(cookie); // Если есть реферальный url, то сохраняем в статистику if (HttpContext.Request.UrlReferrer != null) { var urlReferrer = HttpContext.Request.UrlReferrer; // Создаем новые cookie if (Request.Cookies["Host"] == null) { var hostCookie = new HttpCookie("Host"); hostCookie.Values["shortHost"] = urlReferrer.Host; hostCookie.Values["fullHostUrl"] = urlReferrer.OriginalString; hostCookie.Expires = DateTime.Now.AddHours(1); ControllerContext.HttpContext.Response.Cookies.Add(hostCookie); } else // или обновляем имеющиеся { Response.Cookies["Host"]["shortHost"] = urlReferrer.Host; Response.Cookies["Host"]["fullHostUrl"] = urlReferrer.OriginalString; Response.Cookies["Host"].Expires = DateTime.Now.AddHours(1); } var entity = new Referrer { Host = urlReferrer.Host, FullReferrerUrl = urlReferrer.OriginalString, Date = DateTime.Now, IsDeleted = false, OwnerId = ownerUser.Id, Registered = false }; _statService.AddReferrer(entity); } else { Response.Cookies["Host"]["shortHost"] = "undefined"; Response.Cookies["Host"]["fullHostUrl"] = "undefined"; Response.Cookies["Host"].Expires = DateTime.Now.AddHours(1); var entity = new Referrer { Host = "undefined", FullReferrerUrl = "", Date = DateTime.Now, IsDeleted = false, OwnerId = ownerUser.Id, Registered = false }; _statService.AddReferrer(entity); } } else { Response.Cookies["owner"].Value = ownerUser.Id.ToString(CultureInfo.InvariantCulture); Response.Cookies["owner"].Expires = DateTime.Now.AddHours(1); } } return View(); }
private void addReferrersParametersToCommand(Referrer referrer, DbProviderFactory provider, DbCommand cmd) { DbParameter dpId = provider.CreateParameter(); dpId.ParameterName = "ReferrerId"; dpId.Value = referrer.Id.ToString(); cmd.Parameters.Add(dpId); DbParameter dpDay = provider.CreateParameter(); dpDay.ParameterName = parmPrefix + "ReferralDay"; dpDay.Value = referrer.Day; cmd.Parameters.Add(dpDay); DbParameter dpReferrer = provider.CreateParameter(); dpReferrer.ParameterName = parmPrefix + "ReferrerUrl"; dpReferrer.Value = referrer.ReferrerUrl != null ? (object)referrer.ReferrerUrl.ToString() : DBNull.Value; cmd.Parameters.Add(dpReferrer); DbParameter dpCount = provider.CreateParameter(); dpCount.ParameterName = parmPrefix + "ReferralCount"; dpCount.Value = referrer.Count; cmd.Parameters.Add(dpCount); DbParameter dpUrl = provider.CreateParameter(); dpUrl.ParameterName = "Url"; dpUrl.Value = referrer.Url != null ? (object)referrer.Url.ToString() : DBNull.Value; cmd.Parameters.Add(dpUrl); DbParameter dpIsSpam = provider.CreateParameter(); dpIsSpam.ParameterName = "IsSpam"; dpIsSpam.Value = referrer.PossibleSpam; cmd.Parameters.Add(dpIsSpam); }
protected void Submitlogin_Click(object sender, EventArgs e) { /* validate form */ //validate Referral Phone if (!Helper.IsNumeric(txtReferralPhonePt1.Text)) { lblErrorMessage.Text = "Invalid referral phone number"; txtReferralPhonePt1.Focus(); return; } if (!Helper.IsNumeric(txtReferralPhonePt2.Text)) { lblErrorMessage.Text = "Invalid referral phone number"; txtReferralPhonePt2.Focus(); return; } if (!Helper.IsNumeric(txtReferralPhonePt3.Text)) { lblErrorMessage.Text = "Invalid referral phone number"; txtReferralPhonePt3.Focus(); return; } //validate Referral Fax if (!Helper.IsNumeric(txtReferralFaxPt1.Text)) { lblErrorMessage.Text = "Invalid referral fax number"; txtReferralFaxPt1.Focus(); return; } if (!Helper.IsNumeric(txtReferralFaxPt2.Text)) { lblErrorMessage.Text = "Invalid referral fax number"; txtReferralFaxPt2.Focus(); return; } if (!Helper.IsNumeric(txtReferralFaxPt3.Text)) { lblErrorMessage.Text = "Invalid referral fax number"; txtReferralFaxPt3.Focus(); return; } //validate Social Security Number if (!Helper.IsNumeric(SocialSecurityNumberPt1.Text)) { lblErrorMessage.Text = "Invalid Social Security Number"; SocialSecurityNumberPt1.Focus(); return; } if (!Helper.IsNumeric(SocialSecurityNumberPt2.Text)) { lblErrorMessage.Text = "Invalid Social Security Number"; SocialSecurityNumberPt2.Focus(); return; } if (!Helper.IsNumeric(SocialSecurityNumberPt3.Text)) { lblErrorMessage.Text = "Invalid Social Security Number"; SocialSecurityNumberPt3.Focus(); return; } //validate School Phone if (!Helper.IsNumeric(txtSchoolPhonePt1.Text)) { lblErrorMessage.Text = "Invalid School Phone number"; txtSchoolPhonePt1.Focus(); return; } if (!Helper.IsNumeric(txtSchoolPhonePt2.Text)) { lblErrorMessage.Text = "Invalid School Phone number"; txtSchoolPhonePt2.Focus(); return; } if (!Helper.IsNumeric(txtSchoolPhonePt3.Text)) { lblErrorMessage.Text = "Invalid School Phone number"; txtSchoolPhonePt3.Focus(); return; } //validate chkServiceRequested if (!chkServiceRequestedSelected()) { lblErrorMessage.Text = "Service Requested is not specified"; chkServiceRequested.Focus(); return; } //string values = string.Join(",", chkServiceRequested.Items.Cast<ListItem>() // .Where(i => i.Selected) // .Select(i => i.Value)); string ServiceRequested = string.Empty; foreach (ListItem oItem in chkServiceRequested.Items) { if (oItem.Selected) // if you want only selected { ServiceRequested = ServiceRequested + oItem.Value + ","; } } ServiceRequested = ServiceRequested.Substring(0, ServiceRequested.Length - 1); Patient patient = new Patient { ID = Int64.Parse(txtPatientNo.Text), FirstName = txtFirstName.Text, LastName = txtLastName.Text, DateOfBirth = DateTime.Parse(drpDateOfBirthYear.SelectedValue + "," + drpDateOfBirthMonth.SelectedValue + "," + drpDateOfBirthDay.SelectedValue), Gender = drpGender.SelectedValue, Ethnicity = drpEthnicity.SelectedValue, MedicaidNumber = txtMedicaidNumber.Text, SocialSecurityNumber = SocialSecurityNumberPt1.Text + '-' + SocialSecurityNumberPt2.Text + '-' + SocialSecurityNumberPt3.Text, ResidingWithName = txtResidingWithName.Text, ResidingWithRelationship = txtResidingWithRelationship.Text, SchoolName = txtSchoolName.Text, SchoolGrade = txtSchoolGrade.Text, SchoolPhone = txtSchoolPhonePt0.Text + txtSchoolPhonePt1.Text + txtSchoolPhonePt2.Text + txtSchoolPhonePt3.Text, EmployerName = txtEmployer.Text, Occupation = txtOccupation.Text, ClientOnProbation = chkOnProbation.Checked, Diagnosis = txtDiagnosis.Text, ServiceRequested = ServiceRequested, LocationofServices = drpLocationOfServices.SelectedValue, FinanciallyResponsiblePerson = txtFinanciallyRep.Text, PaymentMethod = drpPaymentMethods.SelectedValue, EmailAddress = txtEmailAddress.Text, PatientStreet = txtClientStreet.Text, PatientSuite = txtClientSuiteApt.Text, PatientCity = txtClientCity.Text, PatientState = drpClientState.SelectedValue, PatientCountry = drpClientCountry.SelectedValue, PatientZipCode = txtClientZipCode.Text, }; Referrer referrer = new Referrer { ReferralSourceName = txtReferrerName.Text, ReferralSourceAgency = txtReferrerAgency.Text, ReferrerPhone = txtReferralPhonePt0.Text + txtReferralPhonePt1.Text + txtReferralPhonePt2.Text + txtReferralPhonePt3.Text, ReferralFax = txtReferralFaxPt0.Text + txtReferralFaxPt1.Text + txtReferralFaxPt2.Text + txtReferralFaxPt3.Text, Street = txtReferralStreet.Text, Suite = txtReferralSuiteApt.Text, City = txtReferralCity.Text, State = drpReferralState.SelectedValue, ZipCode = txtReferralZip.Text, Country = drpReferralCountry.SelectedValue, }; controller.Portal_SavePatient(patient, referrer); }
/// <summary> /// Adds a new Referrer to the database. /// </summary> /// <param name="referrer">Referrer to add.</param> public override void InsertReferrer(Referrer referrer) { List<Referrer> referrers = Referrer.Referrers; referrers.Add(referrer); string connString = ConfigurationManager.ConnectionStrings[connStringName].ConnectionString; string providerName = ConfigurationManager.ConnectionStrings[connStringName].ProviderName; DbProviderFactory provider = DbProviderFactories.GetFactory(providerName); using (DbConnection conn = provider.CreateConnection()) { conn.ConnectionString = connString; conn.Open(); using (DbCommand cmd = conn.CreateCommand()) { string sqlQuery = "INSERT INTO " + tablePrefix + "Referrers (ReferrerId, ReferralDay, ReferrerUrl, ReferralCount, Url, IsSpam) " + "VALUES (@ReferrerId, @ReferralDay, @ReferrerUrl, @ReferralCount, @Url, @IsSpam)"; if (parmPrefix != "@") sqlQuery = sqlQuery.Replace("@", parmPrefix); cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; addReferrersParametersToCommand(referrer, provider, cmd); cmd.ExecuteNonQuery(); } } }
public static Letter.FileContents SendTreatmentLetter(FileFormat fileFormat, Booking booking, Patient patient, HealthCard hc, Letter.TreatmentLetterType treatmentLetterType, Booking.InvoiceType invType, int fieldID, int siteID, int staffID, Referrer referrer, bool keepInHistory, int letterPrintHistorySendMethodID) { // 1. Add to healthcardaction int healthCardActionID = -1; if (treatmentLetterType == Letter.TreatmentLetterType.First || treatmentLetterType == Letter.TreatmentLetterType.Last || treatmentLetterType == Letter.TreatmentLetterType.LastWhenReplacingEPC) healthCardActionID = HealthCardActionDB.Insert(hc.HealthCardID, Letter.GetHealthCardActionTypeID(treatmentLetterType), DateTime.Now); // 2.create document and put it in history int letterID = Letter.GetLetterIDByTreatmentLetterTypeAndInvoiceType(treatmentLetterType, invType, fieldID, siteID); if (letterID == -1) return null; //string[] notes = (treatmentLetterType == TreatmentLetterType.TreatmentNotes) ? booking.GetNoteTextForTreatmentLetter(referrer) : null; string[] notes = null; Letter.FileContents fileContents = Letter.CreateLetter(fileFormat, SiteDB.GetByID(siteID), letterID, booking.Organisation.OrganisationID, patient.PatientID, staffID, booking.BookingID, healthCardActionID, 1, notes, keepInHistory, letterPrintHistorySendMethodID); return fileContents; //Letter.SendLetter(Response, SiteDB.GetByID(Convert.ToInt32(Session["SiteID"])), GetLetterID(treatmentLetterType, invType), booking.Organisation.OrganisationID, booking.Patient.PatientID, Convert.ToInt32(Session["StaffID"]), booking.BookingID, healthCardActionID, 1, null); }