示例#1
0
        protected void charu_Click(object sender, EventArgs e)
        {
            string c   = "学号,山峰名称,时间";
            string v   = "'" + this.xuehao2.Text + "','" + this.shanfeng2.Text + "','" + this.shijian2.Text + "'";
            string sql = "insert into 攀登表";

            if (this.dengding2.SelectedItem.Value != "未知")
            {
                c += ",是否登顶"; v += ",'" + this.dengding2.SelectedItem.Value + "'";
            }
            sql += " (" + c + ") values (" + v + ")";

            LinkDB.ExecuteSql(sql);
            if (LinkDB.error == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息插入成功');</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息插入失败(" + LinkDB.error + ")');</script>");
                LinkDB.error = "";
            }
            GridView1.PageIndex = 0;
            bind();
            sqlStr = "select * from 攀登表 where 学号 = '" + this.xuehao2.Text + "' union " + sqlStr;
            bind();
        }
示例#2
0
        private void RepeaterDataBind(string sql)
        {
            DataSet myds = LinkDB.dataSet(sql);

            RepeaterBind.DataSource = myds;
            RepeaterBind.DataBind();
        }
示例#3
0
        protected void submit_Click(object sender, EventArgs e)
        {
            string sqlStr1 = "if exists ( select * from 注册表 where 登录号 = '" + this.xuehao.Text + "' )select '1' else select '0'";
            int    number1 = LinkDB.executeSql(sqlStr1);

            if (number1 == 1)
            {
                string sql = "update 注册表 set 密码='" + this.xuehao.Text + "'where 登录号='" + this.xuehao.Text + "'";
                LinkDB.ExecuteSql(sql);
                if (LinkDB.error == "")
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('密码重置成功');</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('密码重置失败(" + LinkDB.error + ")');</script>");
                    LinkDB.error = "";
                }
            }
            else
            {
                string sqlStr2 = "if exists ( select * from 人员表 where 学号 = '" + this.xuehao.Text + "' )select '1' else select '0'";
                int    number2 = LinkDB.executeSql(sqlStr2);
                if (number2 == 1)
                {
                    LinkDB.ExecuteSql("insert into 注册表 (登录号,密码) values ('" + this.xuehao.Text + "','" + this.xuehao.Text + "')");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('学号错误');</script>");
                }
            }
        }
示例#4
0
        protected void charu_Click(object sender, EventArgs e)
        {
            string c   = "部门名称";
            string v   = "'" + this.bumen.Text + "'";
            string sql = "insert into 部门表";

            if (this.buzhang.Text != "")
            {
                c += ",部长"; v += ",'" + this.buzhang.Text + "'";
            }
            if (this.fubuzhang.Text != "")
            {
                c += ",副部长"; v += ",'" + this.fubuzhang.Text + "'";
            }
            sql += " (" + c + ") values (" + v + ")";

            LinkDB.ExecuteSql(sql);
            if (LinkDB.error == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息插入成功');</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息插入失败(" + LinkDB.error + ")');</script>");
                LinkDB.error = "";
            }
            GridView1.PageIndex = 0;
            bind();
        }
示例#5
0
        // protected System.Web.UI.HtmlControls.HtmlTable Ttable;
        public void NewsDetial(int i)
        {
            string        picture = "kuaile";
            string        sql     = "select 新闻标题,发布时间,新闻作者,图片描述 from 新闻表 where ID=" + i;
            SqlDataReader dr      = LinkDB.Reader(sql);

            while (dr.Read())
            {
                Ttitle.Text = (string)dr["新闻标题"];
                Ttime.Text  = "    发布单位:地大登山攀岩俱乐部" + "      发布时间:" + ((DateTime)dr["发布时间"]).ToShortDateString() +
                              "        文/" + (string)dr["新闻作者"] + "  浏览次数:20";
                picture = (string)dr["图片描述"];
            }
            dr.Close();
            string  content = "select 新闻内容 from 新闻表 where ID=" + i;
            DataSet newsset = LinkDB.dataSet(content);

            Repeater1.DataSource = newsset.Tables["tables"].DefaultView;
            Repeater1.DataBind();
            newsset.Clear();

            string path = AppDomain.CurrentDomain.BaseDirectory + "Admin\\Images\\upload\\" + picture + ".jpg";

            Image1.ImageUrl = "~/Admin/Images/upload/" + picture + ".jpg";
            Bitmap smallP = new Bitmap(path);

            Image1.Height = 200;
            Image1.Width  = 200 * smallP.Width / smallP.Height;
        }
示例#6
0
        public void DataBind(string s)
        {
            string sql = s;

            try
            {
                DataSet ds = LinkDB.dataSet(sql);
                if (sql == sql1)
                {
                    repeater1.DataSource = ds.Tables["tables"].DefaultView;
                    repeater1.DataBind();
                }
                else
                {
                    repeater2.DataSource = ds.Tables["tables"].DefaultView;
                    repeater2.DataBind();
                }
                ds.Clear();
            }
            catch (SqlException ex)
            {
                Response.Write(ex.ToString());
            }
            // finally//可能用不到
        }
示例#7
0
        protected void charu_Click(object sender, EventArgs e)
        {
            string c   = "学号,日期";
            string v   = "'" + this.xuehao2.Text + "','" + this.riqi2.Text + "'";
            string sql = "insert into 考勤表";

            if (this.kaoqin2a.Checked)
            {
                c += ",出勤"; v += ",'是'";
            }
            if (this.kaoqin2b.Checked)
            {
                c += ",出勤"; v += ",'否'";
            }
            if (this.beizhu2.Text != "")
            {
                c += ",备注"; v += ",'" + this.beizhu2.Text + "'";
            }
            sql += " (" + c + ") values (" + v + ")";
            LinkDB.ExecuteSql(sql);
            if (LinkDB.error == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息插入成功');</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息插入失败(" + LinkDB.error + ")');</script>");
                LinkDB.error = "";
            }
            GridView1.PageIndex = 0;
            sqlStr = "select * from 考勤表 where 学号= '" + this.xuehao2.Text + "' union " + sqlStr;
            bind();
        }
示例#8
0
        public void bindParent()
        {
            string  sqlStr = "select * from 装备表";
            DataSet myds   = LinkDB.dataSet(sqlStr);

            ParentGridView.DataSource   = myds;
            ParentGridView.DataKeyNames = new string[] { "ID", "装备名称" };
            ParentGridView.DataBind();
        }
示例#9
0
        // 在单击 GridView 控件内某一行的 Delete 按钮时发生,但在 GridView 控件更新记录之前。此事件通常用于删除操作。
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string sqlStr = "delete from 活动表 where 活动名称='" + GridView1.DataKeys[e.RowIndex].Value + "'";

            LinkDB.ExecuteSql(sqlStr);
            if (LinkDB.error != "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除失败(" + LinkDB.error + ")');</script>");
                LinkDB.error = "";
            }
            bind();
        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string postType = Request.QueryString["s"];

            if (postType != null && postType == "registration")
            {
                string name     = Request.Form["name"];
                string password = Request.Form["password"];
                string sqlStr1  = "if exists ( select * from 注册表 where 登录号 = '" + name + "' )select '1' else select '0'";
                int    number1  = LinkDB.executeSql(sqlStr1);
                string sqlStr2  = "if exists ( select * from 注册表 where 登录号 = '" + name + "' and 密码 = '" + password + "' )select '1' else select '0'";
                int    number2  = LinkDB.executeSql(sqlStr2);
                if (number1 == 1)
                {
                    if (number2 == 1)
                    {
                        if (name == "admin")
                        {
                            Response.Redirect("Admin/Admin9.aspx?&id=0");
                        }
                        else
                        {
                            Response.Redirect("Admin/Admin0.aspx?&id=" + name);
                        }
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('密码错误');</script>");
                    }
                }
                else
                {
                    int number3 = LinkDB.executeSql("if exists ( select * from 人员表 where 学号 = '" + name + "' )select '1' else select '0'");
                    if (number3 == 1)
                    {
                        LinkDB.ExecuteSql("insert into 注册表 (登录号,密码) values ('" + name + "','" + name + "')");
                        if (name == password)
                        {
                            Response.Redirect("Admin/Admin0.aspx?&id=" + name);
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('初次登录时密码同用户名');</script>");
                        }
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('用户名错误');</script>");
                    }
                }
            }
        }
示例#11
0
        public PagedDataSource pds(string i)
        {
            string  sql = "select ID,新闻标题,发布时间 from 新闻表 where 栏目名称= '" + i + "' order by 发布时间 desc";
            DataSet ds  = LinkDB.dataSet(sql);

            PagedDataSource pds = new PagedDataSource();

            pds.DataSource       = ds.Tables["tables"].DefaultView;
            pds.AllowPaging      = true;
            pds.PageSize         = 15;
            pds.CurrentPageIndex = Convert.ToInt32(Request.QueryString["page"]);
            return(pds);
        }
示例#12
0
        // 在单击 GridView 控件内某一行的 Update 按钮(其 CommandName 属性设置为"Update"的按钮)时发生,但在 GridView 控件更新记录之前。此事件通常用于取消更新操作。
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string 原活动名称 = GridView1.DataKeys[e.RowIndex].Value.ToString();
            string 活动名称  = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
            string 部门名称  = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
            string 活动类型  = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim();
            string 活动时间  = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim();
            string 备注    = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].Controls[0])).Text.ToString().Trim();

            if (活动名称 == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('活动名称不能为空');</script>");
                return;
            }
            string sql = "update 活动表 set 活动名称='" + 活动名称 + "'";

            if (部门名称 != "")
            {
                sql += ",部门名称='" + 部门名称 + "'";
            }
            else
            {
                sql += ",部门名称=NULL";
            }
            if (活动类型 != "")
            {
                sql += ",活动类型='" + 活动类型 + "'";
            }
            else
            {
                sql += ",活动类型=NULL";
            }
            if (活动时间 != "")
            {
                sql += ",活动时间='" + 活动时间 + "'";
            }
            else
            {
                sql += ",活动时间=NULL";
            }
            sql += " where 活动名称 = '" + 原活动名称 + "'";
            LinkDB.ExecuteSql(sql);
            if (LinkDB.error != "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('更新失败(" + LinkDB.error + ")');</script>");
                LinkDB.error = "";
            }
            GridView1.EditIndex = -1;
            bind();
        }
示例#13
0
        // 数据绑定
        public void bind()
        {
            DataSet myds = LinkDB.dataSet(sqlStr);

            if (LinkDB.error != "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + LinkDB.error + "');</script>");
                LinkDB.error = "";
                return;
            }
            GridView1.DataSource   = myds;
            GridView1.DataKeyNames = new string[] { "活动名称" };
            GridView1.DataBind();
        }
示例#14
0
        // 在单击 GridView 控件内某一行的 Update 按钮(其 CommandName 属性设置为"Update"的按钮)时发生,但在 GridView 控件更新记录之前。此事件通常用于取消更新操作。
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string 原学号 = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
            string 原日期 = GridView1.DataKeys[e.RowIndex].Values[1].ToString();
            string 学号  = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
            string 日期  = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();
            string 出勤  = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim();
            string 备注  = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim();

            if (学号 == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('学号不能为空');</script>");
                return;
            }
            else if (日期 == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('日期不能为空');</script>");
                return;
            }
            string sql = "update 考勤表 set 学号='" + 学号 + "',日期='" + 日期 + "'";

            if (出勤 != "")
            {
                sql += ",出勤='" + 出勤 + "'";
            }
            else
            {
                sql += ",出勤=NULL";
            }
            if (备注 != "")
            {
                sql += ",备注='" + 备注 + "'";
            }
            else
            {
                sql += ",备注=NULL";
            }
            sql += " where 学号 = '" + 原学号 + "' and 日期='" + 原日期 + "'";
            LinkDB.ExecuteSql(sql);
            if (LinkDB.error != "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('更新失败(" + LinkDB.error + ")');</script>");
                LinkDB.error = "";
            }
            GridView1.EditIndex = -1;
            bind();
        }
示例#15
0
        // 在单击 GridView 控件内某一行的 Update 按钮(其 CommandName 属性设置为"Update"的按钮)时发生,但在 GridView 控件更新记录之前。此事件通常用于取消更新操作。
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string[] s = { "学号", "山峰名称", "时间", "是否登顶" };
            string[] q = new string[4];
            for (int i = 0; i < 4; i++)
            {
                q[i] = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[i + 2].Controls[0])).Text.ToString().Trim();
            }
            if (q[0] == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('学号不能为空');</script>");
                return;
            }
            else if (q[1] == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('山峰名称不能为空');</script>");
                return;
            }
            else if (q[2] == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('时间不能为空');</script>");
                return;
            }
            string sql = "update 攀登表 set 学号='" + q[0] + "',山峰名称='" + q[1] + "',时间='" + q[2] + "'";

            if (q[3] != "")
            {
                sql += ",是否登顶='" + q[3] + "'";
            }
            else
            {
                sql += ",是否登顶=NULL";
            }
            string 原学号 = GridView1.DataKeys[e.RowIndex].Value.ToString();

            sql += " where 学号 = '" + 原学号 + "'";
            LinkDB.ExecuteSql(sql);
            if (LinkDB.error != "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('更新失败(" + LinkDB.error + ")');</script>");
                LinkDB.error = "";
            }
            GridView1.EditIndex = -1;
            bind();
        }
示例#16
0
        protected void ParentGridView_RowEditing(object sender, GridViewEditEventArgs e)
        {
            int parent_index = e.NewEditIndex;

            ParentGridView.EditIndex = parent_index;
            bindParent();
            string tablename = "";

            if (Convert.ToInt32(ParentGridView.DataKeys[parent_index].Values[0]) < 200)
            {
                tablename = ParentGridView.DataKeys[parent_index].Values[1].ToString().Trim() + "1";
            }
            else if (Convert.ToInt32(ParentGridView.DataKeys[parent_index].Values[0]) < 300)
            {
                tablename = ParentGridView.DataKeys[parent_index].Values[1].ToString().Trim() + "2";
            }
            else
            {
                tablename = ParentGridView.DataKeys[parent_index].Values[1].ToString().Trim() + "3";
            }
            string   sql           = "select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = '" + tablename + "'";
            GridView childGridView = (GridView)(ParentGridView.Rows[parent_index].FindControl("ChildGridView"));

            childGridView.Columns.Clear();
            SqlDataReader dr = LinkDB.Reader(sql);

            while (dr.Read())
            {
                string     DR = (string)dr["COLUMN_NAME"];
                BoundField bf = new BoundField();
                if (DR != "编号")
                {
                    bf.DataField = DR;
                }
                bf.HeaderText = DR;
                childGridView.Columns.Add(bf);
            }
            dr.Close();
            string  sqlStr = "select * from " + tablename;
            DataSet myds   = LinkDB.dataSet(sqlStr);

            childGridView.DataSource   = myds;
            childGridView.DataKeyNames = new string[] { "编号" };
            childGridView.DataBind();
        }
示例#17
0
 protected void shanchu_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < this.GridView1.Rows.Count; i++)
     {
         bool ischecked = ((CheckBox)GridView1.Rows[i].FindControl("select")).Checked;
         if (ischecked)
         {
             string sqlStr = "delete from 活动表 where 活动名称='" + GridView1.DataKeys[i].Value + "'";
             LinkDB.ExecuteSql(sqlStr);
             if (LinkDB.error != "")
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('删除失败(" + LinkDB.error + ")');</script>");
                 LinkDB.error = "";
             }
         }
     }
     bind();
 }
示例#18
0
        public void NewsDataBind(int i)
        {
            string        sql1   = "select 新闻标题,栏目名称,新闻内容,图片描述,新闻作者 from 新闻表 where ID=" + i;
            SqlDataReader reader = LinkDB.Reader(sql1);

            while (reader.Read())
            {
                Ttitle.Text = (string)reader["新闻标题"];
                RadioButtonList1.ClearSelection();
                //RadioButtonList1.SelectedValue=dr["栏目名称"].ToString();//两者都可以实现Radiobuttonlist的数据库显示
                RadioButtonList1.Text = reader["栏目名称"].ToString();
                FreeTextBox1.Text    += reader["新闻内容"].ToString();
                TPath.Text            = (string)reader["图片描述"];
                Tauthor.Text          = (string)reader["新闻作者"];
            }
            reader.Close();
            LinkDB.closeConnection();
        }
示例#19
0
        // 在单击 GridView 控件内某一行的 Update 按钮(其 CommandName 属性设置为"Update"的按钮)时发生,但在 GridView 控件更新记录之前。此事件通常用于取消更新操作。
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string[] s = { "学号", "姓名", "性别", "联系电话", "出生日期", "籍贯", "所在院系", "入学年份", "学历", "部门名称", "职位" };
            string[] q = new string[11];
            for (int i = 0; i < 11; i++)
            {
                q[i] = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[i + 2].Controls[0])).Text.ToString().Trim();
            }
            if (q[0] == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('学号不能为空');</script>");
                return;
            }
            else if (q[1] == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('姓名不能为空');</script>");
                return;
            }
            string sql = "update 人员表 set 学号='" + q[0] + "',姓名='" + q[1] + "'";

            for (int i = 2; i < 11; i++)
            {
                if (q[i] != "")
                {
                    sql += "," + s[i] + "='" + q[i] + "'";
                }
                else
                {
                    sql += "," + s[i] + "=NULL";
                }
            }
            string 原学号 = GridView1.DataKeys[e.RowIndex].Value.ToString();

            sql += " where 学号 = '" + 原学号 + "'";
            LinkDB.ExecuteSql(sql);
            if (LinkDB.error != "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('更新失败(" + LinkDB.error + ")');</script>");
                LinkDB.error = "";
            }
            GridView1.EditIndex = -1;
            bind();
        }
示例#20
0
        // 在单击 GridView 控件内某一行的 Update 按钮(其 CommandName 属性设置为"Update"的按钮)时发生,但在 GridView 控件更新记录之前。此事件通常用于取消更新操作。
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string 原部门名称 = GridView1.DataKeys[e.RowIndex].Value.ToString();
            string 部门名称  = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim();
            string 部长    = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim();
            string 副部长   = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim();

            if (部门名称 == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('部门名称不能为空');</script>");
                return;
            }
            string sql = "update 部门表 set 部门名称='" + 部门名称 + "'";

            if (部长 != "")
            {
                sql += ",部长='" + 部长 + "'";
            }
            else
            {
                sql += ",部长=NULL";
            }
            if (副部长 != "")
            {
                sql += ",副部长='" + 副部长 + "'";
            }
            else
            {
                sql += ",副部长=NULL";
            }
            sql += " where 部门名称 = '" + 原部门名称 + "'";
            LinkDB.ExecuteSql(sql);
            if (LinkDB.error != "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('更新失败(" + LinkDB.error + ")');</script>");
                LinkDB.error = "";
            }
            GridView1.EditIndex = -1;
            bind();
        }
示例#21
0
        public void RepeaterBind(string D)
        {
            Ttitle.Text = D;
            string sql = "select 内容 from 其余项 where ID=";

            if (D == "俱乐部简介")
            {
                sql += 1;
            }
            if (D == "大事记")
            {
                sql += 2;
            }
            else if (D == "联系我们")
            {
                sql += 3;
            }
            DataSet repDS = LinkDB.dataSet(sql);

            Repeater1.DataSource = repDS.Tables["tables"].DefaultView;
            Repeater1.DataBind();
        }
示例#22
0
        protected void charu_Click(object sender, EventArgs e)
        {
            string c   = "活动名称";
            string v   = "'" + this.huodong2.Text + "'";
            string sql = "insert into 活动表";

            if (this.bumen2.SelectedItem.Value != "未知")
            {
                c += ",部门名称"; v += ",'" + this.bumen2.SelectedItem.Value + "'";
            }
            if (this.leixing2.SelectedItem.Value != "未知")
            {
                c += ",活动类型"; v += ",'" + this.leixing2.SelectedItem.Value + "'";
            }
            if (this.shijian2.SelectedIndex != null)
            {
                string s = ContentClear.GetCheckBoxListValue(shijian2);
                c += ",活动时间"; v += ",'" + s + "'";
            }
            if (this.leixing2.Text != "")
            {
                c += ",备注"; v += ",'" + this.beizhu2.Text + "'";
            }
            sql += " (" + c + ") values (" + v + ")";

            LinkDB.ExecuteSql(sql);
            if (LinkDB.error == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息插入成功');</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息插入失败(" + LinkDB.error + ")');</script>");
                LinkDB.error = "";
            }
            GridView1.PageIndex = 0;
            sqlStr = "select * from 活动表 where 活动名称= '" + this.huodong2.Text + "' union " + sqlStr;
            bind();
        }
示例#23
0
        public void LabBind(string D)
        {
            string[] a = new string[6];
            string   lab;

            if (D == "部门介绍")
            {
                lab = "select 部门简介 from 部门介绍";
            }
            else if (D == "日常活动")
            {
                lab = "select 活动简介 from 日常活动 ";
            }
            else if (D == "精品活动")
            {
                lab = "select 活动简介 from 精品活动 ";
            }
            else
            {
                lab = "select 活动简介 from 户外百科 ";
            }

            DataSet labDS = LinkDB.dataSet(lab);

            for (int x = 0; x < labDS.Tables["tables"].Rows.Count; x++)
            {
                for (int y = 0; y < labDS.Tables["tables"].Columns.Count; y++)
                {
                    a[x] = labDS.Tables["tables"].Rows[x][y].ToString();
                }
            }
            Label1.Text = a[0];
            Label2.Text = a[1];
            Label3.Text = a[2];
            Label4.Text = a[3];
            Label5.Text = a[4];
        }
示例#24
0
        public void HyperBind(string D)
        {
            string[] b = new string[6];
            string   hyp;

            if (D == "部门介绍")
            {
                hyp = "select 部门名称 from 部门介绍";
            }
            else if (D == "日常活动")
            {
                hyp = "select 活动名称 from 日常活动 ";
            }
            else if (D == "精品活动")
            {
                hyp = "select 活动名称 from 精品活动 ";
            }
            else
            {
                hyp = "select 活动名称 from 户外百科 ";
            }

            DataSet hypDS = LinkDB.dataSet(hyp);

            for (int x = 0; x < hypDS.Tables["tables"].Rows.Count; x++)
            {
                for (int y = 0; y < hypDS.Tables["tables"].Columns.Count; y++)
                {
                    b[x] = hypDS.Tables["tables"].Rows[x][y].ToString();
                }
            }
            HyperLink1.Text = b[0];
            HyperLink2.Text = b[1];
            HyperLink3.Text = b[2];
            HyperLink4.Text = b[3];
            HyperLink5.Text = b[4];
        }
示例#25
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //上页传参学号
         //string SN = Request.QueryString["id"];
         string SN = "1004105200";
         //个人信息数据绑定
         string  sql1     = "select * from 人员表 where 学号='" + SN + "'";
         DataSet dataset1 = LinkDB.dataSet(sql1);
         Repeater1.DataSource = dataset1.Tables[0].DefaultView;
         Repeater1.DataBind();
         //部门信息数据绑定
         string  sql2     = "select * from 部门表";
         DataSet dataset2 = LinkDB.dataSet(sql2);
         Repeater2_1.DataSource = dataset2.Tables[0].DefaultView;
         Repeater2_1.DataBind();
         Repeater2_2.DataSource = dataset2.Tables[0].DefaultView;
         Repeater2_2.DataBind();
         Repeater2_3.DataSource = dataset2.Tables[0].DefaultView;
         Repeater2_3.DataBind();
         //活动信息数据绑定
         string  sql3     = "select * from 活动表";
         DataSet dataset3 = LinkDB.dataSet(sql3);
         Repeater3.DataSource = dataset3.Tables[0].DefaultView;
         Repeater3.DataBind();
         //欢迎字样数据绑定
         SqlDataReader dr = LinkDB.Reader("select 昵称 from 注册表 where 登录号='" + SN + "'");
         dr.Read();
         string DR = (string)dr["昵称"];
         dr.Close();
         Label1.Text = "您好," + DR + "(" + SN + "),欢迎登录";
     }
     else
     {
         string[] s1 = Label1.Text.Split('(');
         string[] s2 = s1[1].Split(')');
         xuehao = s2[0];
         //表单提交
         string postType = Request.QueryString["s"];
         if (postType != null)
         {
             string old  = Request.Form["old"];
             string new1 = Request.Form["new1"];
             string new2 = Request.Form["new2"];
             if (postType == "withname")
             {
                 string name = Request.Form["name"];
                 LinkDB.ExecuteSql("update 注册表 set 密码='" + new1 + "' , 昵称='" + name + "' where 登录号='" + xuehao + "'");
                 Label1.Text = "您好," + name + "(" + s1[1];
             }
             if (postType == "withoutname")
             {
                 LinkDB.ExecuteSql("update 注册表 set 密码='" + new1 + "'where 登录号='" + xuehao + "'");
             }
             if (LinkDB.error != "")
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('密码更新失败(" + LinkDB.error + ")');</script>");
                 LinkDB.error = "";
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('密码更改成功');</script>");
             }
         }
     }
 }
示例#26
0
        protected void charu_Click(object sender, EventArgs e)
        {
            string c   = "学号,姓名";
            string v   = "'" + this.xuehao2.Text + "','" + this.xingming2.Text + "'";
            string sql = "insert into 人员表";

            if (this.dianhua2.Text != "")
            {
                c += ",联系电话"; v += ",'" + this.dianhua2.Text + "'";
            }
            if (this.shengri2.Text != "")
            {
                c += ",出生日期"; v += ",'" + this.shengri2.Text + "'";
            }
            if (this.xingbie2a.Checked)
            {
                c += ",性别"; v += ",'男'";
            }
            if (this.xingbie2b.Checked)
            {
                c += ",性别"; v += ",'女'";
            }
            if (this.jiguan2.SelectedItem.Value != "未知")
            {
                c += ",籍贯"; v += ",'" + this.jiguan2.SelectedItem.Value + "'";
            }
            if (this.xueyuan2.SelectedItem.Value != "未知")
            {
                c += ",所在院系"; v += ",'" + this.xueyuan2.SelectedItem.Value + "'";
            }
            if (this.xuenian2.SelectedItem.Value != "未知")
            {
                c += ",入学年份"; v += ",'" + this.xuenian2.SelectedItem.Value + "'";
            }
            if (this.xueli2.SelectedItem.Value != "未知")
            {
                c += ",学历"; v += ",'" + this.xueli2.SelectedItem.Value + "'";
            }
            if (this.bumen2.SelectedItem.Value != "未知")
            {
                c += ",部门名称"; v += ",'" + this.bumen2.SelectedItem.Value + "'";
            }
            if (this.zhiwei2.SelectedItem.Value != "未知")
            {
                c += ",职位"; v += ",'" + this.zhiwei2.SelectedItem.Value + "'";
            }
            sql += " (" + c + ") values (" + v + ")";

            LinkDB.ExecuteSql(sql);
            if (LinkDB.error == "")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息插入成功');</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息插入失败(" + LinkDB.error + ")');</script>");
                LinkDB.error = "";
            }
            GridView1.PageIndex = 0;
            sqlStr = "select * from 人员表 where 学号= '" + this.xuehao2.Text + "' union " + sqlStr;
            bind();
        }
示例#27
0
        protected void save_Click(object sender, EventArgs e)
        {
            //Boolean fileOK = false;
            string path          = Server.MapPath("~/content/");                         //设置为服务器网站接收文件目录
            string FileExtension = System.IO.Path.GetExtension(FUL1.FileName).ToLower(); //获得文件类型

            if (FUL1.HasFile && FileExtension != ".doc" && FileExtension != ".docx")
            {
                Response.Write("<script>window.alert('您上传的文件类型不符合要求!');</script>");
            }
            else
            {
                string connsql = @"data source=HONG-PC\SA;database=14峰网站数据库;uid=sa;password=sa1010";
                //btnS.Attributes.Add("onclick", "return confirm('确定要保存吗?');");//弹出提示框,有问题?????????
                string sql;
                if (decide == 0)
                {
                    string L = "select count(*) from dbo.新闻表";
                    int    l = LinkDB.executeSql(L);
                    sql = "insert into dbo.新闻表(ID,新闻标题,栏目名称,存储路径,新闻作者,新闻内容,图片描述) values('" + l + "',@新闻标题,@栏目名称,@存储路径,@新闻作者,@新闻内容,@图片)";
                }
                else
                {
                    sql = "update dbo.新闻表 set 新闻标题=@新闻标题,栏目名称=@栏目名称,存储路径=@存储路径,新闻作者=@新闻作者,新闻内容=@新闻内容,图片描述=@图片 where ID=" + decide;
                }
                SqlConnection conn       = new SqlConnection(connsql);
                SqlCommand    insertnews = new SqlCommand(sql, conn);
                //为每个DB字段设置参数
                insertnews.Parameters.Add("@新闻标题", SqlDbType.NVarChar, 50);
                insertnews.Parameters.Add("@栏目名称", SqlDbType.NVarChar, 50);
                insertnews.Parameters.Add("@存储路径", SqlDbType.NVarChar, 50);
                insertnews.Parameters.Add("@新闻作者", SqlDbType.NChar, 10);
                insertnews.Parameters.Add("@新闻内容", SqlDbType.NVarChar, 4000);
                insertnews.Parameters.Add("@图片", SqlDbType.NVarChar, 50);
                //为每个参数赋值
                insertnews.Parameters["@新闻标题"].Value = Ttitle.Text;
                insertnews.Parameters["@栏目名称"].Value = RadioButtonList1.Text.ToString();//有点问题??????????
                insertnews.Parameters["@存储路径"].Value = path + FUL1.FileName;
                insertnews.Parameters["@新闻作者"].Value = Tauthor.Text;
                insertnews.Parameters["@新闻内容"].Value = this.FreeTextBox1.Text.Trim().ToString();
                insertnews.Parameters["@图片"].Value   = TPath.Text;
                try
                {
                    if (decide != 0)
                    {
                        //提示是否保存?是、否
                    }
                    conn.Open();
                    int flag = insertnews.ExecuteNonQuery();
                    if (flag > 0)
                    {
                        if (FUL1.HasFile && (FileExtension != ".doc" || FileExtension != ".docx"))
                        {
                            FUL1.PostedFile.SaveAs(path + FUL1.FileName);
                        }
                        Response.Write("<script>window.alert('保存成功!');</script>");
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("<script>window.alert('保存失败!');</script>");
                }
                finally
                {
                    conn.Close();
                }
            }
        }
示例#28
0
        public void RepeaterBind(string D)
        {
            string rep;

            if (D == "部门介绍")
            {
                rep = "select 内容 from 部门内容 where 类型ID=";
            }
            else if (D == "日常活动")
            {
                rep = "select 内容 from 日常内容 where 类型ID=";
            }
            else if (D == "精品活动")
            {
                rep = "select 内容 from 精品内容 where 类型ID=";
            }
            else
            {
                rep = "select 内容 from 户外内容 where 类型ID=";
            }
            for (int id = 0; id < 6; id++)
            {
                string  repp  = rep + id;
                DataSet repDS = LinkDB.dataSet(repp);
                switch (id)
                {
                case 0:
                {
                    repeater1.DataSource = repDS.Tables["tables"].DefaultView;
                    repeater1.DataBind();
                    repeater2.DataSource = repDS.Tables["tables"].DefaultView;
                    repeater2.DataBind();
                    break;
                }

                case 1:
                {
                    repeater3.DataSource = repDS.Tables["tables"].DefaultView;
                    repeater3.DataBind();
                    repeater4.DataSource = repDS.Tables["tables"].DefaultView;
                    repeater4.DataBind();
                    break;
                }

                case 2:
                {
                    repeater5.DataSource = repDS.Tables["tables"].DefaultView;
                    repeater5.DataBind();
                    repeater6.DataSource = repDS.Tables["tables"].DefaultView;
                    repeater6.DataBind();
                    break;
                }

                case 3:
                {
                    repeater7.DataSource = repDS.Tables["tables"].DefaultView;
                    repeater7.DataBind();
                    repeater8.DataSource = repDS.Tables["tables"].DefaultView;
                    repeater8.DataBind();
                    break;
                }

                case 4:
                {
                    repeater9.DataSource = repDS.Tables["tables"].DefaultView;
                    repeater9.DataBind();
                    repeater10.DataSource = repDS.Tables["tables"].DefaultView;
                    repeater10.DataBind();
                    break;
                }

                case 5:
                    break;
                }
            }
        }