public ResultDTO GetAffiliateInfoByAccount(RequestAffiliateInfoDTO obj)
        {
            ResultDTO accInfo = new ResultDTO();

            try
            {
                accInfo = _repository.GetAffiliateInfoByAccount(obj);
            }
            catch (Exception ex)
            {
                Utilities.AppLog.WriteLog("GetAffiliateInfoByAccount", 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 GetAffiliateInfoByAccount(this IEntityBaseRepository <Affiliate> repository, RequestAffiliateInfoDTO 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 <AfiliateAlertDTO>("EXEC [dbo].[sp_GetAffiliateInfoByAccount] @UserName,@SessionKey, @FromDate,@ToDate, @errorCode out",
                                                                            new SqlParameter("UserName", DB.SafeSQL(obj.UserName)),
                                                                            new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                                            new SqlParameter("FromDate", DB.SafeSQL(obj.FromDate)),
                                                                            new SqlParameter("ToDate", DB.SafeSQL(obj.ToDate)),
                                                                            errorCode).ToList <AfiliateAlertDTO>();
            result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            result.SetContentMsg();
            return(result);
        }
 public HttpResponseMessage GetAffiliateInfoByAccount(HttpRequestMessage request, RequestAffiliateInfoDTO obj)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response = null;
         response = request.CreateResponse(HttpStatusCode.OK, _service.GetAffiliateInfoByAccount(obj));
         return response;
     }));
 }