VisitorPreInvitePreAction.cs changes
This commit is contained in:
@@ -70,6 +70,7 @@ namespace Bizgaze.CRM.Visitors.ActionProviders
|
||||
var stageManager = Unibase.Dependency.DependencyConfig.Resolve<IStageManager>();
|
||||
var visitorManager = Unibase.Dependency.DependencyConfig.Resolve<Bizgaze.CRM.Visitors.Managers.IVisitorManager>();
|
||||
var dictObj = obj as IDictionary<string, dynamic>;
|
||||
var visitorItems = dictObj.ContainsKey("VisitorItems") ? dictObj["VisitorItems"] : null;
|
||||
dictObj.Add("lastupdateddate", DateTime.Now);
|
||||
dictObj.Add("checkindate", DateTime.Now);
|
||||
var CaptureImageObj = Convert.ChangeType(dictObj["Captureimage"].ToString(), typeof(object)).ToString();
|
||||
@@ -126,25 +127,57 @@ namespace Bizgaze.CRM.Visitors.ActionProviders
|
||||
updateDate.Add("agreement", agreement);
|
||||
updateDate.Add("purposeofvisit", purposeofvisit);
|
||||
updateDate.Add("lastupdateddate", DateTime.Now);
|
||||
if (dictObj.ContainsKey("VisitorItems"))
|
||||
{
|
||||
var Items = Convert.ChangeType(dictObj["VisitorItems"].ToString(), typeof(object)).ToString();
|
||||
var deserializeObj = System.Text.Json.JsonSerializer.Deserialize<List<Dictionary<string, object>>>(Items);
|
||||
var visitoritem = deserializeObj[0]["visitoritemname"].ToString();
|
||||
var serial = deserializeObj[0]["serialnumber"].ToString();
|
||||
var quantity = Convert.ToInt64(deserializeObj[0]["quantity"].ToString());
|
||||
var brand = deserializeObj[0]["brand"].ToString();
|
||||
var vistoroptions2 = new EntityOptions()
|
||||
{
|
||||
IsIdentity = true,
|
||||
IsNewEntity = true,
|
||||
TableName = "bizgazecrm_visitoritems",
|
||||
PkColumn = "visitoritemid",
|
||||
IsExcludeFromAudit = false,
|
||||
Id = 0,
|
||||
};
|
||||
dynamic visitor2 = new Dictionary<string, object>();
|
||||
visitor2.Add("visitorid", visitorid);
|
||||
visitor2.Add("visitoritemname", visitoritem);
|
||||
visitor2.Add("quantity", quantity);
|
||||
visitor2.Add("brand", brand);
|
||||
visitor2.Add("serialnumber", serial);
|
||||
var response2 = await _repository.SaveAsync(request, vistoroptions2, visitor2);
|
||||
}
|
||||
var UpdateStage = new Update("bizgazecrm_visitors").Values(updateDate).Where(Exp.Eq("visitorid", visitorid));
|
||||
// var UpdateStage = new Update("bizgazecrm_visitors").Value("stageid", NewStageId).Value("lastupdateddate", date).Value("checkindate", DateTime.Now).Where(Exp.Eq("visitorid", visitorid));
|
||||
await _repository.ExecuteAsync(request, UpdateStage);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ActionResponse<FormActionResponse>.CreateErrorResponse("1", "No visitor information found");
|
||||
|
||||
}
|
||||
//returnresponse = new FormActionResponse();
|
||||
//returnresponse.Obj = dictObj as ExpandoObject;
|
||||
//returnresponse.PkValue = defaultPKValue;
|
||||
//return ActionResponse<FormActionResponse>.CreateSuccessResponse("success", returnresponse);
|
||||
returnresponse = new FormActionResponse();
|
||||
returnresponse.Obj = null;
|
||||
returnresponse.PkValue = 0;
|
||||
return ActionResponse<FormActionResponse>.CreateSuccessResponse("success", returnresponse);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ActionResponse<FormActionResponse>.CreateErrorResponse("1", "visitor Not Found");
|
||||
}
|
||||
|
||||
}
|
||||
//returnresponse = new FormActionResponse();
|
||||
//returnresponse.Obj = dictObj as ExpandoObject;
|
||||
//returnresponse.PkValue = defaultPKValue;
|
||||
//return ActionResponse<FormActionResponse>.CreateSuccessResponse("success", returnresponse);
|
||||
returnresponse = new FormActionResponse();
|
||||
returnresponse.Obj = null;
|
||||
returnresponse.PkValue = 0;
|
||||
return ActionResponse<FormActionResponse>.CreateSuccessResponse("success", returnresponse);
|
||||
return ActionResponse<FormActionResponse>.CreateErrorResponse("1", "No visitor information found");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public List<UniqueKey> AppliedApps
|
||||
{
|
||||
get
|
||||
@@ -154,7 +187,6 @@ namespace Bizgaze.CRM.Visitors.ActionProviders
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user