コード例 #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public STBC.Model.ST_SUITCLASS DataRowToModel(DataRow row)
 {
     STBC.Model.ST_SUITCLASS model = new STBC.Model.ST_SUITCLASS();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = decimal.Parse(row["ID"].ToString());
         }
         if (row["NAME"] != null)
         {
             model.NAME = row["NAME"].ToString();
         }
         if (row["CODE"] != null)
         {
             model.CODE = row["CODE"].ToString();
         }
         if (row["CEILING"] != null && row["CEILING"].ToString() != "")
         {
             model.CEILING = decimal.Parse(row["CEILING"].ToString());
         }
         if (row["FLOOR"] != null && row["FLOOR"].ToString() != "")
         {
             model.FLOOR = decimal.Parse(row["FLOOR"].ToString());
         }
         if (row["USERID"] != null && row["USERID"].ToString() != "")
         {
             model.USERID = decimal.Parse(row["USERID"].ToString());
         }
     }
     return(model);
 }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(STBC.Model.ST_SUITCLASS model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ST_SUITCLASS(");
            strSql.Append("ID,NAME,CODE,CEILING,FLOOR,USERID)");
            strSql.Append(" values (");
            strSql.Append(":ID,:NAME,:CODE,:CEILING,:FLOOR,:USERID)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":ID",      OracleDbType.Int32,      7),
                new OracleParameter(":NAME",    OracleDbType.Varchar2, 100),
                new OracleParameter(":CODE",    OracleDbType.Varchar2, 100),
                new OracleParameter(":CEILING", OracleDbType.Decimal,    7),
                new OracleParameter(":FLOOR",   OracleDbType.Decimal,    7),
                new OracleParameter(":USERID",  OracleDbType.Int32, 7)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.NAME;
            parameters[2].Value = model.CODE;
            parameters[3].Value = model.CEILING;
            parameters[4].Value = model.FLOOR;
            parameters[5].Value = model.USERID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
ファイル: ST_SUITCLASS.cs プロジェクト: coasline/STBC
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public STBC.Model.ST_SUITCLASS DataRowToModel(DataRow row)
 {
     STBC.Model.ST_SUITCLASS model=new STBC.Model.ST_SUITCLASS();
     if (row != null)
     {
         if(row["ID"]!=null && row["ID"].ToString()!="")
         {
             model.ID=decimal.Parse(row["ID"].ToString());
         }
         if(row["NAME"]!=null)
         {
             model.NAME=row["NAME"].ToString();
         }
         if(row["CODE"]!=null)
         {
             model.CODE=row["CODE"].ToString();
         }
         if(row["CEILING"]!=null && row["CEILING"].ToString()!="")
         {
             model.CEILING=decimal.Parse(row["CEILING"].ToString());
         }
         if(row["FLOOR"]!=null && row["FLOOR"].ToString()!="")
         {
             model.FLOOR=decimal.Parse(row["FLOOR"].ToString());
         }
         if(row["USERID"]!=null && row["USERID"].ToString()!="")
         {
             model.USERID=decimal.Parse(row["USERID"].ToString());
         }
     }
     return model;
 }
コード例 #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(STBC.Model.ST_SUITCLASS model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ST_SUITCLASS set ");
            //strSql.Append("NAME=:NAME,");
            strSql.Append("CODE=:CODE,");
            strSql.Append("CEILING=:CEILING,");
            strSql.Append("FLOOR=:FLOOR");
            //strSql.Append("USERID=:USERID");
            strSql.Append(" where USERID=:USERID and NAME=:NAME");
            OracleParameter[] parameters =
            {
                new OracleParameter(":CODE",    OracleDbType.Varchar2, 100),
                new OracleParameter(":CEILING", OracleDbType.Decimal,    7),
                new OracleParameter(":FLOOR",   OracleDbType.Decimal,    7),
                new OracleParameter(":USERID",  OracleDbType.Int32,      7),
                new OracleParameter(":NAME",    OracleDbType.Varchar2, 100)
            };

            parameters[0].Value = model.CODE;
            parameters[1].Value = model.CEILING;
            parameters[2].Value = model.FLOOR;
            parameters[3].Value = model.USERID;
            parameters[4].Value = model.NAME;
            //parameters[5].Value = model.ID;

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

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

            strSql.Append("select ID,NAME,CODE,CEILING,FLOOR,USERID from ST_SUITCLASS ");
            strSql.Append(" where ID=:ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":ID", OracleDbType.Int32, 22)
            };
            parameters[0].Value = ID;

            STBC.Model.ST_SUITCLASS model = new STBC.Model.ST_SUITCLASS();
            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
ファイル: KnowlgManager.aspx.cs プロジェクト: coasline/STBC
        //创建适宜性级别规则
        protected void btnCreateRule_Click(object sender, EventArgs e)
        {
            //获得用户的id
            int userID = CommonClass.OperateUsers.getUserID();
            STBC.BLL.ST_SUITCLASS suitclassB = new STBC.BLL.ST_SUITCLASS();

            STBC.Model.ST_SUITCLASS suitclassM = new STBC.Model.ST_SUITCLASS();
            suitclassM.NAME = levelLabel1.Text.ToString().Trim();
            suitclassM.CODE = levelName1.Text.ToString().Trim();
            suitclassM.CEILING = (decimal)Math.Round(double.Parse(levelLeft1.Text.ToString().Trim()), 3);
            suitclassM.FLOOR = (decimal)Math.Round(double.Parse(levelRight1.Text.ToString().Trim()), 3);
            suitclassM.USERID = userID;

            STBC.Model.ST_SUITCLASS suitclassM2 = new STBC.Model.ST_SUITCLASS();
            suitclassM2.NAME = levelLabel2.Text.ToString().Trim();
            suitclassM2.CODE = levelName2.Text.ToString().Trim();
            suitclassM2.CEILING = (decimal)Math.Round(double.Parse(levelLeft2.Text.ToString().Trim()), 3);
            suitclassM2.FLOOR = (decimal)Math.Round(double.Parse(levelRight2.Text.ToString().Trim()), 3);
            suitclassM2.USERID = userID;

            STBC.Model.ST_SUITCLASS suitclassM3 = new STBC.Model.ST_SUITCLASS();
            suitclassM3.NAME = levelLabel3.Text.ToString().Trim();
            suitclassM3.CODE = levelName3.Text.ToString().Trim();
            suitclassM3.CEILING = (decimal)Math.Round(double.Parse(levelLeft3.Text.ToString().Trim()), 3);
            suitclassM3.FLOOR = (decimal)Math.Round(double.Parse(levelRight3.Text.ToString().Trim()), 3);
            suitclassM3.USERID = userID;

            STBC.Model.ST_SUITCLASS suitclassM4 = new STBC.Model.ST_SUITCLASS();
            suitclassM4.NAME = levelLabel4.Text.ToString().Trim();
            suitclassM4.CODE = levelName4.Text.ToString().Trim();
            suitclassM4.CEILING = (decimal)Math.Round(double.Parse(levelLeft4.Text.ToString().Trim()), 3);
            suitclassM4.FLOOR = (decimal)Math.Round(double.Parse(levelRight4.Text.ToString().Trim()), 3);
            suitclassM4.USERID = userID;

            if (!suitclassB.Exists(userID, suitclassM.NAME))
            {
                suitclassB.Add(suitclassM);
            }
            else
            {
                suitclassB.Update(suitclassM);
            }
            if (!suitclassB.Exists(userID, suitclassM2.NAME))
            {
                suitclassB.Add(suitclassM2);
            }
            else
            {
                suitclassB.Update(suitclassM2);
            }
            if (!suitclassB.Exists(userID, suitclassM3.NAME))
            {
                suitclassB.Add(suitclassM3);
            }
            else
            {
                suitclassB.Update(suitclassM3);
            }
            if (!suitclassB.Exists(userID, suitclassM4.NAME))
            {
                suitclassB.Add(suitclassM4);
            }
            else
            {
                suitclassB.Update(suitclassM4);
            }
            //提醒用户插入成功
            Response.Write("<script>alert('规则创建成功!');</script>");
        }
コード例 #7
0
ファイル: ST_SUITCLASS.cs プロジェクト: coasline/STBC
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public STBC.Model.ST_SUITCLASS GetModel(decimal ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ID,NAME,CODE,CEILING,FLOOR,USERID from ST_SUITCLASS ");
            strSql.Append(" where ID=:ID ");
            OracleParameter[] parameters = {
                    new OracleParameter(":ID", OracleDbType.Int32,22)			};
            parameters[0].Value = ID;

            STBC.Model.ST_SUITCLASS model=new STBC.Model.ST_SUITCLASS();
            DataSet ds=DbHelperOra.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
コード例 #8
0
        //创建适宜性级别规则
        protected void btnCreateRule_Click(object sender, EventArgs e)
        {
            //获得用户的id
            int userID = CommonClass.OperateUsers.getUserID();

            STBC.BLL.ST_SUITCLASS suitclassB = new STBC.BLL.ST_SUITCLASS();

            STBC.Model.ST_SUITCLASS suitclassM = new STBC.Model.ST_SUITCLASS();
            suitclassM.NAME    = levelLabel1.Text.ToString().Trim();
            suitclassM.CODE    = levelName1.Text.ToString().Trim();
            suitclassM.CEILING = (decimal)Math.Round(double.Parse(levelLeft1.Text.ToString().Trim()), 3);
            suitclassM.FLOOR   = (decimal)Math.Round(double.Parse(levelRight1.Text.ToString().Trim()), 3);
            suitclassM.USERID  = userID;

            STBC.Model.ST_SUITCLASS suitclassM2 = new STBC.Model.ST_SUITCLASS();
            suitclassM2.NAME    = levelLabel2.Text.ToString().Trim();
            suitclassM2.CODE    = levelName2.Text.ToString().Trim();
            suitclassM2.CEILING = (decimal)Math.Round(double.Parse(levelLeft2.Text.ToString().Trim()), 3);
            suitclassM2.FLOOR   = (decimal)Math.Round(double.Parse(levelRight2.Text.ToString().Trim()), 3);
            suitclassM2.USERID  = userID;

            STBC.Model.ST_SUITCLASS suitclassM3 = new STBC.Model.ST_SUITCLASS();
            suitclassM3.NAME    = levelLabel3.Text.ToString().Trim();
            suitclassM3.CODE    = levelName3.Text.ToString().Trim();
            suitclassM3.CEILING = (decimal)Math.Round(double.Parse(levelLeft3.Text.ToString().Trim()), 3);
            suitclassM3.FLOOR   = (decimal)Math.Round(double.Parse(levelRight3.Text.ToString().Trim()), 3);
            suitclassM3.USERID  = userID;

            STBC.Model.ST_SUITCLASS suitclassM4 = new STBC.Model.ST_SUITCLASS();
            suitclassM4.NAME    = levelLabel4.Text.ToString().Trim();
            suitclassM4.CODE    = levelName4.Text.ToString().Trim();
            suitclassM4.CEILING = (decimal)Math.Round(double.Parse(levelLeft4.Text.ToString().Trim()), 3);
            suitclassM4.FLOOR   = (decimal)Math.Round(double.Parse(levelRight4.Text.ToString().Trim()), 3);
            suitclassM4.USERID  = userID;

            if (!suitclassB.Exists(userID, suitclassM.NAME))
            {
                suitclassB.Add(suitclassM);
            }
            else
            {
                suitclassB.Update(suitclassM);
            }
            if (!suitclassB.Exists(userID, suitclassM2.NAME))
            {
                suitclassB.Add(suitclassM2);
            }
            else
            {
                suitclassB.Update(suitclassM2);
            }
            if (!suitclassB.Exists(userID, suitclassM3.NAME))
            {
                suitclassB.Add(suitclassM3);
            }
            else
            {
                suitclassB.Update(suitclassM3);
            }
            if (!suitclassB.Exists(userID, suitclassM4.NAME))
            {
                suitclassB.Add(suitclassM4);
            }
            else
            {
                suitclassB.Update(suitclassM4);
            }
            //提醒用户插入成功
            Response.Write("<script>alert('规则创建成功!');</script>");
        }