public string[] GetUserOtherList(string prefixText, int count) { List <string> items = new List <string>(count);//泛型 SqlDataReader myDR = new MyDataOp("select top " + count + " Name from t_R_UserInfo where (Name like '%" + prefixText + "%' or UserID like '%" + prefixText + "%' ) group by Name order by Name ").CreateReader(); while (myDR.Read()) { items.Add(myDR["Name"].ToString()); } //myCon.Close();//关闭数据库连接 return(items.ToArray()); }
public string[] GetSampleSourceList(string prefixText, int count) { List <string> items = new List <string>(count);//泛型 SqlDataReader myDR = new MyDataOp("select top " + count + " 单位全称 from View_SampleSource where (单位全称 like '%" + prefixText + "%' or 单位曾用名全称 like '%" + prefixText + "%' or 企业简称代码 like '%" + prefixText + "%' ) order by num desc").CreateReader(); while (myDR.Read()) { items.Add(myDR["单位全称"].ToString()); } //myCon.Close();//关闭数据库连接 return(items.ToArray()); }
protected void ItemBind() { cbl_itemlist.Items.Clear(); string strSql = "select ItemID,ItemName,classid from t_M_ItemInfo where bzw=0 order by classid"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); cbl_itemlist.DataSource = ds; cbl_itemlist.DataTextField = "ItemName"; cbl_itemlist.DataValueField = "ItemID"; cbl_itemlist.DataBind(); }
protected void btn_Add_Click(object sender, EventArgs e) { lbl_Type.Text = "添加"; CleanAllText(); btn_OK.Text = "确定"; Query(); string str = "select top 1 t_M_AnStandard.id,t_M_AnStandard.Standard from t_M_AIStandard inner join t_M_AnStandard on t_M_AnStandard.Standard=t_M_AIStandard.Standard where AIID='" + strSelectedId + "'"; DataSet tep = new MyDataOp(str).CreateDataSet(); dsmethod = tep.Clone(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "showAddEdit();", true); }
protected int GetID() { int id = 0; string str = "select max(DepartID) from t_M_DepartInfo"; DataSet ds = new MyDataOp(str).CreateDataSet(); if (ds != null) { id = int.Parse(ds.Tables[0].Rows[0][0].ToString()) + 1; } return(id); }
private void BindItemList(DropDownList ddl_Item) { DataTable dt = new DataTable(); DataColumn dc1 = new DataColumn("MonitorItem"); DataColumn dc2 = new DataColumn("监测项"); dt.Columns.Add(dc1); dt.Columns.Add(dc2); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["MonitorItem"].ToString() != "") { DataRow[] drselect = dt.Select("MonitorItem='" + dr["MonitorItem"].ToString() + "'"); if (drselect.Length == 0) { DataRow drnew = dt.NewRow(); drnew["MonitorItem"] = dr["MonitorItem"].ToString(); drnew["监测项"] = dr["监测项"].ToString(); dt.Rows.Add(drnew); dt.AcceptChanges(); } } } if (dt.Rows.Count > 0) { ddl_Item.DataSource = dt; ddl_Item.DataValueField = "MonitorItem"; ddl_Item.DataTextField = "监测项"; ddl_Item.DataBind(); } else { string constr = ""; if (txt_Itemquery.Text.Trim() != "") { constr += " and (t_M_ANItemInf.AIName like '%" + txt_Itemquery.Text.Trim() + "%' or t_M_ANItemInf.AICode like '%" + txt_Itemquery.Text.Trim() + "%')"; } if (txt_QueryTime.Text.Trim() != "") { constr += " and (year(fxdate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Year + "' AND month(fxdate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Month + "' and day(fxdate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Day + "')"; } string getitemstr = "select distinct AIName 监测项,MonitorItem from t_MonitorItemDetail inner join t_M_ANItemInf on t_M_ANItemInf.id=t_MonitorItemDetail.MonitorItem where t_MonitorItemDetail.LyUser='******' and delflag=0"; DataSet dsitem = new MyDataOp(getitemstr).CreateDataSet(); ddl_Item.DataSource = dsitem; ddl_Item.DataValueField = "MonitorItem"; ddl_Item.DataTextField = "监测项"; ddl_Item.DataBind(); } }
public string[] GetMainClassList(string prefixText, int count) { List <string> items = new List <string>(count);//泛型 SqlDataReader myDR = new MyDataOp("select top " + count + " ClassName from t_M_AnalysisMainClassEx where ClassCode like '" + prefixText + "%'group by ClassName order by ClassName ").CreateReader(); while (myDR.Read()) { items.Add(myDR["ClassName"].ToString()); } //myCon.Close();//关闭数据库连接 return(items.ToArray()); }
public string[] Getxz(string prefixText, int count) { List <string> items = new List <string>(count);//泛型 // SqlDataReader myDR = new MyDataOp("select top " + count + " 单位全称 from t_企业信息 where (单位全称 like '%" + prefixText + "%' or 单位曾用名全称 like '%" + prefixText + "%' or 企业简称代码 like '%" + prefixText + "%' ) group by 单位全称 union (select top " + count + " 单位全称 from t_other where (单位全称 like '%" + prefixText + "%' or 单位曾用名全称 like '%" + prefixText + "%' or 企业简称代码 like '%" + prefixText + "%' ) group by 单位全称) order by 单位全称 ").CreateReader(); SqlDataReader myDR = new MyDataOp("select top " + count + " xz from t_xz where (xz like '%" + prefixText + "%' or code like '%" + prefixText + "%' ) group by xz order by xz ").CreateReader(); while (myDR.Read()) { items.Add(myDR["xz"].ToString()); } //myCon.Close();//关闭数据库连接 return(items.ToArray()); }
/// <summary> /// 新增、修改时的重复性检查 /// </summary> /// <param name="entity"></param> /// <param name="flag"></param> /// <returns></returns> public bool IsExistUnder(string id) { bool Existflag = false; string sqlstr = String.Format(@"select * from t_c_outdetail where outid='{0}'", id); DataSet ds = new MyDataOp(sqlstr).CreateDataSet(); if (ds.Tables[0].Rows.Count > 0) { Existflag = true; } return(Existflag); }
void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument) { string strSql, strTmp; strTmp = eventArgument; strSql = "update t_chart_type set line='" + linepoint + strTmp + "' where id=" + drop_List.SelectedValue + ""; MyDataOp mdo = new MyDataOp(strSql); mdo.ExecuteCommand(); }
public string[] GetReportList(string prefixText, int count) { List <string> items = new List <string>(count);//泛型 //string conditionstr = ""; SqlDataReader myDR = new MyDataOp("select top " + count + " ReportName from t_M_ReporInfo where ReportName like '" + prefixText + "%' and (StatusID<=5) group by ReportName order by ReportName ").CreateReader(); while (myDR.Read()) { items.Add(myDR["ReportName"].ToString()); } //myCon.Close();//关闭数据库连接 return(items.ToArray()); }
public string[] GetCompletionList(string prefixText, int count) { List <string> items = new List <string>(count);//泛型 SqlDataReader myDR = new MyDataOp("select top " + count + " ItemName from t_M_ItemInfo where ItemCode like '" + prefixText + "%'group by ItemName order by ItemName ").CreateReader(); while (myDR.Read()) { items.Add(myDR["ItemName"].ToString()); } //myCon.Close();//关闭数据库连接 return(items.ToArray()); }
protected void btn_query_Click(object sender, EventArgs e) { //strSelectedId=txt_samplequery.Text; string strSample = ""; string strDate = ""; if (txt_samplequery.Text != "") { strSample = "and SampleID like'%" + txt_samplequery.Text + "%'"; } if (txt_QueryTime.Text != "") { strDate = " and (year(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Year + "' AND month(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Month + "' and day(AccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Day + "')"; } string strSql = "select t_M_SampleInfor.id,AccessDate 接样时间,t_M_ReporInfo.ItemType,ItemName 项目类型,SampleID 样品编号,t_M_SampleInfor.TypeID,t_M_SampleType.SampleType 样品类型,t_M_ReporInfo.ClientID,ClientName 区域,t_M_ReporInfo.ReportName 报告标识,t_M_ReporInfo.urgent 备注,t_M_SampleInfor.ReportRemark 报告备注,Ulevel,snum,wtdepart 委托单位 from t_M_ReporInfo, t_M_SampleInfor,t_M_ItemInfo,t_M_SampleType,t_M_ClientInfo where t_M_ClientInfo.id=t_M_ReporInfo.ClientID and t_M_ReporInfo.ItemType=t_M_ItemInfo.ItemID and t_M_SampleInfor.TypeID=t_M_SampleType.TypeID and t_M_ReporInfo.StatusID<2 and t_M_SampleInfor.ReportID=t_M_ReporInfo.id and t_M_SampleInfor.StatusID=0 " + strSample + strDate + " order by t_M_SampleInfor.id "; DataSet ds = new MyDataOp(strSql).CreateDataSet(); DataColumn dcc = new DataColumn("紧急程度"); ds.Tables[0].Columns.Add(dcc); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Ulevel"].ToString() == "1") { dr["紧急程度"] = "紧急"; } else { dr["紧急程度"] = "一般"; } } if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_List.DataSource = ds; grdvw_List.DataBind(); } ds.Dispose(); }
protected void btn_OK_Click(object sender, EventArgs e) { string strFlag = Verify(); if (strFlag != "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('" + strFlag + "');", true); } else { #region 添加新纪录 if (lbl_Type.Text == "添加") { string strSql = @"insert into t_操作员级别 (级别名称) values('" + txt_levelName.Text.Trim() + "')"; MyDataOp mdo = new MyDataOp(strSql); bool blSuccess = mdo.ExecuteCommand(); if (blSuccess == true) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加成功!');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据添加失败!');", true); } } #endregion #region 编辑记录 if (lbl_Type.Text == "编辑") { string strSql = @"update t_操作员级别 set 级别名称='" + txt_levelName.Text.Trim() + "' where 级别='" + strSelectedId + "'"; MyDataOp mdo = new MyDataOp(strSql); bool blSuccess = mdo.ExecuteCommand(); if (blSuccess == true) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑成功!');", true); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "hiddenDetail();alert('数据编辑失败!');", true); } } #endregion Query(); } }
protected void btn_delete_Click(object sender, EventArgs e) { string strSql, strTmp; strTmp = ""; strSql = "update t_chart_type set line='" + strTmp + "' where id=" + drop_List.SelectedValue + ""; MyDataOp mdo = new MyDataOp(strSql); if (mdo.ExecuteCommand()) { btn_search_Click(null, null); Response.Write("<script language='javascript'>alert('删除成功!');</script>"); } }
protected void grdvw_List_RowEditing(object sender, GridViewEditEventArgs e) { CleanAllText(); lbl_Type.Text = "详细"; strSelectedId = grdvw_List.Rows[e.NewEditIndex].Cells[3].Text; string strSql = @"select t_M_AnalysisItemEx.ClassID,t_M_AnalysisItemEx.num,t_M_ANItemInf.AICode,t_M_ANItemInf.AIName,t_M_ANItemInf.dw,t_M_AnalysisItemEx.type,t_M_AnalysisItemEx.dose,t_M_AnalysisItemEx.effectivetime,t_M_AnalysisItemEx.effectivedw from t_M_AnalysisItemEx inner join t_M_ANItemInf on t_M_ANItemInf.id=t_M_AnalysisItemEx.AIID where t_M_AnalysisItemEx.id='" + strSelectedId + "'"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); dropList_type.SelectedValue = ds.Tables[0].Rows[0]["ClassID"].ToString(); txt_AIName.Text = ds.Tables[0].Rows[0]["AIName"].ToString(); txt_AICode.Text = ds.Tables[0].Rows[0]["AICode"].ToString(); if (ds.Tables[0].Rows[0]["num"].ToString() != " " && ds.Tables[0].Rows[0]["num"].ToString() != "0") { txt_num.Text = ds.Tables[0].Rows[0]["num"].ToString(); } if (ds.Tables[0].Rows[0]["dose"].ToString() != " ") { txt_dose.Text = ds.Tables[0].Rows[0]["dose"].ToString(); } if (ds.Tables[0].Rows[0]["dw"].ToString() != "") { rbl_dw.SelectedIndex = int.Parse(ds.Tables[0].Rows[0]["dw"].ToString()); } drop_type.SelectedValue = ds.Tables[0].Rows[0]["type"].ToString(); if (ds.Tables[0].Rows[0]["effectivetime"].ToString() != " " && ds.Tables[0].Rows[0]["effectivetime"].ToString() != "0") { txt_Effnum.Text = ds.Tables[0].Rows[0]["effectivetime"].ToString(); } if (ds.Tables[0].Rows[0]["effectivedw"].ToString() != "") { rbl_Effdw.SelectedIndex = int.Parse(ds.Tables[0].Rows[0]["effectivedw"].ToString()); } string str = "select distinct t_M_AnStandard.id,t_M_AnStandard.Standard from t_M_AIStandard inner join t_M_AnStandard on t_M_AnStandard.id=t_M_AIStandard.Standardid where AIID='" + strSelectedId + "'"; dsmethod = new MyDataOp(str).CreateDataSet(); cbl_Method.DataSource = dsmethod; cbl_Method.DataValueField = "id"; cbl_Method.DataTextField = "Standard"; cbl_Method.DataBind(); for (int i = 0; i < cbl_Method.Items.Count; i++) { cbl_Method.Items[i].Selected = true; } AllTxtreadOnly(); btn_OK.Text = "编辑"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "showAddEdit();", true); }
public string[] GetClientList(string prefixText, int count) { List <string> items = new List <string>(count);//泛型 // SqlDataReader myDR = new MyDataOp("select top " + count + " 单位全称 from t_企业信息 where (单位全称 like '%" + prefixText + "%' or 单位曾用名全称 like '%" + prefixText + "%' or 企业简称代码 like '%" + prefixText + "%' ) group by 单位全称 union (select top " + count + " 单位全称 from t_other where (单位全称 like '%" + prefixText + "%' or 单位曾用名全称 like '%" + prefixText + "%' or 企业简称代码 like '%" + prefixText + "%' ) group by 单位全称) order by 单位全称 ").CreateReader(); // SqlDataReader myDR = new MyDataOp("select top " + count + " 单位全称 from t_委托单位 where (单位全称 like '%" + prefixText + "%' or 单位曾用名全称 like '%" + prefixText + "%' or 企业简称代码 like '%" + prefixText + "%' ) group by 单位全称 order by 单位全称 ").CreateReader(); SqlDataReader myDR = new MyDataOp("select top " + count + " 单位全称 from View_wtdepart where (单位全称 like '%" + prefixText + "%' or 单位曾用名全称 like '%" + prefixText + "%' or 企业简称代码 like '%" + prefixText + "%' ) order by num desc ").CreateReader(); while (myDR.Read()) { items.Add(myDR["单位全称"].ToString()); } //myCon.Close();//关闭数据库连接 return(items.ToArray()); }
public string[] GetClassList(string prefixText, int count) { List <string> items = new List <string>(count);//泛型 string conditionstr = ""; SqlDataReader myDR = new MyDataOp("select top " + count + " AIName from t_M_ANItemInf where" + conditionstr + " (AIName like '" + prefixText + "%' or AICode like '" + prefixText + "%') group by AIName order by AIName ").CreateReader(); while (myDR.Read()) { items.Add(myDR["AIName"].ToString()); } //myCon.Close();//关闭数据库连接 return(items.ToArray()); }
//查询并填入GridView中 private void Query() { string str = ""; if (txts_name.Text.Trim() != "") { str += " and t_R_UserInfo.name like '%" + txts_name.Text.Trim() + "%'"; } if (txts_ulog.Text.Trim() != "") { str += " and ulog like '%" + txts_ulog.Text.Trim() + "%'"; } if (txts_time1.Text.Trim() != "") { str += " and dtime >= '" + txts_time1.Text.Trim() + "'"; } if (txts_time2.Text.Trim() != "") { str += " and dtime <= '" + txts_time2.Text.Trim() + " 23:59:59'"; } string strSql = "select t_R_UserLog.id,t_R_UserLog.name as 工作人员,ulog as 工作内容,dtime as 工作时间,DepartName 所在部门,UserID from t_R_UserLog inner join t_R_UserInfo on t_R_UserLog.uid=t_R_UserInfo.UserID inner join t_M_DepartInfo on t_R_UserInfo.DepartID=t_M_DepartInfo.DepartID where 1=1 " + str + " order by t_R_UserLog.id desc"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { grdvw_List.DataSource = ds; grdvw_List.DataBind(); for (int i = 0; i < grdvw_List.Rows.Count; i++) { if (grdvw_List.Rows[i].Cells[8].Text.Trim() != Request.Cookies["Cookies"].Values["u_id"].ToString()) { ImageButton fibtn = (ImageButton)grdvw_List.Rows[i].FindControl("editid"); fibtn.Visible = false; } } } }
public string[] GetUserList(string prefixText, int count) { List <string> items = new List <string>(count);//泛型 prefixText = prefixText.Replace('/', '/'); SqlDataReader myDR = new MyDataOp("select top " + count + " Standard from t_M_AnStandard where (Standard like '%" + prefixText + "%') group by Standard order by Standard ").CreateReader(); while (myDR.Read()) { items.Add(myDR["Standard"].ToString()); } //myCon.Close();//关闭数据库连接 return(items.ToArray()); }
private void SummaryQuery() { StringBuilder outputSum = new StringBuilder(); //string sql = "SELECT t_M_AnalysisItem.AIName,"; //sql += "SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NULL THEN t_M_MonitorItem.num ELSE 0 END) AS undone,"; //sql += "SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NOT NULL THEN t_M_MonitorItem.num ELSE 0 END) AS done "; //sql += "FROM t_M_MonitorItem INNER JOIN t_M_AnalysisItem ON t_M_MonitorItem.MonitorItem = t_M_AnalysisItem.id INNER JOIN t_M_SampleInfor ON t_M_MonitorItem.SampleID = t_M_SampleInfor.id inner join t_M_ReporInfo on t_M_ReporInfo.id=t_M_SampleInfor.ReportID "; //sql += "WHERE (t_M_ReporInfo.StatusID < 6) and SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NULL THEN t_M_MonitorItem.num ELSE 0 END)>0 GROUP BY t_M_AnalysisItem.AIName"; string sql = "select * from view_ywc"; //DataSet dss = new MyDataOp(sql).CreateDataSetP("tj"); DataSet dss = new MyDataOp(sql).CreateDataSet(); outputSum.Append("<table><tr><td>分析项目</td>"); if (dss.Tables[0].Rows.Count > 0) { string AIName = ""; string UnDone = ""; string Done = ""; for (int m = 0; m < dss.Tables[0].Rows.Count; m++) { AIName = dss.Tables[0].Rows[m][0].ToString(); outputSum.Append("<td>" + AIName + "</td>"); } outputSum.Append("</tr><tr><td>已完成</td>"); for (int n = 0; n < dss.Tables[0].Rows.Count; n++) { Done = dss.Tables[0].Rows[n][2].ToString(); outputSum.Append("<td>" + Done + "</td>"); } outputSum.Append("</tr><tr><td>未完成</td>"); for (int l = 0; l < dss.Tables[0].Rows.Count; l++) { UnDone = dss.Tables[0].Rows[l][1].ToString(); outputSum.Append("<td>" + UnDone + "</td>"); } } outputSum.Append("</tr></table>"); lbl_sum.Text = outputSum.ToString(); dss.Dispose(); // if (flagRelash == "1") //{ // Response.ContentType = "text/xml"; // Response.Write(outputSum.ToString()); // Response.End(); // flagRelash = ""; //} }
protected void btn_Login_Click(object sender, ImageClickEventArgs e) { if (txt_UserName.Text.Trim() != "user") { if (SSOHelper.CheckOnline(txt_UserName.Text.Trim())) { string strSql = "select DepartID,UserID,t_R_UserInfo.RoleID,PWDModifyTime,Name,LevelID,ReadRight,WriteRight,RefreshRight,FileRight,id,ManageRight,dataflag from t_R_UserInfo inner join t_R_Role on t_R_Role.RoleID=t_R_UserInfo.RoleID where t_R_UserInfo.flag=0 and UserID='" + txt_UserName.Text.Trim() + "' and PWD='" + txt_Pwd.Text.Trim() + "'"; MyDataOp mdo = new MyDataOp(strSql); DataSet ds = mdo.CreateDataSet(); if (ds.Tables[0].Rows.Count == 0) { Response.Write("<script language='javascript'>alert('帐户或密码输入错误!请重新输入!');</script>"); } else { HttpCookie Cookie = new HttpCookie("Cookies"); DateTime dt = DateTime.Now; TimeSpan ts = new TimeSpan(0, 10, 0, 0); //有效期10小时; Cookie.Expires = dt.Add(ts); Cookie.Values.Add("uid", ds.Tables[0].Rows[0]["id"].ToString()); Cookie.Values.Add("u_id", ds.Tables[0].Rows[0]["UserID"].ToString()); Cookie.Values.Add("u_role", ds.Tables[0].Rows[0]["RoleID"].ToString()); Cookie.Values.Add("u_flag", ds.Tables[0].Rows[0]["dataflag"].ToString()); Cookie.Values.Add("u_pswdtime", ds.Tables[0].Rows[0]["PWDModifyTime"].ToString()); Cookie.Values.Add("Name", HttpUtility.UrlEncode(ds.Tables[0].Rows[0]["Name"].ToString())); //Cookie.Values.Add("u_Name",ds.Tables[0].Rows[0]["Name"].ToString());//用户名 // Cookie.Values.Add("RealName", HttpUtility.UrlEncode(ds.Tables[0].Rows[0]["RealName"].ToString())); Cookie.Values.Add("u_level", ds.Tables[0].Rows[0]["LevelID"].ToString()); Cookie.Values.Add("u_purview", ds.Tables[0].Rows[0]["ReadRight"].ToString() + //读权限 ds.Tables[0].Rows[0]["WriteRight"].ToString() + //写权限 ds.Tables[0].Rows[0]["ManageRight"].ToString() + ds.Tables[0].Rows[0]["FileRight"].ToString()); //刷新权限; Cookie.Values.Add("departid", ds.Tables[0].Rows[0]["DepartID"].ToString()); Response.AppendCookie(Cookie); SSOHelper sso = new SSOHelper(); sso.LoginRegister(txt_UserName.Text.Trim()); Response.Redirect("~/main.htm"); } } else { Response.Write("<script language='javascript'>alert('您的帐户已在别处登陆!');</script>"); } } }
protected void GridView_Report_RowDeleting(object sender, GridViewDeleteEventArgs e) { strSelectedId = GridView_Report.Rows[e.RowIndex].Cells[1].Text; string strSql; string fileUrl = GridView_Report.Rows[e.RowIndex].Cells[4].Text; if (fileUrl != " ") { string[] deletelist = new string[2]; strSql = "update t_M_ReporInfo set ReportAddress=null,fileflag=0,ReportUploadDate=null WHERE id= '" + strSelectedId + "'"; //待修改,改项目删除后,相应要修改的信息 //deletelist.SetValue("delete from t_操作员信息 where 所属角色id=(select id from t_角色信息 where 级别id='" + strSelectedId + "')", 0); //deletelist.SetValue("delete from t_角色菜单关系表 where 角色id=(select id from t_角色信息 where 级别id='" + strSelectedId + "')", 1); // deletelist.SetValue("DELETE FROM t_角色信息 WHERE 级别id = '" + strSelectedId + "'",2); deletelist.SetValue(strSql, 0); MyDataOp mdo = new MyDataOp(strSql); if (mdo.DoTran(1, deletelist)) { try { fileUrl = fileUrl.Replace("\\", "/"); int kkp = fileUrl.LastIndexOf('/'); //string link1 = fileUrl.Substring(kkp-1, fileUrl.Length - kkp); FileInfo file = new FileInfo(fileUrl); file.Delete(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('报告删除成功!')", true); } catch (Exception deletemsg) { WebApp.Components.Log.SaveLog("报告编制中删除报告异常:(" + strSelectedId + ")" + deletemsg, Request.Cookies["Cookies"].Values["u_id"].ToString(), 6); } } else { WebApp.Components.Log.SaveLog("报告编制中删除报告:(" + strSelectedId + ")失败!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 6); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('报告删除失败!')", true); } string str = "select id,ReportNumber 报告编号,ReportUploadDate 报告上传日期,ReportAddress 报告地址 from t_M_ReporInfo where id='" + strSelectedId + "' and fileflag=1"; DataSet ds = new MyDataOp(str).CreateDataSet(); GridView_Report.DataSource = ds; GridView_Report.DataBind(); } }
protected void grdvw_List_RowEditing(object sender, GridViewEditEventArgs e) { CleanAllText(); lbl_Type.Text = "详细"; strSelectedId = grdvw_List.Rows[e.NewEditIndex].Cells[3].Text; string strSql = @"select * from t_M_SampleType where TypeID='" + strSelectedId + "'"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); txt_SampleType.Text = ds.Tables[0].Rows[0]["SampleType"].ToString(); txt_SampleTypeCode.Text = ds.Tables[0].Rows[0]["SampleTypeCode"].ToString(); AllTxtreadOnly(); btn_OK.Text = "编辑"; ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "showAddEdit();", true); }
//撤销监测项领用时,检测本次领用是否存在有效的监测项,是-不更改领用记录;否-则更改领用记录为无效! protected int checkDraw(string LyID, string strID) { int ret = 0; string checkstr = "select count(*) from t_DrawSampleDetail where yxflag=0 and DrawID='" + LyID + "' and id!='" + strID + "'"; DataSet dscheck = new MyDataOp(checkstr).CreateDataSet(); if (dscheck != null) { if (dscheck.Tables[0].Rows[0][0].ToString() == "0") { ret = 1; } } return(ret); }
//将各个id分别翻译成相对应的名称 private void translateTheIDToName() { for (int i = 0; i < grdvw_List.Rows.Count; i++) { string strSql = ""; DataSet ds = new DataSet(); //翻译操作员id为用户名 strSql = "select * from t_R_UserInfo where id='" + grdvw_List.Rows[i].Cells[4].Text + "'"; ds = new MyDataOp(strSql).CreateDataSet(); grdvw_List.Rows[i].Cells[0].Text = ds.Tables[0].Rows[0]["UserID"].ToString(); strSql = "select * from t_R_Level where LevelID='" + grdvw_List.Rows[i].Cells[5].Text + "'"; ds = new MyDataOp(strSql).CreateDataSet(); grdvw_List.Rows[i].Cells[1].Text = ds.Tables[0].Rows[0]["LevelName"].ToString(); strSql = "select * from t_R_Role where RoleID='" + grdvw_List.Rows[i].Cells[6].Text + "'"; ds = new MyDataOp(strSql).CreateDataSet(); grdvw_List.Rows[i].Cells[2].Text = ds.Tables[0].Rows[0]["RoleName"].ToString(); if (grdvw_List.Rows[i].Cells[5].Text == "6") { grdvw_List.Rows[i].Cells[3].Text = ""; } //else //{ // //strSql = "select * from "; // //switch (grdvw_List.Rows[i].Cells[5].Text) // //{ // // case "4": // // strSql += " t_第一级信息 "; // // break; // // case "5": // // strSql += " t_第二级信息 "; // // break; // // case "12": // // strSql += " t_第三级信息 "; // // break; // // default: // // strSql += " t_第三级信息 "; // // break; // } //strSql += " where ID='" + grdvw_List.Rows[i].Cells[7].Text + "'"; //ds = new MyDataOp(strSql).CreateDataSet(); //grdvw_List.Rows[i].Cells[3].Text = ds.Tables[0].Rows[0]["名称"].ToString(); //} } }
//查询并填入GridView中 private void Query() { string strconstr = ""; if (dropList_type_Query.SelectedValue.Trim() != "-1") { strconstr += " and itemid = '" + dropList_type_Query.SelectedValue.Trim() + "' "; } if (txt_qyQuery.Text.Trim() != "") { strconstr += " and 单位全称 like '%" + txt_qyQuery.Text.Trim() + "%' "; } string strSql = "select t_CompabyBZ.id,t_委托单位.id 企业id,单位全称,t_CompabyBZ.wrwtype,className 污染物类型,行业类别 hyid,descs 行业类别,t_CompabyBZ.bzid,t_M_ItemInfo.itemid,t_M_ItemInfo.itemname 项目类型 from t_委托单位 inner join t_行业信息 on t_行业信息.id=行业类别 inner join t_CompabyBZ on t_CompabyBZ.qyid=t_委托单位.id inner join t_hyClassParam on t_hyClassParam.id=t_CompabyBZ.bzid inner join t_M_AnalysisMainClassEx on t_M_AnalysisMainClassEx.ClassID=t_CompabyBZ.wrwtype and t_CompabyBZ.flag=0 inner join t_M_ItemInfo on itemtype =t_M_ItemInfo.itemid where 1=1 " + strconstr + " order by 单位全称"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); if (ds.Tables[0].Rows.Count == 0) { //没有记录仍保留表头 ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); grdvw_List.DataSource = ds; grdvw_List.DataBind(); int intColumnCount = grdvw_List.Rows[0].Cells.Count; grdvw_List.Rows[0].Cells.Clear(); grdvw_List.Rows[0].Cells.Add(new TableCell()); grdvw_List.Rows[0].Cells[0].ColumnSpan = intColumnCount; } else { DataColumn dc = new DataColumn("监测指标"); ds.Tables[0].Columns.Add(dc); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["bzid"].ToString() != "") { strSql = @"select t_hyItem.id,t_M_ANItemInf.AIName 分析项目,ItemID,fw 标准 from t_hyItem inner join t_M_ANItemInf on t_M_ANItemInf.id=t_hyItem.itemid where pid='" + int.Parse(dr["bzid"].ToString()) + "'"; DataSet dsitem = new MyDataOp(strSql).CreateDataSet(); foreach (DataRow drr in dsitem.Tables[0].Rows) { dr["监测指标"] += drr["分析项目"].ToString() + ","; } } } grdvw_List.DataSource = ds; grdvw_List.DataBind(); } }
private void SummaryQuery() { string sql = "SELECT t_M_AnalysisItem.AIName,"; sql += "SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NULL THEN t_M_MonitorItem.num ELSE 0 END) AS undone,"; sql += "SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NOT NULL THEN t_M_MonitorItem.num ELSE 0 END) AS done "; sql += "FROM t_M_MonitorItem INNER JOIN t_M_AnalysisItem ON t_M_MonitorItem.MonitorItem = t_M_AnalysisItem.id INNER JOIN t_M_SampleInfor ON t_M_MonitorItem.SampleID = t_M_SampleInfor.id inner join t_M_ReporInfo on t_M_ReporInfo.id=t_M_SampleInfor.ReportID "; sql += "WHERE (t_M_ReporInfo.StatusID < 6) GROUP BY t_M_AnalysisItem.AIName"; //string sql = "SELECT t_M_AnalysisItem.AIName,"; //sql += "SUM(t_M_MonitorItem.num) AS undone "; ////sql += "SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NOT NULL THEN t_M_MonitorItem.num ELSE 0 END) AS done "; //sql += "FROM t_M_MonitorItem INNER JOIN t_M_AnalysisItem ON t_M_MonitorItem.MonitorItem = t_M_AnalysisItem.id INNER JOIN t_M_SampleInfor ON t_M_MonitorItem.SampleID = t_M_SampleInfor.id inner join t_M_ReporInfo on t_M_ReporInfo.id=t_M_SampleInfor.ReportID "; //sql += "WHERE (t_M_ReporInfo.StatusID < 6) GROUP BY t_M_AnalysisItem.AIName"; DataSet dss = new MyDataOp(sql).CreateDataSet(); //string sql1 = "SELECT t_M_AnalysisItem.AIName,"; //sql1 += "SUM(t_M_MonitorItem.num) AS undone "; ////sql += "SUM(CASE WHEN t_M_MonitorItem.ReportDate IS NOT NULL THEN t_M_MonitorItem.num ELSE 0 END) AS done "; //sql1 += "FROM t_M_MonitorItem INNER JOIN t_M_AnalysisItem ON t_M_MonitorItem.MonitorItem = t_M_AnalysisItem.id INNER JOIN t_M_SampleInfor ON t_M_MonitorItem.SampleID = t_M_SampleInfor.id inner join t_M_ReporInfo on t_M_ReporInfo.id=t_M_SampleInfor.ReportID "; //sql1 += "WHERE (t_M_ReporInfo.StatusID =6) GROUP BY t_M_AnalysisItem.AIName"; //DataSet dss2= new MyDataOp(sql1).CreateDataSet(); outputSum = "<table><tr><td>分析项目</td>"; if (dss.Tables[0].Rows.Count > 0) { string AIName = ""; string UnDone = ""; string Done = ""; for (int m = 0; m < dss.Tables[0].Rows.Count; m++) { AIName = dss.Tables[0].Rows[m][0].ToString(); outputSum += "<td>" + AIName + "</td>"; } outputSum += "</tr><tr><td>已完成</td>"; for (int n = 0; n < dss.Tables[0].Rows.Count; n++) { Done = dss.Tables[0].Rows[n][2].ToString(); outputSum += "<td>" + Done + "</td>"; } outputSum += "</tr><tr><td>未完成</td>"; for (int l = 0; l < dss.Tables[0].Rows.Count; l++) { UnDone = dss.Tables[0].Rows[l][1].ToString(); outputSum += "<td>" + UnDone + "</td>"; } } outputSum += "</tr></table>"; }
private void AddChildNode(TreeNode parent, string ID) { //string str = String.Format("select * from t_R_Menu where FatherID ='{0}' order by id ASC", ID); string str = String.Format("select t_R_Menu.* from t_R_Menu inner join t_R_RoleMenu on t_R_RoleMenu.MenuID=t_R_Menu.ID where FatherID ='{0}' and RoleID='" + RoleID + "' order by t_R_Menu.OrderID ASC", ID); DataSet ds = new MyDataOp(str).CreateDataSet(); foreach (DataRow dr in ds.Tables[0].Rows) { TreeNode child = new TreeNode(); child.Text = dr["MenuName"].ToString(); child.Value = dr["ID"].ToString(); parent.ChildNodes.Add(child); this.AddChildNode(child, dr["ID"].ToString()); } }
private void AddChildNode(TreeNode parent, string ID) { string str = String.Format("select * from t_R_Menu where FatherID ='{0}' order by id ASC", ID); DataSet ds = new MyDataOp(str).CreateDataSet(); foreach (DataRow dr in ds.Tables[0].Rows) { TreeNode child = new TreeNode(); child.Text = dr["MenuName"].ToString(); child.Value = dr["ID"].ToString(); parent.ChildNodes.Add(child); this.AddChildNode(child, dr["ID"].ToString()); } }