Ejemplo n.º 1
0
        public HttpResponseBase GetEpaperById()
        {
            string json = string.Empty;
            EpaperContentQuery store = new EpaperContentQuery();
            EpaperContentQuery query = new EpaperContentQuery();
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["rowid"]))
                {
                    _IEpaperContentMgr = new EpaperContentMgr(mySqlConnectionString);
                    store.epaper_id = Convert.ToUInt32(Request.Params["rowid"]);
                    store = _IEpaperContentMgr.GetEpaperContentById(store);
                    store.epaper_content = Server.HtmlDecode(store.epaper_content);
                    store.epaperShowStart = CommonFunction.GetNetTime(store.epaper_show_start);
                    store.epaperShowEnd = CommonFunction.GetNetTime(store.epaper_show_end);
                    store.epaperCreateDate = CommonFunction.GetNetTime(store.epaper_createdate);
                    store.epaperUpdateDate = CommonFunction.GetNetTime(store.epaper_updatedate);
                    IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                    timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                    json = "{success:true" + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";
                }
                else
                {
                    json = "{success:false,data:[]}";
                }

            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);

            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 2
0
 public HttpResponseBase GetEpaperContentList()
 {
     string json = string.Empty;
     List<EpaperContentQuery> store = new List<EpaperContentQuery>();
     EpaperContentQuery query = new EpaperContentQuery();
     try
     {
         query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
         query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");
         _IEpaperContentMgr = new EpaperContentMgr(mySqlConnectionString);
         int totalCount = 0;
         if (!string.IsNullOrEmpty(Request.Params["searchCon"]))
         {
             query.searchCon = Request.Params["searchCon"];
         }
         if (!string.IsNullOrEmpty(Request.Params["search_text"]))
         {
             query.search_text = Request.Params["search_text"];
         }
         if (!string.IsNullOrEmpty(Request.Params["dateCon"]))
         {
             query.dateCon = Request.Params["dateCon"];
         }
         if (!string.IsNullOrEmpty(Request.Params["date_start"]))
         {
             query.epaperShowStart = Convert.ToDateTime(Request.Params["date_start"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["date_end"]))
         {
             query.epaperShowEnd = Convert.ToDateTime(Request.Params["date_end"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["activeStatus"]))
         {
             query.epaperStatus = Request.Params["activeStatus"].ToString();
         }
         if (!string.IsNullOrEmpty(Request.Params["sizeCon"]))
         {
             query.epaper_size = Request.Params["sizeCon"];
         }
         store = _IEpaperContentMgr.GetEpaperContentList(query, out totalCount);
         foreach (var item in store)
         {
             item.epaperShowStart = CommonFunction.GetNetTime(item.epaper_show_start);
             item.epaperShowEnd = CommonFunction.GetNetTime(item.epaper_show_end);
             item.epaperCreateDate = CommonFunction.GetNetTime(item.epaper_createdate);
             item.epaperUpdateDate = CommonFunction.GetNetTime(item.epaper_updatedate);
             item.epaper_content = Server.HtmlDecode(Server.HtmlDecode(item.epaper_content));
         }
         IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
         timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
         json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         json = "{success:false,totalCount:0,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Ejemplo n.º 3
0
        public HttpResponseBase SaveEpaperContent()
        {
            string json = string.Empty;
            List<EpaperContentQuery> store = new List<EpaperContentQuery>();
            EpaperContentQuery OldQuery = new EpaperContentQuery();
            EpaperContentQuery query = new EpaperContentQuery();
            _IEpaperContentMgr = new EpaperContentMgr(mySqlConnectionString);
            try
            {
                query.user_id = uint.Parse((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString());
                if (string.IsNullOrEmpty(Request.Params["epaper_id"]))//新增
                {
                    if (!string.IsNullOrEmpty(Request.Params["epaper_title"]))
                    {
                        query.epaper_title = Request.Params["epaper_title"];
                    }
                    if (!string.IsNullOrEmpty(Request.Params["epaper_short_title"]))
                    {
                        query.epaper_short_title = Request.Params["epaper_short_title"];
                    }
                    if (!string.IsNullOrEmpty(Request.Params["epaper_size"]))
                    {
                        query.epaper_size = Request.Params["epaper_size"];
                    }
                    if (!string.IsNullOrEmpty(Request.Params["type"]))
                    {
                        query.type = Convert.ToUInt32(Request.Params["type"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["epaper_sort"]))
                    {
                        query.epaper_sort = Convert.ToUInt32(Request.Params["epaper_sort"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["epaperShowStart"]))
                    {
                        query.epaperShowStart = Convert.ToDateTime(Request.Params["epaperShowStart"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["epaperShowEnd"]))
                    {
                        query.epaperShowEnd = Convert.ToDateTime(Request.Params["epaperShowEnd"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["kendoEditor"]))
                    {
                        query.epaper_content = Request.Params["kendoEditor"];
                    }

                    if (!string.IsNullOrEmpty(Request.Params["type"]))
                    {
                        if (Request.Params["newsType"] == "direct")//直接上稿
                        {
                            query.epaper_status = 1;
                        }
                        else
                        {
                            query.epaper_status = 0;
                        }
                    }
                    System.Net.IPAddress[] addlist = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList;
                    if (addlist.Length > 0)
                    {
                        query.epaper_ipfrom = addlist[0].ToString();
                    }
                    query.epaperCreateDate = DateTime.Now;
                    query.epaperUpdateDate = query.epaperCreateDate;
                    query.log_description = "add";
                    _IEpaperContentMgr.SaveEpaperContent(query);
                    json = "{success:true}";
                }
                else
                {
                    query.epaper_id = Convert.ToUInt32(Request.Params["epaper_id"]);
                    OldQuery = _IEpaperContentMgr.GetEpaperContentById(query);
                    if (!string.IsNullOrEmpty(Request.Params["epaper_title"]))
                    {
                        query.epaper_title = Request.Params["epaper_title"];
                    }
                    else
                    {
                        query.epaper_title = OldQuery.epaper_title;
                    }
                    if (!string.IsNullOrEmpty(Request.Params["epaper_short_title"]))
                    {
                        query.epaper_short_title = Request.Params["epaper_short_title"];
                    }
                    if (!string.IsNullOrEmpty(Request.Params["epaper_size"]))
                    {
                        query.epaper_size = Request.Params["epaper_size"];
                    }
                    else
                    {
                        query.epaper_size = OldQuery.epaper_size;
                    }
                    if (!string.IsNullOrEmpty(Request.Params["type"]))
                    {
                        query.type = Convert.ToUInt32(Request.Params["type"]);
                    }
                    else
                    {
                        query.type = OldQuery.type;
                    }
                    if (!string.IsNullOrEmpty(Request.Params["epaper_sort"]))
                    {
                        query.epaper_sort = Convert.ToUInt32(Request.Params["epaper_sort"]);
                    }
                    else
                    {
                        query.epaper_sort = OldQuery.epaper_sort;
                    }
                    if (!string.IsNullOrEmpty(Request.Params["epaperShowStart"]))
                    {
                        query.epaperShowStart = Convert.ToDateTime(Request.Params["epaperShowStart"]);
                    }
                    else
                    {
                        query.epaperShowStart = OldQuery.epaperShowStart;

                    }
                    if (!string.IsNullOrEmpty(Request.Params["epaperShowEnd"]))
                    {
                        query.epaperShowEnd = Convert.ToDateTime(Request.Params["epaperShowEnd"]);
                    }
                    else
                    {
                        query.epaperShowEnd = OldQuery.epaperShowEnd;

                    }
                    if (!string.IsNullOrEmpty(Request.Params["kendoEditor"]))
                    {
                        query.epaper_content = Request.Params["kendoEditor"];
                    }
                    else
                    {
                        query.epaper_content = OldQuery.epaper_content;

                    }
                    if (!string.IsNullOrEmpty(Request.Params["epaper_status"]))
                    {
                        query.epaper_status = Convert.ToUInt32(Request.Params["epaper_status"]);
                    }
                    else
                    {
                        query.epaper_status = OldQuery.epaper_status;

                    }
                    if (!string.IsNullOrEmpty(Request.Params["fb_description"]))
                    {
                        query.fb_description = Request.Params["fb_description"];
                    }
                    else
                    {
                        query.fb_description = OldQuery.fb_description;

                    }
                    System.Net.IPAddress[] addlist = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList;
                    if (addlist.Length > 0)
                    {
                        query.epaper_ipfrom = addlist[0].ToString();
                    }
                    query.epaperUpdateDate = DateTime.Now;
                    query.log_description = "modify,status=" + query.epaper_status;
                    _IEpaperContentMgr.SaveEpaperContent(query);
                    json = "{success:true}";
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:false}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 4
0
        public HttpResponseBase GetEpaperLogList()
        {
            string json = string.Empty;
            List<EpaperLogQuery> store = new List<EpaperLogQuery>();
            EpaperLogQuery query = new EpaperLogQuery();
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["epaperId"]))
                {
                    query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
                    query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");
                    query.epaper_id = Convert.ToUInt32(Request.Params["epaperId"]);
                    _IEpaperContentMgr = new EpaperContentMgr(mySqlConnectionString);
                    int totalCount = 0;
                    store = _IEpaperContentMgr.GetEpaperLogList(query, out  totalCount);
                    foreach (var item in store)
                    {
                        item.LogCreateDate = CommonFunction.GetNetTime(item.log_createdate);
                    }
                    IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                    timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                    json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";
                }
                else
                {
                    json = "{success:false,totalCount:0,data:[]}";
                }

            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:false,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 5
0
        public HttpResponseBase GetEpaperContent()
        {
            string json = string.Empty;
            try
            {
                _epaperContentMgr = new EpaperContentMgr(mySqlConnectionString);

                json = _epaperContentMgr.GetEpaperContent();
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:false,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;

        }
Ejemplo n.º 6
0
 public HttpResponseBase GetEpaperContent()
 {
     string json = string.Empty;
     List<EpaperContent> store = new List<EpaperContent>();
     EpaperContent query = new EpaperContent();
     try
     {
         _epaperMgr = new EpaperContentMgr(mySqlConnectionString);
         store = _epaperMgr.GetEpaperContentLimit();
         EpaperContent zero = new EpaperContent();
         zero.epaper_title = "請選擇...";
         store.Insert(0, zero);
         foreach (var item in store)
         {
             item.epaper_content = Server.HtmlDecode(item.epaper_content);
         }
         json = "{success:true" + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented) + "}";
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         json = "{success:false,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Ejemplo n.º 7
0
        public HttpResponseBase LoadEpaperContent()
        {
            string json = string.Empty;
            EpaperContentQuery query = new EpaperContentQuery();
            EpaperContentQuery model = new EpaperContentQuery();
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["content_id"]))
                {
                    _IEdmContentMgr = new EdmContentMgr(mySqlConnectionString);
                    query.epaper_id = Convert.ToUInt32(Request.Params["content_id"]);
                    _epaperMgr = new EpaperContentMgr(mySqlConnectionString);
                    model = _epaperMgr.GetEpaperContentById(query);
                    IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                    timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                    if (model != null)
                    {
                        model.epaper_id = query.epaper_id;
                        switch (model.epaper_status)
                        {
                            case 0:
                                json = "{success:false" + ",data:" + JsonConvert.SerializeObject(model, Formatting.Indented, timeConverter) + ",msg:0}";
                                break;
                            case 1:
                                json = "{success:true" + ",data:" + JsonConvert.SerializeObject(model, Formatting.Indented, timeConverter) + "}";
                                break;
                            case 2:
                                json = "{success:false" + ",data:" + JsonConvert.SerializeObject(model, Formatting.Indented, timeConverter) + ",msg:1}";
                                break;
                            case 3:
                                json = "{success:false" + ",data:" + JsonConvert.SerializeObject(model, Formatting.Indented, timeConverter) + ",msg:2}";
                                break;
                        }
                    }
                    else
                    {
                        json = "{success:false,msg:3}";
                    }
                }
                else
                {
                    json = "{success:false,data:[]}";
                }

            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);

            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }