Пример #1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">相应的数据实体</param>
 /// <returns>真表示有记录被更新,否表示没有记录被更新</returns>
 public bool Update(RelayTest.Model.ModelDEV_UPGRADERECORD model)
 {
     try
     {
         Log.Info("BllDEV_UPGRADERECORD->Update---START");
         ConnectionOpen();
         dal.SetDBAccess(GetDBAccess());
         return(dal.Update(model));
     }
     catch (Exception ex)
     {
         Log.Error("BllDEV_UPGRADERECORD->Update---FAILED", ex);
         throw ex;
     }
     finally
     {
         ConnectionClose();
         Log.Info("BllDEV_UPGRADERECORD->Update---finally");
     }
 }
Пример #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void  Add(RelayTest.Model.ModelDEV_UPGRADERECORD model)
 {
     try
     {
         Log.Info("BllDEV_UPGRADERECORD->Add---START");
         ConnectionOpen();
         dal.SetDBAccess(GetDBAccess());
         dal.Add(model);
     }
     catch (Exception ex)
     {
         Log.Error("BllDEV_UPGRADERECORD->Add---FAILED", ex);
         throw ex;
     }
     finally
     {
         ConnectionClose();
         Log.Info("BllDEV_UPGRADERECORD->Add---finally");
     }
 }
Пример #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <RelayTest.Model.ModelDEV_UPGRADERECORD> DataTableToList(DataTable dt)
        {
            try
            {
                Log.Info("BllDEV_UPGRADERECORD->DataTableToList---START");
                ConnectionOpen();
                dal.SetDBAccess(GetDBAccess());
                List <RelayTest.Model.ModelDEV_UPGRADERECORD> modelList = new List <RelayTest.Model.ModelDEV_UPGRADERECORD>();
                int rowsCount = dt.Rows.Count;
                if (rowsCount > 0)
                {
                    RelayTest.Model.ModelDEV_UPGRADERECORD model;
                    for (int n = 0; n < rowsCount; n++)
                    {
                        model = new RelayTest.Model.ModelDEV_UPGRADERECORD();
                        if (dt.Rows[n]["F_DEV_TYPE"].ToString() != "")
                        {
                            model.F_DEV_TYPE = decimal.Parse(dt.Rows[n]["F_DEV_TYPE"].ToString());
                        }
                        if (dt.Rows[n]["F_CREATE_TIME"].ToString() != "")
                        {
                            model.F_CREATE_TIME = DateTime.Parse(dt.Rows[n]["F_CREATE_TIME"].ToString());
                        }
                        model.F_OPERATOR_ID = dt.Rows[n]["F_OPERATOR_ID"].ToString();
                        if (dt.Rows[n]["F_OPERATIONTIME"].ToString() != "")
                        {
                            model.F_OPERATIONTIME = DateTime.Parse(dt.Rows[n]["F_OPERATIONTIME"].ToString());
                        }
                        if (dt.Rows[n]["F_DEL"].ToString() != "")
                        {
                            model.F_DEL = decimal.Parse(dt.Rows[n]["F_DEL"].ToString());
                        }
                        model.F_DEV_ID           = dt.Rows[n]["F_DEV_ID"].ToString();
                        model.F_DEV_NAME         = dt.Rows[n]["F_DEV_NAME"].ToString();
                        model.F_HARDWARE_VERSION = dt.Rows[n]["F_HARDWARE_VERSION"].ToString();
                        model.F_SOFTWARE_VERSION = dt.Rows[n]["F_SOFTWARE_VERSION"].ToString();
                        if (dt.Rows[n]["F_UPDATE_DATE"].ToString() != "")
                        {
                            model.F_UPDATE_DATE = DateTime.Parse(dt.Rows[n]["F_UPDATE_DATE"].ToString());
                        }
                        if (dt.Rows[n]["F_USED_DATE"].ToString() != "")
                        {
                            model.F_USED_DATE = DateTime.Parse(dt.Rows[n]["F_USED_DATE"].ToString());
                        }
                        if (dt.Rows[n]["F_ATTATCHMENT"].ToString() != "")
                        {
                            model.F_ATTATCHMENT = (byte[])dt.Rows[n]["F_ATTATCHMENT"];
                        }
                        model.F_MEMO = dt.Rows[n]["F_MEMO"].ToString();


                        modelList.Add(model);
                    }
                }
                return(modelList);
            }
            catch (Exception ex)
            {
                Log.Error("BllDEV_UPGRADERECORD->DataTableToList---FAILED", ex);
                throw ex;
            }
            finally
            {
                ConnectionClose();
                Log.Info("BllDEV_UPGRADERECORD->DataTableToList---finally");
            }
        }
Пример #4
0
        /// <summary>
        /// 上传附件
        /// </summary>
        public bool Upload(RelayTest.Model.ModelDEV_UPGRADERECORD model)
        {
            try
            {
                Log.Info("DalDEV_UPGRADERECORD->Update---START");
                StringBuilder strSql = new StringBuilder();
                strSql.Append("update T_DEV_UPGRADERECORD set ");

                strSql.Append(" F_ATTATCHMENT = :F_ATTATCHMENT , ");
                strSql.Append(" F_OPERATIONTIME = :F_OPERATIONTIME , ");
                strSql.Append(" F_OPERATOR_ID = :F_OPERATOR_ID  ");
                strSql.Append(" where F_DEV_TYPE=:F_DEV_TYPE and F_DEV_ID=:F_DEV_ID and F_HARDWARE_VERSION=:F_HARDWARE_VERSION and F_SOFTWARE_VERSION=:F_SOFTWARE_VERSION ");
                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_DEV_TYPE",         OracleType.Number,      8),
                    new OracleParameter(":F_DEV_ID",           OracleType.VarChar,    20),
                    new OracleParameter(":F_HARDWARE_VERSION", OracleType.VarChar,   100),
                    new OracleParameter(":F_SOFTWARE_VERSION", OracleType.VarChar,   100),
                    new OracleParameter(":F_OPERATOR_ID",      OracleType.VarChar,    10),
                    new OracleParameter(":F_OPERATIONTIME",    OracleType.DateTime),
                    new OracleParameter(":F_ATTATCHMENT",      OracleType.Blob),
                };
                parameters[0].Value = model.F_DEV_TYPE;
                parameters[1].Value = model.F_DEV_ID;
                parameters[2].Value = model.F_HARDWARE_VERSION;
                parameters[3].Value = model.F_SOFTWARE_VERSION;


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

                int rows = ExecuteSql(strSql.ToString(), parameters);
                if (rows > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log.Error("DalDEV_UPGRADERECORD->Update---FAILED", ex);
                throw ex;
            }
        }
Пример #5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(RelayTest.Model.ModelDEV_UPGRADERECORD model)
        {
            try
            {
                Log.Info("DalDEV_UPGRADERECORD->Add---START");
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into T_DEV_UPGRADERECORD(");
                strSql.Append("F_DEV_TYPE,F_CREATE_TIME,F_OPERATOR_ID,F_OPERATIONTIME,F_DEL,F_DEV_ID,F_DEV_NAME,F_HARDWARE_VERSION,F_SOFTWARE_VERSION,F_UPDATE_DATE,F_USED_DATE,F_MEMO");
                strSql.Append(") values (");
                strSql.Append(":F_DEV_TYPE,:F_CREATE_TIME,:F_OPERATOR_ID,:F_OPERATIONTIME,:F_DEL,:F_DEV_ID,:F_DEV_NAME,:F_HARDWARE_VERSION,:F_SOFTWARE_VERSION,:F_UPDATE_DATE,:F_USED_DATE,:F_MEMO");
                strSql.Append(") ");

                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_DEV_TYPE",         OracleType.Number,      8),
                    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),
                    new OracleParameter(":F_DEV_ID",           OracleType.VarChar,    20),
                    new OracleParameter(":F_DEV_NAME",         OracleType.VarChar,   100),
                    new OracleParameter(":F_HARDWARE_VERSION", OracleType.VarChar,   100),
                    new OracleParameter(":F_SOFTWARE_VERSION", OracleType.VarChar,   100),
                    new OracleParameter(":F_UPDATE_DATE",      OracleType.DateTime),
                    new OracleParameter(":F_USED_DATE",        OracleType.DateTime),
                    new OracleParameter(":F_MEMO",             OracleType.VarChar, 500)
                };

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

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

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

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

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

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

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

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

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

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

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


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

                ExecuteSql(strSql.ToString(), parameters);
            }
            catch (Exception ex)
            {
                Log.Error("DalDEV_UPGRADERECORD->Add---FAILED", ex);
                throw ex;
            }
        }
Пример #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RelayTest.Model.ModelDEV_UPGRADERECORD GetModel(decimal F_DEV_TYPE, string F_DEV_ID, string F_HARDWARE_VERSION, string F_SOFTWARE_VERSION)
        {
            try
            {
                Log.Info("DalDEV_UPGRADERECORD->GetModel---START");
                StringBuilder strSql = new StringBuilder();
                strSql.Append("select F_DEV_TYPE, F_CREATE_TIME, F_OPERATOR_ID, F_OPERATIONTIME, F_DEL, F_DEV_ID, F_DEV_NAME, F_HARDWARE_VERSION, F_SOFTWARE_VERSION, F_UPDATE_DATE, F_USED_DATE,  F_MEMO  ");
                strSql.Append("  from T_DEV_UPGRADERECORD ");
                strSql.Append(" where 1=1 AND  F_DEV_TYPE=:F_DEV_TYPE and F_DEV_ID=:F_DEV_ID and F_HARDWARE_VERSION=:F_HARDWARE_VERSION and F_SOFTWARE_VERSION=:F_SOFTWARE_VERSION ");
                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_DEV_TYPE",         OracleType.Number,    8),
                    new OracleParameter(":F_DEV_ID",           OracleType.VarChar,  20),
                    new OracleParameter(":F_HARDWARE_VERSION", OracleType.VarChar, 100),
                    new OracleParameter(":F_SOFTWARE_VERSION", OracleType.VarChar, 100)
                };
                parameters[0].Value = F_DEV_TYPE;
                parameters[1].Value = F_DEV_ID;
                parameters[2].Value = F_HARDWARE_VERSION;
                parameters[3].Value = F_SOFTWARE_VERSION;


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

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["F_DEV_TYPE"].ToString() != "")
                    {
                        model.F_DEV_TYPE = decimal.Parse(ds.Tables[0].Rows[0]["F_DEV_TYPE"].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());
                    }
                    model.F_DEV_ID           = ds.Tables[0].Rows[0]["F_DEV_ID"].ToString();
                    model.F_DEV_NAME         = ds.Tables[0].Rows[0]["F_DEV_NAME"].ToString();
                    model.F_HARDWARE_VERSION = ds.Tables[0].Rows[0]["F_HARDWARE_VERSION"].ToString();
                    model.F_SOFTWARE_VERSION = ds.Tables[0].Rows[0]["F_SOFTWARE_VERSION"].ToString();
                    if (ds.Tables[0].Rows[0]["F_UPDATE_DATE"].ToString() != "")
                    {
                        model.F_UPDATE_DATE = DateTime.Parse(ds.Tables[0].Rows[0]["F_UPDATE_DATE"].ToString());
                    }
                    if (ds.Tables[0].Rows[0]["F_USED_DATE"].ToString() != "")
                    {
                        model.F_USED_DATE = DateTime.Parse(ds.Tables[0].Rows[0]["F_USED_DATE"].ToString());
                    }

                    model.F_MEMO = ds.Tables[0].Rows[0]["F_MEMO"].ToString();

                    return(model);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Log.Error("DalDEV_UPGRADERECORD->GetModel---FAILED", ex);
                throw ex;
            }
        }