Example #1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public EDRS.Model.XT_QX_JSGNFP DataRowToModel(DataRow row)
 {
     EDRS.Model.XT_QX_JSGNFP model = new EDRS.Model.XT_QX_JSGNFP();
     if (row != null)
     {
         if (row["DWBM"] != null)
         {
             model.DWBM = row["DWBM"].ToString();
         }
         if (row["JSBM"] != null)
         {
             model.JSBM = row["JSBM"].ToString();
         }
         if (row["GNBM"] != null)
         {
             model.GNBM = row["GNBM"].ToString();
         }
         if (row["GNCS"] != null)
         {
             model.GNCS = row["GNCS"].ToString();
         }
         if (row["BMBM"] != null)
         {
             model.BMBM = row["BMBM"].ToString();
         }
         if (row["BZ"] != null)
         {
             model.BZ = row["BZ"].ToString();
         }
     }
     return(model);
 }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(EDRS.Model.XT_QX_JSGNFP model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into XT_QX_JSGNFP(");
            strSql.Append("DWBM,JSBM,GNBM,GNCS,BMBM,BZ)");
            strSql.Append(" values (");
            strSql.Append(":DWBM,:JSBM,:GNBM,:GNCS,:BMBM,:BZ)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":DWBM", OracleType.VarChar,  50),
                new OracleParameter(":JSBM", OracleType.Char,      3),
                new OracleParameter(":GNBM", OracleType.VarChar,  50),
                new OracleParameter(":GNCS", OracleType.VarChar, 600),
                new OracleParameter(":BMBM", OracleType.Char,      4),
                new OracleParameter(":BZ",   OracleType.VarChar, 900)
            };
            parameters[0].Value = model.DWBM;
            parameters[1].Value = model.JSBM;
            parameters[2].Value = model.GNBM;
            parameters[3].Value = model.GNCS;
            parameters[4].Value = model.BMBM;
            parameters[5].Value = model.BZ;

            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_JSGNFP model)", "EDRS.OracleDAL.XT_QX_JSGNFP", strSql.ToString(), parameters);
            }

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(EDRS.Model.XT_QX_JSGNFP model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update XT_QX_JSGNFP set ");
            strSql.Append("GNCS=:GNCS,");
            strSql.Append("BMBM=:BMBM,");
            strSql.Append("BZ=:BZ");
            strSql.Append(" where DWBM=:DWBM and JSBM=:JSBM and GNBM=:GNBM ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":GNCS", OracleType.VarChar, 600),
                new OracleParameter(":BMBM", OracleType.Char,      4),
                new OracleParameter(":BZ",   OracleType.VarChar, 900),
                new OracleParameter(":DWBM", OracleType.VarChar,  50),
                new OracleParameter(":JSBM", OracleType.Char,      3),
                new OracleParameter(":GNBM", OracleType.VarChar, 50)
            };
            parameters[0].Value = model.GNCS;
            parameters[1].Value = model.BMBM;
            parameters[2].Value = model.BZ;
            parameters[3].Value = model.DWBM;
            parameters[4].Value = model.JSBM;
            parameters[5].Value = model.GNBM;

            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_JSGNFP model)", "EDRS.OracleDAL.XT_QX_JSGNFP", strSql.ToString(), parameters);
            }
            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public EDRS.Model.XT_QX_JSGNFP GetModel(string DWBM, string JSBM, string GNBM)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select DWBM,JSBM,GNBM,GNCS,BMBM,BZ from XT_QX_JSGNFP ");
            strSql.Append(ConfigHelper.GetConfigString("OrcDBLinq"));
            strSql.Append(" where DWBM=:DWBM and JSBM=:JSBM and GNBM=:GNBM ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":DWBM", OracleType.VarChar, 50),
                new OracleParameter(":JSBM", OracleType.Char,     3),
                new OracleParameter(":GNBM", OracleType.VarChar, 50)
            };
            parameters[0].Value = DWBM;
            parameters[1].Value = JSBM;
            parameters[2].Value = GNBM;

            EDRS.Model.XT_QX_JSGNFP model = new EDRS.Model.XT_QX_JSGNFP();
            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_JSGNFP GetModel(string DWBM,string JSBM,string GNBM)", "EDRS.OracleDAL.XT_QX_JSGNFP", strSql.ToString(), parameters);
            }
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }