コード例 #1
0
        //绑定文物数据
        private void BindCull()
        {
            //唐
            DataTable dt = CullService.SelectCullDyn(6);

            if (dt != null && dt.Rows.Count != 0)
            {
                tanglist.DataSource = dt;
                tanglist.DataBind();
            }
            //宋
            DataTable dt1 = CullService.SelectCullDyn(8);

            if (dt1 != null && dt1.Rows.Count != 0)
            {
                songlist.DataSource = dt1;
                songlist.DataBind();
            }
            //书画
            DataTable dt2 = CullService.SelectCullClass(8);

            if (dt2 != null && dt2.Rows.Count != 0)
            {
                shuhualist.DataSource = dt2;
                shuhualist.DataBind();
            }
            //书画
            DataTable dt3 = CullService.SelectCullClass(1);

            if (dt3 != null && dt3.Rows.Count != 0)
            {
                qingtonglist.DataSource = dt3;
                qingtonglist.DataBind();
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindClass();

                if (Request.QueryString["flag"] == "true")
                {
                    DataTable dt = CullService.mohu(cull_name);
                    if (dt != null && dt.Rows.Count != 0)
                    {
                        cullview.DataSource = dt;
                        cullview.DataBind();
                    }
                    cullpanel.Visible  = false;
                    cullpanel2.Visible = true;
                }
                else
                {
                    cullpanel.Visible  = true;
                    cullpanel2.Visible = false;

                    BindCull();
                }
            }
        }
コード例 #3
0
 //文物宝鉴数据
 private void BindCull()
 {
     DataTable dt = CullService.SelectTop8();
     if (dt != null && dt.Rows.Count != 0)
     {
         cullview.DataSource = dt;
         cullview.DataBind();
     }
 }
コード例 #4
0
        //数据绑定
        private void BindAct()
        {
            DataTable dt = CullService.SelectAll();

            if (dt != null && dt.Rows.Count > 0)
            {
                ListView1.DataSource = dt;
                ListView1.DataBind();
            }
        }
コード例 #5
0
        //删除事件
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Button bt = (Button)sender;
            int    id = Convert.ToInt32(((HiddenField)(bt.Parent.FindControl("HiddenField1"))).Value);

            if (CullService.Delete(id) > 0)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "message", "<script language='javascript' >alert('删除成功!');</script>");
                BindAct();
            }
        }
コード例 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BindNews1();
         BindNews2();
         if (Request.QueryString["cull_id"] != null)
         {
             DataTable cull = CullService.culldetail1(int.Parse(Request.QueryString["cull_id"].ToString()));
             //cull.Read();
             Repeater1.DataSource = cull;
             Repeater1.DataBind();
             //cullname.Text = cull[1].ToString();
             DataTable dt = NewsService.selectCull(int.Parse(Request.QueryString["cull_id"]));
             if (dt != null && dt.Rows.Count != 0)
             {
                 Newsview.DataSource = dt;
                 Newsview.DataBind();
             }
         }
     }
 }
コード例 #7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (Label2.Text.Trim() == "")
                {
                    Response.Write("<script>alert('照片不能为空!')</script>");
                }
                else
                {
                    Culinfo Cull = new Culinfo();
                    Cull.Cull_Name    = txtTitle.Text.Trim();
                    Cull.Cull_Content = CKEditorControl1.Text.Trim();
                    Cull.Cull_Img     = Label2.Text;
                    //朝代
                    switch (DropDownList1.SelectedItem.ToString())
                    {
                    case "史前时代":
                        Cull.Dyn_ID = 1;
                        break;

                    case "夏商":
                        Cull.Dyn_ID = 2;
                        break;

                    case "春秋战国":
                        Cull.Dyn_ID = 3;
                        break;

                    case "秦汉":
                        Cull.Dyn_ID = 4;
                        break;

                    case "魏晋南北朝":
                        Cull.Dyn_ID = 5;
                        break;

                    case "隋唐":
                        Cull.Dyn_ID = 6;
                        break;

                    case "五代十国":
                        Cull.Dyn_ID = 7;
                        break;

                    case "宋":
                        Cull.Dyn_ID = 8;
                        break;

                    case "元":
                        Cull.Dyn_ID = 9;
                        break;

                    case "明清":
                        Cull.Dyn_ID = 10;
                        break;
                    }
                    //类别
                    switch (DropDownList2.SelectedItem.ToString())
                    {
                    case "青铜器":
                        Cull.Class_ID = 1;
                        break;

                    case "玉器":
                        Cull.Class_ID = 2;
                        break;

                    case "陶瓷":
                        Cull.Class_ID = 3;
                        break;

                    case "金银器":
                        Cull.Class_ID = 4;
                        break;

                    case "钱币":
                        Cull.Class_ID = 5;
                        break;

                    case "雕塑":
                        Cull.Class_ID = 6;
                        break;

                    case "书画 ":
                        Cull.Class_ID = 7;
                        break;

                    case "漆器":
                        Cull.Class_ID = 8;
                        break;

                    case "家具":
                        Cull.Class_ID = 9;
                        break;

                    case "铜镜 ":
                        Cull.Class_ID = 10;
                        break;

                    case "织绣":
                        Cull.Class_ID = 11;
                        break;

                    case "文房四宝":
                        Cull.Class_ID = 12;
                        break;

                    case "紫砂器":
                        Cull.Class_ID = 13;
                        break;
                    }
                    int result = CullService.Insert(Cull);
                    if (result >= 1)
                    {
                        Response.Write("<script>alert('发布成功!')</script>");
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write("<script>alert('上传失败');</script> 原因是:" + ex);
            }
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindClass();
                classpanel.Visible = false;
                dynpanel.Visible   = false;

                #region 朝代进来
                if (Request.QueryString["dynid"] != null)
                {
                    dynpanel.Visible = true;
                    if (Request.QueryString["dynid"] == "dyn")
                    {
                        //全部数据
                        dyn.Text = "朝代";
                        iddyn    = "朝代";
                        DataTable dt = CullService.SelectAll();
                        if (dt != null && dt.Rows.Count != 0)
                        {
                            cullview.DataSource = dt;
                            cullview.DataBind();
                        }
                    }
                    else
                    {
                        iddyn = Request.QueryString["dynid"].ToString();
                        //根据分类ID查询分类名或者朝代名
                        SqlDataReader dynname = DynBll.dynname(int.Parse(Request.QueryString["dynid"].ToString()));
                        dynname.Read();
                        dyn.Text = dynname["Dyn_Name"].ToString();
                        //根据朝代绑定前台数据
                        DataTable dt = CullService.SelectCullDyn(int.Parse(Request.QueryString["dynid"].ToString()));
                        if (dt != null && dt.Rows.Count != 0)
                        {
                            cullview.DataSource = dt;
                            cullview.DataBind();
                        }
                    }
                }
                #endregion
                #region 页面内分类查询
                if (Request.QueryString["class2"] != null)
                {
                    classpanel.Visible = true;

                    //根据分类ID查询分类名或者朝代名
                    SqlDataReader classname = ClassificationBll.clssname(int.Parse(Request.QueryString["class2"].ToString()));
                    classname.Read();
                    cullclass.Text = classname["Class_Name"].ToString();
                    if (iddyn == "朝代")
                    {
                        dyn.Text = iddyn;
                        //根据朝代和分类绑定前台数据
                        DataTable dt2 = CullService.SelectCullClass(int.Parse(Request.QueryString["class2"]));
                        if (dt2 != null && dt2.Rows.Count != 0)
                        {
                            cullview.DataSource = dt2;
                            cullview.DataBind();
                        }
                    }
                    else
                    {
                        //根据分类ID查询分类名或者朝代名
                        SqlDataReader dynname = DynBll.dynname(int.Parse(iddyn));
                        dynname.Read();
                        dyn.Text = dynname["Dyn_Name"].ToString();
                        DataTable dt2 = CullService.SelectCullClassDyn(int.Parse(iddyn), int.Parse(Request.QueryString["class2"].ToString()));
                        if (dt2 != null && dt2.Rows.Count != 0)
                        {
                            cullview.DataSource = dt2;
                            cullview.DataBind();
                        }
                    }
                }
                #endregion
                #region 分类进来
                if (Request.QueryString["classid"] != null)
                {
                    classpanel.Visible = true;
                    if (Request.QueryString["classid"] == "leibie")
                    {
                        cullclass.Text = "类别";
                        idclass        = "类别";
                        DataTable dt = CullService.SelectAll();
                        if (dt != null && dt.Rows.Count != 0)
                        {
                            cullview.DataSource = dt;
                            cullview.DataBind();
                        }
                    }
                    else
                    {
                        idclass = Request.QueryString["classid"].ToString();
                        //根据分类ID查询分类名或者朝代名
                        SqlDataReader cullclassname = ClassificationBll.clssname(int.Parse(Request.QueryString["classid"].ToString()));
                        cullclassname.Read();
                        cullclass.Text = cullclassname["Class_Name"].ToString();
                        //根据分类绑定前台数据
                        DataTable dt = CullService.SelectCullClass(int.Parse(Request.QueryString["classid"].ToString()));
                        if (dt != null && dt.Rows.Count != 0)
                        {
                            cullview.DataSource = dt;
                            cullview.DataBind();
                        }
                    }
                }

                #endregion
                #region 页面内朝代查询
                if (Request.QueryString["dyn2"] != null)
                {
                    dynpanel.Visible = true;

                    //根据分类ID查询分类名或者朝代名
                    SqlDataReader dynname = DynBll.dynname(int.Parse(Request.QueryString["dyn2"].ToString()));
                    dynname.Read();
                    dyn.Text = dynname["Dyn_Name"].ToString();
                    if (idclass == "类别")
                    {
                        cullclass.Text = idclass;
                        //根据朝代和分类绑定前台数据
                        DataTable dt2 = CullService.SelectCullDyn(int.Parse(Request.QueryString["dyn2"]));
                        if (dt2 != null && dt2.Rows.Count != 0)
                        {
                            cullview.DataSource = dt2;
                            cullview.DataBind();
                        }
                    }
                    else
                    {
                        //根据分类ID查询分类名或者朝代名
                        SqlDataReader cullclassname = ClassificationBll.clssname(int.Parse(idclass));
                        cullclassname.Read();
                        cullclass.Text = cullclassname["Class_Name"].ToString();
                        //根据朝代和分类绑定前台数据
                        DataTable dt2 = CullService.SelectCullClassDyn(int.Parse(Request.QueryString["dyn2"].ToString()), int.Parse(idclass));
                        if (dt2 != null && dt2.Rows.Count != 0)
                        {
                            cullview.DataSource = dt2;
                            cullview.DataBind();
                        }
                    }
                }
                #endregion
            }
        }