コード例 #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);
     }
    
 }
コード例 #4
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); 
     }
    
 }