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

            strSql.Append("update ST_FUZZFUNCT set ");
            strSql.Append("UNIT=:UNIT,");
            strSql.Append("INFLEXION=:INFLEXION,");
            strSql.Append("FUNCTTYPE=:FUNCTTYPE");
            strSql.Append(" where FACTID=:FACTID and  USERID=:USERID");
            OracleParameter[] parameters =
            {
                new OracleParameter(":UNIT",      OracleDbType.Varchar2,  20),
                new OracleParameter(":INFLEXION", OracleDbType.Varchar2, 200),
                new OracleParameter(":FUNCTTYPE", OracleDbType.Varchar2,  20),
                new OracleParameter(":FACTID",    OracleDbType.Int32,      7),
                new OracleParameter(":USERID",    OracleDbType.Int32, 7)
            };
            parameters[0].Value = model.UNIT;
            parameters[1].Value = model.INFLEXION;
            parameters[2].Value = model.FUNCTTYPE;
            parameters[3].Value = model.FACTID;
            parameters[4].Value = model.USERID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(STBC.Model.ST_FUZZFUNCT model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ST_FUZZFUNCT(");
            strSql.Append("ID,FACTID,UNIT,INFLEXION,FUNCTTYPE,MEASNAME,USERID)");
            strSql.Append(" values (");
            strSql.Append(":ID,:FACTID,:UNIT,:INFLEXION,:FUNCTTYPE,:MEASNAME,:USERID)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":ID",        OracleDbType.Int32,      7),
                new OracleParameter(":FACTID",    OracleDbType.Int32,      7),
                new OracleParameter(":UNIT",      OracleDbType.Varchar2,  20),
                new OracleParameter(":INFLEXION", OracleDbType.Varchar2, 200),
                new OracleParameter(":FUNCTTYPE", 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.INFLEXION;
            parameters[4].Value = model.FUNCTTYPE;
            parameters[5].Value = model.MEASNAME;
            parameters[6].Value = model.USERID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public STBC.Model.ST_FUZZFUNCT DataRowToModel(DataRow row)
 {
     STBC.Model.ST_FUZZFUNCT model=new STBC.Model.ST_FUZZFUNCT();
     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["INFLEXION"]!=null)
         {
             model.INFLEXION=row["INFLEXION"].ToString();
         }
         if(row["FUNCTTYPE"]!=null)
         {
             model.FUNCTTYPE=row["FUNCTTYPE"].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;
 }
示例#4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public STBC.Model.ST_FUZZFUNCT DataRowToModel(DataRow row)
 {
     STBC.Model.ST_FUZZFUNCT model = new STBC.Model.ST_FUZZFUNCT();
     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["INFLEXION"] != null)
         {
             model.INFLEXION = row["INFLEXION"].ToString();
         }
         if (row["FUNCTTYPE"] != null)
         {
             model.FUNCTTYPE = row["FUNCTTYPE"].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);
 }
示例#5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public STBC.Model.ST_FUZZFUNCT GetModel(decimal ID)
        {
            StringBuilder strSql = new StringBuilder();

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

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

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

            STBC.Model.ST_FUZZFUNCT model=new STBC.Model.ST_FUZZFUNCT();
            DataSet ds=DbHelperOra.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
示例#7
0
        //模糊函数创建规则构建,创建规则并提交到数据库中
        protected void btn_modelCreated_Click(object sender, EventArgs e)
        {
            //获得用户的id
            int userID = CommonClass.OperateUsers.getUserID();

            string measurename = measureFuzzfunct.SelectedItem.Text;
            STBC.BLL.ST_FUZZFUNCT fuzzfunctB = new STBC.BLL.ST_FUZZFUNCT();
            STBC.Model.ST_FUZZFUNCT fuzzfunctM = new STBC.Model.ST_FUZZFUNCT();
            for (int i = 0; i < lsFuzzName.Count; i++)
            {

                DropDownList ddlFunct = (DropDownList)FuzzfunctGrid.Rows[i].FindControl("ddlFunctSelect");
                string functtype = ddlFunct.SelectedItem.Text;
                //查找到每行因子对应的因子id
                STBC.BLL.ST_FACTDIR factdirB = new STBC.BLL.ST_FACTDIR();
                DataSet ds2 = factdirB.GetList("Name='" + lsFuzzName[i].ToString() + "'");
                DataTable dt2 = ds2.Tables[0];
                int factid = int.Parse(dt2.Rows[0]["ID"].ToString());
                //找到对应的单位
                TextBox txtUn = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtUnit1");
                #region 取得拐点值的设置,并把它插入数据库里面
                if (functtype == "抛物线型")
                {

                    //拼接拐点设置条件
                    TextBox txtPa11 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtPa1");
                    TextBox txtPb11 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtPb1");
                    TextBox txtPb21 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtPb2");
                    TextBox txtPa21 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtPa2");
                    string inflexion = txtPa11.Text + "|" + txtPb11.Text + "|" + txtPb21.Text + "|" + txtPa21.Text;
                    fuzzfunctM.FACTID = factid;
                    fuzzfunctM.FUNCTTYPE = functtype;
                    fuzzfunctM.MEASNAME = measurename;
                    fuzzfunctM.UNIT = txtUn.Text;
                    fuzzfunctM.USERID = userID;
                    fuzzfunctM.INFLEXION = inflexion;
                    //判断数据是否已经存在,如果不存在则插入数据
                    if (!fuzzfunctB.Exists(factid, userID, measurename))
                    {
                        fuzzfunctB.Add(fuzzfunctM);
                    }
                    //如果存在,则更新数据
                    else
                    {
                        fuzzfunctB.Update(fuzzfunctM);
                    }

                }
                else if (functtype == "升半梯形")
                {

                    //拼接拐点设置条件
                    TextBox txtSa1 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtSa");
                    TextBox txtSb1 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtSb");
                    string inflexion = txtSa1.Text + "|" + txtSb1.Text;
                    fuzzfunctM.FACTID = factid;
                    fuzzfunctM.FUNCTTYPE = functtype;
                    fuzzfunctM.MEASNAME = measurename;
                    fuzzfunctM.UNIT = txtUn.Text;
                    fuzzfunctM.USERID = userID;
                    fuzzfunctM.INFLEXION = inflexion;
                    //判断数据是否已经存在,如果不存在则插入数据
                    if (!fuzzfunctB.Exists(factid, userID, measurename))
                    {
                        fuzzfunctB.Add(fuzzfunctM);
                    }
                    //如果存在,则更新数据
                    else
                    {
                        fuzzfunctB.Update(fuzzfunctM);
                    }

                }
                else if (functtype == "降半梯形")
                {
                    //拼接拐点设置条件
                    TextBox txtJa1 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtJa");
                    TextBox txtJb1 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtJb");
                    string inflexion = txtJa1.Text + "|" + txtJb1.Text;
                    fuzzfunctM.FACTID = factid;
                    fuzzfunctM.FUNCTTYPE = functtype;
                    fuzzfunctM.MEASNAME = measurename;
                    fuzzfunctM.UNIT = txtUn.Text;
                    fuzzfunctM.USERID = userID;
                    fuzzfunctM.INFLEXION = inflexion;
                    //判断数据是否已经存在,如果不存在则插入数据
                    if (!fuzzfunctB.Exists(factid, userID, measurename))
                    {
                        fuzzfunctB.Add(fuzzfunctM);
                    }
                    //如果存在,则更新数据
                    else
                    {
                        fuzzfunctB.Update(fuzzfunctM);
                    }

                }
                //特征函数
                else
                {
                    //拼接拐点设置条件
                    TextBox txtGsuit1 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtGsuit");
                    TextBox txtBJsuit1 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtBJsuit");
                    TextBox txtYsuit1 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtYsuit");
                    TextBox txtBsuit1 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtBsuit");
                    string inflexion = txtGsuit1.Text + "|" + txtBJsuit1.Text + "|" + txtYsuit1.Text + "|" + txtBsuit1.Text;
                    fuzzfunctM.FACTID = factid;
                    fuzzfunctM.FUNCTTYPE = functtype;
                    fuzzfunctM.MEASNAME = measurename;
                    fuzzfunctM.UNIT = txtUn.Text;
                    fuzzfunctM.USERID = userID;
                    fuzzfunctM.INFLEXION = inflexion;
                    //判断数据是否已经存在,如果不存在则插入数据
                    if (!fuzzfunctB.Exists(factid, userID, measurename))
                    {
                        fuzzfunctB.Add(fuzzfunctM);
                    }
                    //如果存在,则更新数据
                    else
                    {
                        fuzzfunctB.Update(fuzzfunctM);
                    }

                }
                if (i == lsFuzzName.Count - 1)
                {
                    Response.Write("<script>alert('模糊函数已经创建了!');</script>");
                }
                #endregion

            }
        }
示例#8
0
        //模糊函数创建规则构建,创建规则并提交到数据库中
        protected void btn_modelCreated_Click(object sender, EventArgs e)
        {
            //获得用户的id
            int userID = CommonClass.OperateUsers.getUserID();

            string measurename = measureFuzzfunct.SelectedItem.Text;

            STBC.BLL.ST_FUZZFUNCT   fuzzfunctB = new STBC.BLL.ST_FUZZFUNCT();
            STBC.Model.ST_FUZZFUNCT fuzzfunctM = new STBC.Model.ST_FUZZFUNCT();
            for (int i = 0; i < lsFuzzName.Count; i++)
            {
                DropDownList ddlFunct  = (DropDownList)FuzzfunctGrid.Rows[i].FindControl("ddlFunctSelect");
                string       functtype = ddlFunct.SelectedItem.Text;
                //查找到每行因子对应的因子id
                STBC.BLL.ST_FACTDIR factdirB = new STBC.BLL.ST_FACTDIR();
                DataSet             ds2      = factdirB.GetList("Name='" + lsFuzzName[i].ToString() + "'");
                DataTable           dt2      = ds2.Tables[0];
                int factid = int.Parse(dt2.Rows[0]["ID"].ToString());
                //找到对应的单位
                TextBox txtUn = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtUnit1");
                #region 取得拐点值的设置,并把它插入数据库里面
                if (functtype == "抛物线型")
                {
                    //拼接拐点设置条件
                    TextBox txtPa11   = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtPa1");
                    TextBox txtPb11   = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtPb1");
                    TextBox txtPb21   = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtPb2");
                    TextBox txtPa21   = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtPa2");
                    string  inflexion = txtPa11.Text + "|" + txtPb11.Text + "|" + txtPb21.Text + "|" + txtPa21.Text;
                    fuzzfunctM.FACTID    = factid;
                    fuzzfunctM.FUNCTTYPE = functtype;
                    fuzzfunctM.MEASNAME  = measurename;
                    fuzzfunctM.UNIT      = txtUn.Text;
                    fuzzfunctM.USERID    = userID;
                    fuzzfunctM.INFLEXION = inflexion;
                    //判断数据是否已经存在,如果不存在则插入数据
                    if (!fuzzfunctB.Exists(factid, userID, measurename))
                    {
                        fuzzfunctB.Add(fuzzfunctM);
                    }
                    //如果存在,则更新数据
                    else
                    {
                        fuzzfunctB.Update(fuzzfunctM);
                    }
                }
                else if (functtype == "升半梯形")
                {
                    //拼接拐点设置条件
                    TextBox txtSa1    = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtSa");
                    TextBox txtSb1    = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtSb");
                    string  inflexion = txtSa1.Text + "|" + txtSb1.Text;
                    fuzzfunctM.FACTID    = factid;
                    fuzzfunctM.FUNCTTYPE = functtype;
                    fuzzfunctM.MEASNAME  = measurename;
                    fuzzfunctM.UNIT      = txtUn.Text;
                    fuzzfunctM.USERID    = userID;
                    fuzzfunctM.INFLEXION = inflexion;
                    //判断数据是否已经存在,如果不存在则插入数据
                    if (!fuzzfunctB.Exists(factid, userID, measurename))
                    {
                        fuzzfunctB.Add(fuzzfunctM);
                    }
                    //如果存在,则更新数据
                    else
                    {
                        fuzzfunctB.Update(fuzzfunctM);
                    }
                }
                else if (functtype == "降半梯形")
                {
                    //拼接拐点设置条件
                    TextBox txtJa1    = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtJa");
                    TextBox txtJb1    = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtJb");
                    string  inflexion = txtJa1.Text + "|" + txtJb1.Text;
                    fuzzfunctM.FACTID    = factid;
                    fuzzfunctM.FUNCTTYPE = functtype;
                    fuzzfunctM.MEASNAME  = measurename;
                    fuzzfunctM.UNIT      = txtUn.Text;
                    fuzzfunctM.USERID    = userID;
                    fuzzfunctM.INFLEXION = inflexion;
                    //判断数据是否已经存在,如果不存在则插入数据
                    if (!fuzzfunctB.Exists(factid, userID, measurename))
                    {
                        fuzzfunctB.Add(fuzzfunctM);
                    }
                    //如果存在,则更新数据
                    else
                    {
                        fuzzfunctB.Update(fuzzfunctM);
                    }
                }
                //特征函数
                else
                {
                    //拼接拐点设置条件
                    TextBox txtGsuit1  = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtGsuit");
                    TextBox txtBJsuit1 = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtBJsuit");
                    TextBox txtYsuit1  = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtYsuit");
                    TextBox txtBsuit1  = (TextBox)FuzzfunctGrid.Rows[i].FindControl("txtBsuit");
                    string  inflexion  = txtGsuit1.Text + "|" + txtBJsuit1.Text + "|" + txtYsuit1.Text + "|" + txtBsuit1.Text;
                    fuzzfunctM.FACTID    = factid;
                    fuzzfunctM.FUNCTTYPE = functtype;
                    fuzzfunctM.MEASNAME  = measurename;
                    fuzzfunctM.UNIT      = txtUn.Text;
                    fuzzfunctM.USERID    = userID;
                    fuzzfunctM.INFLEXION = inflexion;
                    //判断数据是否已经存在,如果不存在则插入数据
                    if (!fuzzfunctB.Exists(factid, userID, measurename))
                    {
                        fuzzfunctB.Add(fuzzfunctM);
                    }
                    //如果存在,则更新数据
                    else
                    {
                        fuzzfunctB.Update(fuzzfunctM);
                    }
                }
                if (i == lsFuzzName.Count - 1)
                {
                    Response.Write("<script>alert('模糊函数已经创建了!');</script>");
                }
                #endregion
            }
        }