|
@@ -1,4 +1,6 @@
|
1
|
1
|
using Bizgaze.CRM;
|
|
2
|
+using ChoETL;
|
|
3
|
+using DnsClient;
|
2
|
4
|
using System;
|
3
|
5
|
using System.Collections.Generic;
|
4
|
6
|
using System.Dynamic;
|
|
@@ -78,16 +80,20 @@ namespace Bizgaze.CRM.Visitors.ActionProviders
|
78
|
80
|
var req = obj1 as IDictionary<string, object>;
|
79
|
81
|
var mobileNumber = "";
|
80
|
82
|
var emailId = "";
|
81
|
|
- long installedAppId = 0;
|
|
83
|
+ //long installedAppId = 0;
|
82
|
84
|
var visitorName = "";
|
83
|
|
- var stageStatusName = "";
|
|
85
|
+ // var stageStatusName = "";
|
84
|
86
|
var photourl = "";
|
85
|
87
|
var visitorInfo = docParameters.Find(x => x.DocType == "bizgazecrm_visitors");
|
|
88
|
+
|
86
|
89
|
if (visitorInfo != null)
|
87
|
90
|
{
|
88
|
|
- var visitorId = Convert.ToInt64(visitorInfo.Parameters["visitorid"]);
|
|
91
|
+ long installedAppId = 0;
|
|
92
|
+ var stageStatusName = "";
|
|
93
|
+ var visitorIds = Convert.ToInt64(visitorInfo.Parameters["visitorid"]);
|
89
|
94
|
var visitorType = Convert.ToInt64(visitorInfo.Parameters["visitortype"]);
|
90
|
|
- var visitordata = await visitorManager.GetVisitorByIdAsync(srequest, visitorId);
|
|
95
|
+ var code = visitorInfo.Parameters["code"].ToString();
|
|
96
|
+ var visitordata = await visitorManager.GetVisitorByIdAsync(srequest, visitorIds);
|
91
|
97
|
if (visitordata.Result != null)
|
92
|
98
|
{
|
93
|
99
|
if (visitorType == 1)
|
|
@@ -97,17 +103,17 @@ namespace Bizgaze.CRM.Visitors.ActionProviders
|
97
|
103
|
else
|
98
|
104
|
{
|
99
|
105
|
stageStatusName = "Pre-Invite";
|
100
|
|
- defaultPKValue = visitorId;
|
|
106
|
+ defaultPKValue = visitorIds;
|
101
|
107
|
}
|
102
|
108
|
mobileNumber = visitordata.Result.MobileNumber;
|
103
|
109
|
emailId = visitordata.Result.EmailId;
|
104
|
110
|
installedAppId = visitordata.Result.Installedappid;
|
105
|
111
|
visitorName = visitordata.Result.FullName;
|
106
|
112
|
photourl = visitordata.Result.PhotoUrl;
|
107
|
|
- var stage = await stageManager.GetStageByStageStatusAsync(srequest, installedAppId, stageStatusName);
|
108
|
|
- var NewStageId = stage.Result.StageId;
|
109
|
|
- var UpdateStage = new Update("bizgazecrm_visitors").Value("stageid", NewStageId).Where(Exp.Eq("visitorId", visitorId));
|
110
|
|
- await _repository.ExecuteAsync(request, UpdateStage);
|
|
113
|
+ var stages = await stageManager.GetStageByStageStatusAsync(srequest, installedAppId, stageStatusName);
|
|
114
|
+ var NewStageIds = stages.Result.StageId;
|
|
115
|
+ var UpdateStages= new Update("bizgazecrm_visitors").Value("stageid", NewStageIds).Where(Exp.Eq("visitorId", visitorIds));
|
|
116
|
+ await _repository.ExecuteAsync(request, UpdateStages);
|
111
|
117
|
var visitorTypeid = visitordata.Result.VisitorType;
|
112
|
118
|
if (visitorTypeid != 2)
|
113
|
119
|
{
|
|
@@ -168,12 +174,40 @@ namespace Bizgaze.CRM.Visitors.ActionProviders
|
168
|
174
|
if (requestTrans.StartedLocal) await request.RollbackTransactionAsync();
|
169
|
175
|
return ActionResponse<FormActionResponse>.CreateErrorResponse("1", "Contacts Are Not Saved");
|
170
|
176
|
}
|
171
|
|
- var update = new Update("bizgazecrm_visitors").Value("contactid", userid).Where(Exp.Eq("visitorid", visitorId));
|
|
177
|
+ var update = new Update("bizgazecrm_visitors").Value("contactid", userid).Where(Exp.Eq("visitorid", visitorIds));
|
172
|
178
|
await _repository.ExecuteAsync(request, update);
|
173
|
179
|
}
|
174
|
180
|
}
|
175
|
181
|
}
|
176
|
|
- }
|
|
182
|
+ }
|
|
183
|
+ var visitorInfos = await visitorManager.GetpreVisitorsAsync(srequest, code);
|
|
184
|
+ var visitorId = Convert.ToInt64(visitorInfos.Result.VisitorId);
|
|
185
|
+ var vistoroptions = new EntityOptions()
|
|
186
|
+ {
|
|
187
|
+ IsIdentity = true,
|
|
188
|
+ IsNewEntity = true,
|
|
189
|
+ TableName = "bizgazecrm_visitorcheckout",
|
|
190
|
+ PkColumn = "visitorcheckoutid",
|
|
191
|
+ IsExcludeFromAudit = false,
|
|
192
|
+ Id = 0,
|
|
193
|
+ };
|
|
194
|
+ dynamic visitor = new Dictionary<string, object>();
|
|
195
|
+ visitor.Add("createdby", srequest.Identity.UserId);
|
|
196
|
+ visitor.Add("checkindate", visitorInfos.Result.CheckInDate);
|
|
197
|
+ visitor.Add("comments", "");
|
|
198
|
+ visitor.Add("checkoutdate", DateTime.MinValue);
|
|
199
|
+ visitor.Add("rating", 0);
|
|
200
|
+ visitor.Add("versionguid", Guid.NewGuid());
|
|
201
|
+ visitor.Add("uniqueid", code);
|
|
202
|
+ visitor.Add("statusid", (int)RowStatus.Active);
|
|
203
|
+ visitor.Add("installedappid", visitorInfos.Result.Installedappid);
|
|
204
|
+ visitor.Add("visitorid", visitorId);
|
|
205
|
+ var response1 = await _repository.SaveAsync(request, vistoroptions, visitor);
|
|
206
|
+ if (response1.Status == ResponseStatus.Error)
|
|
207
|
+ {
|
|
208
|
+ if (requestTrans.StartedLocal) await request.RollbackTransactionAsync();
|
|
209
|
+ return ActionResponse<FormActionResponse>.CreateErrorResponse("1", "Visitor Check Out Data Not Saved");
|
|
210
|
+ }
|
177
|
211
|
}
|
178
|
212
|
var returnresponse = new FormActionResponse();
|
179
|
213
|
returnresponse.Obj = dictObj as ExpandoObject;
|