protected void txt_wtdepart_TextChanged(object sender, EventArgs e) { DAl.Station StationObj = new DAl.Station(); DataTable dt = StationObj.GetStationByName(txt_wtdepart.Text.Trim()); if (dt != null) { if (dt.Rows.Count == 1) { if (dt.Rows[0]["单位详细地址"].ToString() != " ") { txt_address.Text = dt.Rows[0]["单位详细地址"].ToString(); } if (dt.Rows[0]["环保负责人"].ToString() != " ") { txt_lxman.Text = dt.Rows[0]["环保负责人"].ToString(); } if (dt.Rows[0]["mobile3"].ToString() != " ") { txt_lxtel.Text = dt.Rows[0]["mobile3"].ToString(); } if (dt.Rows[0]["电子邮箱"].ToString() != " ") { txt_lxemail.Text = dt.Rows[0]["电子邮箱"].ToString(); } } } }
protected void drop_wrw_SelectedIndexChanged(object sender, EventArgs e) { DAl.Station stationobj = new DAl.Station(); DataTable dtcompanay = stationobj.GetStationByName(txt_SampleSource.Text.Trim()); if (dtcompanay != null) { if (dtcompanay.Rows.Count > 0) { } } }
protected void drop_wrw_SelectedIndexChanged(object sender, EventArgs e) { DAl.Station stationobj = new DAl.Station(); DataTable dtcompanay = stationobj.GetStationByName(txt_SampleSource.Text.Trim()); if (dtcompanay != null) { if (dtcompanay.Rows.Count > 0) { // MyStaVoid.BindList("bz", "id", "select t_hyClassParam.id,t_标准字典.bz+'('+t_hyClassParam.itemlst+')' as bz from t_hyClassParam inner join t_标准字典 on t_hyClassParam.bz=t_标准字典.id where hyid='" + strHyId + "'", drop_bz); string strSql = @"select t_hyClassParam.id,t_标准字典.bz+'('+t_hyClassParam.itemlist+')' as bz from t_hyClassParam inner join t_标准字典 on t_标准字典.id=t_hyClassParam.bz where wrwtype='" + drop_wrw.SelectedValue.ToString().Trim() + "' and flag=0"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); drop_bz.DataSource = ds; drop_bz.DataTextField = "bz"; drop_bz.DataValueField = "id"; drop_bz.DataBind(); ListItem li = new ListItem("请选择", ""); drop_bz.Items.Add(li); drop_bz.SelectedIndex = drop_bz.Items.Count - 1; } } }
protected void btn_OK_Click(object sender, EventArgs e) { string strFlag = Verify(); if (strFlag != "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('" + strFlag + "');", true); // return; } else { string compay = "0"; string cyman = "0"; ////获取采样人,现场分析人 //DAl.User.Users userobj = new DAl.User.Users(); //Entity.User.Users user = null;//= new Entity.User.Users(); //user = userobj.GetUsers(txt_xmfzr.Text.Trim()); //if (user != null) //{ // cyman = user.UserID.ToString(); //} //else //{ // ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('系统不存在项目负责人/报告编制人,请核实!');", true); // return; //} Entity.AccessReport entity = new Entity.AccessReport(); entity.classID = int.Parse(drop_rwtype.SelectedValue.ToString()); //任务类型 if (entity.classID == 1) //委托任务 { DAl.Station stationobj = new DAl.Station(); DataTable dtstation = stationobj.GetStationByName(txt_wtdepart.Text.Trim()); if (dtstation.Rows.Count > 0) { compay = dtstation.Rows[0]["id"].ToString(); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('系统不存在该委托单位,请核实!');", true); return; } entity.WTMan = compay;//委托单位 entity.lxEmail = txt_lxemail.Text.Trim(); entity.lxMan = txt_lxman.Text.Trim();; entity.lxtel = txt_lxtel.Text.Trim();; entity.address = txt_address.Text.Trim(); } entity.CreateDate = DateTime.Now; //创建时间 entity.CreateUser = Request.Cookies["Cookies"].Values["u_id"].ToString(); //创建人 entity.WTDate = DateTime.Parse(txt_CreateDate.Text.Trim()); //委托日期,任务接收日期 entity.chargeman = cyman; //项目负责人 entity.level = drop_level.SelectedValue.ToString(); //紧急程度 entity.Mode = drop_mode.SelectedValue.ToString(); //监测方式 entity.Remark = drop_urgent.Text.Trim(); //备注 entity.WTNO = txt_ReportID.Text.Trim(); //委托协议编码,报告标识 entity.ProjectName = txt_Projectname.Text.Trim(); //项目名称 entity.TypeID = int.Parse(drop_ItemList.SelectedValue.ToString().Trim()); DAl.Report reportobj = new DAl.Report(); entity.StatusID = 0; #region 添加新纪录 if (strReportId == "" || strReportId == "0") { if (reportobj.AddYS(entity) == 1) { btn_Save.Visible = true; WebApp.Components.Log.SaveLog("创建任务单添加成功!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('任务创建成功!')", true); //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddSuccess", "hiddenDetail();alert('数据添加成功!')", true); } else { WebApp.Components.Log.SaveLog("创建任务单添加失败!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddFail", "alert('数据添加失败!')", true); } } #endregion else { entity.ID = int.Parse(strReportId); if (reportobj.UpateYS(entity) == 1) { WebApp.Components.Log.SaveLog("创建任务单编辑成功!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddSuccess", "hiddenDetail();alert('数据保存成功!')", true); } else { WebApp.Components.Log.SaveLog("创建任务单编辑失败!", Request.Cookies["Cookies"].Values["u_id"].ToString(), 5); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "clickAddFail", "hiddenDetail();alert('数据添保存失败!')", true); } } } Query(); }
private void Query() { //strSelectedId=txt_samplequery.Text; string strSample = ""; string strDate = ""; if (txt_samplequery.Text != "") { strSample = "and ReportName like'%" + txt_samplequery.Text + "%'"; } if (txt_QueryTime.Text != "") { strDate = " and (year(ReportAccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Year + "' AND month(ReportAccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Month + "' and day(ReportAccessDate)= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00").Day + "')"; } string strSql = "select t_Y_FlowInfo.id,t_Y_FlowInfo.ReportAccessDate 时间,t_Y_FlowInfo.ItemType,ItemName 项目类型,ReportName 报告标识,urgent 备注,t_Y_FlowInfo.Ulevel,Projectname 项目名称,t_R_UserInfo.Name 项目负责人,rwclass,jcmethod,address,lxman,lxtel,lxemail,wtdepart from t_Y_FlowInfo,t_M_ItemInfo,t_R_UserInfo where t_Y_FlowInfo.ItemType=t_M_ItemInfo.ItemID and (StatusID='0') and wetherscance=0 and chargeman=t_R_UserInfo.UserID " + strSample + strDate + " order by t_Y_FlowInfo.id"; DataSet ds = new MyDataOp(strSql).CreateDataSet(); DataColumn dcc = new DataColumn("紧急程度"); ds.Tables[0].Columns.Add(dcc); DataColumn dc = new DataColumn("监测方式"); ds.Tables[0].Columns.Add(dc); DataColumn dc0 = new DataColumn("任务类型"); ds.Tables[0].Columns.Add(dc0); DataColumn dc1 = new DataColumn("委托单位"); ds.Tables[0].Columns.Add(dc1); DAl.Sample getobj = new DAl.Sample(); DataTable dtmode = getobj.GetMode("", "mode", ""); DAl.Station get = new DAl.Station(); DataTable dtstation = get.GetStationByName(""); foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Ulevel"].ToString() == "1") { dr["紧急程度"] = "紧急"; } else { dr["紧急程度"] = "一般"; } if (dr["rwclass"].ToString() == "1") { dr["任务类型"] = "委托监测"; } else { dr["任务类型"] = "例行监测"; } DataRow[] drsel = dtmode.Select("code='" + dr["jcmethod"].ToString() + "'"); if (drsel.Length == 1) { dr["监测方式"] = drsel[0]["name"].ToString(); } else { dr["监测方式"] = ""; } if (dr["wtdepart"].ToString().Trim() != "") { DataRow[] drdep = dtstation.Select("id=" + dr["wtdepart"].ToString().Trim() + ""); if (drdep.Length == 1) { dr["委托单位"] = drdep[0]["单位全称"].ToString(); } 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(); }