示例#1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">相应的数据实体</param>
 /// <returns>真表示有记录被更新,否表示没有记录被更新</returns>
 public bool Update(RelayTest.Model.ModelSYSTEM_USER model)
 {
     try
     {
         Log.Info("BllSYSTEM_USER->Update---START");
         ConnectionOpen();
         dal.SetDBAccess(GetDBAccess());
         return(dal.Update(model));
     }
     catch (Exception ex)
     {
         Log.Error("BllSYSTEM_USER->Update---FAILED", ex);
         throw ex;
     }
     finally
     {
         ConnectionClose();
         Log.Info("BllSYSTEM_USER->Update---finally");
     }
 }
示例#2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(RelayTest.Model.ModelSYSTEM_USER model)
 {
     try
     {
         Log.Info("BllSYSTEM_USER->Add---START");
         ConnectionOpen();
         dal.SetDBAccess(GetDBAccess());
         dal.Add(model);
     }
     catch (Exception ex)
     {
         Log.Error("BllSYSTEM_USER->Add---FAILED", ex);
         throw ex;
     }
     finally
     {
         ConnectionClose();
         Log.Info("BllSYSTEM_USER->Add---finally");
     }
 }
示例#3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public RelayTest.Model.ModelSYSTEM_USER GetModel(string F_USER_ID)
        {
            try
            {
                Log.Info("DalSYSTEM_USER->GetModel---START");
                StringBuilder strSql = new StringBuilder();
                strSql.Append("select ");
                //用户编号
                strSql.Append("F_USER_ID,  ");
                //真实姓名
                strSql.Append("F_USER_NAME,  ");
                //密码
                strSql.Append("F_PASSWORD,  ");
                //联系电话
                strSql.Append("F_PHONE,  ");
                //是否是上位机用户
                strSql.Append("F_ISSWJ,  ");
                //创建时间
                strSql.Append("F_CREATE_TIME,  ");
                //操作员
                strSql.Append("F_OPERATOR_ID,  ");
                //操作时间
                strSql.Append("F_OPERATIONTIME,  ");
                //是否删除
                strSql.Append("F_DEL  ");
                strSql.Append("  from T_SYSTEM_USER ");
                strSql.Append(" where 1=1 AND  F_USER_ID=:F_USER_ID ");
                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_USER_ID", OracleType.VarChar, 10)
                };
                parameters[0].Value = F_USER_ID;


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

                if (ds.Tables[0].Rows.Count > 0)
                {
                    model.F_USER_ID   = ds.Tables[0].Rows[0]["F_USER_ID"].ToString();
                    model.F_USER_NAME = ds.Tables[0].Rows[0]["F_USER_NAME"].ToString();
                    model.F_PASSWORD  = ds.Tables[0].Rows[0]["F_PASSWORD"].ToString();
                    model.F_PHONE     = ds.Tables[0].Rows[0]["F_PHONE"].ToString();
                    if (ds.Tables[0].Rows[0]["F_ISSWJ"].ToString() != "")
                    {
                        model.F_ISSWJ = decimal.Parse(ds.Tables[0].Rows[0]["F_ISSWJ"].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("DalSYSTEM_USER->GetModel---FAILED", ex);
                throw ex;
            }
        }
示例#4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(RelayTest.Model.ModelSYSTEM_USER model)
        {
            try
            {
                Log.Info("DalSYSTEM_USER->Add---START");
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into T_SYSTEM_USER(");

                //用户编号
                strSql.Append("  F_USER_ID,");
                //真实姓名
                strSql.Append("  F_USER_NAME,");
                //密码
                strSql.Append("  F_PASSWORD,");
                //联系电话
                strSql.Append("  F_PHONE,");
                //是否是上位机用户
                strSql.Append("  F_ISSWJ,");
                //创建时间
                strSql.Append("  F_CREATE_TIME,");
                //操作员
                strSql.Append("  F_OPERATOR_ID,");
                //操作时间
                strSql.Append("  F_OPERATIONTIME,");
                //是否删除
                strSql.Append("  F_DEL");
                strSql.Append(") values (");
                strSql.Append(" :F_USER_ID,");
                strSql.Append(" :F_USER_NAME,");
                strSql.Append(" :F_PASSWORD,");
                strSql.Append(" :F_PHONE,");
                strSql.Append(" :F_ISSWJ,");
                strSql.Append(" :F_CREATE_TIME,");
                strSql.Append(" :F_OPERATOR_ID,");
                strSql.Append(" :F_OPERATIONTIME,");
                strSql.Append(" :F_DEL");
                strSql.Append(") ");

                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_USER_ID",       OracleType.VarChar,    10),
                    new OracleParameter(":F_USER_NAME",     OracleType.VarChar,   100),
                    new OracleParameter(":F_PASSWORD",      OracleType.VarChar,   128),
                    new OracleParameter(":F_PHONE",         OracleType.VarChar,    20),
                    new OracleParameter(":F_ISSWJ",         OracleType.Number,      4),
                    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_USER_ID == null)
                {
                    parameters[0].Value = DBNull.Value;
                }
                else
                {
                    parameters[0].Value = model.F_USER_ID;
                }

                //真实姓名
                if (model.F_USER_NAME == null)
                {
                    parameters[1].Value = DBNull.Value;
                }
                else
                {
                    parameters[1].Value = model.F_USER_NAME;
                }

                //密码
                if (model.F_PASSWORD == null)
                {
                    parameters[2].Value = DBNull.Value;
                }
                else
                {
                    parameters[2].Value = model.F_PASSWORD;
                }

                //联系电话
                if (model.F_PHONE == null)
                {
                    parameters[3].Value = DBNull.Value;
                }
                else
                {
                    parameters[3].Value = model.F_PHONE;
                }

                //是否是上位机用户
                if (model.F_ISSWJ == null)
                {
                    parameters[4].Value = DBNull.Value;
                }
                else
                {
                    parameters[4].Value = model.F_ISSWJ;
                }

                //创建时间
                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("DalSYSTEM_USER->Add---FAILED", ex);
                throw ex;
            }
        }
示例#5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(RelayTest.Model.ModelSYSTEM_USER model)
        {
            try
            {
                Log.Info("DalSYSTEM_USER->Update---START");
                StringBuilder strSql = new StringBuilder();
                strSql.Append("update T_SYSTEM_USER set ");

                //用户编号
                strSql.Append(" F_USER_ID = :F_USER_ID , ");

                //真实姓名
                strSql.Append(" F_USER_NAME = :F_USER_NAME , ");

                //密码
                strSql.Append(" F_PASSWORD = :F_PASSWORD , ");

                //联系电话
                strSql.Append(" F_PHONE = :F_PHONE , ");

                //是否是上位机用户
                strSql.Append(" F_ISSWJ = :F_ISSWJ , ");

                //操作员
                strSql.Append(" F_OPERATOR_ID = :F_OPERATOR_ID , ");

                //操作时间
                strSql.Append(" F_OPERATIONTIME = :F_OPERATIONTIME , ");

                //是否删除
                strSql.Append(" F_DEL = :F_DEL  ");

                strSql.Append(" where F_USER_ID=:F_USER_ID  ");

                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_USER_ID",       OracleType.VarChar,    10),

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

                    new OracleParameter(":F_PASSWORD",      OracleType.VarChar,   128),

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

                    new OracleParameter(":F_ISSWJ",         OracleType.Number,      4),

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

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

                    new OracleParameter(":F_DEL",           OracleType.Number, 4)
                };
                //用户编号
                if (model.F_USER_ID == null)
                {
                    parameters[0].Value = DBNull.Value;
                }
                else
                {
                    parameters[0].Value = model.F_USER_ID;
                }
                //真实姓名
                if (model.F_USER_NAME == null)
                {
                    parameters[1].Value = DBNull.Value;
                }
                else
                {
                    parameters[1].Value = model.F_USER_NAME;
                }
                //密码
                if (model.F_PASSWORD == null)
                {
                    parameters[2].Value = DBNull.Value;
                }
                else
                {
                    parameters[2].Value = model.F_PASSWORD;
                }
                //联系电话
                if (model.F_PHONE == null)
                {
                    parameters[3].Value = DBNull.Value;
                }
                else
                {
                    parameters[3].Value = model.F_PHONE;
                }
                //是否是上位机用户
                if (model.F_ISSWJ == null)
                {
                    parameters[4].Value = DBNull.Value;
                }
                else
                {
                    parameters[4].Value = model.F_ISSWJ;
                }
                //操作员
                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("DalSYSTEM_USER->Update---FAILED", ex);
                throw ex;
            }
        }
示例#6
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <RelayTest.Model.ModelSYSTEM_USER> DataTableToList(DataTable dt)
        {
            try
            {
                Log.Info("BllSYSTEM_USER->DataTableToList---START");
                ConnectionOpen();
                dal.SetDBAccess(GetDBAccess());
                List <RelayTest.Model.ModelSYSTEM_USER> modelList = new List <RelayTest.Model.ModelSYSTEM_USER>();
                int rowsCount = dt.Rows.Count;
                if (rowsCount > 0)
                {
                    RelayTest.Model.ModelSYSTEM_USER model;
                    for (int n = 0; n < rowsCount; n++)
                    {
                        model = new RelayTest.Model.ModelSYSTEM_USER();

                        //用户编号
                        model.F_USER_ID = dt.Rows[n]["F_USER_ID"].ToString();

                        //真实姓名
                        model.F_USER_NAME = dt.Rows[n]["F_USER_NAME"].ToString();

                        //密码
                        model.F_PASSWORD = dt.Rows[n]["F_PASSWORD"].ToString();

                        //联系电话
                        model.F_PHONE = dt.Rows[n]["F_PHONE"].ToString();

                        //是否是上位机用户
                        if (dt.Rows[n]["F_ISSWJ"].ToString() != "")
                        {
                            model.F_ISSWJ = decimal.Parse(dt.Rows[n]["F_ISSWJ"].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());
                        }


                        modelList.Add(model);
                    }
                }
                return(modelList);
            }
            catch (Exception ex)
            {
                Log.Error("BllSYSTEM_USER->DataTableToList---FAILED", ex);
                throw ex;
            }
            finally
            {
                ConnectionClose();
                Log.Info("BllSYSTEM_USER->DataTableToList---finally");
            }
        }