Beispiel #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(STBC.Model.ST_CONSTRCONDIT model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ST_CONSTRCONDIT set ");
            //strSql.Append("FACTID=:FACTID,");
            strSql.Append("UNIT=:UNIT,");
            strSql.Append("SYMBOLTYPE=:SYMBOLTYPE,");
            strSql.Append("LIMCONDIT=:LIMCONDIT,");
            strSql.Append("FACTTYPE=:FACTTYPE,");
            //strSql.Append("MEASNAME=:MEASNAME,");
            //strSql.Append("USERID=:USERID");
            strSql.Append(" where FACTID=:FACTID and USERID=:USERID and  MEASNAME=:MEASNAME");
            OracleParameter[] parameters =
            {
                //new OracleParameter(":FACTID", OracleDbType.Int32,7),
                new OracleParameter(":UNIT",       OracleDbType.Varchar2,  20),
                new OracleParameter(":SYMBOLTYPE", OracleDbType.Varchar2,  20),
                new OracleParameter(":LIMCONDIT",  OracleDbType.Varchar2, 200),
                new OracleParameter(":FACTTYPE",   OracleDbType.Varchar2,  20),
                new OracleParameter(":FACTID",     OracleDbType.Int32,      7),
                new OracleParameter(":USERID",     OracleDbType.Int32,      7),
                new OracleParameter(":MEASNAME",   OracleDbType.Varchar2, 100)
            };

            parameters[0].Value = model.UNIT;
            parameters[1].Value = model.SYMBOLTYPE;
            parameters[2].Value = model.LIMCONDIT;
            parameters[3].Value = model.FACTTYPE;
            parameters[4].Value = model.FACTID;
            parameters[5].Value = model.USERID;
            //parameters[6].Value = model.ID;
            parameters[6].Value = model.MEASNAME;
            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public STBC.Model.ST_CONSTRCONDIT DataRowToModel(DataRow row)
 {
     STBC.Model.ST_CONSTRCONDIT model=new STBC.Model.ST_CONSTRCONDIT();
     if (row != null)
     {
         if(row["ID"]!=null && row["ID"].ToString()!="")
         {
             model.ID=decimal.Parse(row["ID"].ToString());
         }
         if(row["FACTID"]!=null && row["FACTID"].ToString()!="")
         {
             model.FACTID=decimal.Parse(row["FACTID"].ToString());
         }
         if(row["UNIT"]!=null)
         {
             model.UNIT=row["UNIT"].ToString();
         }
         if(row["SYMBOLTYPE"]!=null)
         {
             model.SYMBOLTYPE=row["SYMBOLTYPE"].ToString();
         }
         if(row["LIMCONDIT"]!=null)
         {
             model.LIMCONDIT=row["LIMCONDIT"].ToString();
         }
         if(row["FACTTYPE"]!=null)
         {
             model.FACTTYPE=row["FACTTYPE"].ToString();
         }
         if(row["MEASNAME"]!=null)
         {
             model.MEASNAME=row["MEASNAME"].ToString();
         }
         if(row["USERID"]!=null && row["USERID"].ToString()!="")
         {
             model.USERID=decimal.Parse(row["USERID"].ToString());
         }
     }
     return model;
 }
Beispiel #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public STBC.Model.ST_CONSTRCONDIT DataRowToModel(DataRow row)
 {
     STBC.Model.ST_CONSTRCONDIT model = new STBC.Model.ST_CONSTRCONDIT();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = decimal.Parse(row["ID"].ToString());
         }
         if (row["FACTID"] != null && row["FACTID"].ToString() != "")
         {
             model.FACTID = decimal.Parse(row["FACTID"].ToString());
         }
         if (row["UNIT"] != null)
         {
             model.UNIT = row["UNIT"].ToString();
         }
         if (row["SYMBOLTYPE"] != null)
         {
             model.SYMBOLTYPE = row["SYMBOLTYPE"].ToString();
         }
         if (row["LIMCONDIT"] != null)
         {
             model.LIMCONDIT = row["LIMCONDIT"].ToString();
         }
         if (row["FACTTYPE"] != null)
         {
             model.FACTTYPE = row["FACTTYPE"].ToString();
         }
         if (row["MEASNAME"] != null)
         {
             model.MEASNAME = row["MEASNAME"].ToString();
         }
         if (row["USERID"] != null && row["USERID"].ToString() != "")
         {
             model.USERID = decimal.Parse(row["USERID"].ToString());
         }
     }
     return(model);
 }
Beispiel #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(STBC.Model.ST_CONSTRCONDIT model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ST_CONSTRCONDIT(");
            strSql.Append("ID,FACTID,UNIT,SYMBOLTYPE,LIMCONDIT,FACTTYPE,MEASNAME,USERID)");
            strSql.Append(" values (");
            strSql.Append(":ID,:FACTID,:UNIT,:SYMBOLTYPE,:LIMCONDIT,:FACTTYPE,:MEASNAME,:USERID)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":ID",         OracleDbType.Int32,      7),
                new OracleParameter(":FACTID",     OracleDbType.Int32,      7),
                new OracleParameter(":UNIT",       OracleDbType.Varchar2,  20),
                new OracleParameter(":SYMBOLTYPE", OracleDbType.Varchar2,  20),
                new OracleParameter(":LIMCONDIT",  OracleDbType.Varchar2, 200),
                new OracleParameter(":FACTTYPE",   OracleDbType.Varchar2,  20),
                new OracleParameter(":MEASNAME",   OracleDbType.Varchar2, 100),
                new OracleParameter(":USERID",     OracleDbType.Int32, 7)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.FACTID;
            parameters[2].Value = model.UNIT;
            parameters[3].Value = model.SYMBOLTYPE;
            parameters[4].Value = model.LIMCONDIT;
            parameters[5].Value = model.FACTTYPE;
            parameters[6].Value = model.MEASNAME;
            parameters[7].Value = model.USERID;

            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public STBC.Model.ST_CONSTRCONDIT GetModel(decimal ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,FACTID,UNIT,SYMBOLTYPE,LIMCONDIT,FACTTYPE,MEASNAME,USERID from ST_CONSTRCONDIT ");
            strSql.Append(" where ID=:ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":ID", OracleDbType.Int32, 22)
            };
            parameters[0].Value = ID;

            STBC.Model.ST_CONSTRCONDIT model = new STBC.Model.ST_CONSTRCONDIT();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public STBC.Model.ST_CONSTRCONDIT GetModel(decimal ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ID,FACTID,UNIT,SYMBOLTYPE,LIMCONDIT,FACTTYPE,MEASNAME,USERID from ST_CONSTRCONDIT ");
            strSql.Append(" where ID=:ID ");
            OracleParameter[] parameters = {
                    new OracleParameter(":ID", OracleDbType.Int32,22)			};
            parameters[0].Value = ID;

            STBC.Model.ST_CONSTRCONDIT model=new STBC.Model.ST_CONSTRCONDIT();
            DataSet ds=DbHelperOra.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
Beispiel #7
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>");
                }

            }
        }
Beispiel #8
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>");
                }
            }
        }