public ResultDTO GetSummaryReportByAccount(SummaryRequestDTO obj)
        {
            ResultDTO accInfo = new ResultDTO();

            try
            {
                obj.StartList = Utilities.Common.GeStartListByYear(obj.YearList);
                obj.EndList   = Utilities.Common.GeEndListByYear(obj.YearList);
                accInfo       = _repository.GetSummaryReportByAccount(obj);
            }
            catch (Exception ex)
            {
                Utilities.AppLog.WriteLog("GetSummaryReportByAccount", ActionType.GetData, ex.Message.ToString(), obj.SessionKey);
                accInfo.StatusCode = Utilities.Common.ConvertErrorCodeToInt(RetCode.ECS9999);
                accInfo.StatusMsg  = ex.Message.ToString();
            }

            return(accInfo);
        }
Ejemplo n.º 2
0
        public static ResultDTO GetSummaryReportByAccount(this IEntityBaseRepository <Affiliate> repository, SummaryRequestDTO obj)
        {
            var result    = new ResultDTO();
            var dbContext = new ApplicationContext();

            var errorCode = new SqlParameter("ErrorCode", System.Data.SqlDbType.Int)
            {
                Direction = System.Data.ParameterDirection.Output
            };

            result.Details = dbContext.Database.SqlQuery <AffiliateOfMonthDTO>("EXEC [dbo].[sp_GetSummaryReportByAccount] @StartList,@EndList, @UserName,@SessionKey,@errorCode out",
                                                                               new SqlParameter("StartList", DB.SafeSQL(obj.StartList)),
                                                                               new SqlParameter("EndList", DB.SafeSQL(obj.EndList)),
                                                                               new SqlParameter("UserName", DB.SafeSQL(obj.UserName)),
                                                                               new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                                               errorCode).ToList <AffiliateOfMonthDTO>();
            result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            result.SetContentMsg();
            return(result);
        }
Ejemplo n.º 3
0
 public HttpResponseMessage SummaryLeadsChartByAccount(HttpRequestMessage request, SummaryRequestDTO obj)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response;
         response = request.CreateResponse(HttpStatusCode.OK, _service.SummaryLeadsChartByAccount(obj));
         return response;
     }));
 }
        public static ResultDTO SummaryLeadsChartByAccount(this IEntityBaseRepository <Account> repository, SummaryRequestDTO obj)
        {
            var result    = new ResultDTO();
            var dbContext = new ApplicationContext();

            var errorCode = new SqlParameter("ErrorCode", System.Data.SqlDbType.Int)
            {
                Direction = System.Data.ParameterDirection.Output
            };
            LeadsChartOfMonthDTO LeadsChart = new LeadsChartOfMonthDTO();
            int f*g = 0;

            LeadsChart.EnrolledItems = dbContext.Database.SqlQuery <LeadsOfMonthDTO>("EXEC [dbo].[sp_SummaryLeadsChartByAccount] @LeadType,@FunnalID,@SoloID,@StartList,@EndList, @UserName,@SessionKey,@errorCode out",
                                                                                     new SqlParameter("LeadType", f*g),
                                                                                     new SqlParameter("FunnalID", obj.FunnalID),
                                                                                     new SqlParameter("SoloID", obj.SoloID),
                                                                                     new SqlParameter("StartList", DB.SafeSQL(obj.StartList)),
                                                                                     new SqlParameter("EndList", DB.SafeSQL(obj.EndList)),
                                                                                     new SqlParameter("UserName", DB.SafeSQL(obj.UserName)),
                                                                                     new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                                                     errorCode).ToList <LeadsOfMonthDTO>();
            f*g++;
            var errorCode1 = new SqlParameter("ErrorCode", System.Data.SqlDbType.Int)
            {
                Direction = System.Data.ParameterDirection.Output
            };

            LeadsChart.ColdItems = dbContext.Database.SqlQuery <LeadsOfMonthDTO>("EXEC [dbo].[sp_SummaryLeadsChartByAccount] @LeadType,@FunnalID,@SoloID,@StartList,@EndList, @UserName,@SessionKey,@errorCode out",
                                                                                 new SqlParameter("LeadType", f*g),
                                                                                 new SqlParameter("FunnalID", obj.FunnalID),
                                                                                 new SqlParameter("SoloID", obj.SoloID),
                                                                                 new SqlParameter("StartList", DB.SafeSQL(obj.StartList)),
                                                                                 new SqlParameter("EndList", DB.SafeSQL(obj.EndList)),
                                                                                 new SqlParameter("UserName", DB.SafeSQL(obj.UserName)),
                                                                                 new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                                                 errorCode1).ToList <LeadsOfMonthDTO>();
            f*g++;
            var errorCode2 = new SqlParameter("ErrorCode", System.Data.SqlDbType.Int)
            {
                Direction = System.Data.ParameterDirection.Output
            };

            LeadsChart.WarmItems = dbContext.Database.SqlQuery <LeadsOfMonthDTO>("EXEC [dbo].[sp_SummaryLeadsChartByAccount] @LeadType,@FunnalID,@SoloID,@StartList,@EndList, @UserName,@SessionKey,@errorCode out",
                                                                                 new SqlParameter("LeadType", f*g),
                                                                                 new SqlParameter("FunnalID", obj.FunnalID),
                                                                                 new SqlParameter("SoloID", obj.SoloID),
                                                                                 new SqlParameter("StartList", DB.SafeSQL(obj.StartList)),
                                                                                 new SqlParameter("EndList", DB.SafeSQL(obj.EndList)),
                                                                                 new SqlParameter("UserName", DB.SafeSQL(obj.UserName)),
                                                                                 new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                                                 errorCode2).ToList <LeadsOfMonthDTO>();
            f*g++;
            var errorCode3 = new SqlParameter("ErrorCode", System.Data.SqlDbType.Int)
            {
                Direction = System.Data.ParameterDirection.Output
            };

            LeadsChart.HotItems = dbContext.Database.SqlQuery <LeadsOfMonthDTO>("EXEC [dbo].[sp_SummaryLeadsChartByAccount] @LeadType,@FunnalID,@SoloID,@StartList,@EndList, @UserName,@SessionKey,@errorCode out",
                                                                                new SqlParameter("LeadType", f*g),
                                                                                new SqlParameter("FunnalID", obj.FunnalID),
                                                                                new SqlParameter("SoloID", obj.SoloID),
                                                                                new SqlParameter("StartList", DB.SafeSQL(obj.StartList)),
                                                                                new SqlParameter("EndList", DB.SafeSQL(obj.EndList)),
                                                                                new SqlParameter("UserName", DB.SafeSQL(obj.UserName)),
                                                                                new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                                                errorCode3).ToList <LeadsOfMonthDTO>();

            result.Details    = LeadsChart;
            result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            result.SetContentMsg();
            return(result);
        }