Exemplo n.º 1
0
 public HttpResponseMessage UpdateLeadsByAccount(HttpRequestMessage request, RegisterLeadBySoloPageDTO obj)
 {
     return(CreateHttpResponse(request, () =>
     {
         HttpResponseMessage response;
         response = request.CreateResponse(HttpStatusCode.OK, _service.UpdateLeadsByAccount(obj));
         return response;
     }));
 }
Exemplo n.º 2
0
        public ResultDTO RegisterLeadBySoloPage(RegisterLeadBySoloPageDTO obj)
        {
            ResultDTO accInfo = null;

            try
            {
                accInfo = _repository.RegisterLeadBySoloPage(obj);
            }
            catch (Exception ex)
            {
                Utilities.AppLog.WriteLog("RegisterLeadBySoloPage", ActionType.GetData, ex.Message.ToString(), "Call FO method");
                accInfo.StatusCode = Utilities.Common.ConvertErrorCodeToInt(RetCode.ECS9999);
                accInfo.StatusMsg  = ex.Message.ToString();
            }
            return(accInfo);
        }
Exemplo n.º 3
0
        public ResultDTO GetLeadsDetailByAccount(RegisterLeadBySoloPageDTO obj)
        {
            ResultDTO errorCode = new ResultDTO();

            try
            {
                errorCode = _repository.GetLeadsDetailByAccount(obj);
            }
            catch (Exception ex)
            {
                Utilities.AppLog.WriteLog("GetLeadsDetailByAccount", ActionType.GetData, ex.Message.ToString(), obj.SessionKey);
                errorCode.StatusCode = Utilities.Common.ConvertErrorCodeToInt(RetCode.ECS9999);
                errorCode.StatusMsg  = ex.Message.ToString();
            }

            return(errorCode);
        }
        public static ResultDTO RegisterLeadBySoloPage(this IEntityBaseRepository <LandingPage> repository, RegisterLeadBySoloPageDTO 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 <GetResponseConfigDTO>("EXEC [dbo].[sp_FO_RegisterLeadBySoloPage] @Name,@Email,@Phone,@FunnalID,@SoloID,@errorCode out",
                                                                                new SqlParameter("Name", DB.SafeSQL(obj.Name)),
                                                                                new SqlParameter("Email", DB.SafeSQL(obj.Email)),
                                                                                new SqlParameter("Phone", DB.SafeSQL(obj.Phone)),
                                                                                new SqlParameter("FunnalID", DB.SafeSQL(obj.FunnelID)),
                                                                                new SqlParameter("SoloID", DB.SafeSQL(obj.SoloID)),
                                                                                errorCode).FirstOrDefault <GetResponseConfigDTO>();
            result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            result.SetContentMsg();

            return(result);
        }
        public HttpResponseMessage RegisterLeadBySoloPage(HttpRequestMessage request, RegisterLeadBySoloPageDTO obj)
        {
            if (string.IsNullOrEmpty(obj.Email))
            {
                ResultDTO result = new ResultDTO();
                result.StatusCode = Common.ConvertErrorCodeToInt(RetCode.ECS0034);
                result.SetContentMsg();

                return(CreateHttpResponse(request, () =>
                {
                    var response = request.CreateResponse(HttpStatusCode.OK, result);
                    return response;
                }));
            }

            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response;

                ResultDTO result = _service.RegisterLeadBySoloPage(obj);
                if (result.Details != null)
                {
                    GetResponseConfigDTO objOlala = (GetResponseConfigDTO)result.Details;
                    try {
                        AddContract(objOlala.APIKey, objOlala.CampaignName, obj.Name, obj.Email);
                    }
                    catch (Exception ex) {
                        Business.Utilities.AppLog.WriteLog(GetResponseConfig.ContactsFunc, ActionType.Add, ex.Message, obj.SessionKey);
                    }

                    result.Details = string.Empty;
                }
                response = request.CreateResponse(HttpStatusCode.OK, result);
                return response;
            }));
        }
        public static ResultDTO GetLeadsDetailByAccount(this IEntityBaseRepository <Account> repository, RegisterLeadBySoloPageDTO 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 <LeadsItemDTO>("EXEC [dbo].[sp_GetLeadsDetailByAccount] @ID,@SessionKey,@errorCode out",
                                                                        new SqlParameter("ID", obj.ID),
                                                                        new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                                        errorCode).FirstOrDefault <LeadsItemDTO>();

            result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            result.SetContentMsg();

            return(result);
        }
        public static ResultDTO UpdateLeadsTypeByAccount(this IEntityBaseRepository <Account> repository, RegisterLeadBySoloPageDTO obj)
        {
            var result    = new ResultDTO();
            var dbContext = new ApplicationContext();

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

            dbContext.Database.ExecuteSqlCommand("EXEC [dbo].[sp_UpdateLeadsTypeByAccount] @ID,@LeadsType,@SessionKey,@errorCode out",
                                                 new SqlParameter("ID", obj.ID),
                                                 new SqlParameter("LeadsType", obj.LeadsType),
                                                 new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                 errorCode);

            result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            result.SetContentMsg();

            return(result);
        }
        public static ResultDTO AddLeadsByAccount(this IEntityBaseRepository <Account> repository, RegisterLeadBySoloPageDTO obj)
        {
            var result    = new ResultDTO();
            var dbContext = new ApplicationContext();

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

            dbContext.Database.ExecuteSqlCommand("EXEC [dbo].[sp_AddLeadsByAccount] @Name,@Email,@Phone,@FunnalID,@SoloID,@LeadsType,@Notes,@SessionKey,@errorCode out",
                                                 new SqlParameter("Name", DB.SafeSQL(obj.Name)),
                                                 new SqlParameter("Email", DB.SafeSQL(obj.Email)),
                                                 new SqlParameter("Phone", DB.SafeSQL(obj.Phone)),
                                                 new SqlParameter("SoloID", DB.SafeSQL(obj.SoloID)),
                                                 new SqlParameter("FunnalID", DB.SafeSQL(obj.FunnelID)),
                                                 new SqlParameter("LeadsType", obj.LeadsType),
                                                 new SqlParameter("Notes", DB.SafeSQL(obj.Notes)),
                                                 new SqlParameter("SessionKey", DB.SafeSQL(obj.SessionKey)),
                                                 errorCode);

            result.StatusCode = int.Parse(errorCode.Value.ToString(), 0);
            result.SetContentMsg();

            return(result);
        }
        public HttpResponseMessage RegisterLeadBySoloPage(HttpRequestMessage request, RegisterLeadBySoloPageDTO obj)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response;

                ResultDTO result = _service.RegisterLeadBySoloPage(obj);
                if (result.Details != null)
                {
                    MailChimpResponse1DTO objOlala = (MailChimpResponse1DTO)result.Details;
                    AddSubscribe(objOlala.APIKey, objOlala.DataCenter, objOlala.ListID, obj.Email, objOlala.PageName, obj.Name, obj.Phone, obj.SessionKey);
                }
                response = request.CreateResponse(HttpStatusCode.OK, result);
                return response;
            }));
        }