Bizgaze CRM Visitors App
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Visitor.cs 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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, ComingFrom, VersionguId, MobileNumber, FullName, NewCheckIn, PreInvite, AccessCode, FutureInvitation, TimeOfVisit, DateOfVisit, HostName, OrganizationName, TitleName, VisitorType, TemplateId, Installedappid, PhotoUrl, CreatedDate, StageStatusName, RefStatusId, AlternateNumber, ImageUrl, VisitorNumberId, VisitorEmailId
  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 Int64 SeriesId { get; set; }
  27. public Int64 EmployeeId { get; set; }
  28. public Int64 TemplateId { get; set; }
  29. public int RefStatusId { get; set; }
  30. public long Installedappid { get; set; }
  31. public string Code { get; set; }
  32. public string Reason { get; set; }
  33. public string EmailId { get; set; }
  34. public string ComingFrom { get; set; }
  35. public string MobileNumber { get; set; }
  36. public string PurposeOfVisitType { get; set; }
  37. public string HostName { get; set; }
  38. public string FullName { get; set; }
  39. public string OrganizationName { get; set; }
  40. public string NewCheckIn { get; set; }
  41. public string PreInvite { get; set; }
  42. public string TitleName { get; set; }
  43. public string StageStatusName { get; set; }
  44. public string AccessCode { get; set; }
  45. public Boolean FutureInvitation { get; set; }
  46. public DateTime TimeOfVisit { get; set; }
  47. public DateTime CheckInDate { get; set; }
  48. public DateTime DateOfVisit { get; set; }
  49. public Boolean Agreement { get; set; }
  50. public string PhotoUrl { get; set; }
  51. public string ImageUrl { get; set; }
  52. #endregion
  53. public string __TableName
  54. {
  55. get
  56. {
  57. return "bizgazecrm_visitors";
  58. }
  59. }
  60. public SortList GetDefaultSort()
  61. {
  62. return new SortList()
  63. {
  64. new Sort("VisitorId", Unibase.Data.Enums.SortOrder.Desc)
  65. };
  66. }
  67. public override Select GetQuery(SelectRequest srequest)
  68. {
  69. Int64 CompanyId = srequest.Identity.Settings == null ? 0 : Convert.ToInt64(srequest.Identity.GetSetting("companyid").SettingValue);
  70. string[] columns = {
  71. "vn.mobilenumber",
  72. "v.alternatenumber",
  73. "v.employeeid",
  74. "v.photourl",
  75. "v.installedappid",
  76. "v.organizationname",
  77. "v.comingfrom",
  78. "v.accesscode",
  79. "v.visitorid",
  80. "v.code",
  81. "ve.emailid",
  82. "v.FullName",
  83. "v.title",
  84. "v.FutureInvitation",
  85. "v.TimeOfVisit",
  86. "v.DateOfVisit",
  87. "v.checkindate",
  88. "v.CreatedDate",
  89. "ve.visitoremailid",
  90. "vn.visitornumberid",
  91. "v.purposeofvisit",
  92. "ss.stagestatusname",
  93. "ss.refstatusid",
  94. "s.stageid",
  95. "v.statusid",
  96. "v.tenantid",
  97. "v.visitortype",
  98. "v.seriesid",
  99. "(select imageurl from bizgazecrm_companies where companyid="+CompanyId+") as imageurl",
  100. "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",
  101. "concat(e.firstname, e.lastname) AS HostName",
  102. "Case when title=1 then 'Mr' when title=2 then 'Miss' end as TitleName",
  103. };
  104. return new Select("bizgazecrm_visitors v").Columns(columns).
  105. 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"));
  106. }
  107. }
  108. }