예제 #1
0
        public ResponseModel ReportSearch([FromBody] StoreReportModel SearchParams)
        {
            ResponseModel           objResponseModel = new ResponseModel();
            int                     StatusCode       = 0;
            string                  statusMessage    = "";
            int                     resultCount      = 0;
            StoreReportCaller       dbsearchMaster   = new StoreReportCaller();
            List <StoreUserListing> StoreUserList    = new List <StoreUserListing>();

            try
            {
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();

                authenticate          = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));
                SearchParams.TenantID = authenticate.TenantId; // add tenantID to request
                                                               // searchparams.curentUserId = authenticate.UserMasterID; // add currentUserID to request

                StoreUserList = new StoreUserService(_connectioSting).GetStoreUserList(authenticate.TenantId);

                resultCount = dbsearchMaster.StoreReportSearch(new StoreReportService(_connectioSting), SearchParams, StoreUserList);

                StatusCode                    = resultCount > 0 ? (int)EnumMaster.StatusCode.Success : (int)EnumMaster.StatusCode.RecordNotFound;
                statusMessage                 = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode);
                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = StatusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = resultCount;
            }
            catch (Exception)
            {
                throw;
            }
            return(objResponseModel);
        }
예제 #2
0
        public ResponseModel GetCampaignNames()
        {
            ResponseModel             objResponseModel = new ResponseModel();
            List <CampaignScriptName> objCampaignList  = new List <CampaignScriptName>();
            int    StatusCode    = 0;
            string statusMessage = "";

            try
            {
                ////Get token (Double encrypted) and get the tenant id
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));

                StoreReportCaller newReport = new StoreReportCaller();

                objCampaignList = newReport.GetCampaignNames(new StoreReportService(_connectioSting));

                StatusCode = objCampaignList.Count == 0 ? (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success;

                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode);

                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = StatusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = objCampaignList;
            }
            catch (Exception)
            {
                throw;
            }

            return(objResponseModel);
        }
예제 #3
0
        public ResponseModel SaveStoreReport([FromBody] StoreReportRequest ReportMaster)
        {
            ResponseModel objResponseModel = new ResponseModel();
            int           StatusCode       = 0;
            string        statusMessage    = "";

            try
            {
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));

                StoreReportCaller reportCaller = new StoreReportCaller();
                ReportMaster.CreatedBy = authenticate.UserMasterID;
                ReportMaster.ModifyBy  = authenticate.UserMasterID;
                ReportMaster.TenantID  = authenticate.TenantId;

                int result = reportCaller.InsertStoreReport(new StoreReportService(_connectioSting), ReportMaster);
                StatusCode =
                    result >= 0 ?
                    (int)EnumMaster.StatusCode.Success : (int)EnumMaster.StatusCode.InternalServerError;
                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode);

                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = StatusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = result;
            }
            catch (Exception)
            {
                throw;
            }
            return(objResponseModel);
        }
예제 #4
0
        public ResponseModel DeleteStoreReport(int ReportID)
        {
            int           Deletecount      = 0;
            ResponseModel objResponseModel = new ResponseModel();
            int           StatusCode       = 0;
            string        statusMessage    = "";

            try
            {
                ////Get token (Double encrypted) and get the tenant id
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();
                authenticate = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));

                StoreReportCaller newReport = new StoreReportCaller();

                Deletecount = newReport.DeleteStoreReport(new StoreReportService(_connectioSting), authenticate.TenantId, ReportID);

                StatusCode =
                    Deletecount.Equals(0) ?
                    (int)EnumMaster.StatusCode.RecordNotFound : (int)EnumMaster.StatusCode.Success;

                statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode);

                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = StatusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = Deletecount;
            }
            catch (Exception)
            {
                throw;
            }
            return(objResponseModel);
        }
예제 #5
0
        public ResponseModel CheckIfReportNameExists(int ReportID, string ReportName)
        {
            ResponseModel           objResponseModel = new ResponseModel();
            int                     StatusCode       = 0;
            string                  statusMessage    = "";
            bool                    IsExists         = false;
            StoreReportCaller       dbsearchMaster   = new StoreReportCaller();
            List <StoreUserListing> StoreUserList    = new List <StoreUserListing>();

            try
            {
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();

                authenticate  = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));
                StoreUserList = new StoreUserService(_connectioSting).GetStoreUserList(authenticate.TenantId);
                IsExists      = dbsearchMaster.CheckIfReportNameExists(new StoreReportService(_connectioSting), ReportID, ReportName, authenticate.TenantId);

                StatusCode                    = IsExists ? (int)EnumMaster.StatusCode.RecordAlreadyExists : (int)EnumMaster.StatusCode.RecordNotFound;
                statusMessage                 = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode);
                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = StatusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = IsExists;
            }
            catch (Exception)
            {
                throw;
            }
            return(objResponseModel);
        }
예제 #6
0
        public ResponseModel DownloadStoreReportSearch(int ReportID)
        {
            ResponseModel           objResponseModel = new ResponseModel();
            int                     StatusCode       = 0;
            string                  statusMessage    = "";
            string                  CSVReport        = string.Empty;
            string                  appRoot          = string.Empty;
            string                  Folderpath       = string.Empty;
            string                  URLPath          = string.Empty;
            StoreReportCaller       dbsearchMaster   = new StoreReportCaller();
            List <StoreUserListing> StoreUserList    = new List <StoreUserListing>();

            try
            {
                string       token        = Convert.ToString(Request.Headers["X-Authorized-Token"]);
                Authenticate authenticate = new Authenticate();

                authenticate  = SecurityService.GetAuthenticateDataFromToken(_radisCacheServerAddress, SecurityService.DecryptStringAES(token));
                StoreUserList = new StoreUserService(_connectioSting).GetStoreUserList(authenticate.TenantId);
                CSVReport     = dbsearchMaster.DownloadStoreReportSearch(new StoreReportService(_connectioSting), ReportID, authenticate.UserMasterID, authenticate.TenantId, StoreUserList);

                appRoot = Directory.GetCurrentDirectory();

                string CSVFileName = "StoreReport_" + ReportID + "_" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".csv";

                Folderpath = Path.Combine(appRoot, "ReportDownload");
                if (!Directory.Exists(Folderpath))
                {
                    Directory.CreateDirectory(Folderpath);
                }


                if (!string.IsNullOrEmpty(CSVReport))
                {
                    URLPath    = rootPath + "ReportDownload" + "/" + CSVFileName;
                    Folderpath = Path.Combine(Folderpath, CSVFileName);
                    CommonService.SaveFile(Folderpath, CSVReport);
                }


                StatusCode                    = !string.IsNullOrEmpty(CSVReport) ? (int)EnumMaster.StatusCode.Success : (int)EnumMaster.StatusCode.RecordNotFound;
                statusMessage                 = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)StatusCode);
                objResponseModel.Status       = true;
                objResponseModel.StatusCode   = StatusCode;
                objResponseModel.Message      = statusMessage;
                objResponseModel.ResponseData = !string.IsNullOrEmpty(CSVReport) ? URLPath : string.Empty;
            }
            catch (Exception)
            {
                throw;
            }
            return(objResponseModel);
        }