本文整理汇总了C#中Ticket类的典型用法代码示例。如果您正苦于以下问题:C# Ticket类的具体用法?C# Ticket怎么用?C# Ticket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ticket类属于命名空间,在下文中一共展示了Ticket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TBestellenVM
//Constructor
public TBestellenVM()
{
Holders = Ticket.GetTicketHolders();
TicketTypes = TicketType.GetTicketTypes();
VerkochteTickets = Ticket.GetAmountSoldTickets();
TicketHolder = new Ticket();
}
示例2: UpdateOldTicket
public Ticket UpdateOldTicket(Ticket t)
{
t = Update(t);
entity.SaveChanges();
return t;
}
示例3: BuildTestData
private static void BuildTestData()
{
using (var data = new HssTicketingContext())
{
var user = new User() { FirstName = "Nicolai", LastName = "Naglestad", UserName = "nickern", AccessLevel = 1, Password = "123456789" };
data.Users.Add(user);
var user2 = new User() { FirstName = "Ola", LastName = "Nordman", UserName = "test", AccessLevel = 2, Password = "test123" };
data.Users.Add(user2);
var happening = new Happening() { HappeningName = "Neon Party", Location = "Remmen", MaxParticipants = 100};
data.Happenings.Add(happening);
var happening2 = new Happening() { HappeningName = "Test Party", Location = "Fredrikstad", MaxParticipants = 50};
data.Happenings.Add(happening2);
var ticket = new Ticket() { Happening = happening, UniqueId = "123456789", Scanned = true, TimeScanned = new DateTime(2015, 11, 12, 15, 25, 00) };
data.Tickets.Add(ticket);
var ticket2 = new Ticket() { Happening = happening2, UniqueId = "987654321", Scanned = true, TimeScanned = new DateTime(2015, 11, 12, 17, 25, 00) };
data.Tickets.Add(ticket2);
var ticket3 = new Ticket() { Happening = happening, UniqueId = "147258369" };
data.Tickets.Add(ticket3);
var ticket4 = new Ticket() { Happening = happening2, UniqueId = "963852741" };
data.Tickets.Add(ticket4);
data.SaveChanges();
}
}
示例4: TicketCloseSendMail
private void TicketCloseSendMail(Category EntCategory, Ticket lastTicket)
{
StringBuilder sbBody = new StringBuilder();
sbBody.AppendLine("<p>");
sbBody.AppendLine("<IMG src=\"Logo.png\"><br/>");
sbBody.AppendFormat("<strong>Ticket No: {0}</strong>", lastTicket.IdTicket);
sbBody.AppendLine("<br/>");
sbBody.AppendFormat("<strong>Cerradp por: {0} el {1:d} </strong>", lastTicket.AssignedTo.UserCompleteName, lastTicket.ClosedOn);
sbBody.AppendLine("<br/>");
sbBody.AppendLine("<strong>Descripción:</strong>");
sbBody.AppendFormat("<i>{0}</i>", lastTicket.Description);
sbBody.AppendLine("<br/>");
sbBody.AppendLine("<strong>Descripción de Cierre:</strong>");
sbBody.AppendFormat("<i>{0}</i>", lastTicket.CloseDescription);
sbBody.AppendLine("<br/>");
sbBody.AppendLine("</p>");
string slImagePath = Server.MapPath(@"~/App_Themes/Default/Images/Logo.png");
MailMessage mail = new MailMessage("[email protected]", EntCategory.DefaultMail);
mail.Attachments.Add(new Attachment(slImagePath));
if (EntCategory.AlternativeMail != "")
mail.To.Add(EntCategory.AlternativeMail);
mail.Subject = "Ticket Cerrado";
mail.Body = sbBody.ToString();
CoreLibrary.CommonUtils.EmailOperations.SendEmail(mail);
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
//参数判断与处理(考虑用框架处理)
string paramTicketId = Request["Id"];
if (!string.IsNullOrEmpty(paramTicketId))
{
if (int.TryParse(paramTicketId, out ticketId))
{
CurrentTicket = bllTicket.GetTicket(ticketId);
IsNew = false;
}
else
{
ErrHandler.Redirect(ErrType.ParamIllegal);
}
}
if (!IsPostBack)
{
if (!IsNew)
{
LoadForm();
}
}
}
示例6: Get
/// <summary>
/// Retrieve the details of the Ticket
/// </summary>
/// <param name="ticket"></param>
/// <returns>List of Ticket</returns>
public static List<TicketContenu> Get(Ticket ticket)
{
List<TicketContenu> listTicketContenu = new List<TicketContenu>();
using(SqlConnection db = DbConnexion.connect())
{
string sql = "SELECT NumArticle, QteArticle FROM Ticket_Contenu tc WHERE tc.NumTicket = @NumTicket";
using (SqlCommand req = new SqlCommand(sql, db))
{
req.Parameters.Add(new SqlParameter("NumTicket", ticket.Num));
SqlDataReader row = req.ExecuteReader();
while (row.Read())
{
TicketContenu ticketContenu = new TicketContenu();
ticketContenu.Ticket = ticket;
ticketContenu.Article = ArticleDAO.Get(int.Parse(row["NumArticle"].ToString()));
ticketContenu.Quantite = float.Parse(row["QteArticle"].ToString());
listTicketContenu.Add(ticketContenu);
}
}
}
return listTicketContenu;
}
示例7: Write
public static void Write(XmlWriter writer, Ticket pt)
{
var declarations = NamespaceDeclarations(pt);
writer.WriteStartDocument();
var prefix = declarations.LookupPrefix(Psf.PrintTicket.NamespaceName);
writer.WriteStartElement(prefix, Psf.PrintTicket.LocalName, Psf.PrintTicket.NamespaceName);
writer.WriteAttributeString("version", "1");
foreach (var decl in declarations)
{
writer.WriteAttributeString("xmlns", decl.Prefix, null, decl.Uri.NamespaceName);
}
foreach (var f in pt.Features())
{
Write(writer, f);
}
foreach (var p in pt.Properties())
{
Write(writer, p);
}
foreach (var p in pt.Parameters())
{
Write(writer, p);
}
writer.WriteEndElement();
writer.Flush();
}
示例8: CanCreateUpdateAndDeleteTicketAsync
public void CanCreateUpdateAndDeleteTicketAsync()
{
var ticket = new Ticket()
{
Subject = "my printer is on fire",
Comment = new Comment() { Body = "HELP" },
Priority = TicketPriorities.Urgent
};
ticket.CustomFields = new List<CustomField>()
{
new CustomField()
{
Id = Settings.CustomFieldId,
Value = "Doing fine!"
}
};
var res = api.Tickets.CreateTicketAsync(ticket).Result.Ticket;
Assert.NotNull(res);
Assert.Greater(res.Id.Value, 0);
res.Status = TicketStatus.Solved;
res.AssigneeId = Settings.UserId;
res.CollaboratorEmails = new List<string>() { Settings.ColloboratorEmail };
var body = "got it thanks";
var updateResponse = api.Tickets.UpdateTicketAsync(res, new Comment() { Body = body, Public = true });
Assert.NotNull(updateResponse.Result);
Assert.AreEqual(updateResponse.Result.Audit.Events.First().Body, body);
Assert.True(api.Tickets.DeleteAsync(res.Id.Value).Result);
}
示例9: OnSave
private void OnSave(object sender, RoutedEventArgs e)
{
var h = new Hashtable();
var title = m_title.Text;
if (string.IsNullOrEmpty(title))
{
MessageBox.Show("Title must not be empty");
return;
}
var t = new Ticket(App.Base, h)
{
TicketName = Ticket.CreateTicketName(title),
Title = title,
Opened = DateTime.Now,
Assigned = m_assigned.Text,
State=m_status.Text,
};
// add comment if any
if (!string.IsNullOrEmpty(m_comment.Text))
t.Comments.Add(new Comment(m_comment.Text));
// add tags if any
if (!string.IsNullOrEmpty(m_tags.Text))
t.Tags.AddRange(m_tags.Text.Split(','));
t.SaveNew();
//if (TicketSaved != null)
TicketSaved();
//this.Close();
//this.Owner.Focus();
}
示例10: AddTicket
/// <summary>
/// Добавляет билет в запрос к сервису авторизации доступа.
/// </summary>
/// <param name="article">
/// Код товара-билета.
/// </param>
/// <param name="periodOfValidity">
/// Срок действия билета в днях.
/// </param>
/// <param name="ticketBarcode">
/// Штрихкод билета.
/// </param>
public void AddTicket(string article, int periodOfValidity, string ticketBarcode)
{
if (periodOfValidity < 1)
{
// если срок действия не задан, то по умолчанию он равен одному дню
periodOfValidity = 1;
}
var ticketValidFrom = DateTime.Now;
var ticket = new Ticket
{
TicketTypeInnerId = int.Parse(article),
AcessCode = ticketBarcode,
DTStart = ticketValidFrom,
DTEnd = ticketValidFrom
.AddDays(periodOfValidity - 1)
.Date
.AddDays(1)
.AddTicks(-1),
Details = new TicketDetails
{
DTPurchased = ticketValidFrom,
SerialNumber = ticketBarcode
}
};
tickets.Add(ticket);
}
示例11: PutTicket
public IHttpActionResult PutTicket(string id, Ticket ticket)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (id != ticket.UniqueId)
{
return BadRequest();
}
db.Entry(ticket).State = EntityState.Modified;
try
{
db.SaveChanges();
}
catch (DbUpdateConcurrencyException)
{
if (!TicketExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return StatusCode(HttpStatusCode.NoContent);
}
示例12: PostTicket
public IHttpActionResult PostTicket(Ticket ticket)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
var happening = db.Happenings.FirstOrDefault(h => h.HappeningId == ticket.Happening.HappeningId);
ticket.Happening = happening;
db.Tickets.Add(ticket);
try
{
db.SaveChanges();
}
catch (DbUpdateException)
{
if (TicketExists(ticket.UniqueId))
{
return Conflict();
}
else
{
throw;
}
}
return CreatedAtRoute("DefaultApi", new { id = ticket.UniqueId }, ticket);
}
示例13: Get
/// <summary>
/// Retrieve the Ticket by the num
/// </summary>
/// <param name="caisse"></param>
/// <returns>Ticket</returns>
public static Ticket Get(int num)
{
Ticket ticket = new Ticket();
using (SqlConnection db = DbConnexion.connect())
{
string sql = "SELECT * FROM Ticket t WHERE t.NumTicket = @NumTicket";
using (SqlCommand req = new SqlCommand(sql, db))
{
req.Parameters.Add(new SqlParameter("NumTicket", num));
SqlDataReader row = req.ExecuteReader();
if (row.Read())
{
ticket.Num = num;
ticket.DateHeure = row.GetDateTime(row.GetOrdinal("DateHeureTicket"));
ticket.TypeReglement = row["TypeReglement"].ToString();
ticket.Contenu = TicketContenuDAO.Get(ticket);
ticket.Caisse = CaisseDAO.Get(int.Parse(row["NumCaisse"].ToString()));
}
}
}
return ticket;
}
示例14: GetTestCases
public static IEnumerable GetTestCases()
{
var drawnTicket = new Ticket
{
Numbers = new List<int> { 44, 45, 46, 47, 48, 49 }, Additional = 17, Super = 9
};
var classEightTicket = new Ticket { Numbers = new List<int> { 4, 5, 6, 47, 48, 49 }, Super = 0 };
yield return new TestCaseData(drawnTicket, classEightTicket).Returns(WinningClasses.VIII);
var classSevenTicket = new Ticket { Numbers = new List<int> { 17, 5, 6, 47, 48, 49 }, Super = 0 };
yield return new TestCaseData(drawnTicket, classSevenTicket).Returns(WinningClasses.VII);
var classSixTicket = new Ticket { Numbers = new List<int> { 4, 5, 46, 47, 48, 49 }, Super = 0 };
yield return new TestCaseData(drawnTicket, classSixTicket).Returns(WinningClasses.VI);
var classFiveTicket = new Ticket { Numbers = new List<int> { 17, 5, 46, 47, 48, 49 }, Super = 0 };
yield return new TestCaseData(drawnTicket, classFiveTicket).Returns(WinningClasses.V);
var classFourTicket = new Ticket { Numbers = new List<int> { 4, 45, 46, 47, 48, 49 }, Super = 0 };
yield return new TestCaseData(drawnTicket, classFourTicket).Returns(WinningClasses.IV);
var classThreeTicket = new Ticket { Numbers = new List<int> { 17, 45, 46, 47, 48, 49 }, Super = 0 };
yield return new TestCaseData(drawnTicket, classThreeTicket).Returns(WinningClasses.III);
var classTwoTicket = new Ticket { Numbers = new List<int> { 44, 45, 46, 47, 48, 49 }, Super = 0 };
yield return new TestCaseData(drawnTicket, classTwoTicket).Returns(WinningClasses.II);
var classOneTicket = new Ticket { Numbers = new List<int> { 44, 45, 46, 47, 48, 49 }, Super = 9 };
yield return new TestCaseData(drawnTicket, classOneTicket).Returns(WinningClasses.I);
}
示例15: AddAttachment
public Attachment AddAttachment(int ticketId, string fileName, byte[] data, string comment = null)
{
var text = comment ?? string.Format("Attachment: {0}", fileName);
var uploadResponse = UploadFile<UploadWrapper>(
string.Format("uploads.json?filename={0}", fileName), null,
new Dictionary<string, byte[]> { { fileName, data } });
if (uploadResponse.StatusCode != HttpStatusCode.Created || uploadResponse.Data == null ||
uploadResponse.Data.Upload == null || string.IsNullOrEmpty(uploadResponse.Data.Upload.Token) ||
!uploadResponse.Data.Upload.Attachments.Any())
{
return null;
}
var uploadToken = uploadResponse.Data.Upload.Token;
var ticket = new Ticket
{
Id = ticketId,
Comment = new TicketComment
{
Body = text,
Uploads = new[] { uploadToken }
}
};
return UpdateTicket(ticket) != null ? uploadResponse.Data.Upload.Attachments.First() : null;
}