protected void lbtn_cequ_Click(object sender, EventArgs e)
    {
        string aname = txtcequ.Value;

        if (aname == "")
        {
            SystemTool.AlertShow(this, "测区名称不能为空");
            return;
        }
        string  sqlck = "select * from areainfo where areaname='" + aname + "'";
        DataSet dsck  = DB.ExecuteSqlDataSet(sqlck, null);

        if (dsck.Tables[0].Rows.Count > 0)
        {
            SystemTool.AlertShow(this, "测区名称已存在");
            return;
        }
        string sql    = "insert into areainfo (areaname) values('" + aname + "')";
        int    result = DB.ExecuteSql(sql, null);

        if (result > 0)
        {
            SystemTool.JavascriptShow(this, "changclass1()");
            sql = "select * from AreaInfo";
            DataSet ds = DB.ExecuteSqlDataSet(sql, null);
            rpt_cequ.DataSource = ds.Tables[0];
            rpt_cequ.DataBind();
            txtcequ.Value = "";
            BindData();
        }
        else
        {
            SystemTool.AlertShow(this, "操作失败");
        }
    }
    protected void lbtn_xiangdao_Click(object sender, EventArgs e)
    {
        string aname = txtxiangdao.Value;
        string cequ  = ddl_cequ2.SelectedValue;

        if (cequ == "0")
        {
            SystemTool.AlertShow(this, "测区名称不能为空");
            return;
        }
        if (aname == "")
        {
            SystemTool.AlertShow(this, "巷道名称不能为空");
            return;
        }
        string  sqlck = "select * from roadinfo where areaname='" + cequ + "' and roadname='" + aname + "'";
        DataSet dsck  = DB.ExecuteSqlDataSet(sqlck, null);

        if (dsck.Tables[0].Rows.Count > 0)
        {
            SystemTool.AlertShow(this, "巷道名称已存在");
            SystemTool.JavascriptShow(this, "changclass33()");
            return;
        }
        string sql    = "insert into roadinfo (areaname,roadname) values('" + cequ + "','" + aname + "')";
        int    result = DB.ExecuteSql(sql, null);

        if (result > 0)
        {
            SystemTool.JavascriptShow(this, "changclass3()");
            sql = "select * from roadinfo";
            DataSet ds = DB.ExecuteSqlDataSet(sql, null);
            rpt_xiangdao.DataSource = ds.Tables[0];
            rpt_xiangdao.DataBind();
            ddl_cequ2.SelectedValue = "0";
            txtxiangdao.Value       = "";
        }
        else
        {
            SystemTool.AlertShow(this, "操作失败");
        }
    }
    protected void lbtn_gongzuomian_Click(object sender, EventArgs e)
    {
        string aname = txtgongzuomian.Value;
        string cequ  = ddl_AreaInfo.SelectedValue;

        if (cequ == "0")
        {
            SystemTool.AlertShow(this, "测区名称不能为空");
            return;
        }
        if (aname == "")
        {
            SystemTool.AlertShow(this, "工作面名称不能为空");
            return;
        }
        string  sqlck = "select * from workfaceinfo where areaname='" + cequ + "' and workfacename='" + aname + "'";
        DataSet dsck  = DB.ExecuteSqlDataSet(sqlck, null);

        if (dsck.Tables[0].Rows.Count > 0)
        {
            SystemTool.AlertShow(this, "工作面名称已存在");
            SystemTool.JavascriptShow(this, "changclass22()");
            return;
        }
        string sql    = "insert into workfaceinfo (areaname,workfacename) values('" + cequ + "','" + aname + "')";
        int    result = DB.ExecuteSql(sql, null);

        if (result > 0)
        {
            SystemTool.JavascriptShow(this, "changclass2()");
            sql = "select * from workfaceinfo";
            DataSet ds = DB.ExecuteSqlDataSet(sql, null);
            rpt_workface.DataSource = ds.Tables[0];
            rpt_workface.DataBind();
            ddl_AreaInfo.SelectedValue = "0";
            txtgongzuomian.Value       = "";
        }
        else
        {
            SystemTool.AlertShow(this, "操作失败");
        }
    }
Example #4
0
 protected void ddl_page_changed(object sender, EventArgs e)
 {
     SystemTool.JavascriptShow(this, "requestData()");
 }
Example #5
0
    protected void ddl_cequ_changed(object sender, EventArgs e)
    {
        txtdiyitongdaojie.Value  = "";
        txtgangjing1.Value       = "";
        txtdiertongdaojie.Value  = "";
        txtgangjing2.Value       = "";
        txtyalishangxian.Value   = "";
        txtyalixiaxian.Value     = "";
        txtbaojingzhi.Value      = "";
        txtchuanganqizushu.Value = "";

        string  sql = "SELECT workfaceName FROM WorkfaceInfo where areaName='" + ddl_cequ.SelectedValue + "'";//工作面
        DataSet ds  = DB.ExecuteSqlDataSet(sql, null);

        if (ds.Tables[0].Rows.Count > 0)
        {
            ddl_gongzuomian.Items.Clear();
            ddl_gongzuomian.DataSource     = ds.Tables[0];
            ddl_gongzuomian.DataTextField  = "workfaceName";
            ddl_gongzuomian.DataValueField = "workfaceName";
            ddl_gongzuomian.DataBind();
            string workfacename = ds.Tables[0].Rows[0]["workfaceName"].ToString();
            sql = "select * from PressurePar where areaname='" + ddl_cequ.SelectedValue + "' and facename='" + workfacename + "'";
            ds  = DB.ExecuteSqlDataSet(sql, null);
            if (ds.Tables[0].Rows.Count > 0)
            {
                //txtchuanganqizushu.Value = ds.Tables[0].Rows[0][""].ToString();
                txtdiyitongdaojie.Value = ds.Tables[0].Rows[0]["firstconnect"].ToString();
                txtgangjing1.Value      = ds.Tables[0].Rows[0]["firstd"].ToString();
                txtdiertongdaojie.Value = ds.Tables[0].Rows[0]["secondconnect"].ToString();
                txtgangjing2.Value      = ds.Tables[0].Rows[0]["sencondd"].ToString();
                txtyalishangxian.Value  = ds.Tables[0].Rows[0]["pressuremax"].ToString();
                txtyalixiaxian.Value    = ds.Tables[0].Rows[0]["pressuremin"].ToString();
                txtbaojingzhi.Value     = ds.Tables[0].Rows[0]["pressurealarm"].ToString();
                sql = "select * from PreSenInfo where areaName='" + ddl_cequ.SelectedValue + "' and FaceName='" + workfacename + "' and Type = '" + ddl_yalileixing.SelectedValue + "' order by BracketNo";
                ds  = DB.ExecuteSqlDataSet(sql, null);
                txtchuanganqizushu.Value = ds.Tables[0].Rows.Count.ToString();
                sql = @"select count(*) as total from PreSenInfo psi 
left join PreNewData pnd on psi.areaname=pnd.areaname and psi.facename=pnd.facename and psi.sensorno=pnd.sensorno
where psi.areaname='" + ddl_cequ.SelectedValue + "' and psi.facename='" + workfacename + "' ";
                ds  = DB.ExecuteSqlDataSet(sql, null);
                decimal total = Convert.ToDecimal(ds.Tables[0].Rows[0]["total"].ToString());
                ddl_page.Items.Clear();
                Int32  p   = 20;//每页条数
                string num = ConfigurationManager.ConnectionStrings["sensornum"].ToString();
                if (num != "")
                {
                    p = Convert.ToInt32(num);
                }
                int pages = Convert.ToInt32(Math.Ceiling(total / p));
                for (int i = 0; i < pages; i++)
                {
                    ListItem list = new ListItem((i + 1).ToString(), "between " + (1 + i * p) + " and " + (i * p + p));
                    ddl_page.Items.Add(list);
                }
            }
            else
            {
                ddl_page.Items.Clear();
                ListItem list = new ListItem("1", "between 0 and 0");
                ddl_page.Items.Add(list);
            }
        }
        else
        {
            ListItem item1 = new ListItem("--请选择--", "0");
            ddl_gongzuomian.Items.Insert(0, item1);
            ddl_page.Items.Clear();
            ListItem list = new ListItem("1", "between 0 and 0");
            ddl_page.Items.Add(list);
        }
        SystemTool.JavascriptShow(this, "requestData()");
    }