protected void Page_Load(object sender, EventArgs e) { // 进行安全检查 if (Session["yonghuming"] == null) { Response.Redirect("../default.aspx"); } if (Session["xiangmuhao"] == null) { Response.Redirect("../login.aspx"); } security sc = new security(); int xx = sc.flag(Session["yonghuming"].ToString(), Request.UserHostAddress.ToString()); if (xx == 1) { Response.Redirect("../alert.aspx"); } // 建立连接 string connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnection conn = new SqlConnection(connStr); conn.Open(); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT username,name,money,spent,company,email FROM pro" + Session["xiangmuhao"].ToString(); codemaker maker = new codemaker(); SqlDataReader dr = cmd.ExecuteReader(); dr.Close(); // 填充任务下拉菜单及任务数量 cmd.CommandText = "SELECT name,number FROM task WHERE projectno = '" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); int num = 0; while (dr.Read()) { renwu = renwu + maker.progress(dr[1].ToString().Trim(), dr[0].ToString().Trim()); num = num + 1; } tempnum = num.ToString(); if (num == 0) { tempnum1 = ""; } else { tempnum1 = tempnum; } dr.Close(); // 填充成员信息 cmd.CommandText = "SELECT username,name,money,spent,company,email FROM pro" + Session["xiangmuhao"].ToString(); maker = new codemaker(); dr = cmd.ExecuteReader(); SqlCommand tmpcmd = new SqlCommand(); SqlConnection conn1 = new SqlConnection(connStr); conn1.Open(); tmpcmd.Connection = conn1; while (dr.Read()) { string spent; string totalmoney; string username = dr[0].ToString().Trim(); tmpcmd.CommandText = "SELECT SUM(ALL money) as tomoney FROM moneyrecord WHERE name='" + dr[1].ToString().Trim() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; SqlDataReader moneyReader = tmpcmd.ExecuteReader(); moneyReader.Read(); if (moneyReader[0].ToString().Trim() != "") { spent = moneyReader[0].ToString().Trim(); } else { spent = "0"; } moneyReader.Close(); tmpcmd.CommandText = "SELECT SUM(ALL money) as tomoney FROM bonus WHERE name='" + dr[1].ToString().Trim() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; SqlDataReader moneyReader1 = tmpcmd.ExecuteReader(); moneyReader1.Read(); if (moneyReader1[0].ToString().Trim() != "") { totalmoney = moneyReader1[0].ToString().Trim(); } else { totalmoney = "0"; } moneyReader1.Close(); if (Session["yonghuming"].ToString() == dr[0].ToString() || Session["yonghuming"].ToString() == Session["guanliyuan"].ToString()) { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), totalmoney, spent, dr[4].ToString().Trim(), dr[5].ToString().Trim(), true); } else { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), totalmoney, spent, dr[4].ToString().Trim(), dr[5].ToString().Trim(), false); } } dr.Close(); conn1.Close(); conn1.Dispose(); // 填充私信下拉菜单 string guanliyuan; cmd.CommandText = "SELECT name FROM main WHERE username = '******'"; dr = cmd.ExecuteReader(); dr.Read(); guanliyuan = dr[0].ToString().Trim(); dr.Close(); cmd.CommandText = "SELECT dateandtime,senduser,message FROM webchat WHERE receiveuser ='******' and flag='否'"; dr = cmd.ExecuteReader(); num = 0; while (dr.Read()) { webchat = webchat + maker.webchat(dr[1].ToString().Trim(), guanliyuan, dr[0].ToString().Trim(), dr[2].ToString().Trim()); num++; } chatnum = num.ToString(); if (num == 0) { chatnum1 = ""; } else { chatnum1 = chatnum; } dr.Close(); // 填充周次下拉菜单 /* * int total; * * cmd.CommandText = "SELECT weeknum FROM weekreport WHERE projectno = '" + Session["xiangmuhao"].ToString() + "' and" + " username='******' ORDER BY weeknum DESC"; + dr = cmd.ExecuteReader(); + + if(dr.Read()) + { + total = Convert.ToInt16(dr[0].ToString().Trim()) + 1; + } + else + { + total = 1; + } + + dr.Close(); + + for(int i=0;i<=5;i++,total++) + { + ListItem li = new ListItem(); + li.Text = total.ToString(); + li.Value = total.ToString(); + this.shangchuanuser.Items.Add(li); + } * */ if (!IsPostBack) { // 填充周报告姓名下拉菜单 cmd.CommandText = "SELECT name FROM pro" + Session["xiangmuhao"].ToString(); dr = cmd.ExecuteReader(); this.renming.DataSource = dr; this.renming.DataTextField = "name"; this.renming.DataValueField = "name"; this.renming.DataBind(); dr.Close(); // 填充周次下拉菜单 cmd.CommandText = "SELECT start FROM project WHERE username='******'"; dr = cmd.ExecuteReader(); int jiange = 1; DateTime chushi = DateTime.Now; if (dr.Read()) { string[] items = dr[0].ToString().Trim().Split('/'); chushi = new DateTime(Convert.ToInt16(items[2]), Convert.ToInt16(items[0]), Convert.ToInt16(items[1])); } TimeSpan ts = DateTime.Now.Subtract(chushi); jiange = (int)ts.TotalDays / 7 + 1; ListItem li = new ListItem(); li.Text = jiange.ToString(); li.Value = jiange.ToString(); this.shangchuanuser.Items.Add(li); for (int i = 1; i < jiange + 1; i++) { ListItem li1 = new ListItem(); li1.Text = i.ToString(); li1.Value = i.ToString(); this.zhoucixiala.Items.Add(li1); } dr.Close(); } // 填充周报告表格 if (Session["yonghuming"].ToString() == Session["guanliyuan"].ToString()) // 如果本人即管理员,则可以看到所有人的周报告 { cmd.CommandText = "SELECT weeknum,name,proname,filename,dateandtime,checked FROM weekreport WHERE projectno ='" + Session["xiangmuhao"].ToString() + "' and weeknum=" + this.shangchuanuser.SelectedItem.Text + " ORDER BY weeknum"; dr = cmd.ExecuteReader(); while (dr.Read()) { zhoubaogao = zhoubaogao + maker.weekreport(dr[0].ToString().Trim(), dr[1].ToString().Trim(), dr[2].ToString().Trim(), dr[3].ToString().Trim(), dr[4].ToString().Trim(), dr[5].ToString().Trim()); } dr.Close(); } else // 否则只能看到本人的周报告 { cmd.CommandText = "SELECT weeknum,name,proname,filename,dateandtime,checked FROM weekreport WHERE projectno ='" + Session["xiangmuhao"].ToString() + "' and username='******' and weeknum='" + this.shangchuanuser.SelectedItem.Text + "' ORDER BY weeknum"; dr = cmd.ExecuteReader(); while (dr.Read()) { zhoubaogao = zhoubaogao + maker.weekreport(dr[0].ToString().Trim(), dr[1].ToString().Trim(), dr[2].ToString().Trim(), dr[3].ToString().Trim(), dr[4].ToString().Trim(), dr[5].ToString().Trim()); } dr.Close(); } // 填充往期周报告表格 string comm; if (this.zhouciorrenming.Checked) { comm = " and weeknum='" + this.zhoucixiala.SelectedItem.Text + "'"; } else { comm = " and name='" + this.renming.SelectedItem.Text + "'"; } if (Session["yonghuming"].ToString() == Session["guanliyuan"].ToString()) // 如果本人即管理员,则可以看到所有人的周报告 { cmd.CommandText = "SELECT weeknum,name,proname,filename,dateandtime,checked FROM weekreport WHERE projectno ='" + Session["xiangmuhao"].ToString() + "'" + comm + " ORDER BY weeknum"; dr = cmd.ExecuteReader(); while (dr.Read()) { wangqizhoubaogao = wangqizhoubaogao + maker.weekreport(dr[0].ToString().Trim(), dr[1].ToString().Trim(), dr[2].ToString().Trim(), dr[3].ToString().Trim(), dr[4].ToString().Trim(), dr[5].ToString().Trim()); } dr.Close(); } else // 否则只能看到本人的周报告 { cmd.CommandText = "SELECT weeknum,name,proname,filename,dateandtime,checked FROM weekreport WHERE projectno ='" + Session["xiangmuhao"].ToString() + "' and username='******' ORDER BY weeknum"; dr = cmd.ExecuteReader(); while (dr.Read()) { wangqizhoubaogao = wangqizhoubaogao + maker.weekreport(dr[0].ToString().Trim(), dr[1].ToString().Trim(), dr[2].ToString().Trim(), dr[3].ToString().Trim(), dr[4].ToString().Trim(), dr[5].ToString().Trim()); } dr.Close(); } } catch (Exception ex) { conn.Close(); conn.Dispose(); Response.Write("<script>alert(\"" + ex.Message + "\")</script>"); } finally { conn.Close(); conn.Dispose(); } }
protected void Page_Load(object sender, EventArgs e) { // 进行安全检查 if (Session["yonghuming"] == null) { Response.Redirect("../default.aspx"); } if (Session["xiangmuhao"] == null) { Response.Redirect("../login.aspx"); } security sc = new security(); int xx = sc.flag(Session["yonghuming"].ToString(), Request.UserHostAddress.ToString()); if (xx == 1) { Response.Redirect("../alert.aspx"); } // 建立连接 string connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnection conn = new SqlConnection(connStr); conn.Open(); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT username,name,money,spent,company,email FROM pro" + Session["xiangmuhao"].ToString(); codemaker maker = new codemaker(); SqlDataReader dr = cmd.ExecuteReader(); dr.Close(); // 填充任务下拉菜单及任务数量 cmd.CommandText = "SELECT name,number FROM task WHERE projectno = '" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); int num = 0; while (dr.Read()) { renwu = renwu + maker.progress(dr[1].ToString().Trim(), dr[0].ToString().Trim()); num = num + 1; } tempnum = num.ToString(); if (num == 0) { tempnum1 = ""; } else { tempnum1 = tempnum; } dr.Close(); // 填充私信下拉菜单 string guanliyuan; cmd.CommandText = "SELECT name FROM main WHERE username = '******'"; dr = cmd.ExecuteReader(); dr.Read(); guanliyuan = dr[0].ToString().Trim(); dr.Close(); cmd.CommandText = "SELECT dateandtime,senduser,message FROM webchat WHERE receiveuser ='******' and flag='否'"; dr = cmd.ExecuteReader(); num = 0; while (dr.Read()) { webchat = webchat + maker.webchat(dr[1].ToString().Trim(), guanliyuan, dr[0].ToString().Trim(), dr[2].ToString().Trim()); num++; } chatnum = num.ToString(); if (num == 0) { chatnum1 = ""; } else { chatnum1 = chatnum; } dr.Close(); // 填充成员信息 cmd.CommandText = "SELECT username,name,money,spent,company,email FROM pro" + Session["xiangmuhao"].ToString(); maker = new codemaker(); dr = cmd.ExecuteReader(); SqlCommand tmpcmd = new SqlCommand(); SqlConnection conn1 = new SqlConnection(connStr); conn1.Open(); tmpcmd.Connection = conn1; while (dr.Read()) { string spent; string totalmoney; string username = dr[0].ToString().Trim(); tmpcmd.CommandText = "SELECT SUM(ALL money) as tomoney FROM moneyrecord WHERE name='" + dr[1].ToString().Trim() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; SqlDataReader moneyReader = tmpcmd.ExecuteReader(); moneyReader.Read(); if (moneyReader[0].ToString().Trim() != "") { spent = moneyReader[0].ToString().Trim(); } else { spent = "0"; } moneyReader.Close(); tmpcmd.CommandText = "SELECT SUM(ALL money) as tomoney FROM bonus WHERE name='" + dr[1].ToString().Trim() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; SqlDataReader moneyReader1 = tmpcmd.ExecuteReader(); moneyReader1.Read(); if (moneyReader1[0].ToString().Trim() != "") { totalmoney = moneyReader1[0].ToString().Trim(); } else { totalmoney = "0"; } moneyReader1.Close(); if (Session["yonghuming"].ToString() == dr[0].ToString() || Session["yonghuming"].ToString() == Session["guanliyuan"].ToString()) { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), totalmoney, spent, dr[4].ToString().Trim(), dr[5].ToString().Trim(), true); } else { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), totalmoney, spent, dr[4].ToString().Trim(), dr[5].ToString().Trim(), false); } } dr.Close(); conn1.Close(); conn1.Dispose(); // 填充截图类别下拉菜单 if (!IsPostBack) { cmd.CommandText = "SELECT type FROM gallery WHERE projectno = '" + Session["xiangmuhao"].ToString() + "' GROUP BY type"; dr = cmd.ExecuteReader(); this.ruanjianjietu.DataSource = dr; this.ruanjianjietu.DataTextField = "type"; this.ruanjianjietu.DataValueField = "type"; this.ruanjianjietu.DataBind(); dr.Close(); ListItem li = new ListItem(); li.Text = "添加新类别"; li.Value = "添加新类别"; this.ruanjianjietu.Items.Add(li); } // 填充控制中心数量提醒 cmd.CommandText = "SELECT COUNT(*) FROM files WHERE projectno='" + Session["xiangmuhao"].ToString() + "' and checked='否'"; dr = cmd.ExecuteReader(); int total = 0; if (dr.Read()) { total = Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM weekreport WHERE projectno='" + Session["xiangmuhao"].ToString() + "' and checked = '否'"; dr = cmd.ExecuteReader(); if (dr.Read()) { total = total + Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM applies WHERE prono='" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); if (dr.Read()) { total = total + Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); if (total != 0) { tixing = "<span class=\"badge pull-right\">" + total.ToString() + "</span>"; } } catch { conn.Close(); conn.Dispose(); } finally { conn.Close(); conn.Dispose(); } }
protected void Page_Load(object sender, EventArgs e) { // 进行安全检查 if (Session["yonghuming"] == null) { Response.Redirect("../default.aspx"); } if (Session["xiangmuhao"] == null) { Response.Redirect("../login.aspx"); } security sc = new security(); int xx = sc.flag(Session["yonghuming"].ToString(), Request.UserHostAddress.ToString()); if (xx == 1) { Response.Redirect("../alert.aspx"); } // 建立连接 string connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnection conn = new SqlConnection(connStr); conn.Open(); try { // 填充成员信息 SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT username,name,money,spent,company,email FROM pro" + Session["xiangmuhao"].ToString(); codemaker maker = new codemaker(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { if (Session["yonghuming"].ToString() == dr[0].ToString() || Session["yonghuming"].ToString() == Session["guanliyuan"].ToString()) { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), dr[2].ToString().Trim(), dr[3].ToString().Trim(), dr[4].ToString().Trim(), dr[5].ToString().Trim(), true); } else { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), dr[2].ToString().Trim(), dr[3].ToString().Trim(), dr[4].ToString().Trim(), dr[5].ToString().Trim(), false); } } dr.Close(); // 填充任务下拉菜单及任务数量 cmd.CommandText = "SELECT name,number FROM task WHERE projectno = '" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); int num = 0; while (dr.Read()) { renwu = renwu + maker.progress(dr[1].ToString().Trim(), dr[0].ToString().Trim()); num = num + 1; } tempnum = num.ToString(); if (num == 0) { tempnum1 = ""; } else { tempnum1 = tempnum; } dr.Close(); // 填充私信下拉菜单 string guanliyuan; cmd.CommandText = "SELECT name FROM main WHERE username = '******'"; dr = cmd.ExecuteReader(); dr.Read(); guanliyuan = dr[0].ToString().Trim(); dr.Close(); cmd.CommandText = "SELECT dateandtime,senduser,message FROM webchat WHERE receiveuser ='******' and flag='否'"; dr = cmd.ExecuteReader(); num = 0; while (dr.Read()) { webchat = webchat + maker.webchat(dr[1].ToString().Trim(), guanliyuan, dr[0].ToString().Trim(), dr[2].ToString().Trim()); num++; } chatnum = num.ToString(); if (num == 0) { chatnum1 = ""; } else { chatnum1 = chatnum; } dr.Close(); // 填充正文图片部分 cmd.CommandText = "SELECT title,type,filename FROM gallery WHERE projectno='" + Session["xiangmuhao"].ToString() + "' ORDER BY type"; dr = cmd.ExecuteReader(); int cirnum = 0; string temp = ""; while (dr.Read()) { if (temp != dr[1].ToString()) { cirnum++; temp = dr[1].ToString().Trim(); } gallerycontent = gallerycontent + maker.gallerycontent(dr[1].ToString(), dr[0].ToString(), dr[2].ToString(), cirnum); } dr.Close(); cmd.CommandText = "SELECT type FROM gallery WHERE projectno='" + Session["xiangmuhao"].ToString() + "' GROUP BY type"; dr = cmd.ExecuteReader(); int cir = 1; while (dr.Read()) { gallerytitle = gallerytitle + maker.gallerytitle(dr[0].ToString().Trim(), cir); galleryoption = galleryoption + maker.galleryoption(dr[0].ToString().Trim(), cir); cir++; } dr.Close(); // 填充控制中心数量提醒 cmd.CommandText = "SELECT COUNT(*) FROM files WHERE projectno='" + Session["xiangmuhao"].ToString() + "' and checked='否'"; dr = cmd.ExecuteReader(); int total = 0; if (dr.Read()) { total = Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM applies WHERE prono='" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); if (dr.Read()) { total = total + Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM weekreport WHERE projectno='" + Session["xiangmuhao"].ToString() + "' and checked = '否'"; dr = cmd.ExecuteReader(); if (dr.Read()) { total = total + Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); if (total != 0) { tixing = "<span class=\"badge pull-right\">" + total.ToString() + "</span>"; } } catch { conn.Close(); conn.Dispose(); } finally { conn.Close(); conn.Dispose(); } }
protected void Page_Load(object sender, EventArgs e) { // 进行安全检查 if (Session["yonghuming"] == null) { Response.Redirect("../default.aspx"); } if (Session["xiangmuhao"] == null) { Response.Redirect("../login.aspx"); } security sc = new security(); int xx = sc.flag(Session["yonghuming"].ToString(), Request.UserHostAddress.ToString()); if (xx == 1) { Response.Redirect("../alert.aspx"); } // 建立连接 string connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnection conn = new SqlConnection(connStr); conn.Open(); codemaker maker = new codemaker(); try { // 填充期刊论文 SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT filename,type,info,username,name,dateandtime FROM files WHERE projectno='" + Session["xiangmuhao"].ToString() + "' and checked = '是' ORDER BY dateandtime DESC,username"; SqlDataReader dr = cmd.ExecuteReader(); int qikan = 1; int huiyi = 1; int shenqingzhl = 1; int shouquanzhl = 1; int qt = 1; while (dr.Read()) { string name; if (dr[3].ToString().Trim() == "System") { name = "系统"; } else { name = dr[4].ToString().Trim(); } if (Session["yonghuming"].ToString() == Session["guanliyuan"].ToString()) { if (dr[1].ToString().Trim() == "期刊论文") { qklw = qklw + maker.qklw(qikan.ToString(), dr[2].ToString().Trim(), dr[0].ToString().Trim(), name, dr[5].ToString().Trim()); qikan++; } else if (dr[1].ToString().Trim() == "会议论文") { hylw = hylw + maker.qklw(huiyi.ToString(), dr[2].ToString().Trim(), dr[0].ToString().Trim(), name, dr[5].ToString().Trim()); huiyi++; } else if (dr[1].ToString().Trim() == "授权专利") { shouquan = shouquan + maker.qklw(shouquanzhl.ToString(), dr[2].ToString().Trim(), dr[0].ToString().Trim(), name, dr[5].ToString().Trim()); shouquanzhl++; } else if (dr[1].ToString().Trim() == "申请专利") { shenqing = shenqing + maker.qklw(shenqingzhl.ToString(), dr[2].ToString().Trim(), dr[0].ToString().Trim(), name, dr[5].ToString().Trim()); shenqingzhl++; } else { qita = qita + maker.qklw(qt.ToString(), dr[2].ToString().Trim(), dr[0].ToString().Trim(), name, dr[5].ToString().Trim()); qt++; } } else { if (dr[1].ToString().Trim() == "期刊论文") { qklw = qklw + maker.qklwpt(qikan.ToString(), dr[2].ToString().Trim(), dr[0].ToString().Trim(), name, dr[5].ToString().Trim()); qikan++; } else if (dr[1].ToString().Trim() == "会议论文") { hylw = hylw + maker.qklwpt(huiyi.ToString(), dr[2].ToString().Trim(), dr[0].ToString().Trim(), name, dr[5].ToString().Trim()); huiyi++; } else if (dr[1].ToString().Trim() == "授权专利") { shouquan = shouquan + maker.qklwpt(shouquanzhl.ToString(), dr[2].ToString().Trim(), dr[0].ToString().Trim(), name, dr[5].ToString().Trim()); shouquanzhl++; } else if (dr[1].ToString().Trim() == "申请专利") { shenqing = shenqing + maker.qklwpt(shenqingzhl.ToString(), dr[2].ToString().Trim(), dr[0].ToString().Trim(), name, dr[5].ToString().Trim()); shenqingzhl++; } else { qita = qita + maker.qklwpt(qt.ToString(), dr[2].ToString().Trim(), dr[0].ToString().Trim(), name, dr[5].ToString().Trim()); qt++; } } } dr.Close(); // 填充成员信息 cmd.CommandText = "SELECT username,name,money,spent,company,email FROM pro" + Session["xiangmuhao"].ToString(); maker = new codemaker(); dr = cmd.ExecuteReader(); SqlCommand tmpcmd = new SqlCommand(); SqlConnection conn1 = new SqlConnection(connStr); conn1.Open(); tmpcmd.Connection = conn1; while (dr.Read()) { string spent; string totalmoney; string username = dr[0].ToString().Trim(); tmpcmd.CommandText = "SELECT SUM(ALL money) as tomoney FROM moneyrecord WHERE name='" + dr[1].ToString().Trim() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; SqlDataReader moneyReader = tmpcmd.ExecuteReader(); moneyReader.Read(); if (moneyReader[0].ToString().Trim() != "") { spent = moneyReader[0].ToString().Trim(); } else { spent = "0"; } moneyReader.Close(); tmpcmd.CommandText = "SELECT SUM(ALL money) as tomoney FROM bonus WHERE name='" + dr[1].ToString().Trim() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; SqlDataReader moneyReader1 = tmpcmd.ExecuteReader(); moneyReader1.Read(); if (moneyReader1[0].ToString().Trim() != "") { totalmoney = moneyReader1[0].ToString().Trim(); } else { totalmoney = "0"; } moneyReader1.Close(); if (Session["yonghuming"].ToString() == dr[0].ToString() || Session["yonghuming"].ToString() == Session["guanliyuan"].ToString()) { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), totalmoney, spent, dr[4].ToString().Trim(), dr[5].ToString().Trim(), true); } else { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), totalmoney, spent, dr[4].ToString().Trim(), dr[5].ToString().Trim(), false); } } dr.Close(); conn1.Close(); conn1.Dispose(); // 填充私信下拉菜单 string guanliyuan; cmd.CommandText = "SELECT name FROM main WHERE username = '******'"; dr = cmd.ExecuteReader(); dr.Read(); guanliyuan = dr[0].ToString().Trim(); dr.Close(); cmd.CommandText = "SELECT dateandtime,senduser,message FROM webchat WHERE receiveuser ='******' and flag='否'"; dr = cmd.ExecuteReader(); int num = 0; while (dr.Read()) { webchat = webchat + maker.webchat(dr[1].ToString().Trim(), guanliyuan, dr[0].ToString().Trim(), dr[2].ToString().Trim()); num++; } chatnum = num.ToString(); if (num == 0) { chatnum1 = ""; } else { chatnum1 = chatnum; } dr.Close(); // 填充任务下拉菜单及任务数量 cmd.CommandText = "SELECT name,number FROM task WHERE projectno = '" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); num = 0; while (dr.Read()) { renwu = renwu + maker.progress(dr[1].ToString().Trim(), dr[0].ToString().Trim()); num = num + 1; } tempnum = num.ToString(); if (num == 0) { tempnum1 = ""; } else { tempnum1 = tempnum; } dr.Close(); // 填充控制中心数量提醒 cmd.CommandText = "SELECT COUNT(*) FROM files WHERE projectno='" + Session["xiangmuhao"].ToString() + "' and checked='否'"; dr = cmd.ExecuteReader(); int total = 0; if (dr.Read()) { total = Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM applies WHERE prono='" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); if (dr.Read()) { total = total + Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM weekreport WHERE projectno='" + Session["xiangmuhao"].ToString() + "' and checked = '否'"; dr = cmd.ExecuteReader(); if (dr.Read()) { total = total + Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); if (total != 0) { tixing = "<span class=\"badge pull-right\">" + total.ToString() + "</span>"; } } catch (Exception ex) { Response.Write("<script>alert(\"" + ex.Message + "\")</script>"); conn.Close(); conn.Dispose(); } finally { conn.Close(); conn.Dispose(); } }
protected void Page_Load(object sender, EventArgs e) { // 进行安全检查 if (Session["yonghuming"] == null) { Response.Redirect("../default.aspx"); } if (Session["xiangmuhao"] == null) { Response.Redirect("../login.aspx"); } security sc = new security(); int xx = sc.flag(Session["yonghuming"].ToString(), Request.UserHostAddress.ToString()); if (xx == 1) { Response.Redirect("../alert.aspx"); } // 建立连接 string connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnection conn = new SqlConnection(connStr); conn.Open(); //try { // 获取登录用户的IP地址并写入数据库 SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT * FROM pro" + Session["xiangmuhao"].ToString() + " WHERE username = '******'"; SqlDataReader dr = cmd.ExecuteReader(); if (!dr.Read()) { dr.Close(); Response.Redirect("temp.aspx"); // 如果查询不到结果,说明该成员尚未加入项目,跳转至提示页面 } string ipdizhi; ipdizhi = Request.UserHostAddress.ToString(); dr.Close(); IPSearch.IPLocation wulidizhi; if (ipdizhi != "::1") { IPSearch ips = new IPSearch(); wulidizhi = ips.GetIPLocation(ipdizhi); } else { ipdizhi = "127.0.0.1"; wulidizhi.country = "维护地址"; wulidizhi.area = "主机"; } cmd.CommandText = "INSERT INTO records VALUES('" + Session["yonghuming"].ToString() + "','" + Session["xingming"].ToString() + "','" + DateTime.Now.ToString("MM-dd") + "','" + DateTime.Now.ToLongTimeString().ToString() + "','" + ipdizhi + "','" + Session["xiangmuhao"].ToString() + "','" + wulidizhi.country + wulidizhi.area + "')"; cmd.ExecuteNonQuery(); dr.Close(); // 关闭读取器,以便之后的代码可以调用该读取器 // 绘制项目成果汇总图 string[] name = new string[5] { "期刊论文", "会议论文", "申请专利", "授权专利", "其它" }; string[] number = new string[5]; /* * 以下过程可以循环使用 */ cmd.CommandText = "SELECT COUNT(*) FROM files WHERE projectno = '" + Session["xiangmuhao"].ToString() + "' and type='期刊论文' and checked='是'"; dr = cmd.ExecuteReader(); if (dr.Read()) { number[0] = dr[0].ToString().Trim(); } else { number[0] = "0"; } dr.Close(); /* * 以下过程可以循环使用 */ cmd.CommandText = "SELECT COUNT(*) FROM files WHERE projectno = '" + Session["xiangmuhao"].ToString() + "' and type='会议论文' and checked='是'"; dr = cmd.ExecuteReader(); if (dr.Read()) { number[1] = dr[0].ToString().Trim(); } else { number[1] = "0"; } dr.Close(); /* * 以下过程可以循环使用 */ cmd.CommandText = "SELECT COUNT(*) FROM files WHERE projectno = '" + Session["xiangmuhao"].ToString() + "' and type='申请专利' and checked='是'"; dr = cmd.ExecuteReader(); if (dr.Read()) { number[2] = dr[0].ToString().Trim(); } else { number[2] = "0"; } dr.Close(); /* * 以下过程可以循环使用 */ cmd.CommandText = "SELECT COUNT(*) FROM files WHERE projectno = '" + Session["xiangmuhao"].ToString() + "' and type='授权专利' and checked='是'"; dr = cmd.ExecuteReader(); if (dr.Read()) { number[3] = dr[0].ToString().Trim(); } else { number[3] = "0"; } dr.Close(); /* * 以下过程可以循环使用 */ cmd.CommandText = "SELECT COUNT(*) FROM files WHERE projectno = '" + Session["xiangmuhao"].ToString() + "' and type='其它' and checked='是'"; dr = cmd.ExecuteReader(); if (dr.Read()) { number[4] = dr[0].ToString().Trim(); } else { number[4] = "0"; } dr.Close(); DataTable dt = new DataTable(); dt.Columns.Add("hengzuobiao", System.Type.GetType("System.String")); dt.Columns.Add("zongzuobiao", System.Type.GetType("System.String")); for (int i = 0; i <= 4; i++) { DataRow row = dt.NewRow(); row["hengzuobiao"] = name[i]; row["zongzuobiao"] = number[i]; dt.Rows.Add(row); } this.Chart1.DataSource = dt; this.Chart1.Series[0].XValueMember = "hengzuobiao"; this.Chart1.Series[0].YValueMembers = "zongzuobiao"; this.Chart1.ChartAreas["ChartArea1"].AxisX.Title = "类别"; this.Chart1.ChartAreas["ChartArea1"].AxisY.Title = "数量"; Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1; this.Chart1.Series[0].IsValueShownAsLabel = true; // 绘制访问量变化统计图 /* * cmd.CommandText = "SELECT COUNT(*),date FROM records WHERE projectno = '" + Session["xiangmuhao"].ToString() + "' GROUP BY date ORDER BY date DESC"; * dr = cmd.ExecuteReader(); * string[] label = new string[7]; * string[] quantity = new string[7]; * * int a; * * for (a = 6; a >= 0; a--) * { * if (dr.Read()) * { * label[a] = dr[1].ToString().Trim(); * quantity[a] = dr[0].ToString().Trim(); * } * else * { * break; * } * } * * dr.Close(); * * DataTable dt1 = new DataTable(); * dt1.Columns.Add("riqi", System.Type.GetType("System.String")); * dt1.Columns.Add("shuliang", System.Type.GetType("System.String")); * int b; * * for (b = 0; b < 7; b++) * { * DataRow row = dt1.NewRow(); * row["riqi"] = label[b]; * row["shuliang"] = quantity[b]; * dt1.Rows.Add(row); * } * * this.Chart2.DataSource = dt1; * this.Chart2.Series[0].XValueMember = "riqi"; * this.Chart2.Series[0].YValueMembers = "shuliang"; * * this.Chart2.ChartAreas[0].AxisX.Title = "日期"; * this.Chart2.ChartAreas[0].AxisY.Title = "访问量"; * Chart2.ChartAreas["ChartArea2"].AxisX.Interval = 1; * this.Chart2.Series[0].IsValueShownAsLabel = true; * dr.Close(); */ // 绘制经费使用情况图 string[] type = new string[7] { "设备费", "材料费", "资料费", "差旅费", "通信费", "劳务费", "其它" }; double[] money = new double[7] { 0, 0, 0, 0, 0, 0, 0 }; /* * 以下过程可以循环使用 */ cmd.CommandText = "SELECT flag,money FROM moneyrecord WHERE projectno = '" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); while (dr.Read()) { //string[] tmpstr = dr[0].ToString().Trim().Split(new char[] { '#', '#' }); string[] tmpstr = new string[2]; tmpstr[0] = dr[0].ToString().Trim(); tmpstr[1] = dr[1].ToString().Trim(); if (tmpstr[0].IndexOf("设备费") >= 0) { money[0] = money[0] + Convert.ToDouble(tmpstr[1]) / 10000; } else if (tmpstr[0].IndexOf("材料费") >= 0) { money[1] = money[1] + Convert.ToDouble(tmpstr[1]) / 10000; } else if (tmpstr[0].IndexOf("资料费") >= 0) { money[2] = money[2] + Convert.ToDouble(tmpstr[1]) / 10000; } else if (tmpstr[0].IndexOf("差旅费") >= 0) { money[3] = money[3] + Convert.ToDouble(tmpstr[1]) / 10000; } else if (tmpstr[0].IndexOf("通信费") >= 0) { money[4] = money[4] + Convert.ToDouble(tmpstr[1]) / 10000; } else if (tmpstr[0].IndexOf("劳务费") >= 0) { money[5] = money[5] + Convert.ToDouble(tmpstr[1]) / 10000; } else if (tmpstr[0].IndexOf("其它") >= 0) { money[6] = money[6] + Convert.ToDouble(tmpstr[1]) / 10000; } } dr.Close(); DataTable dt1 = new DataTable(); dt1.Columns.Add("hengzuobiao1", System.Type.GetType("System.String")); dt1.Columns.Add("zongzuobiao1", System.Type.GetType("System.String")); for (int i = 0; i <= 6; i++) { DataRow row = dt1.NewRow(); row["hengzuobiao1"] = type[i]; row["zongzuobiao1"] = money[i].ToString(); dt1.Rows.Add(row); } this.Chart2.DataSource = dt1; this.Chart2.Series[0].XValueMember = "hengzuobiao1"; this.Chart2.Series[0].YValueMembers = "zongzuobiao1"; this.Chart2.ChartAreas["ChartArea2"].AxisX.Title = "类别"; this.Chart2.ChartAreas["ChartArea2"].AxisY.Title = "数量"; Chart2.ChartAreas["ChartArea2"].AxisX.Interval = 1; this.Chart2.Series[0].IsValueShownAsLabel = true; // 填充公告栏内容 cmd.CommandText = "SELECT message,dateandtime FROM publics WHERE projectno = '" + Session["xiangmuhao"].ToString() + "' ORDER BY dateandtime DESC"; dr = cmd.ExecuteReader(); dr.Read(); gonggao = dr[0].ToString().Trim(); shijian = dr[1].ToString().Trim(); dr.Close(); // 填充成员信息 cmd.CommandText = "SELECT username,name,money,spent,company,email FROM pro" + Session["xiangmuhao"].ToString(); codemaker maker = new codemaker(); dr = cmd.ExecuteReader(); SqlCommand tmpcmd = new SqlCommand(); SqlConnection conn1 = new SqlConnection(connStr); conn1.Open(); tmpcmd.Connection = conn1; while (dr.Read()) { string spent; string totalmoney; string username = dr[0].ToString().Trim(); tmpcmd.CommandText = "SELECT SUM(ALL money) as tomoney FROM moneyrecord WHERE name='" + dr[1].ToString().Trim() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; SqlDataReader moneyReader = tmpcmd.ExecuteReader(); moneyReader.Read(); if (moneyReader[0].ToString().Trim() != "") { spent = moneyReader[0].ToString().Trim(); } else { spent = "0"; } moneyReader.Close(); tmpcmd.CommandText = "SELECT SUM(ALL money) as tomoney FROM bonus WHERE name='" + dr[1].ToString().Trim() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; SqlDataReader moneyReader1 = tmpcmd.ExecuteReader(); moneyReader1.Read(); if (moneyReader1[0].ToString().Trim() != "") { totalmoney = moneyReader1[0].ToString().Trim(); } else { totalmoney = "0"; } moneyReader1.Close(); if (Session["yonghuming"].ToString() == dr[0].ToString() || Session["yonghuming"].ToString() == Session["guanliyuan"].ToString()) { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), totalmoney, spent, dr[4].ToString().Trim(), dr[5].ToString().Trim(), true); } else { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), totalmoney, spent, dr[4].ToString().Trim(), dr[5].ToString().Trim(), false); } } dr.Close(); conn1.Close(); conn1.Dispose(); // 填充平台人数总占比及总人数 cmd.CommandText = "SELECT COUNT(*) FROM pro" + Session["xiangmuhao"].ToString(); dr = cmd.ExecuteReader(); dr.Read(); double int1 = Convert.ToDouble(dr[0].ToString()); renshu = int1.ToString(); dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM main"; dr = cmd.ExecuteReader(); dr.Read(); double int2 = Convert.ToDouble(dr[0].ToString()); dr.Close(); double result = int1 / int2 * 100; rszb = ((int)result).ToString(); // 填充平台经费总占比 cmd.CommandText = "SELECT money FROM project WHERE username='******'"; dr = cmd.ExecuteReader(); dr.Read(); int1 = Convert.ToDouble(dr[0].ToString()); dr.Close(); cmd.CommandText = "SELECT SUM(ALL money) AS tomoney FROM project"; dr = cmd.ExecuteReader(); dr.Read(); int2 = Convert.ToDouble(dr[0].ToString()); dr.Close(); result = int1 / int2 * 100; jfzb = ((int)result).ToString(); // 填充平台成果总占比 cmd.CommandText = "SELECT COUNT(*) FROM files WHERE projectno='" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); dr.Read(); int1 = Convert.ToDouble(dr[0].ToString()); dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM files"; dr = cmd.ExecuteReader(); dr.Read(); int2 = Convert.ToDouble(dr[0].ToString()); dr.Close(); result = int1 / int2 * 100; cgzb = ((int)result).ToString(); // 填充访问总流量 cmd.CommandText = "SELECT COUNT(*) FROM records WHERE projectno = '" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); dr.Read(); liuliang = dr[0].ToString().Trim(); dr.Close(); // 填充任务下拉菜单及任务数量 cmd.CommandText = "SELECT name,number FROM task WHERE projectno = '" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); int num = 0; while (dr.Read()) { renwu = renwu + maker.progress(dr[1].ToString().Trim(), dr[0].ToString().Trim()); num = num + 1; } tempnum = num.ToString(); if (num == 0) { tempnum1 = ""; } else { tempnum1 = tempnum; } dr.Close(); // 填充私信下拉菜单 string guanliyuan; cmd.CommandText = "SELECT name FROM main WHERE username = '******'"; dr = cmd.ExecuteReader(); dr.Read(); guanliyuan = dr[0].ToString().Trim(); dr.Close(); cmd.CommandText = "SELECT dateandtime,senduser,message FROM webchat WHERE receiveuser ='******' and flag='否' ORDER BY dateandtime DESC"; dr = cmd.ExecuteReader(); num = 0; while (dr.Read()) { webchat = webchat + maker.webchat(dr[1].ToString().Trim(), guanliyuan, dr[0].ToString().Trim(), dr[2].ToString().Trim()); num++; } chatnum = num.ToString(); if (num == 0) { chatnum1 = ""; } else { chatnum1 = chatnum; } dr.Close(); // 填充最近活动 cmd.CommandText = "SELECT dateandtime,message,type FROM messages WHERE projectno ='" + Session["xiangmuhao"].ToString() + "' ORDER BY dateandtime DESC"; dr = cmd.ExecuteReader(); int tmpint = 0; while (dr.Read() && tmpint <= 25) { activity = activity + maker.activity(dr[1].ToString().Trim(), dr[0].ToString().Trim(), dr[2].ToString().Trim()); tmpint++; } dr.Close(); // 填充聊天窗口 cmd.CommandText = "SELECT name,dateandtime,message,username FROM bbs WHERE projectno='" + Session["xiangmuhao"].ToString() + "' ORDER BY dateandtime DESC"; dr = cmd.ExecuteReader(); while (dr.Read()) { if (dr[3].ToString() == Session["yonghuming"].ToString()) { chatwindow = chatwindow + maker.chatwindow2(dr[0].ToString().Trim(), dr[2].ToString().Trim(), dr[1].ToString().Trim(), dr[3].ToString().Trim()); } else { chatwindow = chatwindow + maker.chatwindow(dr[0].ToString().Trim(), dr[2].ToString().Trim(), dr[1].ToString().Trim(), dr[3].ToString().Trim()); } } dr.Close(); // 填充控制中心数量提醒 cmd.CommandText = "SELECT COUNT(*) FROM files WHERE projectno='" + Session["xiangmuhao"].ToString() + "' and checked='否'"; dr = cmd.ExecuteReader(); int total = 0; if (dr.Read()) { total = Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM weekreport WHERE projectno='" + Session["xiangmuhao"].ToString() + "' and checked = '否'"; dr = cmd.ExecuteReader(); if (dr.Read()) { total = total + Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM applies WHERE prono='" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); if (dr.Read()) { total = total + Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); if (total != 0) { tixing = "<span class=\"badge pull-right\">" + total.ToString() + "</span>"; } /* * } * catch(Exception ex) * { * conn.Close(); * conn.Dispose(); * Response.Write("<script>alert(\"" + ex.Message + "\")</script>"); * } * finally * { * conn.Close(); * conn.Dispose(); * } * */ }
protected void Page_Load(object sender, EventArgs e) { // 进行安全检查 if (Session["yonghuming"] == null) { Response.Redirect("../default.aspx"); } if (Session["xiangmuhao"] == null) { Response.Redirect("../login.aspx"); } security sc = new security(); int xx = sc.flag(Session["yonghuming"].ToString(), Request.UserHostAddress.ToString()); if (xx == 1) { Response.Redirect("../alert.aspx"); } if (Session["guanliyuan"] == Session["yonghuming"]) { isAdmin = true; } else { isAdmin = false; } // 建立连接 string connStr = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnection conn = new SqlConnection(connStr); conn.Open(); try { // 确定是否显示搜索框 if (Session["yonghuming"].ToString() == Session["guanliyuan"].ToString()) { flag = "false"; } else { flag = "true"; } // 填充成员信息 SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT username,name,money,spent,company,email FROM pro" + Session["xiangmuhao"].ToString(); codemaker maker = new codemaker(); SqlDataReader dr = cmd.ExecuteReader(); dr.Close(); // 填充任务下拉菜单及任务数量 cmd.CommandText = "SELECT name,number FROM task WHERE projectno = '" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); int num = 0; while (dr.Read()) { renwu = renwu + maker.progress(dr[1].ToString().Trim(), dr[0].ToString().Trim()); num = num + 1; } tempnum = num.ToString(); if (num == 0) { tempnum1 = ""; } else { tempnum1 = tempnum; } dr.Close(); // 填充成员信息 cmd.CommandText = "SELECT username,name,money,spent,company,email FROM pro" + Session["xiangmuhao"].ToString(); maker = new codemaker(); dr = cmd.ExecuteReader(); SqlCommand tmpcmd = new SqlCommand(); SqlConnection conn1 = new SqlConnection(connStr); conn1.Open(); tmpcmd.Connection = conn1; while (dr.Read()) { string spent; string totalmoney; string username = dr[0].ToString().Trim(); tmpcmd.CommandText = "SELECT SUM(ALL money) as tomoney FROM moneyrecord WHERE name='" + dr[1].ToString().Trim() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; SqlDataReader moneyReader = tmpcmd.ExecuteReader(); moneyReader.Read(); if (moneyReader[0].ToString().Trim() != "") { spent = moneyReader[0].ToString().Trim(); } else { spent = "0"; } moneyReader.Close(); tmpcmd.CommandText = "SELECT SUM(ALL money) as tomoney FROM bonus WHERE name='" + dr[1].ToString().Trim() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; SqlDataReader moneyReader1 = tmpcmd.ExecuteReader(); moneyReader1.Read(); if (moneyReader1[0].ToString().Trim() != "") { totalmoney = moneyReader1[0].ToString().Trim(); } else { totalmoney = "0"; } moneyReader1.Close(); if (Session["yonghuming"].ToString() == dr[0].ToString() || Session["yonghuming"].ToString() == Session["guanliyuan"].ToString()) { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), totalmoney, spent, dr[4].ToString().Trim(), dr[5].ToString().Trim(), true); } else { member = member + maker.member(dr[0].ToString().Trim(), dr[1].ToString().Trim(), totalmoney, spent, dr[4].ToString().Trim(), dr[5].ToString().Trim(), false); } } dr.Close(); conn1.Close(); conn1.Dispose(); // 填充私信下拉菜单 string guanliyuan; cmd.CommandText = "SELECT name FROM main WHERE username = '******'"; dr = cmd.ExecuteReader(); dr.Read(); guanliyuan = dr[0].ToString().Trim(); dr.Close(); cmd.CommandText = "SELECT dateandtime,senduser,message FROM webchat WHERE receiveuser ='******' and flag='否'"; dr = cmd.ExecuteReader(); num = 0; while (dr.Read()) { webchat = webchat + maker.webchat(dr[1].ToString().Trim(), guanliyuan, dr[0].ToString().Trim(), dr[2].ToString().Trim()); num++; } chatnum = num.ToString(); if (num == 0) { chatnum1 = ""; } else { chatnum1 = chatnum; } dr.Close(); // 填充经费使用情况统计图 double yi; double wei; cmd.CommandText = "SELECT SUM(ALL money) AS money FROM moneyrecord WHERE projectno = '" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); dr.Read(); if (dr[0].ToString().Trim() != "") { yi = Convert.ToDouble(dr[0].ToString().Trim()); } else { yi = 0; } dr.Close(); cmd.CommandText = "SELECT SUM(ALL money) AS money FROM bonus WHERE projectno = '" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); dr.Read(); if (dr[0].ToString().Trim() != "") { wei = Convert.ToDouble(dr[0].ToString().Trim()) - yi; } else { wei = -yi; } //dr.Read(); string[] label = new string[] { "已使用金额", "未使用金额" }; string[] value = new string[] { yi.ToString(), wei.ToString() }; DataTable dt = new DataTable(); dt.Columns.Add("hengzuobiao", System.Type.GetType("System.String")); dt.Columns.Add("zongzuobiao", System.Type.GetType("System.String")); for (int i = 0; i <= 1; i++) { DataRow row = dt.NewRow(); row["hengzuobiao"] = label[i]; row["zongzuobiao"] = value[i]; dt.Rows.Add(row); } this.Chart1.DataSource = dt; Chart1.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie; //设置图表类型 Chart1.Series[0].XValueMember = "hengzuobiao"; //X轴数据成员列 Chart1.Series[0].YValueMembers = "zongzuobiao"; //Y轴数据成员列 Chart1.Series[0].IsVisibleInLegend = true; Chart1.Series[0].IsValueShownAsLabel = true; //显示坐标值 dr.Close(); // 填充本人经费使用表 // 填充经费使用情况统计图 //cmd.CommandText = "SELECT money,spent FROM pro" + Session["xiangmuhao"].ToString() + " WHERE username='******'"; cmd.CommandText = "SELECT SUM(ALL money) AS money FROM moneyrecord WHERE name='" + Session["xingming"].ToString() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; double yi1; double wei1; dr = cmd.ExecuteReader(); dr.Read(); if (dr[0].ToString().Trim() != "") { yi1 = Convert.ToDouble(dr[0].ToString().Trim()); } else { yi1 = 0; } dr.Close(); cmd.CommandText = "SELECT SUM(ALL money) AS money FROM bonus WHERE name='" + Session["xingming"].ToString() + "' and projectno='" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); dr.Read(); if (dr[0].ToString().Trim() != "") { wei1 = Convert.ToDouble(dr[0].ToString().Trim()) - yi1; } else { wei1 = -yi1; } dr.Close(); string[] label1 = new string[] { "已使用金额", "未使用金额" }; string[] value1 = new string[] { yi1.ToString(), wei1.ToString() }; DataTable dt2 = new DataTable(); dt2.Columns.Add("hengzuobiao1", System.Type.GetType("System.String")); dt2.Columns.Add("zongzuobiao1", System.Type.GetType("System.String")); for (int i = 0; i <= 1; i++) { DataRow row1 = dt2.NewRow(); row1["hengzuobiao1"] = label1[i]; row1["zongzuobiao1"] = value1[i]; dt2.Rows.Add(row1); } this.Chart2.DataSource = dt2; Chart2.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie; //设置图表类型 Chart2.Series[0].XValueMember = "hengzuobiao1"; //X轴数据成员列 Chart2.Series[0].YValueMembers = "zongzuobiao1"; //Y轴数据成员列 Chart2.Series[0].IsVisibleInLegend = true; Chart2.Series[0].IsValueShownAsLabel = true; //显示坐标值 dr.Close(); /* * // 填充经费分配情况统计图 * cmd.CommandText = "SELECT username,name,money FROM pro" + Session["xiangmuhao"].ToString(); * * string[] username = new string[300]; * string[] money = new string[300]; * * dr.Close(); * * dr = cmd.ExecuteReader(); * * int temp = 0; * * while (dr.Read()) * { * username[temp] = dr[1].ToString().Trim() + "(" + dr[2].ToString().Trim() + "万元)"; * money[temp] = dr[2].ToString().Trim(); * * temp++; * } * * DataTable dt1 = new DataTable(); * dt1.Columns.Add("heng", System.Type.GetType("System.String")); * dt1.Columns.Add("zong", System.Type.GetType("System.String")); * * for (num = 0; num < temp; num++) * { * DataRow row1 = dt1.NewRow(); * row1["heng"] = username[num]; * row1["zong"] = money[num]; * dt1.Rows.Add(row1); * } * * this.Chart2.DataSource = dt1; * * Chart2.Series["Series1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie;//设置图表类型 * Chart2.Series[0].XValueMember = "heng";//X轴数据成员列 * Chart2.Series[0].YValueMembers = "zong";//Y轴数据成员列 * Chart2.Series[0].IsVisibleInLegend = true; * Chart2.Series[0].IsValueShownAsLabel = true;//显示坐标值 * * dr.Close(); */ // 填充经费明细表 cmd.CommandText = "SELECT code FROM mingxi WHERE username='******'"; dr = cmd.ExecuteReader(); if (dr.Read()) { mingxi = dr[0].ToString().Trim(); dr.Close(); cmd.CommandText = "DELETE mingxi WHERE username='******'"; cmd.ExecuteNonQuery(); } else { dr.Close(); if (Session["guanliyuan"].ToString() == Session["yonghuming"].ToString()) { cmd.CommandText = "SELECT dateandtime,flag,username,money,projectno,name FROM moneyrecord WHERE projectno='" + Session["xiangmuhao"].ToString() + "' ORDER BY dateandtime DESC"; } else { cmd.CommandText = "SELECT dateandtime,flag,username,money,projectno,name FROM moneyrecord WHERE name = '" + Session["xingming"].ToString() + "' and projectno='" + Session["xiangmuhao"].ToString() + "' ORDER BY dateandtime DESC"; } dr = cmd.ExecuteReader(); int i = 1; while (dr.Read()) { mingxi = mingxi + maker.mingxi(i.ToString(), dr[1].ToString().Trim(), dr[0].ToString().Trim(), dr[3].ToString().Trim(), isGuest(dr[2].ToString().Trim()), dr[5].ToString().Trim(), dr[4].ToString().Trim(), isAdmin); i++; } dr.Close(); if (Session["guanliyuan"].ToString() == Session["yonghuming"].ToString()) { cmd.CommandText = "SELECT dateandtime,flag,username,money,projectno,name FROM bonus WHERE projectno='" + Session["xiangmuhao"].ToString() + "' ORDER BY dateandtime DESC"; } else { cmd.CommandText = "SELECT dateandtime,flag,username,money,projectno,name FROM bonus WHERE name = '" + Session["xingming"].ToString() + "' and projectno='" + Session["xiangmuhao"].ToString() + "' ORDER BY dateandtime DESC"; } dr = cmd.ExecuteReader(); while (dr.Read()) { mingxi = mingxi + maker.mingxi(i.ToString(), dr[1].ToString().Trim(), dr[0].ToString().Trim(), dr[3].ToString().Trim(), isGuest(dr[2].ToString().Trim()), dr[5].ToString().Trim(), dr[4].ToString().Trim(), isAdmin); i++; } dr.Close(); } // 填充控制中心数量提醒 cmd.CommandText = "SELECT COUNT(*) FROM files WHERE projectno='" + Session["xiangmuhao"].ToString() + "' and checked='否'"; dr = cmd.ExecuteReader(); int total = 0; if (dr.Read()) { total = Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM applies WHERE prono='" + Session["xiangmuhao"].ToString() + "'"; dr = cmd.ExecuteReader(); if (dr.Read()) { total = total + Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); cmd.CommandText = "SELECT COUNT(*) FROM weekreport WHERE projectno='" + Session["xiangmuhao"].ToString() + "' and checked = '否'"; dr = cmd.ExecuteReader(); if (dr.Read()) { total = total + Convert.ToInt16(dr[0].ToString().Trim()); } dr.Close(); if (total != 0) { tixing = "<span class=\"badge pull-right\">" + total.ToString() + "</span>"; } } catch (Exception ex) { conn.Close(); conn.Dispose(); Response.Write("<script>alert(\"" + ex.Message + "\")</script>"); } finally { conn.Close(); conn.Dispose(); } }