Пример #1
0
    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();
                }
            }
        }
    }
Пример #2
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)
            {
            }
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //txt_SampleType.Attributes.Add("OnFocus", "javascript:WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})");
            txt_CreateDate.Attributes.Add("OnFocus", "javascript:WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})");//onclick="SetDate(this,'yyyy-MM-dd hh:mm:ss')" readonly="readonly"
            txt_QueryTime.Attributes.Add("OnFocus", "javascript:WdatePicker({dateFmt:'yyyy-MM-dd'})");

            Query();
            DAl.Station stationobj = new DAl.Station();
            DataTable   dtJK       = stationobj.GetJKByName("", "1");
            cbl_cs.DataSource     = dtJK;
            cbl_cs.DataTextField  = "单位全称";
            cbl_cs.DataValueField = "id";
            cbl_cs.DataBind();
            // MyStaVoid.BindList("单位全称", "id", "select id,单位全称 from t_委托单位 where type=1", cbl_cs);
            SetButton();// txt_QueryTime.Text = DateTime.Now.Date.ToString("yyyy-MM-dd");


            grdvw_List.Caption = "<FONT style='WIDTH: 102.16%; COLOR:#2292DD;font-size:14pt; LINE-HEIGHT: 150%; FONT-FAMILY: 楷体_GB2312; HEIGHT: 35px'><b>编制整改函</b></font>";
        }
    }
Пример #4
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;
            }
        }
    }
Пример #5
0
    private void Query()
    {
        //strSelectedId=txt_samplequery.Text;
        string strSample = "";
        string strDate   = "";

        if (txt_samplequery.Text != "")
        {
            strSample = "and ReportName like'%" + txt_samplequery.Text + "%'";
        }
        if (drop_tkwether.SelectedValue.Trim() == "0")
        {
            strSample += " and (StatusID=6)";
        }
        else
        {
            strSample += " and (StatusID>=2 and StatusID!=6 )";
        }
        if (cb_query_fa.Checked)
        {
            strSample += " and  hanwether=1";
        }
        else
        {
            strSample += " and  hanwether=0";
        }
        if (txt_QueryTime.Text != "")
        {
            strDate = " and ReportAccessDate>= '" + DateTime.Parse(txt_QueryTime.Text.Trim() + " 00:00:00") + "' ";
        }
        if (txt_QueryTimeEnd.Text != "")
        {
            strDate = " and ReportAccessDate<= '" + DateTime.Parse(txt_QueryTimeEnd.Text.Trim() + " 00:00:00") + "'";
        }
        //TBD//项目负责人只能看到自己的项目
        string strSql = "select t_Y_FlowInfo.id,t_Y_FlowInfo.ReportAccessDate 时间,t_Y_FlowInfo.ItemType,ItemName 项目类型,ReportName 报告标识,urgent 备注,t_Y_FlowInfo.Ulevel,Projectname 项目名称,rwclass,jcmethod,address,lxman,lxtel,lxemail,wtdepart,wether,varman1,vardate1,varremark1,t_Y_FlowInfo.chargeman,hanwether  from t_Y_FlowInfo,t_M_ItemInfo where  t_Y_FlowInfo.ItemType=t_M_ItemInfo.ItemID  " + strSample + strDate + " order by t_Y_FlowInfo.ReportAccessDate";

        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);
        DataColumn dc2 = new DataColumn("项目负责人");

        ds.Tables[0].Columns.Add(dc2);
        DAl.Sample getobj = new DAl.Sample();
        DataTable  dtmode = getobj.GetMode("", "mode", "");

        DAl.Station get       = new DAl.Station();
        DataTable   dtstation = get.GetWTByName("");

        DAl.User.Users userobj = new DAl.User.Users();
        DataTable      dtuser  = userobj.GetUsersDt("");

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            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["监测方式"] = "";
            }
            dr["委托单位"] = dr["wtdepart"].ToString();
            if (dr["chargeman"].ToString() != "")
            {
                DataRow[] druser = dtuser.Select("UserID='" + dr["chargeman"].ToString().Trim() + "'");
                if (druser.Length == 1)
                {
                    dr["项目负责人"] = druser[0]["name"].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();
    }
Пример #6
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        if (btn_Add.Text == "编 辑")
        {
            AllTxtCanWrite();
            btn_Add.Text = "确定";
        }
        else
        {
            string msg = checkInput();
            if (msg != "")
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('" + msg + "')", true);
                return;
            }
            else
            {
                Entity.Station entity = new Entity.Station();
                entity.type     = 0;
                entity.statusID = 1;
                entity.qymc     = txt_qymc.Text.Trim();               // = ds.Tables[0].Rows[0]["单位全称"].ToString();
                entity.cname    = txt_cname.Text.Trim();              // = ds.Tables[0].Rows[0]["单位曾用名全称"].ToString();
                entity.dz       = txt_dz.Text.Trim();                 // = ds.Tables[0].Rows[0]["单位详细地址"].ToString();
                entity.jgdm     = txt_jgdm.Text.Trim();               // = ds.Tables[0].Rows[0]["单位法人代码"].ToString();
                entity.sd       = drp_sd.SelectedValue.ToString();    // = ds.Tables[0].Rows[0]["所属镇街道"].ToString();
                entity.yzbm     = txt_yzbm.Text.Trim();               // = ds.Tables[0].Rows[0]["邮政编码"].ToString();
                entity.frdb     = txt_frdb.Text.Trim();               // = ds.Tables[0].Rows[0]["法定代表人"].ToString();
                entity.tel1     = txt_tel1.Text.Trim();               // = ds.Tables[0].Rows[0]["tel1"].ToString();
                entity.mobile1  = txt_mobile1.Text.Trim();            // = ds.Tables[0].Rows[0]["mobile1"].ToString();
                entity.zfw1     = txt_zfw1.Text.Trim();               // = ds.Tables[0].Rows[0]["市府网1"].ToString();
                entity.hbfg     = txt_hbfg.Text.Trim();               //= ds.Tables[0].Rows[0]["环保分管人"].ToString();
                entity.tel2     = txt_tel2.Text.Trim();               // = ds.Tables[0].Rows[0]["tel2"].ToString();
                entity.mobile2  = txt_mobile2.Text.Trim();            // = ds.Tables[0].Rows[0]["mobile2"].ToString();
                entity.zfw2     = txt_zfw2.Text.Trim();               // = ds.Tables[0].Rows[0]["市府网2"].ToString().Trim();
                entity.hbfz     = txt_hbfz.Text.Trim();               // = ds.Tables[0].Rows[0]["环保负责人"].ToString().Trim();
                entity.tel3     = txt_tel3.Text.Trim();               // = ds.Tables[0].Rows[0]["tel3"].ToString();
                entity.mobile3  = txt_mobile3.Text.Trim();            // = ds.Tables[0].Rows[0]["mobile3"].ToString();
                entity.zfw3     = txt_zfw3.Text.Trim();               // = ds.Tables[0].Rows[0]["市府网3"].ToString();
                entity.wsrw     = drop_wsrw.SelectedValue.ToString(); // = ds.Tables[0].Rows[0]["污水是否入网"].ToString();
                entity.wstime   = txt_wstime.Text.Trim();             // = ds.Tables[0].Rows[0]["污水入网时间"].ToString();
                entity.grrw     = drop_grrw.SelectedValue.ToString(); // = ds.Tables[0].Rows[0]["集中供热是否入网"].ToString();
                entity.grtime   = txt_grtime.Text.Trim();             // = ds.Tables[0].Rows[0]["集中供热入网时间"].ToString();
                entity.czhm     = txt_czhm.Text.Trim();
                entity.email    = txt_email.Text.Trim();
                entity.status   = drop_status.SelectedValue.Trim();
                entity.bz       = drop_bz.SelectedValue.Trim();
                entity.control  = drop_control.SelectedValue.Trim();
                if (drop_industry.SelectedValue.Trim() != "" && drop_industry.SelectedValue.Trim() != "0")
                {
                    entity.industry = drop_industry.SelectedValue.Trim();
                }
                else
                {
                    entity.industry = "12";
                }
                entity.qyjcdm = "";
                DAl.Station stationbj = new DAl.Station();
                if (Editid == null)
                {
                    if (stationbj.AddStation(entity) > 0)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据添加成功!');hiddenDetail();", true);

                        Query();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据添加失败!');", true);
                    }
                }
                else
                {//单位全称,单位曾用名全称,单位详细地址,单位法人代码,所属镇街道,邮政编码,法定代表人,tel1,mobile1,市府网1,环保分管人,tel2,mobile2,市府网2,环保负责人,tel3,mobile3,市府网3,污水是否入网,污水入网时间,集中供热是否入网,集中供热入网时间
                    entity.ID = int.Parse(Editid);
                    if (stationbj.UpdateStation(entity) > 0)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据编辑成功!');hiddenDetail();", true);
                        Query();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('数据编辑失败!');", true);
                    }
                }
            }
        }
        btn_Add.Enabled = true;
    }
Пример #7
0
    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();
    }
Пример #8
0
    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();
    }
Пример #9
0
    private void Query()
    {
        //strSelectedId=txt_samplequery.Text;
        string strSample = "";
        string strDate   = "";

        if (txt_samplequery.Text != "")
        {
            strSample = "and ReportName like'%" + txt_samplequery.Text + "%'";
        }
        strSample += " and tkwether='1'";
        if (drop_tkwether.SelectedValue.ToString() == "3")
        {
            strSample         += " and (statusID='3')";
            btn_OK.Visible     = true;
            btn_Save.Visible   = true;
            panel_han.Visible  = true;
            btn_print.Visible  = false;
            btn_back.Visible   = true;
            grdvw_List.Caption = "<FONT style='WIDTH: 102.16%; COLOR:#2292DD;font-size:14pt; LINE-HEIGHT: 150%; FONT-FAMILY: 楷体_GB2312; HEIGHT: 35px'><b>编制整改函</b></font>";
        }
        else
        {
            strSample += " and (statusID='5')";

            if (Request.Cookies["Cookies"].Values["u_purview"].ToString().Substring(2, 1) != "1")
            {
                btn_OK.Visible = false;
            }
            else
            {
                btn_OK.Visible = true;
            }
            btn_back.Visible   = false;
            btn_Save.Visible   = false;
            panel_han.Visible  = true;
            btn_print.Visible  = true;
            grdvw_List.Caption = "<FONT style='WIDTH: 102.16%; COLOR:#2292DD;font-size:14pt; LINE-HEIGHT: 150%; FONT-FAMILY: 楷体_GB2312; HEIGHT: 35px'><b>编制整改函</b></font>";
        }
        if (Request.Cookies["Cookies"].Values["u_purview"].ToString().Substring(2, 1) != "1")
        {
            strSample += " and chargeman='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "'";
        }
        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,wether,varman1,vardate1,varremark1,t_Y_FlowInfo.chargeman,varman2,vardate2,varremark2,tkwether,hcontent,hfwdw,hcs,hanNO 函文号  from t_Y_FlowInfo,t_M_ItemInfo,t_R_UserInfo where  t_Y_FlowInfo.ItemType=t_M_ItemInfo.ItemID and chargeman=t_R_UserInfo.UserID  and hanwether=1   " + strSample + strDate + " order by t_Y_FlowInfo.ReportAccessDate";

        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.GetWTByName("");

        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["委托单位"] = dr["wtdepart"].ToString().Trim();
            // }
        }
        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();
    }
Пример #10
0
    private void Query()
    {
        //strSelectedId=txt_samplequery.Text;
        string strSample = "";
        string strDate   = "";

        if (txt_samplequery.Text != "")
        {
            strSample = "and ReportName like'%" + txt_samplequery.Text + "%'";
        }

        if (drop_tkwether.SelectedIndex == 0)
        {
            strSample += " and (StatusID='2') ";
        }
        else
        {
            strSample += " and tkwether='1' and StatusID='2'";
        }
        if (Request.Cookies["Cookies"].Values["u_purview"].ToString().Substring(2, 1) != "1")
        {
            strSample += " and chargeman='" + Request.Cookies["Cookies"].Values["u_id"].ToString() + "'";
        }
        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,wether,varman1,vardate1,varremark1,t_Y_FlowInfo.chargeman,varman2,vardate2,varremark2,tkwether,fanbackflag ,fanbackremark ,backflag,varremark3 from t_Y_FlowInfo,t_M_ItemInfo,t_R_UserInfo where  t_Y_FlowInfo.ItemType=t_M_ItemInfo.ItemID and  chargeman=t_R_UserInfo.UserID    " + strSample + strDate + " and hanwether=1 order by t_Y_FlowInfo.ReportAccessDate";

        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);
        DataColumn dc2 = new DataColumn("踏勘是否通过");

        ds.Tables[0].Columns.Add(dc2);
        DAl.Sample getobj = new DAl.Sample();
        DataTable  dtmode = getobj.GetMode("", "mode", "");

        DAl.Station get       = new DAl.Station();
        DataTable   dtstation = get.GetWTByName("");

        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            if (dr["Ulevel"].ToString() == "1")
            {
                dr["紧急程度"] = "紧急";
            }
            else
            {
                dr["紧急程度"] = "一般";
            }
            if (dr["rwclass"].ToString() == "1")
            {
                dr["任务类型"] = "委托监测";
            }
            else
            {
                dr["任务类型"] = "例行监测";
            }
            if (dr["tkwether"].ToString() == "1")
            {
                dr["踏勘是否通过"] = "未通过";
            }
            else if (dr["tkwether"].ToString() == "0")
            {
                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["委托单位"] = dr["wtdepart"].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();
    }