Exemple #1
0
        //重建限制性条件
        protected void btn_limitativeRule_Click(object sender, EventArgs e)
        {
            //获得用户的id
            int userID = CommonClass.OperateUsers.getUserID();
            //措施的名字
            string measurename = measureLimit.SelectedItem.Text;

            STBC.BLL.ST_CONSTRCONDIT constrconditB = new STBC.BLL.ST_CONSTRCONDIT();
            STBC.Model.ST_CONSTRCONDIT constrconditM = new STBC.Model.ST_CONSTRCONDIT();

            for (int i = 0; i < lsLimitName.Count; i++)
            {
                //查找到每行因子对应的因子id
                STBC.BLL.ST_FACTDIR factdirB = new STBC.BLL.ST_FACTDIR();
                DataSet ds2 = factdirB.GetList("Name='" + lsLimitName[i].ToString() + "'");
                DataTable dt2 = ds2.Tables[0];
                int factid = int.Parse(dt2.Rows[0]["ID"].ToString());

                //获取到单位,比如平方米等等
                TextBox txtUnit21 = (TextBox)LimcondGrid.Rows[i].FindControl("txtUnit2");
                DropDownList ddlFactType1 = (DropDownList)LimcondGrid.Rows[i].FindControl("ddlFactType");
                //如果是数值类型
                if (ddlFactType1.SelectedItem.Text == "数值类型")
                {
                    //获取到底是>,<,=类型
                    DropDownList ddlContType1 = (DropDownList)LimcondGrid.Rows[i].FindControl("ddlContType");
                    //获取限制条件的文本
                    TextBox txtLimitC1 = (TextBox)LimcondGrid.Rows[i].FindControl("txtLimitC");

                    constrconditM.FACTID = factid;
                    constrconditM.FACTTYPE = ddlFactType1.SelectedItem.Text;
                    constrconditM.MEASNAME = measurename;
                    constrconditM.SYMBOLTYPE = ddlContType1.SelectedItem.Text;
                    constrconditM.USERID = userID;
                    constrconditM.UNIT = txtUnit21.Text.ToString().Trim();
                    constrconditM.LIMCONDIT = txtLimitC1.Text.ToString().Trim();
                    //插入到数据库里面
                    if (!constrconditB.Exists(userID, factid, measurename))
                    {
                        constrconditB.Add(constrconditM);
                    }
                    else
                    {
                        constrconditB.Update(constrconditM);
                    }
                }
                //否则
                else
                {
                    //获取in类型
                    DropDownList ddlIntype1 = (DropDownList)LimcondGrid.Rows[i].FindControl("ddlIntype");
                    TextBox txtLimitC1 = (TextBox)LimcondGrid.Rows[i].FindControl("txtLimitC");

                    constrconditM.FACTID = factid;
                    constrconditM.FACTTYPE = ddlFactType1.SelectedItem.Text;
                    constrconditM.MEASNAME = measurename;
                    constrconditM.SYMBOLTYPE = ddlIntype1.SelectedItem.Text;
                    constrconditM.USERID = userID;
                    constrconditM.UNIT = txtUnit21.Text.ToString().Trim();
                    constrconditM.LIMCONDIT = txtLimitC1.Text.ToString().Trim();
                    //插入到数据库里面
                    if (!constrconditB.Exists(userID, factid, measurename))
                    {
                        constrconditB.Add(constrconditM);
                    }
                    else
                    {
                        constrconditB.Update(constrconditM);
                    }
                }
                if (i == lsLimitName.Count - 1)
                {
                    Response.Write("<script>alert('限制条件已经创建了!');</script>");
                }

            }
        }
Exemple #2
0
        //重建限制性条件
        protected void btn_limitativeRule_Click(object sender, EventArgs e)
        {
            //获得用户的id
            int userID = CommonClass.OperateUsers.getUserID();
            //措施的名字
            string measurename = measureLimit.SelectedItem.Text;

            STBC.BLL.ST_CONSTRCONDIT   constrconditB = new STBC.BLL.ST_CONSTRCONDIT();
            STBC.Model.ST_CONSTRCONDIT constrconditM = new STBC.Model.ST_CONSTRCONDIT();

            for (int i = 0; i < lsLimitName.Count; i++)
            {
                //查找到每行因子对应的因子id
                STBC.BLL.ST_FACTDIR factdirB = new STBC.BLL.ST_FACTDIR();
                DataSet             ds2      = factdirB.GetList("Name='" + lsLimitName[i].ToString() + "'");
                DataTable           dt2      = ds2.Tables[0];
                int factid = int.Parse(dt2.Rows[0]["ID"].ToString());

                //获取到单位,比如平方米等等
                TextBox      txtUnit21    = (TextBox)LimcondGrid.Rows[i].FindControl("txtUnit2");
                DropDownList ddlFactType1 = (DropDownList)LimcondGrid.Rows[i].FindControl("ddlFactType");
                //如果是数值类型
                if (ddlFactType1.SelectedItem.Text == "数值类型")
                {
                    //获取到底是>,<,=类型
                    DropDownList ddlContType1 = (DropDownList)LimcondGrid.Rows[i].FindControl("ddlContType");
                    //获取限制条件的文本
                    TextBox txtLimitC1 = (TextBox)LimcondGrid.Rows[i].FindControl("txtLimitC");

                    constrconditM.FACTID     = factid;
                    constrconditM.FACTTYPE   = ddlFactType1.SelectedItem.Text;
                    constrconditM.MEASNAME   = measurename;
                    constrconditM.SYMBOLTYPE = ddlContType1.SelectedItem.Text;
                    constrconditM.USERID     = userID;
                    constrconditM.UNIT       = txtUnit21.Text.ToString().Trim();
                    constrconditM.LIMCONDIT  = txtLimitC1.Text.ToString().Trim();
                    //插入到数据库里面
                    if (!constrconditB.Exists(userID, factid, measurename))
                    {
                        constrconditB.Add(constrconditM);
                    }
                    else
                    {
                        constrconditB.Update(constrconditM);
                    }
                }
                //否则
                else
                {
                    //获取in类型
                    DropDownList ddlIntype1 = (DropDownList)LimcondGrid.Rows[i].FindControl("ddlIntype");
                    TextBox      txtLimitC1 = (TextBox)LimcondGrid.Rows[i].FindControl("txtLimitC");

                    constrconditM.FACTID     = factid;
                    constrconditM.FACTTYPE   = ddlFactType1.SelectedItem.Text;
                    constrconditM.MEASNAME   = measurename;
                    constrconditM.SYMBOLTYPE = ddlIntype1.SelectedItem.Text;
                    constrconditM.USERID     = userID;
                    constrconditM.UNIT       = txtUnit21.Text.ToString().Trim();
                    constrconditM.LIMCONDIT  = txtLimitC1.Text.ToString().Trim();
                    //插入到数据库里面
                    if (!constrconditB.Exists(userID, factid, measurename))
                    {
                        constrconditB.Add(constrconditM);
                    }
                    else
                    {
                        constrconditB.Update(constrconditM);
                    }
                }
                if (i == lsLimitName.Count - 1)
                {
                    Response.Write("<script>alert('限制条件已经创建了!');</script>");
                }
            }
        }