コード例 #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public EDRS.Model.XT_QX_GNDY GetModel(string GNBM, string DWBM)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select GNBM,GNMC,FLBM,GNCXJ,GNCT,GNSM,GNXH,GNXSMC,CSCS,DWBM,SFMTCK,SFSC from XT_QX_GNDY ");
            strSql.Append(ConfigHelper.GetConfigString("OrcDBLinq"));
            strSql.Append(" where GNBM=:GNBM and DWBM=:DWBM ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":GNBM", OracleType.VarChar, 50),
                new OracleParameter(":DWBM", OracleType.VarChar, 50)
            };
            parameters[0].Value = GNBM;
            parameters[1].Value = DWBM;

            EDRS.Model.XT_QX_GNDY model = new EDRS.Model.XT_QX_GNDY();
            DataSet ds = null;

            try
            {
                ds = DbHelperOra.Query(strSql.ToString(), parameters);
            }
            catch (Exception ex)
            {
                EDRS.Common.LogHelper.LogError(this.context, "Exception", ex.Message, "public EDRS.Model.XT_QX_GNDY GetModel(string GNBM,string DWBM)", "EDRS.OracleDAL.XT_QX_GNDY", strSql.ToString(), parameters);
            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(EDRS.Model.XT_QX_GNDY model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into XT_QX_GNDY(");
            strSql.Append("GNBM,GNMC,FLBM,GNCXJ,GNCT,GNSM,GNXH,GNXSMC,CSCS,GNCS,DWBM,SFMTCK,SFSC)");
            strSql.Append(" values (");
            strSql.Append(":GNBM,:GNMC,:FLBM,:GNCXJ,:GNCT,:GNSM,:GNXH,:GNXSMC,:CSCS,:GNCS,:DWBM,:SFMTCK,:SFSC)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":GNBM",   OracleType.VarChar,   50),
                new OracleParameter(":GNMC",   OracleType.VarChar,  300),
                new OracleParameter(":FLBM",   OracleType.VarChar,   50),
                new OracleParameter(":GNCXJ",  OracleType.VarChar, 1000),
                new OracleParameter(":GNCT",   OracleType.VarChar, 1000),
                new OracleParameter(":GNSM",   OracleType.VarChar,  600),
                new OracleParameter(":GNXH",   OracleType.Number,     6),
                new OracleParameter(":GNXSMC", OracleType.VarChar,  300),
                new OracleParameter(":CSCS",   OracleType.VarChar,   50),
                new OracleParameter(":GNCS",   OracleType.Clob,    4000),
                new OracleParameter(":DWBM",   OracleType.VarChar,   50),
                new OracleParameter(":SFMTCK", OracleType.Char,       1),
                new OracleParameter(":SFSC",   OracleType.Char, 1)
            };
            parameters[0].Value  = model.GNBM;
            parameters[1].Value  = model.GNMC;
            parameters[2].Value  = model.FLBM;
            parameters[3].Value  = model.GNCXJ;
            parameters[4].Value  = model.GNCT;
            parameters[5].Value  = model.GNSM;
            parameters[6].Value  = model.GNXH;
            parameters[7].Value  = model.GNXSMC;
            parameters[8].Value  = model.CSCS;
            parameters[9].Value  = string.IsNullOrWhiteSpace(model.GNCS) ? " " : model.GNCS;
            parameters[10].Value = model.DWBM;
            parameters[11].Value = model.SFMTCK;
            parameters[12].Value = model.SFSC;

            int rows = 0;

            try
            {
                rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);
            }
            catch (Exception ex)
            {
                EDRS.Common.LogHelper.LogError(this.context, "Exception", ex.Message, "public bool Add(EDRS.Model.XT_QX_GNDY model)", "EDRS.OracleDAL.XT_QX_GNDY", strSql.ToString(), parameters);
            }
            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public EDRS.Model.XT_QX_GNDY DataRowToModel(DataRow row)
 {
     EDRS.Model.XT_QX_GNDY model = new EDRS.Model.XT_QX_GNDY();
     if (row != null)
     {
         if (row["GNBM"] != null)
         {
             model.GNBM = row["GNBM"].ToString();
         }
         if (row["GNMC"] != null)
         {
             model.GNMC = row["GNMC"].ToString();
         }
         if (row["FLBM"] != null)
         {
             model.FLBM = row["FLBM"].ToString();
         }
         if (row["GNCXJ"] != null)
         {
             model.GNCXJ = row["GNCXJ"].ToString();
         }
         if (row["GNCT"] != null)
         {
             model.GNCT = row["GNCT"].ToString();
         }
         if (row["GNSM"] != null)
         {
             model.GNSM = row["GNSM"].ToString();
         }
         if (row["GNXH"] != null && row["GNXH"].ToString() != "")
         {
             model.GNXH = decimal.Parse(row["GNXH"].ToString());
         }
         if (row["GNXSMC"] != null)
         {
             model.GNXSMC = row["GNXSMC"].ToString();
         }
         if (row["CSCS"] != null)
         {
             model.CSCS = row["CSCS"].ToString();
         }
         //model.GNCS=row["GNCS"].ToString();
         if (row["DWBM"] != null)
         {
             model.DWBM = row["DWBM"].ToString();
         }
         if (row["SFMTCK"] != null)
         {
             model.SFMTCK = row["SFMTCK"].ToString();
         }
         if (row["SFSC"] != null)
         {
             model.SFSC = row["SFSC"].ToString();
         }
     }
     return(model);
 }
コード例 #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(EDRS.Model.XT_QX_GNDY model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update XT_QX_GNDY set ");
            strSql.Append("GNMC=:GNMC,");
            strSql.Append("FLBM=:FLBM,");
            strSql.Append("GNCXJ=:GNCXJ,");
            strSql.Append("GNCT=:GNCT,");
            strSql.Append("GNSM=:GNSM,");
            strSql.Append("GNXH=:GNXH,");
            strSql.Append("GNXSMC=:GNXSMC,");
            strSql.Append("CSCS=:CSCS,");
            strSql.Append("GNCS=:GNCS,");
            strSql.Append("SFMTCK=:SFMTCK,");
            strSql.Append("SFSC=:SFSC");
            strSql.Append(" where GNBM=:GNBM and DWBM=:DWBM ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":GNMC",   OracleType.VarChar,  300),
                new OracleParameter(":FLBM",   OracleType.VarChar,   50),
                new OracleParameter(":GNCXJ",  OracleType.VarChar, 1000),
                new OracleParameter(":GNCT",   OracleType.VarChar, 1000),
                new OracleParameter(":GNSM",   OracleType.VarChar,  600),
                new OracleParameter(":GNXH",   OracleType.Number,     6),
                new OracleParameter(":GNXSMC", OracleType.VarChar,  300),
                new OracleParameter(":CSCS",   OracleType.VarChar,   50),
                new OracleParameter(":GNCS",   OracleType.Clob,    4000),
                new OracleParameter(":SFMTCK", OracleType.Char,       1),
                new OracleParameter(":SFSC",   OracleType.Char,       1),
                new OracleParameter(":GNBM",   OracleType.VarChar,   50),
                new OracleParameter(":DWBM",   OracleType.VarChar, 50)
            };
            parameters[0].Value  = model.GNMC;
            parameters[1].Value  = model.FLBM;
            parameters[2].Value  = model.GNCXJ;
            parameters[3].Value  = model.GNCT;
            parameters[4].Value  = model.GNSM;
            parameters[5].Value  = model.GNXH;
            parameters[6].Value  = model.GNXSMC;
            parameters[7].Value  = model.CSCS;
            parameters[8].Value  = string.IsNullOrWhiteSpace(model.GNCS) ? " " : model.GNCS;
            parameters[9].Value  = model.SFMTCK;
            parameters[10].Value = model.SFSC;
            parameters[11].Value = model.GNBM;
            parameters[12].Value = model.DWBM;

            int rows = 0;

            try
            {
                rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);
            }
            catch (Exception ex)
            {
                EDRS.Common.LogHelper.LogError(this.context, "Exception", ex.Message, "public bool Update(EDRS.Model.XT_QX_GNDY model)", "EDRS.OracleDAL.XT_QX_GNDY", strSql.ToString(), parameters);
            }
            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }