Beispiel #1
0
 public void ConvertFanpageConfigFilter()
 {
     if (!string.IsNullOrEmpty(state))
     {
         state = WebUtility.UrlDecode(state);
         FanpageConfigFilter = JsonConvert.DeserializeObject <FanpageConfigFilter>(state);
     }
 }
Beispiel #2
0
 public int DeleteFanPageOfAgent(FanpageConfigFilter filter)
 {
     IDataParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@AgentId", filter.AgentId),
     };
     return(ExecuteNonQuery("usp_DeleteFanPageOfAgent", parameters));
 }
Beispiel #3
0
 public DataTable GetFanpageConfig(FanpageConfigFilter filter)
 {
     IDataParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@Id", filter.Id),
         new SqlParameter("@PageId", filter.PageId),
         new SqlParameter("@Active", filter.Active),
         new SqlParameter("@SocialConfigId", filter.SocialConfigId),
         new SqlParameter("@Deleted", filter.Deleted),
     };
     return(ExecuteQuery("usp_GetFanpageConfig", parameters));
 }
        public FanpageConfig GetFanpageConfig(FanpageConfigFilter filter)
        {
            FanpageConfig model = null;

            try
            {
                model = repository.GetFanpageConfig(filter).To <FanpageConfig>().FirstOrDefault();
            }
            catch (Exception ex)
            {
                CoreLogger.Instance.Error(this.CreateMessageLog(ex.Message));
            }
            return(model);
        }
        public List <FanpageConfig> GetListFanPageConfigure(FanpageConfigFilter filter)
        {
            List <FanpageConfig> models = null;

            try
            {
                models = repository.GetFanpageConfig(filter).To <FanpageConfig>();
            }
            catch (Exception ex)
            {
                CoreLogger.Instance.Error(this.CreateMessageLog(ex.Message));
            }
            return(models);
        }
Beispiel #6
0
        public JsonResult GetUrlGetCode(FanpageConfigFilter model)
        {
            var socialConfig = socialConfigBusiness.GetSocialConfig(new FilterSocialConfig
            {
                Id = model.SocialConfigId
            });
            var url = string.Format("https://www.facebook.com/v5.0/dialog/oauth?response_type=token&display=popup&client_id={0}&redirect_uri={1}/FanPageConfigure/CallBackGetCode&auth_type=reauthenticate&scope=manage_pages,pages_messaging,pages_messaging_subscriptions&state={2}"
                                    , socialConfig.AppId
                                    , $"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}"
                                    //, "https://4b67bf72.ngrok.io"
                                    , "{connectionId:'" + model.ConnectionId + "',socialConfigId:'" + model.SocialConfigId + "'}");

            return(Json(new { success = true, data = url }));
            //return Json(new { success = true, data = $"https://www.facebook.com/v5.0/dialog/oauth?response_type=token&display=popup&client_id={socialConfig.AppId}&redirect_uri=https://f14b4b83.ngrok.io/FanPageConfigure/CallBackGetCode&scope=manage_pages&state=" });
            //return Json(new { success = true, data = $"https://www.facebook.com/v5.0/dialog/oauth?response_type=token&display=popup&client_id={socialConfig.AppId}&redirect_uri=https://ff7c660e.ngrok.io/api/facebook/getaccess&scope=email,manage_pages,pages_messaging_phone_number,pages_show_list,pages_messaging,pages_messaging_subscriptions,publish_pages" });
        }
        public bool DelFanpageOfAgent(FanpageConfigFilter filter)
        {
            bool rsBool = false;

            try
            {
                if (repository.DeleteFanPageOfAgent(filter) > 0)
                {
                    rsBool = true;
                }
            }
            catch (Exception ex)
            {
                CoreLogger.Instance.Error(this.CreateMessageLog(ex.Message));
            }
            return(rsBool);
        }
Beispiel #8
0
        public JsonResult GetListFanPageConfigure(FanpageConfigFilter filter)
        {
            filter.Deleted = false;
            var list = fanpageConfigBusiness.GetListFanPageConfigure(filter);

            if (list != null && list.Count > 0)
            {
                foreach (var item in list)
                {
                    var subInfo = facebookBusiness.GetSubscribedInfo(item);
                    if (subInfo != null && subInfo.subscribed_fields.Count > 0)
                    {
                        item.IsSubscribe = true;
                    }
                    else
                    {
                        item.IsSubscribe = false;
                    }
                }
            }
            return(Json(new { data = list }));
        }