Пример #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RelayTest.Model.ModelDEV_LOAD_TO_SUB GetModel(string F_SUBORDINATE_ID, string F_LOAD_ID)
        {
            try
            {
                Log.Info("DalDEV_LOAD_TO_SUB->GetModel---START");
                StringBuilder strSql = new StringBuilder();
                strSql.Append("select F_AFFILIATION_ID, F_AFFILIATION_NAME, F_LOAD_ID, F_LOAD_NAME, F_MEMO, F_CREATE_TIME, F_OPERATOR_ID, F_OPERATIONTIME, F_DEL  ");
                strSql.Append("  from T_DEV_LOAD_TO_SUB ");
                strSql.Append(" where 1=1 AND  F_AFFILIATION_ID=:F_AFFILIATION_ID and F_LOAD_ID=:F_LOAD_ID ");
                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_AFFILIATION_ID", OracleType.VarChar, 20),
                    new OracleParameter(":F_LOAD_ID",        OracleType.VarChar, 20)
                };
                parameters[0].Value = F_SUBORDINATE_ID;
                parameters[1].Value = F_LOAD_ID;


                RelayTest.Model.ModelDEV_LOAD_TO_SUB model = new RelayTest.Model.ModelDEV_LOAD_TO_SUB();
                DataSet ds = Query(strSql.ToString(), parameters);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    model.F_SUBORDINATE_ID   = ds.Tables[0].Rows[0]["F_AFFILIATION_ID"].ToString();
                    model.F_SUBORDINATE_NAME = ds.Tables[0].Rows[0]["F_AFFILIATION_NAME"].ToString();
                    model.F_LOAD_ID          = ds.Tables[0].Rows[0]["F_LOAD_ID"].ToString();
                    model.F_LOAD_NAME        = ds.Tables[0].Rows[0]["F_LOAD_NAME"].ToString();
                    model.F_MEMO             = ds.Tables[0].Rows[0]["F_MEMO"].ToString();
                    if (ds.Tables[0].Rows[0]["F_CREATE_TIME"].ToString() != "")
                    {
                        model.F_CREATE_TIME = DateTime.Parse(ds.Tables[0].Rows[0]["F_CREATE_TIME"].ToString());
                    }
                    model.F_OPERATOR_ID = ds.Tables[0].Rows[0]["F_OPERATOR_ID"].ToString();
                    if (ds.Tables[0].Rows[0]["F_OPERATIONTIME"].ToString() != "")
                    {
                        model.F_OPERATIONTIME = DateTime.Parse(ds.Tables[0].Rows[0]["F_OPERATIONTIME"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["F_DEL"].ToString() != "")
                    {
                        model.F_DEL = decimal.Parse(ds.Tables[0].Rows[0]["F_DEL"].ToString());
                    }

                    return(model);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Log.Error("DalDEV_LOAD_TO_SUB->GetModel---FAILED", ex);
                throw ex;
            }
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(RelayTest.Model.ModelDEV_LOAD_TO_SUB model)
        {
            try
            {
                Log.Info("DalDEV_LOAD_TO_SUB->Add---START");
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into T_DEV_LOAD_TO_SUB(");
                strSql.Append("F_AFFILIATION_ID,F_AFFILIATION_NAME,F_LOAD_ID,F_LOAD_NAME,F_MEMO,F_CREATE_TIME,F_OPERATOR_ID,F_OPERATIONTIME,F_DEL");
                strSql.Append(") values (");
                strSql.Append(":F_AFFILIATION_ID,:F_AFFILIATION_NAME,:F_LOAD_ID,:F_LOAD_NAME,:F_MEMO,:F_CREATE_TIME,:F_OPERATOR_ID,:F_OPERATIONTIME,:F_DEL");
                strSql.Append(") ");

                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_AFFILIATION_ID",   OracleType.VarChar,    20),
                    new OracleParameter(":F_AFFILIATION_NAME", OracleType.VarChar,   100),
                    new OracleParameter(":F_LOAD_ID",          OracleType.VarChar,    20),
                    new OracleParameter(":F_LOAD_NAME",        OracleType.VarChar,   100),
                    new OracleParameter(":F_MEMO",             OracleType.VarChar,   500),
                    new OracleParameter(":F_CREATE_TIME",      OracleType.DateTime),
                    new OracleParameter(":F_OPERATOR_ID",      OracleType.VarChar,    10),
                    new OracleParameter(":F_OPERATIONTIME",    OracleType.DateTime),
                    new OracleParameter(":F_DEL",              OracleType.Number, 4)
                };

                if (model.F_SUBORDINATE_ID == null)
                {
                    parameters[0].Value = DBNull.Value;
                }
                else
                {
                    parameters[0].Value = model.F_SUBORDINATE_ID;
                }

                if (model.F_SUBORDINATE_NAME == null)
                {
                    parameters[1].Value = DBNull.Value;
                }
                else
                {
                    parameters[1].Value = model.F_SUBORDINATE_NAME;
                }

                if (model.F_LOAD_ID == null)
                {
                    parameters[2].Value = DBNull.Value;
                }
                else
                {
                    parameters[2].Value = model.F_LOAD_ID;
                }

                if (model.F_LOAD_NAME == null)
                {
                    parameters[3].Value = DBNull.Value;
                }
                else
                {
                    parameters[3].Value = model.F_LOAD_NAME;
                }

                if (model.F_MEMO == null)
                {
                    parameters[4].Value = DBNull.Value;
                }
                else
                {
                    parameters[4].Value = model.F_MEMO;
                }

                if (model.F_CREATE_TIME == null)
                {
                    parameters[5].Value = DBNull.Value;
                }
                else
                {
                    parameters[5].Value = model.F_CREATE_TIME;
                }

                if (model.F_OPERATOR_ID == null)
                {
                    parameters[6].Value = DBNull.Value;
                }
                else
                {
                    parameters[6].Value = model.F_OPERATOR_ID;
                }

                if (model.F_OPERATIONTIME == null)
                {
                    parameters[7].Value = DBNull.Value;
                }
                else
                {
                    parameters[7].Value = model.F_OPERATIONTIME;
                }

                if (model.F_DEL == null)
                {
                    parameters[8].Value = DBNull.Value;
                }
                else
                {
                    parameters[8].Value = model.F_DEL;
                }

                ExecuteSql(strSql.ToString(), parameters);
            }
            catch (Exception ex)
            {
                Log.Error("DalDEV_LOAD_TO_SUB->Add---FAILED", ex);
                throw ex;
            }
        }
Пример #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(RelayTest.Model.ModelDEV_LOAD_TO_SUB model)
        {
            try
            {
                Log.Info("DalDEV_LOAD_TO_SUB->Update---START");
                StringBuilder strSql = new StringBuilder();
                strSql.Append("update T_DEV_LOAD_TO_SUB set ");

                strSql.Append(" F_AFFILIATION_ID = :F_AFFILIATION_ID , ");
                strSql.Append(" F_AFFILIATION_NAME = :F_AFFILIATION_NAME , ");
                strSql.Append(" F_LOAD_ID = :F_LOAD_ID , ");
                strSql.Append(" F_LOAD_NAME = :F_LOAD_NAME , ");
                strSql.Append(" F_MEMO = :F_MEMO , ");
                strSql.Append(" F_OPERATOR_ID = :F_OPERATOR_ID , ");
                strSql.Append(" F_OPERATIONTIME = :F_OPERATIONTIME , ");
                strSql.Append(" F_DEL = :F_DEL  ");
                strSql.Append(" where F_AFFILIATION_ID=:F_AFFILIATION_ID and F_LOAD_ID=:F_LOAD_ID  ");

                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_AFFILIATION_ID",   OracleType.VarChar,    20),

                    new OracleParameter(":F_AFFILIATION_NAME", OracleType.VarChar,   100),

                    new OracleParameter(":F_LOAD_ID",          OracleType.VarChar,    20),

                    new OracleParameter(":F_LOAD_NAME",        OracleType.VarChar,   100),

                    new OracleParameter(":F_MEMO",             OracleType.VarChar,   500),

                    new OracleParameter(":F_OPERATOR_ID",      OracleType.VarChar,    10),

                    new OracleParameter(":F_OPERATIONTIME",    OracleType.DateTime),

                    new OracleParameter(":F_DEL",              OracleType.Number, 4)
                };
                if (model.F_SUBORDINATE_ID == null)
                {
                    parameters[0].Value = DBNull.Value;
                }
                else
                {
                    parameters[0].Value = model.F_SUBORDINATE_ID;
                }
                if (model.F_SUBORDINATE_NAME == null)
                {
                    parameters[1].Value = DBNull.Value;
                }
                else
                {
                    parameters[1].Value = model.F_SUBORDINATE_NAME;
                }
                if (model.F_LOAD_ID == null)
                {
                    parameters[2].Value = DBNull.Value;
                }
                else
                {
                    parameters[2].Value = model.F_LOAD_ID;
                }
                if (model.F_LOAD_NAME == null)
                {
                    parameters[3].Value = DBNull.Value;
                }
                else
                {
                    parameters[3].Value = model.F_LOAD_NAME;
                }
                if (model.F_MEMO == null)
                {
                    parameters[4].Value = DBNull.Value;
                }
                else
                {
                    parameters[4].Value = model.F_MEMO;
                }
                if (model.F_OPERATOR_ID == null)
                {
                    parameters[5].Value = DBNull.Value;
                }
                else
                {
                    parameters[5].Value = model.F_OPERATOR_ID;
                }
                if (model.F_OPERATIONTIME == null)
                {
                    parameters[6].Value = DBNull.Value;
                }
                else
                {
                    parameters[6].Value = model.F_OPERATIONTIME;
                }
                if (model.F_DEL == null)
                {
                    parameters[7].Value = DBNull.Value;
                }
                else
                {
                    parameters[7].Value = model.F_DEL;
                }

                int rows = ExecuteSql(strSql.ToString(), parameters);
                if (rows > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log.Error("DalDEV_LOAD_TO_SUB->Update---FAILED", ex);
                throw ex;
            }
        }