コード例 #1
0
        public static ResultDTO GetAllGetResponseInfoByAccount(this IEntityBaseRepository <Account> repository, RequestDTO obj)
        {
            var result    = new ResultDTO();
            var dbContext = new ApplicationContext();

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

            Items.Items = dbContext.Database.SqlQuery <GetResponseConfigDTO>("EXEC [dbo].[sp_GetAllGetResponseInfoByAccount] @SessionKey,@Count out,@errorCode out",
                                                                             new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                                             count,
                                                                             errorCode).ToList <GetResponseConfigDTO>();
            result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            result.SetContentMsg();
            if (result.StatusCode == 0)
            {
                Items.Total    = int.Parse(count.Value.ToString(), 0);
                result.Details = Items;
            }

            result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            result.SetContentMsg();
            return(result);
        }
コード例 #2
0
        public static ResultDTO GetAllSoloPage(this IEntityBaseRepository <LandingPage> repository, RequestDTO obj)
        {
            var result    = new ResultDTO();
            var dbContext = new ApplicationContext();

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

            Items.Items = dbContext.Database.SqlQuery <SoloPageItem1DTO>("EXEC [dbo].[sp_GetAllSoloPage] @UserName,@SessionKey,@Count out,@errorCode out",
                                                                         new SqlParameter("UserName", DB.SafeSQL(obj.UserName)),
                                                                         new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                                         count,
                                                                         errorCode).Skip((obj.PageIndex - 1) * obj.PageCount).Take(obj.PageCount).ToList <SoloPageItem1DTO>();

            result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            result.SetContentMsg();
            if (result.StatusCode == 0)
            {
                Items.Total    = int.Parse(count.Value.ToString(), 0);
                result.Details = Items;
            }
            return(result);
        }
コード例 #3
0
        public static ResultDTO GetAllLeadsByAccount(this IEntityBaseRepository <Account> repository, LeadsDTO obj)
        {
            var result    = new ResultDTO();
            var dbContext = new ApplicationContext();

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

            try
            {
                BODataListDTO Items = new BODataListDTO();
                Items.Items = dbContext.Database.SqlQuery <LeadsItemDTO>("EXEC [dbo].[sp_GetAllLeadsByAccount] @SessionKey,@LeadType, @Count out, @errorCode out",
                                                                         new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                                         new SqlParameter("LeadType", DB.SafeSQL(obj.LeadType)),
                                                                         count,
                                                                         errorCode).Skip((obj.PageIndex - 1) * obj.PageCount).Take(obj.PageCount).ToList <LeadsItemDTO>();
                result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
                result.SetContentMsg();
                if (result.StatusCode == 0)
                {
                    Items.Total    = int.Parse(count.Value.ToString(), 0);
                    result.Details = Items;
                }
            }
            catch (Exception ex)
            {
                result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
                result.Details    = ex.Message;
            }

            return(result);
        }