コード例 #1
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string    j       = GridView1.DataKeys[e.RowIndex].Value.ToString();
        string    sqlstr  = "delete from magazine where magazineId='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
        string    sqlstr1 = "delete from article where magazineId='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
        string    sqlstr2 = "delete from upImage where magazineId='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
        string    sqlstr3 = "select* from upImage where magazineId='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
        DataTable dt      = DBOper.execQueryBySQLText(sqlstr3);

        for (int k = 0; k < dt.Rows.Count; k++)
        {
            string path1 = dt.Rows[k]["savepath"].ToString();
            File.Delete(path1);
        }
        int i = DBOper.execNonQueryBySQLText(sqlstr2);

        i = DBOper.execNonQueryBySQLText(sqlstr1);
        if (DBOper.execNonQueryBySQLText(sqlstr) == 1)
        {
            BindData(searchCon());
        }
        else
        {
            ComTool.Alert("删除失败");
        }
        string dePath = "./image/" + j + "/";
        string path   = Server.MapPath(dePath);

        Directory.Delete(path);
    }
コード例 #2
0
ファイル: roomBook.cs プロジェクト: chenchenupc/TeamKProj
    public static DataTable selectDataTable1()
    {
        string    strSQL = "select* from roombook";
        DataTable dt     = DBOper.execQueryBySQLText(strSQL);

        return(dt);
    }
コード例 #3
0
    public static DataTable huiyishenqingqb(yuyuehuiyi hy)
    {
        string    str = "select * from shenqinghuiyi where 1=1 ";
        DataTable dt  = DBOper.execQueryBySQLText(str);

        return(dt);
    }
コード例 #4
0
ファイル: Manager.cs プロジェクト: chenchenupc/TeamMProj
    public static bool ifLogin(Manager obj)
    {
        bool blRet = true;

        string strSQL = "select * from tbmanager where managername='" + obj.managername + "' "
                        + " and managerpwd='" + obj.managerpwd + "'";
        DataTable dt = DBOper.execQueryBySQLText(strSQL);

        try
        {
            if (dt.Rows.Count > 0)
            {
                blRet = true;
            }
            else
            {
                blRet = false;
            }
        }
        catch
        {
            blRet = false;
        }
        return(blRet);
    }
コード例 #5
0
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DropDownList1.SelectedValue != "" && DropDownList2.SelectedValue == "")
     {
         DropDownList2.Items.Clear();
         ListItem item = new ListItem();
         item.Text  = "请选择";
         item.Value = "";
         DropDownList2.Items.Insert(0, item);
         DataTable dt = DBOper.execQueryBySQLText("Select * from article where magazineId='" + DropDownList1.SelectedValue + "'");
         DropDownList2.DataSource     = dt;
         DropDownList2.DataTextField  = "articleName";
         DropDownList2.DataValueField = "articleName";
         DropDownList2.DataBind();
     }
     //else
     //{
     //    DropDownList2.Items.Clear();
     //    ListItem item = new ListItem();
     //    item.Text = "请选择";
     //    item.Value = "";
     //    DropDownList2.Items.Insert(0, item);
     //    DataTable dt = DBOper.execQueryBySQLText("Select * from article");
     //    DropDownList2.DataSource = dt;
     //    DropDownList2.DataTextField = "articleName";
     //    DropDownList2.DataValueField = "articleName";
     //    DropDownList2.DataBind();
     //}
 }
コード例 #6
0
    private void binddata()
    {
        string    strSQL = "select * from 分组表";
        DataTable dt     = DBOper.execQueryBySQLText(strSQL);

        GVAdmin.DataSource = dt;
        GVAdmin.DataBind();
    }
コード例 #7
0
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        DataTable dt = DBOper.execQueryBySQLText("Select * from article where magazineId='" + DropDownList1.SelectedValue + "'");

        DropDownList2.DataSource     = dt;
        DropDownList2.DataTextField  = "articleName";
        DropDownList2.DataValueField = "articleName";
        DropDownList2.DataBind();
    }
コード例 #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataTable dt = DBOper.execQueryBySQLText("Select * from magazine");
         DropDownList1.DataSource    = dt;
         DropDownList1.DataTextField = "magazineId";
         DropDownList1.DataBind();
     }
 }
コード例 #9
0
ファイル: Users.cs プロジェクト: chenchenupc/TeamBProj
    public static DataTable selectDataTable(Users obj)
    {
        string strSQL = "select * from tbusers where 1=1 ";
        if (obj.username != "" && obj.username != null)
            strSQL = strSQL + "and username='******'";

        DataTable dt = DBOper.execQueryBySQLText(strSQL);

        return dt;
    }
コード例 #10
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string upPath = "./image/" + DropDownList1.SelectedValue + "/";  //上传文件路径
        //int upLength = 5;        //上传文件大小
        string upFileExtName = "|jpg|jpeg|";

        HttpFileCollection _files      = System.Web.HttpContext.Current.Request.Files;
        string             webFilePath = "";

        for (int i = 0; i < _files.Count; i++)
        {
            string name = _files[i].FileName;

            FileInfo fi = new FileInfo(name);

            string oldfilename = fi.Name;
            string scExtension = fi.Extension.ToLower();

            string fileName = TextBox3.Text + fi.Extension;  // 文件名称,当前时间(yyyyMMddhhmmssfff)
            webFilePath = Server.MapPath(upPath) + fileName; // 服务器端文件路径

            if (upFileExtName.IndexOf(scExtension.Replace(".", "")) == -1)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "upfileOK", "alert('提示:文件类型不符" + scExtension + "');", true);
                return;
            }

            //if ((fi.Length / (1024 * 1024)) > upLength)
            //{
            //    ClientScript.RegisterStartupScript(this.GetType(), "upfileOK", "alert('大小超出 " + upLength + " M的限制,请处理后再上传!');", true);
            //    return;
            //}

            try
            {
                _files[i].SaveAs(webFilePath);
                UpImage obj = new UpImage();
                obj.imageId    = DateTime.Now.ToString("yyyyMMddhhmmssfff");
                obj.savepath   = webFilePath;
                obj.magazineId = DropDownList1.SelectedValue;
                obj.sequence   = System.Int32.Parse(TextBox3.Text);
                obj.uptime     = DateTime.Now;
                string    strsql = "select * from article where articleName='" + DropDownList2.SelectedValue + "' and magazineId='" + DropDownList1.SelectedValue + "'";
                DataTable dt1    = DBOper.execQueryBySQLText(strsql);
                obj.articleId = dt1.Rows[0]["articleId"].ToString();
                obj.imageDesc = TextBox4.Text;
                UpImage.insertRecord(obj);
                ClientScript.RegisterStartupScript(this.GetType(), "upfileOK", "alert('提示:文件上传成功');", true);
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "upfileOK", "alert('提示:文件上传失败" + ex.Message + "');", true);
            }
        }
    }
コード例 #11
0
ファイル: roomBook.cs プロジェクト: chenchenupc/TeamKProj
    public static DataTable selectDataTable(roomBook obj)
    {
        string strSQL = "select roomid,roomnum from room where roomid in(select roomid from roombook where ( datediff(s,begintime, '" + obj.begintime + "' )<0)and(datediff(s,endtime,'" + obj.begintime + "')>0)and (datediff(s,begintime,'" + obj.endtime + "')<0) and (datediff(s,endtime,'" + obj.endtime + "')>0))";
        //string strSQL = "select * from room where roomid in (select)"
        //string strSQL = "select * from room where 1=1 ";
        //if (obj.begintime != "" && obj.username != null)
        //    strSQL = strSQL + "and ='" + obj.username + "'";
        //string strSQL = "select roomid,roomnum from room";
        DataTable dt = DBOper.execQueryBySQLText(strSQL);

        return(dt);
    }
コード例 #12
0
    public static DataTable selectdatatable(Equip e)
    {
        string str = "select * from equipment where 1=1 ";

        if (e.equipname != "" && e.equipname != null)
        {
            str = str + "and equipname='" + e.equipname + "'";
        }
        DataTable dt = DBOper.execQueryBySQLText(str);

        return(dt);
    }
コード例 #13
0
    protected void btncalculate_Click(object sender, EventArgs e)
    {
        float     Num, Num2, WeigTea, WeigStu;
        float     SUMScore, Number1, Number2;
        string    strCount = "select count(*) AS COUNT1 from 评分表 where ( 评分表.DID = (select 传值表.TransID from 传值表)) and (select 用户表.urid from 用户表 where 用户表.cid = 评分表.cid) = 1";
        DataTable DTC      = DBOper.execQueryBySQLText(strCount);

        if (DTC.Rows.Count > 0)
        {
            Num = float.Parse(DTC.Rows[0]["COUNT1"].ToString());
            string    strSti = "select SUM (Value1+Value2+Value3+Value4) AS SumScore1 from 评分表 where ( 评分表.DID = (select 传值表.TransID from 传值表)) and (select 用户表.urid from 用户表 where 用户表.cid = 评分表.cid) = 1";
            DataTable DTT    = DBOper.execQueryBySQLText(strSti);
            if (DTT.Rows.Count > 0)
            {
                Number1 = float.Parse(DTT.Rows[0]["SumScore1"].ToString()) / Num;
                txtScoreTeacher.Text = Number1.ToString();
                string    strCOUNT = "select count(*) AS COUNT2 from 评分表 where ( 评分表.DID = (select 传值表.TransID from 传值表)) and (select 用户表.urid from 用户表 where 用户表.cid = 评分表.cid) = 2";
                DataTable DTCS     = DBOper.execQueryBySQLText(strCOUNT);
                if (DTCS.Rows.Count > 0)
                {
                    Num2 = float.Parse(DTCS.Rows[0]["COUNT2"].ToString());
                    string    strStiSUM = "select SUM (Value1+Value2+Value3+Value4) AS SumScore2 from 评分表 where ( 评分表.DID = (select 传值表.TransID from 传值表)) and (select 用户表.urid from 用户表 where 用户表.cid = 评分表.cid) = 2";
                    DataTable DTTSUM    = DBOper.execQueryBySQLText(strStiSUM);
                    if (DTT.Rows.Count > 0)
                    {
                        Number2 = float.Parse(DTTSUM.Rows[0]["SumScore2"].ToString()) / Num2;
                        txtScoreStudent.Text = Number2.ToString();
                        string    sqlweight1 = "select UWeight from 用户权重表 where URID = 1";
                        DataTable DTW1       = DBOper.execQueryBySQLText(sqlweight1);
                        if (DTCS.Rows.Count > 0)
                        {
                            WeigTea = float.Parse(DTW1.Rows[0]["UWeight"].ToString());
                            string    sqlweight2 = "select UWeight from 用户权重表 where URID = 2";
                            DataTable DTW2       = DBOper.execQueryBySQLText(sqlweight2);
                            if (DTCS.Rows.Count > 0)
                            {
                                WeigStu              = float.Parse(DTW2.Rows[0]["UWeight"].ToString());
                                SUMScore             = Number1 * WeigTea + Number2 * WeigStu; //计算总成绩
                                txtSummaryScore.Text = SUMScore.ToString();
                                string    sqlsummary = "insert into 汇总表 (DID,SValue,TValue,SUValue) values('" + txtkong.Text + "','" + txtScoreStudent.Text + "','" + txtScoreTeacher.Text + "','" + txtSummaryScore.Text + "')";
                                DataTable DTSum      = DBOper.execQueryBySQLText(sqlsummary);
                                if (DTSum.Rows.Count > 0)
                                {
                                    ;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
コード例 #14
0
    public static DataTable selectDataTable(myUser obj)
    {
        string strSQL = "select * from myuser where 1=1 ";

        if (obj.username != "" && obj.username != null)
        {
            strSQL = strSQL + "and username='******'";
        }

        DataTable dt = DBOper.execQueryBySQLText(strSQL);

        return(dt);
    }
コード例 #15
0
    public static DataTable selectyuyueshijian(yuyuehuiyi hy)
    {
        string str = "select * from tbhuiyi where 1=1 ";

        if (hy.shijian != "" && hy.shijian != null)
        {
            str = str + "and shijian='" + hy.shijian + "'";
        }

        DataTable dt = DBOper.execQueryBySQLText(str);

        return(dt);
    }
コード例 #16
0
    public static DataTable selecthuiyi(huiyi hy)
    {
        string str = "select * from tbhuiyi where 1=1 ";

        if (hy.huiyiname != "" && hy.huiyiname != null)
        {
            str = str + "and huiyiname='" + hy.huiyiname + "'";
        }

        DataTable dt = DBOper.execQueryBySQLText(str);

        return(dt);
    }
コード例 #17
0
ファイル: Magazine.cs プロジェクト: chenchenupc/TeamEProj
    public static DataTable selectDataTable(Magazine obj)
    {
        string strSQL = "select * from magazine where 1=1 ";

        if (obj.magazineId != null && obj.magazineId != "")
        {
            strSQL = strSQL + "and magazineId='" + obj.magazineId + "'";
        }

        DataTable dt = DBOper.execQueryBySQLText(strSQL);

        return(dt);
    }
コード例 #18
0
    public static DataTable selectshenhe(yuyuehuiyi hy)
    {
        string str = "select * from shenqinghuiyi where 1=1 ";

        if (hy.shenhe != "" && hy.shenhe != null)
        {
            str = str + "and shenhe='" + hy.shenhe + "'";
        }

        DataTable dt = DBOper.execQueryBySQLText(str);

        return(dt);
    }
コード例 #19
0
    public static DataTable selectDataTable(Admin obj)
    {
        string strSQL = "select * from admin where 1=1 ";

        if (obj.adminname != "" && obj.adminname != null)
        {
            strSQL = strSQL + "and adminname='" + obj.adminname + "'";
        }

        DataTable dt = DBOper.execQueryBySQLText(strSQL);

        return(dt);
    }
コード例 #20
0
ファイル: main.aspx.cs プロジェクト: chenchenupc/TeamEProj
    public string createHtml()
    {
        string    sqlstr  = "select * from magazine";
        DataTable dt      = DBOper.execQueryBySQLText(sqlstr);
        int       magNum  = dt.Rows.Count;
        string    htmlStr = "";

        for (int i = 1; i <= magNum; i++)
        {
            string str = "<li><a href=\"showmagazine.aspx?magid=" + i.ToString() + "\" target=\"_blank\">第" + i.ToString() + "期</a></li>";
            htmlStr += str;
        }
        return(htmlStr);
    }
コード例 #21
0
ファイル: search.aspx.cs プロジェクト: chenchenupc/TeamEProj
    private DataTable searchCon()
    {
        string    strsqlarticle = "select * from article where author='" + TextBox1.Text + "'";
        DataTable dt            = new DataTable();
        DataTable dtarticle     = DBOper.execQueryBySQLText(strsqlarticle);

        for (int i = 0; i < dtarticle.Rows.Count; i++)
        {
            string    strsqlpicture = "select * from upImage where articleId='" + dtarticle.Rows[i]["articleId"] + "'";
            DataTable dtupImage     = DBOper.execQueryBySQLText(strsqlpicture);
            dt.Merge(dtupImage);
        }
        return(dt);
    }
コード例 #22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        String Transport2 = Request.Params.Get("B");

        txtGROUP.Text = Transport2;
        string    sqljud = "select count (*) AS JUD1 from 用户表 where URID= 1 or URID=2";
        DataTable DT1    = DBOper.execQueryBySQLText(sqljud);

        txtCIDcoun.Text = DT1.Rows[0]["JUD1"].ToString();

        string    sqljud2 = "select count (*) AS JUD2 from 评分表 where 评分表.DID =" + Transport2;
        DataTable DT2     = DBOper.execQueryBySQLText(sqljud2);

        txtsubcoun.Text = DT2.Rows[0]["JUD2"].ToString();
    }
コード例 #23
0
    public string createHtmlStr()
    {
        string    magId   = Request.QueryString["magid"].ToString();
        string    sqlstr  = "select * from upImage where magazineId ='" + magId + "' order by sequence asc";
        DataTable dt      = DBOper.execQueryBySQLText(sqlstr);
        int       pageNum = dt.Rows.Count;
        string    htmlStr = "";

        for (int i = 1; i <= pageNum; i++)
        {
            string str = "<div class=\"page\" style=\"background-image:url(./image/" + magId + "/" + i + ".jpg)\"></div>";
            htmlStr += str;
        }
        return(htmlStr);
    }
コード例 #24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BindData(searchCon());
         DataTable dt = DBOper.execQueryBySQLText("Select * from magazine");
         DropDownList1.DataSource     = dt;
         DropDownList1.DataTextField  = "magazineId";
         DropDownList1.DataValueField = "magazineId";
         DropDownList1.DataBind();
         dt = DBOper.execQueryBySQLText("Select * from article");
         DropDownList2.DataSource     = dt;
         DropDownList2.DataTextField  = "articleName";
         DropDownList2.DataValueField = "articleName";
         DropDownList2.DataBind();
     }
 }
コード例 #25
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string    str  = "delete from upImage where imageId='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
        string    str1 = "select * from upImage where imageId='" + GridView1.DataKeys[e.RowIndex].Value.ToString() + "'";
        DataTable dt   = DBOper.execQueryBySQLText(str1);
        string    path = dt.Rows[0]["savepath"].ToString();

        if (DBOper.execNonQueryBySQLText(str) == 1)
        {
            BindData(searchCon());
        }
        else
        {
            ComTool.Alert("删除失败");
        }
        File.Delete(path);
    }
コード例 #26
0
ファイル: Score.aspx.cs プロジェクト: chenchenupc/TeamBProj
    protected void btnlook_Click(object sender, EventArgs e)
    {
        string    sqllookupT = "select TValue from 汇总表";
        DataTable DTC        = DBOper.execQueryBySQLText(sqllookupT);

        if (DTC.Rows.Count > 0)
        {
            txtteacher.Text = DTC.Rows[0]["TValue"].ToString();
        }
        string    sqllookupS = "select SValue from 汇总表";
        DataTable DSUC       = DBOper.execQueryBySQLText(sqllookupS);

        if (DSUC.Rows.Count > 0)
        {
            txtstudent.Text = DSUC.Rows[0]["SValue"].ToString();
        }
        ComTool.Alert("第" + txtgroup.Text + "组的教师评委评分为:" + txtteacher.Text + "第" + txtgroup.Text + "组的学生评委评分为:" + txtstudent.Text);
    }
コード例 #27
0
    private UpImage searchCon()
    {
        UpImage obj = new UpImage();

        obj.magazineId = DropDownList1.SelectedValue;
        if (DropDownList2.SelectedValue != "")
        {
            string    strSQL = "select * from article where articleName='" + DropDownList2.SelectedValue + "'";
            DataTable dt     = DBOper.execQueryBySQLText(strSQL);
            obj.articleId = dt.Rows[0]["articleId"].ToString();
        }
        else
        {
            obj.articleId = "";
        }

        return(obj);
    }
コード例 #28
0
ファイル: Score.aspx.cs プロジェクト: chenchenupc/TeamBProj
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //if (txtgroup.Text == "0")
            //{
            //    submit1.Enabled = false;
            //    submit2.Enabled = true;
            //}

            //string strID="";
            //try
            //{
            //    strID = Request.QueryString["id"].ToString();
            //    txtgroup.Text = strID;
            //}
            //catch
            //{

            //}
            String Transport = Request.Params.Get("A");
            txtCNO.Text = Transport;                    //获取参数传值
            string    strSQL = "select TransID from 传值表";
            DataTable DDT    = DBOper.execQueryBySQLText(strSQL);
            if (DDT.Rows.Count > 0)
            {
                txtgroup.Text = DDT.Rows[0]["TransID"].ToString();
            }
            submit2.Enabled = false;
            if (txtgroup.Text == "0")
            {
                btnlook.Enabled       = false;
                btnScoreAgain.Enabled = false;
                submit1.Enabled       = false;
                submit2.Enabled       = true;
            }
            string    strsql = "select TransProName from 传值表";
            DataTable DTT    = DBOper.execQueryBySQLText(strsql);
            if (DTT.Rows.Count > 0)
            {
                txtPjName.Text = DTT.Rows[0]["TransProName"].ToString();
            }
        }
    }
コード例 #29
0
ファイル: Score.aspx.cs プロジェクト: chenchenupc/TeamBProj
    protected void btnScoreAgain_Click(object sender, EventArgs e)
    {
        string    STRC   = "";
        string    strSQL = "select TransID from 传值表";
        DataTable DDT    = DBOper.execQueryBySQLText(strSQL);

        if (DDT.Rows.Count > 0)
        {
            STRC = DDT.Rows[0]["TransID"].ToString();
        }
        if (STRC == txtgroup.Text)
        {
            ComTool.Alert("尚未创建新组,请稍后!");
        }
        else
        {
            ComTool.Redirect("Score.aspx?A=" + txtCNO.Text);
        }
    }
コード例 #30
0
    public static DataTable selectcondition(Equip e)
    {
        string str = "select * from equipment where 1=1 ";

        if (e.equipname != "" && e.equipname != null)
        {
            str = str + "and equipname='" + e.equipname + "'";
        }
        if (e.status != "" && e.status != null)
        {
            str = str + "and status='" + e.status + "'";
        }
        if (e.location != "" && e.location != null)
        {
            str = str + "and location='" + e.location + "'";
        }
        DataTable dt = DBOper.execQueryBySQLText(str);

        return(dt);
    }