本文整理汇总了C#中Referrer类的典型用法代码示例。如果您正苦于以下问题:C# Referrer类的具体用法?C# Referrer怎么用?C# Referrer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Referrer类属于命名空间,在下文中一共展示了Referrer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertReferrer
/// <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);
}
示例2: GetFileInfo
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,
"",
""
);
}
示例3: FillReferrers
/// <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;
}
示例4: FillReferrers
/// <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;
}
示例5: UpdateReferrer
/// <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();
}
}
}
示例6: Portal_SavePatient
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;
}
示例7: FillReferrers
/// <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;
}
示例8: UpdateReferrer
/// <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();
}
}
}
}
示例9: GetFilesInfo
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));
}
示例10: UpdateReferrer
/// <summary>
/// Updates an existing Referrer.
/// </summary>
/// <param name="referrer">
/// The referrer to update.
/// </param>
public static void UpdateReferrer(Referrer referrer)
{
LoadProviders();
provider.UpdateReferrer(referrer);
}
示例11: InsertReferrer
/// <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);
}
示例12: Index
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();
}
示例13: UpdateReferrer
/// <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);
}
示例14: PopulateRow
/// <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;
}
示例15: InsertReferrer
/// <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();
}
}
}