Bizgaze CRM Visitors App
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Visitor.cs 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Unibase.Data.Expressions;
  7. using Unibase.Data.Sorting;
  8. using Unibase.Data.Sql;
  9. using Unibase.Platform.Data;
  10. namespace Bizgaze.CRM.Visitors.Infos
  11. {
  12. public class Visitor : BaseInfo, IInfo
  13. {
  14. public enum Property
  15. {
  16. VisitorId, StageId, TenantId, StatusId, PurposeOfVisit, Title, SeriesId, Code, Reason, EmailId, VersionguId, MobileNumber, FullName, NewCheckIn, PreInvite, AccessCode, FutureInvitation, TimeOfVisit, DateOfVisit, HostName, OrganizationName, TitleName, VisitorType, TemplateId, Installedappid, PhotoUrl, CreatedDate, StageStatusName, RefStatusId, AlternateNumber, ImageUrl, VisitorNumberId, VisitorEmailId, Agreement, LastUpdatedDate, TypeofVisitor, CityName, CityId, CheckInDate
  17. }
  18. #region Public Properties
  19. public Int64 VisitorId { get; set; }
  20. public Int64 VisitorEmailId { get; set; }
  21. public Int64 VisitorNumberId { get; set; }
  22. public Int64 AlternateNumber { get; set; }
  23. public Int32 PurposeOfVisit { get; set; }
  24. public int Title { get; set; }
  25. public int VisitorType { get; set; }
  26. public int TypeofVisitor { get; set; }
  27. public Int64 SeriesId { get; set; }
  28. public Int64 EmployeeId { get; set; }
  29. public Int64 TemplateId { get; set; }
  30. public int RefStatusId { get; set; }
  31. public long Installedappid { get; set; }
  32. public string Code { get; set; }
  33. public string Reason { get; set; }
  34. public string EmailId { get; set; }
  35. public string ComingFrom { get; set; }
  36. public string MobileNumber { get; set; }
  37. public string PurposeOfVisitType { get; set; }
  38. public string HostName { get; set; }
  39. public string FullName { get; set; }
  40. public string OrganizationName { get; set; }
  41. public string NewCheckIn { get; set; }
  42. public string PreInvite { get; set; }
  43. public string TitleName { get; set; }
  44. public string StageStatusName { get; set; }
  45. public string AccessCode { get; set; }
  46. public Boolean FutureInvitation { get; set; }
  47. public DateTime TimeOfVisit { get; set; }
  48. public DateTime CheckInDate { get; set; }
  49. public DateTime DateOfVisit { get; set; }
  50. public Boolean Agreement { get; set; }
  51. public string PhotoUrl { get; set; }
  52. public string ImageUrl { get; set; }
  53. public DateTime LastUpdatedDate { get; set; }
  54. public string CityName { get; set; }
  55. public Int64 CityId { get; set; }
  56. #endregion
  57. public string __TableName
  58. {
  59. get
  60. {
  61. return "bizgazecrm_visitors";
  62. }
  63. }
  64. public SortList GetDefaultSort()
  65. {
  66. return new SortList()
  67. {
  68. new Sort("VisitorId", Unibase.Data.Enums.SortOrder.Desc)
  69. };
  70. }
  71. public override Select GetQuery(SelectRequest srequest)
  72. {
  73. Int64 CompanyId = srequest.Identity.Settings == null ? 0 : Convert.ToInt64(srequest.Identity.GetSetting("companyid").SettingValue);
  74. string[] columns = {
  75. "v.cityid",
  76. "vn.mobilenumber",
  77. "v.alternatenumber",
  78. "v.employeeid",
  79. "v.photourl",
  80. "v.installedappid",
  81. "v.organizationname",
  82. "v.comingfrom",
  83. "v.accesscode",
  84. "v.visitorid",
  85. "v.code",
  86. "ve.emailid",
  87. "v.FullName",
  88. "v.title",
  89. "v.FutureInvitation",
  90. "v.TimeOfVisit",
  91. "v.DateOfVisit",
  92. "v.checkindate",
  93. "v.CreatedDate",
  94. "ve.visitoremailid",
  95. "vn.visitornumberid",
  96. "v.purposeofvisit",
  97. "ss.stagestatusname",
  98. "ss.refstatusid",
  99. "s.stageid",
  100. "v.statusid",
  101. "v.tenantid",
  102. "v.visitortype",
  103. "v.seriesid",
  104. "v.agreement",
  105. "v.lastupdateddate",
  106. "v.versionguid","ci.cityname",
  107. "(select imageurl from bizgazecrm_companies where companyid="+CompanyId+") as imageurl",
  108. "Case when purposeofvisit=1 then 'Interview' when purposeofvisit=2 then 'Official Meeting' when purposeofvisit=3 then 'Meeting an Employee' when purposeofvisit=4 then 'Package Delivery' when purposeofvisit=5 then 'Others' end as purposeofvisittype",
  109. "concat(e.firstname, e.lastname) AS HostName",
  110. "Case when title=1 then 'Mr' when title=2 then 'Miss' end as TitleName",
  111. };
  112. return new Select("bizgazecrm_visitors v").Columns(columns).
  113. InnerJoin("bizgazecrm_employees e", Exp.EqColumns("e.employeeid", "v.employeeid")).InnerJoin("unibase_stages s", Exp.EqColumns("v.stageid", "s.stageid")).InnerJoin("unibase_stagestatus ss", Exp.EqColumns("ss.stagestatusid", "s.stagestatusid")).InnerJoin("bizgazecrm_visitornumbers vn", Exp.EqColumns("vn.visitorid", "v.visitorid")).InnerJoin("bizgazecrm_visitoremails ve", Exp.EqColumns("ve.visitorid", "v.visitorid")).InnerJoin("bizgazecrm_cities ci ", Exp.EqColumns("v.cityid", "ci.cityid"));
  114. }
  115. }
  116. }