示例#1
0
        public int Update(Model.WebContentType1 model)
        {
            model.Replace4MySQL(); 
            StringBuilder sb = new StringBuilder();
            try
            {
                         WebContentType1 oldModel = GetModel(model);
                        if (model.content_status == 1 && oldModel.content_status != 1)//啟用
                        {
                            WebContentTypeSetupDao _setDao = new WebContentTypeSetupDao(_connStr);
                            WebContentTypeSetup smodel = new WebContentTypeSetup();
                            smodel.site_id = model.site_id;
                            smodel.page_id = model.page_id;
                            smodel.area_id = model.area_id;
                            smodel.web_content_type = "web_content_type1";
                            _setDao.UpdateLimitStatus(smodel);////當前已啟用的個數超過5筆時,使最舊的不啟用,
                        }
                       
                        sb.AppendFormat(@"update web_content_type1  set site_id='{0}',page_id='{1}',area_id='{2}',type_id='{3}',content_title='{4}',content_image='{5}',`content_default`='{6}',content_status='{7}',link_url='{8}',link_page='{9}',link_mode='{10}',update_on='{11}' where content_id={12}",
                            model.site_id, model.page_id, model.area_id, model.type_id, model.content_title, model.content_image, model.content_default, model.content_status, model.link_url, model.link_page, model.link_mode, CommonFunction.DateTimeToString(model.update_on), model.content_id);
                        return _access.execCommand(sb.ToString());
            }
            catch (Exception ex)
            {

                throw new Exception("WebContentType1Dao.Update-->" + ex.Message + sb.ToString(), ex);
            }
          
        }
示例#2
0
        public int Insert(Model.WebContentType5 model)
        {
            model.Replace4MySQL();

            StringBuilder sb = new StringBuilder();
            try
            {
                if (model.content_status == 1)//啟用
                {
                    WebContentTypeSetupDao _setDao = new WebContentTypeSetupDao(_connStr);
                    WebContentTypeSetup smodel = new WebContentTypeSetup();
                    smodel.site_id = model.site_id;
                    smodel.page_id = model.page_id;
                    smodel.area_id = model.area_id;
                    smodel.web_content_type = "web_content_type5";
                    _setDao.UpdateLimitStatus(smodel);////當前已啟用的個數超過5筆時,使最舊的不啟用,
                }

                sb.AppendFormat(@"INSERT INTO web_content_type5(`site_id`,`page_id`,`area_id`,`type_id`,`brand_id`,`content_title`,`content_image`,`content_default`,`content_status`,`link_url`,`link_mode`,`update_on`,`created_on`) VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}') ", model.site_id, model.page_id, model.area_id, model.type_id, model.brand_id, model.content_title, model.content_image, model.content_default, model.content_status, model.link_url, model.link_mode, CommonFunction.DateTimeToString(model.update_on), CommonFunction.DateTimeToString(model.created_on));
                return _access.execCommand(sb.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("WebContentType5Dao.Insert-->" + ex.Message + sb.ToString(), ex); 
            }
           
        }
示例#3
0
 public int Insert(Model.WebContentType1 model)
 {
     model.Replace4MySQL();
     StringBuilder sb = new StringBuilder();
     try
     {
             if (model.content_status == 1)//啟用
             {
                 WebContentTypeSetupDao _setDao = new WebContentTypeSetupDao(_connStr);
                 WebContentTypeSetup smodel = new WebContentTypeSetup();
                 smodel.site_id = model.site_id;
                 smodel.page_id = model.page_id;
                 smodel.area_id = model.area_id;
                 smodel.web_content_type = "web_content_type1";
                 _setDao.UpdateLimitStatus(smodel);////當前已啟用的個數超過5筆時,使最舊的不啟用,
             }
           
             sb.AppendFormat(@"insert into web_content_type1(site_id,page_id,area_id,type_id,content_title,content_image,content_default,content_status,link_url,link_page,link_mode,update_on,created_on) 
         values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}')", model.site_id, model.page_id, model.area_id, model.type_id, model.content_title, model.content_image, model.content_default, model.content_status, model.link_url, model.link_page, model.link_mode, CommonFunction.DateTimeToString(model.update_on), CommonFunction.DateTimeToString(model.created_on));
             return _access.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("WebContentType1Dao.Insert-->" + ex.Message + sb.ToString(), ex);
     }
    
 }
        public DataTable QueryPageStore(WebContentTypeSetup model)
        {
            model.Replace4MySQL();

            StringBuilder str = new StringBuilder(@"select DISTINCT (ws.page_id) , t_page.parameterName as page_name ");
         
            try
            {
                str.Append(" from web_content_type_setup ws  left join t_parametersrc t_site on t_site.parameterType='site_id' and t_site.parameterCode=ws.site_id ");
                str.Append(" left join t_parametersrc t_page on t_page.parameterType='page_id' and t_page.parameterCode=ws.page_id and t_page.topValue=t_site.rowid ");
                str.Append(" where 1=1 and  ws.content_status=1");
                if (!string.IsNullOrEmpty(model.web_content_type))
                {
                    str.AppendFormat(" and ws.web_content_type='{0}'", model.web_content_type);
                }
                if (model.site_id != 0)
                {
                    str.AppendFormat(" and ws.site_id='{0}'", model.site_id);
                }
                if (model.page_id != 0)
                {
                    str.AppendFormat(" and ws.page_id='{0}'", model.page_id);
                }
                if (model.area_id != 0)
                {
                    str.AppendFormat(" and ws.area_id='{0}'", model.area_id);
                }
                return _access.getDataTable(str.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("WebContentTypeSetupDao.QueryPageStore-->" + ex.Message + str.ToString(), ex);
            }
           
        }
示例#5
0
 public int Insert(Model.WebContentType6 model)
 {
     model.Replace4MySQL();
     StringBuilder sb = new StringBuilder();
     try
     {
         if (model.content_status == 1)//啟用
         {
             WebContentTypeSetupDao _setDao = new WebContentTypeSetupDao(_connStr);
             WebContentTypeSetup smodel = new WebContentTypeSetup();
             smodel.site_id = model.site_id;
             smodel.page_id = model.page_id;
             smodel.area_id = model.area_id;
             smodel.web_content_type = "web_content_type6";
             _setDao.UpdateLimitStatus(smodel);////當前已啟用的個數超過5筆時,使最舊的不啟用,
         }
       
         sb.AppendFormat(@"INSERT INTO web_content_type6(`site_id`,`page_id`,`area_id`,`home_title`,`content_title`,`content_html`,`home_image`,`content_default`,`content_status`,`link_url`,`link_mode`,`update_on`,`created_on`,keywords)VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}'); select @@identity  ; ", model.site_id, model.page_id, model.area_id, model.home_title, model.content_title, model.content_html, model.home_image, model.content_default, model.content_status, model.link_url, model.link_mode, CommonFunction.DateTimeToString(model.update_on), CommonFunction.DateTimeToString(model.created_on), model.keywords);
         DataTable dt = _access.getDataTable(sb.ToString());
         model.content_id = Convert.ToInt32(dt.Rows[0][0].ToString());
         return model.content_id;
     }
     catch (Exception ex)
     {
         throw new Exception("WebContentType6Dao.Insert-->" + ex.Message + sb.ToString(), ex); 
     }
    
 }
 public List<WebContentTypeSetup> Query(WebContentTypeSetup model)
 {
     model.Replace4MySQL();
     string s = string.Format(@"select * from web_content_type_setup where 1=1 and content_status=1");
  
     try
     {
         if (!string.IsNullOrEmpty(model.web_content_type))
         {
             s += string.Format(" and web_content_type='{0}'", model.web_content_type);
         }
         if (model.site_id != 0)
         {
             s += string.Format(" and site_id='{0}'", model.site_id);
         }
         if (model.page_id != 0)
         {
             s += string.Format(" and page_id='{0}'", model.page_id);
         }
         if (model.area_id != 0)
         {
             s += string.Format(" and area_id='{0}'", model.area_id);
         }
         return _access.getDataTableForObj<WebContentTypeSetup>(s.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("WebContentTypeSetupDao.Query-->" + ex.Message + s.ToString(), ex);
     }
   
 }
 public DataTable QueryAreaStore(WebContentTypeSetup model)
 {
     try
     {
         return _setUpDao.QueryAreaStore(model);
     }
     catch (Exception ex)
     {
         throw new Exception("WebContentTypeSetupMgr-->QueryAreaStore-->" + ex.Message, ex);
     }
 }
 public List<WebContentTypeSetup> Query(WebContentTypeSetup model)
 {
     try
     {
         return _setUpDao.Query(model);
     }
     catch (Exception ex)
     {
         throw new Exception("WebContentTypeSetupMgr-->Query-->" + ex.Message, ex);
     }
 }
 public WebContentTypeSetup QueryPageArea(string setupContentId)
 {
     WebContentTypeSetup wct = new WebContentTypeSetup();
     wct.content_id = Convert.ToInt32(setupContentId);
     return wtiMgr.Query(wct)[0];
 }
        public JsonResult GetLinkUrl()
        {
            VendorBrandSet vbs = new VendorBrandSet();
            WebContentTypeSetup wts = new WebContentTypeSetup();
            wts.area_id = int.Parse(Request.Params["areaid"].ToString());
            wts.page_id = int.Parse(Request.Params["pageid"].ToString());
            wts.web_content_type = Request.Params["webcontenttype_page"].ToString();
            wts.site_id = 7;
            var linkUrl = "";
            if (wtiMgr.Query(wts) != null)
            {
                WebContentTypeSetup model = wtiMgr.Query(wts)[0];
                linkUrl = model.default_link_url.ToString();

                switch (model.web_content_type)
                {
                    case "web_content_type1":
                    case "web_content_type8":
                        break;
                    case "web_content_type2":
                        if (Request.Params["productid"].ToString() != "" && Request.Params["productid"].ToString() != "0")
                        {
                            var cid = _proMgr.QueryClassId(Convert.ToInt32(Request.Params["productid"].ToString()));
                            linkUrl += "?pid=" + Request.Params["productid"].ToString() + "&cid=" + cid;
                        }
                        break;
                    case "web_content_type3":
                    case "web_content_type5":
                        vbs.brand_id = uint.Parse(Request.Params["brandid"].ToString());
                        linkUrl += "&bid=" + Request.Params["brandid"].ToString();
                        break;
                    case "web_content_type4":
                        vbs.brand_id = uint.Parse(Request.Params["brandid"].ToString());
                        linkUrl += "?bid=" + Request.Params["brandid"].ToString();
                        List<VendorBrandSet> list = vbsMgr.GetClassId(vbs);
                        if (list.Count > 0)
                        {
                            linkUrl += "&cid=" + list[0].class_id.ToString() + "#readstory";
                        }
                        break;
                    case "web_content_type6":
                    case "web_content_type7":
                        break;
                    default:
                        break;


                }

            }
            return Json(new { success = "true", msg = linkUrl });
        }
        /// <summary>
        /// 獲取參數t_parametersrc數據
        /// </summary>
        /// <returns>t_parametersrc數據</returns>
        public string GetPage()
        {
            string json = string.Empty;

            WebContentTypeSetup wts = new WebContentTypeSetup();
            wts.site_id = 7;
            wts.web_content_type = Request.Params["webcontenttype_page"];
            if (Request.Params["type"].ToString() == "page")
            {
                DataTable pagedt = _wctsuMgr.QueryPageStore(wts);
                StringBuilder stb = new StringBuilder();
                stb.Append("{");
                stb.Append(string.Format("success:true,items:["));
                for (int i = 0; i < pagedt.Rows.Count; i++)
                {
                    stb.Append("{");
                    stb.AppendFormat("\"page_id\":\"{0}\",\"page_name\":\"{1}\"", pagedt.Rows[i][0], pagedt.Rows[i][1]);
                    stb.Append("}");
                }
                stb.Append("]}");
                json = stb.ToString().Replace("}{", "},{");
            }
            else if (Request.Params["type"].ToString() == "area")
            {
                wts.page_id = Convert.ToInt32(Request.Params["pageid"]);
                DataTable areadt = _wctsuMgr.QueryAreaStore(wts);
                StringBuilder stb = new StringBuilder();
                stb.Append("{");
                stb.Append(string.Format("success:true,items:["));
                for (int i = 0; i < areadt.Rows.Count; i++)
                {
                    stb.Append("{");
                    stb.AppendFormat("\"area_id\":\"{0}\",\"area_name\":\"{1}\"", areadt.Rows[i][0], areadt.Rows[i][1]);
                    stb.Append("}");
                }
                stb.Append("]}");
                json = stb.ToString().Replace("}{", "},{");
            }

            return json;
        }
        /// <summary>
        /// 獲取參數表中設置的限制值
        /// </summary>
        /// <returns>數據庫操作結果</returns>
        public JsonResult GetDefaultLimit()
        {
            int statusListNum = 0; int limitNumStatus = 0;
            WebContentTypeSetup model = new WebContentTypeSetup();
            model.web_content_type = Request.Params["storeType"].ToString();
            model.site_id = Convert.ToInt32(Request.Params["site"].ToString());
            model.page_id = Convert.ToInt32(Request.Params["page"]);
            model.area_id = Convert.ToInt32(Request.Params["area"]);
            limitNumStatus = _wctsuMgr.Query(model)[0].content_status_num;

            if (limitNumStatus != 0 && !string.IsNullOrEmpty(limitNumStatus.ToString()))
            {

                switch (model.web_content_type)
                {
                    case "web_content_type1":
                        WebContentType1 model1 = new WebContentType1();
                        model1.page_id = model.page_id;
                        statusListNum = _wctMgr1.GetDefault(model1);//獲取列表中已啟用的數量
                        break;
                    case "web_content_type2":
                        WebContentType2 model2 = new WebContentType2();
                        model2.page_id = model.page_id;
                        statusListNum = _wctMgr2.GetDefault(model2);
                        break;
                    case "web_content_type3":
                        WebContentType3 model3 = new WebContentType3();
                        model3.page_id = model.page_id;
                        statusListNum = _wctMgr3.GetDefault(model3);
                        break;
                    case "web_content_type4":
                        WebContentType4 model4 = new WebContentType4();
                        model4.page_id = model.page_id;
                        statusListNum = _wctMgr4.GetDefault(model4);
                        break;
                    case "web_content_type5":
                        WebContentType5 model5 = new WebContentType5();
                        model5.page_id = model.page_id;
                        statusListNum = _wctMgr5.GetDefault(model5);
                        break;
                    case "web_content_type6":
                        WebContentType6 model6 = new WebContentType6();
                        model6.page_id = model.page_id;
                        statusListNum = _wctMgr6.GetDefault(model6);
                        break;
                    case "web_content_type7":
                        WebContentType7 model7 = new WebContentType7();
                        model7.page_id = model.page_id;
                        statusListNum = _wctMgr7.GetDefault(model7);
                        break;
                    case "web_content_type8":
                        WebContentType8 model8 = new WebContentType8();
                        model8.page_id = model.page_id;
                        statusListNum = _wctMgr8.GetDefault(model8);
                        break;
                    default:
                        break;

                }
            }
            return Json(new { success = "true", listNum = statusListNum, limitNum = limitNumStatus });
        }