示例#1
0
    public void rptList2_Bind(int strparentId)
    {
        Cms.BLL.C_article   bllarticle   = new Cms.BLL.C_article();
        Cms.Model.C_article modelarticle = new Cms.Model.C_article();
        DataSet             ds           = bllarticle.GetList("parentId=" + strparentId + "");

        if (ds.Tables[0].Rows.Count > 0)
        {
            switch (this.prolistview)
            {
            case "Txt":
                this.rptList2.Visible    = false;
                this.rptList1.DataSource = ds;
                this.rptList1.DataBind();
                break;

            default:
                this.rptList1.Visible    = false;
                this.rptList2.DataSource = ds;
                this.rptList2.DataBind();
                break;
            }
        }
    }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Cms.Model.C_article model)
 {
     return(dal.Update(model));
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Cms.Model.C_article model)
 {
     return(dal.Add(model));
 }
示例#4
0
    protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("Fielddocid")).Value);

        Cms.BLL.C_article   bll   = new Cms.BLL.C_article();
        Cms.Model.C_article model = bll.GetModel(id);

        LinkButton lb = (LinkButton)e.Item.FindControl("lbedit");

        Cms.BLL.C_Column cm        = new Cms.BLL.C_Column();
        string           classid   = DTRequest.GetQueryString("classid");
        string           classname = cm.GetModel(int.Parse(classid)).className;
        bool             blEdit    = adminUser.setpurview(classname, "Edit");

        if (!blEdit)
        {
            lb.Visible = false;
        }


        switch (e.CommandName)
        {
        case "lbtnIsMsg":
            if (model.is_msg == 1)
            {
                this.updateSate(id, "is_msg=0");
            }
            else
            {
                this.updateSate(id, "is_msg=1");
            }
            break;

        case "lbtnIsTop":
            if (model.isTop == 1)
            {
                this.updateSate(id, "isTop=0");
            }
            else
            {
                this.updateSate(id, "isTop=1");
            }
            break;

        case "lbtnIsRed":
            if (model.isRecommend == 1)
            {
                this.updateSate(id, "isRecommend=0");
            }
            else
            {
                this.updateSate(id, "isRecommend=1");
            }
            break;

        case "lbtnIsHot":
            if (model.isHot == 1)
            {
                this.updateSate(id, "isHot=0");
            }
            else
            {
                this.updateSate(id, "isHot=1");
            }
            break;

        case "lbtnIsSlide":
            if (model.is_slide == 1)
            {
                this.updateSate(id, "is_slide=0");
            }
            else
            {
                this.updateSate(id, "is_slide=1");
            }
            break;
        }
    }
示例#5
0
    //资料导入方法
    public static string ExeclData(string clientid, string CustTypeMax, string CustTypeMin, string CustTypeSub)
    {
        {
            //获取上传的菜单名称和路径
            string        tempMenPath = System.Web.HttpContext.Current.Server.MapPath("~") + "\\Upload\\file\\" + clientid;//
            StringBuilder sbResult    = new StringBuilder("");
            //string strconn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + tempMenPath + ";Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\"";
            string          strconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + tempMenPath + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\"";
            OleDbConnection conn    = new OleDbConnection(strconn);
            conn.Open();
            string sql;
            sql = "SELECT * FROM [Sheet1$]";
            DataSet          objDS  = new DataSet();
            OleDbDataAdapter objadp = new OleDbDataAdapter(sql, conn);
            objadp.Fill(objDS);
            DataTable MenDt = objDS.Tables[0];
            conn.Close();
            int result = 0;
            foreach (DataRow dr in MenDt.Select())
            {
                try
                {
                    Cms.BLL.C_article   bllarticle   = new Cms.BLL.C_article();
                    Cms.Model.C_article modelarticle = new Cms.Model.C_article();
                    modelarticle.parentId     = 78;               //栏目id
                    modelarticle.title        = dr[2].ToString(); //标题
                    modelarticle.englishtitle = "";               //英文标题
                    modelarticle.orderNumber  = 0;                //排序

                    modelarticle.photoUrl = "";                   //缩略图

                    modelarticle.intro   = "";                    //简介
                    modelarticle.content = dr[4].ToString();      //内容

                    modelarticle.seoTitle       = "";             //seo标题
                    modelarticle.seoKeyword     = "";             //seo关键词
                    modelarticle.seoDescription = "";             //seo描述
                    modelarticle.isRecommend    = 1;              //推荐
                    modelarticle.isChannel      = "";             //栏目推荐

                    modelarticle.isHidden = 1;                    //是否隐藏
                    modelarticle.isCheck  = 1;                    //是否审核发布
                    modelarticle.isHot    = 1;                    //是否热门文章


                    modelarticle.isTop      = 1;//是否置顶
                    modelarticle.is_msg     = 1;
                    modelarticle.is_slide   = 1;
                    modelarticle.hits       = 1;            //点击量
                    modelarticle.Attachment = "";
                    modelarticle.expClass   = "";           //
                    modelarticle.editTime   = DateTime.Now; //最后编辑时间
                    modelarticle.updateTime = DateTime.Now; //添加时间

                    modelarticle.txtLinkUrl       = "";
                    modelarticle.contentUrl       = "";
                    modelarticle.txtsource        = "";
                    modelarticle.txtauthor        = "";
                    modelarticle.w_LinkUrl        = "";
                    modelarticle.w_contentUrl     = "";
                    modelarticle.w_intro          = "";
                    modelarticle.w_content        = "";
                    modelarticle.e_LinkUrl        = "";
                    modelarticle.e_contentUrl     = "";
                    modelarticle.e_source         = "";
                    modelarticle.e_author         = "";
                    modelarticle.e_intro          = "";
                    modelarticle.e_content        = "";
                    modelarticle.e_seoTitle       = "";
                    modelarticle.e_seoKeyword     = "";
                    modelarticle.e_seoDescription = "";
                    //modelarticle.textParam1 = "";
                    //modelarticle.textParam2 = "";
                    //modelarticle.textParam3 = "";
                    //modelarticle.textParam4 = "";
                    //modelarticle.textParam5 = "";


                    result = bllarticle.Add(modelarticle);
                    if (result > 1)
                    {
                        StringBuilder strSql = new StringBuilder();
                        strSql.Append("insert into C_article_attribute_value(");
                        strSql.Append("article_id,gra_time,card_id,cord_number)");
                        strSql.Append(" values (");
                        strSql.Append("@article_id,@gra_time,@card_id,@cord_number)");
                        SqlParameter[] parameters =
                        {
                            new SqlParameter("@article_id",  SqlDbType.Int,        4),
                            new SqlParameter("@gra_time",    SqlDbType.NVarChar, 255),
                            new SqlParameter("@card_id",     SqlDbType.NVarChar, 100),
                            new SqlParameter("@cord_number", SqlDbType.NVarChar, 50)
                        };
                        parameters[0].Value = result;
                        parameters[1].Value = dr[5].ToString();
                        parameters[2].Value = dr[1].ToString();
                        parameters[3].Value = dr[3].ToString();

                        int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
                        sbResult.Append("增加成功 <br />");
                    }
                    else
                    {
                        sbResult.Append("增加失败 <br />");
                    }
                }
                catch
                {
                    continue;
                }
            }

            return(sbResult.ToString());

            //更新到数据库中
        }
    }
示例#6
0
    /// <summary>
    ///商品导入方法
    /// </summary>
    /// <param name="clientid"></param>
    /// <param name="CustTypeMax"></param>
    /// <param name="CustTypeMin"></param>
    /// <param name="CustTypeSub"></param>
    /// <returns></returns>
    public static string ExeclData(string clientid, string classid, string CustTypeMin, string CustTypeSub)
    {
        {
            //获取上传的菜单名称和路径
            string        tempMenPath = System.Web.HttpContext.Current.Server.MapPath("~") + "\\Upload\\file\\" + clientid;//
            StringBuilder sbResult    = new StringBuilder("");
            //string strconn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + tempMenPath + ";Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\"";
            string          strconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + tempMenPath + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\"";
            OleDbConnection conn    = new OleDbConnection(strconn);
            conn.Open();
            string sql;
            sql = "SELECT * FROM [Sheet1$]";
            DataSet          objDS  = new DataSet();
            OleDbDataAdapter objadp = new OleDbDataAdapter(sql, conn);
            objadp.Fill(objDS);
            DataTable MenDt = objDS.Tables[0];
            conn.Close();
            int result = 0;
            foreach (DataRow dr in MenDt.Select())
            {
                try
                {
                    Cms.BLL.C_article   bllarticle   = new Cms.BLL.C_article();
                    Cms.Model.C_article modelarticle = new Cms.Model.C_article();
                    modelarticle.parentId     = Convert.ToInt32(classid); //栏目id
                    modelarticle.title        = dr[0].ToString();         //标题
                    modelarticle.englishtitle = "";                       //英文标题
                    modelarticle.orderNumber  = 0;                        //排序
                    modelarticle.photoUrl     = "";                       //缩略图
                    modelarticle.intro        = "";                       //简介
                    modelarticle.content      = dr[1].ToString();         //内容

                    modelarticle.seoTitle       = "";                     //seo标题
                    modelarticle.seoKeyword     = "";                     //seo关键词
                    modelarticle.seoDescription = "";                     //seo描述
                    modelarticle.isRecommend    = 0;                      //推荐
                    modelarticle.isChannel      = "";                     //栏目推荐
                    modelarticle.isHidden       = 0;                      //是否隐藏
                    modelarticle.isCheck        = 0;                      //是否审核发布
                    modelarticle.isHot          = 0;                      //是否热门文章
                    modelarticle.isTop          = 0;                      //是否置顶
                    modelarticle.is_msg         = 0;
                    modelarticle.is_slide       = 0;
                    modelarticle.hits           = 1;            //点击量
                    modelarticle.Attachment     = "";
                    modelarticle.expClass       = "";           //
                    modelarticle.editTime       = DateTime.Now; //最后编辑时间
                    modelarticle.updateTime     = DateTime.Now; //添加时间
                    modelarticle.txtLinkUrl     = "";
                    modelarticle.contentUrl     = "";
                    modelarticle.txtsource      = "";
                    modelarticle.txtauthor      = "";

                    #region 手机|英文信息
                    modelarticle.w_LinkUrl        = "";
                    modelarticle.w_contentUrl     = "";
                    modelarticle.w_intro          = "";
                    modelarticle.w_content        = "";
                    modelarticle.e_LinkUrl        = "";
                    modelarticle.e_contentUrl     = "";
                    modelarticle.e_source         = "";
                    modelarticle.e_author         = "";
                    modelarticle.e_intro          = "";
                    modelarticle.e_content        = "";
                    modelarticle.e_seoTitle       = "";
                    modelarticle.e_seoKeyword     = "";
                    modelarticle.e_seoDescription = "";
                    string channel_name             = new Cms.BLL.C_Column().GetModel(Convert.ToInt32(classid)).className.ToString();
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("sub_title", "");
                    modelarticle.fields = dic; //扩展字段赋值
                    #endregion
                    result = bllarticle.Add(modelarticle);
                    if (result > 1)
                    {
                        #region 产品信息
                        Cms.BLL.C_article_product   bll_product   = new Cms.BLL.C_article_product();
                        Cms.Model.C_article_product model_product = new Cms.Model.C_article_product();
                        model_product.article_id  = result;
                        model_product.price       = Convert.ToDecimal(dr[2].ToString());
                        model_product.marketPrice = Convert.ToDecimal(dr[3].ToString());
                        model_product.integral    = Convert.ToInt32(dr[4].ToString());
                        model_product.stock       = Convert.ToInt32(dr[5].ToString());
                        model_product.is_integral = Convert.ToInt32(0);
                        model_product.s_version   = Convert.ToInt32(0);


                        #endregion
                        sbResult.Append("导入成功! <br />");
                    }
                    else
                    {
                        sbResult.Append("导入失败! <br />");
                    }
                }
                catch
                {
                    continue;
                }
            }

            return(sbResult.ToString());

            //更新到数据库中
        }
    }