Skip to content

Commit

Permalink
ZX
Browse files Browse the repository at this point in the history
  • Loading branch information
Plumb5 authored and Plumb5 committed Aug 22, 2024
1 parent 86966f3 commit 2e619ca
Show file tree
Hide file tree
Showing 1,909 changed files with 949,568 additions and 142 deletions.
14 changes: 14 additions & 0 deletions CoreGithub.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IP5GenralDL", "IP5GenralDL\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plumb5GenralFunction", "Plumb5GenralFunction\Plumb5GenralFunction.csproj", "{2CD0F8DF-C3A6-4E59-BED5-F7CDD4911181}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plumb5", "Plumb5\Plumb5.csproj", "{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -111,6 +113,18 @@ Global
{2CD0F8DF-C3A6-4E59-BED5-F7CDD4911181}.Release|x64.Build.0 = Release|x64
{2CD0F8DF-C3A6-4E59-BED5-F7CDD4911181}.Release|x86.ActiveCfg = Release|x86
{2CD0F8DF-C3A6-4E59-BED5-F7CDD4911181}.Release|x86.Build.0 = Release|x86
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Debug|x64.ActiveCfg = Debug|Any CPU
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Debug|x64.Build.0 = Debug|Any CPU
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Debug|x86.ActiveCfg = Debug|Any CPU
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Debug|x86.Build.0 = Debug|Any CPU
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Release|Any CPU.Build.0 = Release|Any CPU
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Release|x64.ActiveCfg = Release|Any CPU
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Release|x64.Build.0 = Release|Any CPU
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Release|x86.ActiveCfg = Release|Any CPU
{A89012CE-ABA3-4EC4-B9A1-B2B965847D9B}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion IP5GenralDL/IDLFormBannerLoadClick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace IP5GenralDL
{
public interface IDLFormBannerLoadClick
public interface IDLFormBannerLoadClick : IDisposable
{
void SaveUpdateForImpression(int FormBannerId, string TrackIp, string MachineId, string SessionRefeer);
void UpdateFormResponse(int FormBannerId, string TrackIp, string MachineId = null, string SessionRefeer = null);
Expand Down
2 changes: 1 addition & 1 deletion IP5GenralDL/IDLFormBannerLoadClickCount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace IP5GenralDL
{
public interface IDLFormBannerLoadClickCount
public interface IDLFormBannerLoadClickCount:IDisposable
{
void SaveUpdateForImpression(int FormBannerId);
void UpdateFormResponse(int FormBannerId);
Expand Down
22 changes: 22 additions & 0 deletions P5GenralDL/DLFormBannerLoadClickCountPG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ public void UpdateFormClose(int FormBannerId)
using var db = GetDbConnection(connection.Connection);
db.ExecuteScalarAsync<int>(storeProcCommand, param);
}
#region Dispose Method
bool disposed;
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
connection = null;
}
}
//dispose unmanaged ressources
disposed = true;
}

public void Dispose()
{
Dispose(true);
}

#endregion End of Dispose Method

}
}

Expand Down
22 changes: 22 additions & 0 deletions P5GenralDL/DLFormBannerLoadClickCountSQL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ public void UpdateFormClose(int FormBannerId)
using var db = GetDbConnection(connection.Connection);
db.ExecuteScalarAsync<int>(storeProcCommand, param, commandType: CommandType.StoredProcedure);
}

#region Dispose Method
bool disposed;
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
connection = null;
}
}
//dispose unmanaged ressources
disposed = true;
}

public void Dispose()
{
Dispose(true);
}

#endregion End of Dispose Method
}
}

Expand Down
21 changes: 21 additions & 0 deletions P5GenralDL/DLFormBannerLoadClickPG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@ public void UpdateFormClose(int FormBannerId, string TrackIp, string MachineId,
using var db = GetDbConnection(connection.Connection);
db.ExecuteScalarAsync<int>(storeProcCommand, param);
}
#region Dispose Method
bool disposed;
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
connection = null;
}
}
//dispose unmanaged ressources
disposed = true;
}

public void Dispose()
{
Dispose(true);
}

#endregion End of Dispose Method
}
}

22 changes: 22 additions & 0 deletions P5GenralDL/DLFormBannerLoadClickSQL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ public void UpdateFormClose(int FormBannerId, string TrackIp, string MachineId,
using var db = GetDbConnection(connection.Connection);
db.ExecuteScalarAsync<int>(storeProcCommand, param, commandType: CommandType.StoredProcedure);
}

#region Dispose Method
bool disposed;
protected virtual void Dispose(bool disposing)
{
if (!disposed)
{
if (disposing)
{
connection = null;
}
}
//dispose unmanaged ressources
disposed = true;
}

public void Dispose()
{
Dispose(true);
}

#endregion End of Dispose Method
}
}

Expand Down
181 changes: 181 additions & 0 deletions Plumb5/Areas/Analytics/Controllers/AnalyticReportsController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
using Microsoft.AspNetCore.Mvc;
using P5GenralML;
using P5GenralDL;
using Plumb5.Controllers;
using System.Globalization;
using System.Data;
using System.Collections;
using Microsoft.DotNet.Scaffolding.Shared.CodeModifier.CodeChange;
using Newtonsoft.Json;
using Plumb5GenralFunction;
using Plumb5.Areas.Analytics.Dto;

namespace Plumb5.Areas.Analytics.Controllers
{
[Area("Analytics")]
public class AnalyticReportsController : BaseController
{
public AnalyticReportsController(IConfiguration _configuration) : base(_configuration)
{ }

//Analytics/AnalyticReports
public IActionResult Index()
{
return View("AnalyticReports");
}

[HttpPost]
public async Task<JsonResult> GetSavedReports([FromBody] GetSavedReportsDto analyticReportsDto)
{
List<AnalyticReports> fieldDetails = null;

using var objDL = DLAnalyticReports.GetDLAnalyticReports(analyticReportsDto.AccountId, SQLProvider);
fieldDetails = await objDL.GetAnalyticsSaveReport(await GetAllUsersByUserId(analyticReportsDto.UserId, analyticReportsDto.AccountId));

return Json(fieldDetails);
}

public async Task<string> GetAllUsersByUserId(int UserId, int AccountId)
{
string userId = "";
List<MLUserHierarchy> userHierarchy = new List<MLUserHierarchy>();
using (var objUserHierarchy = DLUserHierarchy.GetDLUserHierarchy(SQLProvider))
{
userHierarchy = await objUserHierarchy.GetHisUsers(UserId, AccountId);
userHierarchy.Add(await objUserHierarchy.GetHisDetails(UserId));
}
userHierarchy = userHierarchy.GroupBy(x => x.UserInfoUserId).Select(x => x.First()).ToList();

List<int> usersId = new List<int>();
if (userHierarchy != null)
usersId = userHierarchy.Select(x => x.UserInfoUserId).Distinct().ToList();

userId = string.Join(",", usersId.ToArray());

if (String.IsNullOrEmpty(userId))
userId = UserId.ToString();
return userId;
}


[HttpPost]
public async Task<JsonResult> DeleteSavedSearch([FromBody] DeleteSavedSearchDto analyticReportsDto)
{
using (var objreports = DLAnalyticReports.GetDLAnalyticReports(analyticReportsDto.AccountId, SQLProvider))
{
return Json(await objreports.DeleteSavedSearch(analyticReportsDto.Id));
}
}

[HttpPost]
public async Task<JsonResult> GetFilterConditionDetails([FromBody] GetFilterConditionDetailsDto analyticReportsDto)
{
using (var objLmsLeads = DLAnalyticReports.GetDLAnalyticReports(analyticReportsDto.AccountId, SQLProvider))
{
return Json(await objLmsLeads.GetFilterConditionDetails(analyticReportsDto.FilterConditionId));
}
}

[HttpPost]
public async Task<JsonResult> GetMaxCount([FromBody] GetMaxCountDto analyticReportsDto)
{
int maxCount = 0;
DateTime fromDateTime = DateTime.ParseExact(analyticReportsDto.FromDateTime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
DateTime toDateTime = DateTime.ParseExact(analyticReportsDto.ToDateTime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
using (var objDL = DLAnalyticReports.GetDLAnalyticReports(analyticReportsDto.AccountId, SQLProvider))
{
maxCount = await objDL.GetMaxCount(analyticReportsDto.filterLead, analyticReportsDto.Groupby, fromDateTime, toDateTime);
}

return Json(maxCount);
}

[HttpPost]
public async Task<ActionResult> GetAnalyticSaveReports([FromBody] GetAnalyticSaveReportsDto analyticReportsDto)
{
DateTime fromDateTime = DateTime.ParseExact(analyticReportsDto.FromDateTime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
DateTime toDateTime = DateTime.ParseExact(analyticReportsDto.ToDateTime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
DataSet dataSet = new DataSet();
using (var objDL = DLAnalyticReports.GetDLAnalyticReports(analyticReportsDto.AccountId, SQLProvider))
{
dataSet = await objDL.GetAnalyticReports(analyticReportsDto.filterDataJson, analyticReportsDto.Groupby, analyticReportsDto.OffSet, analyticReportsDto.FetchNext, fromDateTime, toDateTime);
}

ArrayList exportdata = new ArrayList() { analyticReportsDto.filterDataJson, analyticReportsDto.Groupby };

HttpContext.Session.SetString("AnalyticData", JsonConvert.SerializeObject(exportdata));

var getdata = JsonConvert.SerializeObject(dataSet);
return Content(getdata.ToString(), "application/json");
}

[HttpPost]
[Log]
public async Task<JsonResult> SaveReport([FromBody] SaveReportDto analyticReports)
{
LoginInfo? user = JsonConvert.DeserializeObject<LoginInfo>(HttpContext.Session.GetString("UserInfo"));

analyticReports.analyticReports.UserInfoUserId = user.UserId;
using (var objreports = DLAnalyticReports.GetDLAnalyticReports(analyticReports.accountId, SQLProvider))
{
if (analyticReports.analyticReports.Id > 0)
{
int Id = await objreports.Update(analyticReports.analyticReports);
return Json(Id);
}
else
{
int Id = await objreports.Save(analyticReports.analyticReports);
return Json(Id);
}
}
}

[HttpPost]
public async Task<ActionResult> AnalyticsReportExport([FromBody] AnalyticsReportExport analyticReports)
{
DateTime FromDateTimes = DateTime.ParseExact(analyticReports.FromDateTime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
DateTime ToDateTime = DateTime.ParseExact(analyticReports.TodateTime, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
AnalyticCustomReports? filterLead = new AnalyticCustomReports();
string? Groupby = "";
DataSet dataSet = new DataSet();
if (HttpContext.Session.GetString("UserInfo") != null)
{
ArrayList? data = JsonConvert.DeserializeObject<ArrayList>(HttpContext.Session.GetString("AnalyticData"));

filterLead = JsonConvert.DeserializeObject<AnalyticCustomReports>(data[0].ToString());
Groupby = (string?)data[1];
}
using (var objDL = DLAnalyticReports.GetDLAnalyticReports(analyticReports.AccountId, SQLProvider))
{
dataSet = await objDL.GetAnalyticReports(filterLead, Groupby, analyticReports.OffSet, analyticReports.FetchNext, FromDateTimes, ToDateTime);
}
DataTable resultDataTable = (from dataRow in dataSet.Tables[0].Select()
select new
{
ReportedBy = Convert.ToString(dataRow["Groupby"]),
UniqueVisit = Convert.ToString(dataRow["UniqueVisit"]),
TotalVisit = Convert.ToString(dataRow["TotalVisit"]),
Session = Convert.ToString(dataRow["Session"]),
AvgTime = Helper.AverageTime(Convert.ToDecimal(String.IsNullOrEmpty(dataRow["TotalTime"].ToString()) ? "0" : dataRow["TotalTime"]))
}).CopyToDataTableExport();
DataSet resultDataSet = new DataSet();
resultDataSet.Tables.Add(resultDataTable);


string FileName = "AnalyticReportData_" + DateTime.Now.ToString("ddMMyyyyHHmmssfff") + "." + analyticReports.FileType;
string MainPath = AllConfigURLDetails.KeyValueForConfig["MAINPATH"] + "\\TempFiles\\" + FileName;

//string MainPath = "E:/" + FileName;

if (analyticReports.FileType.ToLower() == "csv")
Helper.SaveDataSetToCSV(resultDataSet, MainPath);
else
Helper.SaveDataSetToExcel(resultDataSet, MainPath);

MainPath = AllConfigURLDetails.KeyValueForConfig["ONLINEURL"] + "TempFiles/" + FileName;

return Json(new { Status = true, MainPath });
}
}
}
Loading

0 comments on commit 2e619ca

Please sign in to comment.