Example #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JMP.MDL.jmp_merchantlog GetModel(int l_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select l_id, l_user_id, l_logtype_id, l_ip, l_location, l_info, l_sms, l_time  ");
            strSql.Append("  from jmp_merchantlog ");
            strSql.Append(" where l_id=@l_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@l_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = l_id;


            JMP.MDL.jmp_merchantlog model = new JMP.MDL.jmp_merchantlog();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["l_id"].ToString() != "")
                {
                    model.l_id = int.Parse(ds.Tables[0].Rows[0]["l_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["l_user_id"].ToString() != "")
                {
                    model.l_user_id = int.Parse(ds.Tables[0].Rows[0]["l_user_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["l_logtype_id"].ToString() != "")
                {
                    model.l_logtype_id = int.Parse(ds.Tables[0].Rows[0]["l_logtype_id"].ToString());
                }
                model.l_ip       = ds.Tables[0].Rows[0]["l_ip"].ToString();
                model.l_location = ds.Tables[0].Rows[0]["l_location"].ToString();
                model.l_info     = ds.Tables[0].Rows[0]["l_info"].ToString();
                model.l_sms      = ds.Tables[0].Rows[0]["l_sms"].ToString();
                if (ds.Tables[0].Rows[0]["l_time"].ToString() != "")
                {
                    model.l_time = DateTime.Parse(ds.Tables[0].Rows[0]["l_time"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(JMP.MDL.jmp_merchantlog model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update jmp_merchantlog set ");

            strSql.Append(" l_user_id = @l_user_id , ");
            strSql.Append(" l_logtype_id = @l_logtype_id , ");
            strSql.Append(" l_ip = @l_ip , ");
            strSql.Append(" l_location = @l_location , ");
            strSql.Append(" l_info = @l_info , ");
            strSql.Append(" l_sms = @l_sms , ");
            strSql.Append(" l_time = @l_time  ");
            strSql.Append(" where l_id=@l_id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@l_id",         SqlDbType.Int,       4),
                new SqlParameter("@l_user_id",    SqlDbType.Int,       4),
                new SqlParameter("@l_logtype_id", SqlDbType.Int,       4),
                new SqlParameter("@l_ip",         SqlDbType.NVarChar, -1),
                new SqlParameter("@l_location",   SqlDbType.NVarChar, -1),
                new SqlParameter("@l_info",       SqlDbType.NVarChar, -1),
                new SqlParameter("@l_sms",        SqlDbType.NVarChar, -1),
                new SqlParameter("@l_time",       SqlDbType.DateTime)
            };

            parameters[0].Value = model.l_id;
            parameters[1].Value = model.l_user_id;
            parameters[2].Value = model.l_logtype_id;
            parameters[3].Value = model.l_ip;
            parameters[4].Value = model.l_location;
            parameters[5].Value = model.l_info;
            parameters[6].Value = model.l_sms;
            parameters[7].Value = model.l_time;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(JMP.MDL.jmp_merchantlog model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into jmp_merchantlog(");
            strSql.Append("l_user_id,l_logtype_id,l_ip,l_location,l_info,l_sms,l_time");
            strSql.Append(") values (");
            strSql.Append("@l_user_id,@l_logtype_id,@l_ip,@l_location,@l_info,@l_sms,@l_time");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@l_user_id",    SqlDbType.Int,       4),
                new SqlParameter("@l_logtype_id", SqlDbType.Int,       4),
                new SqlParameter("@l_ip",         SqlDbType.NVarChar, -1),
                new SqlParameter("@l_location",   SqlDbType.NVarChar, -1),
                new SqlParameter("@l_info",       SqlDbType.NVarChar, -1),
                new SqlParameter("@l_sms",        SqlDbType.NVarChar, -1),
                new SqlParameter("@l_time",       SqlDbType.DateTime)
            };

            parameters[0].Value = model.l_user_id;
            parameters[1].Value = model.l_logtype_id;
            parameters[2].Value = model.l_ip;
            parameters[3].Value = model.l_location;
            parameters[4].Value = model.l_info;
            parameters[5].Value = model.l_sms;
            parameters[6].Value = model.l_time;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <JMP.MDL.jmp_merchantlog> DataTableToList(DataTable dt)
        {
            List <JMP.MDL.jmp_merchantlog> modelList = new List <JMP.MDL.jmp_merchantlog>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                JMP.MDL.jmp_merchantlog model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new JMP.MDL.jmp_merchantlog();
                    if (dt.Rows[n]["l_id"].ToString() != "")
                    {
                        model.l_id = int.Parse(dt.Rows[n]["l_id"].ToString());
                    }
                    if (dt.Rows[n]["l_user_id"].ToString() != "")
                    {
                        model.l_user_id = int.Parse(dt.Rows[n]["l_user_id"].ToString());
                    }
                    if (dt.Rows[n]["l_logtype_id"].ToString() != "")
                    {
                        model.l_logtype_id = int.Parse(dt.Rows[n]["l_logtype_id"].ToString());
                    }
                    model.l_ip       = dt.Rows[n]["l_ip"].ToString();
                    model.l_location = dt.Rows[n]["l_location"].ToString();
                    model.l_info     = dt.Rows[n]["l_info"].ToString();
                    model.l_sms      = dt.Rows[n]["l_sms"].ToString();
                    if (dt.Rows[n]["l_time"].ToString() != "")
                    {
                        model.l_time = DateTime.Parse(dt.Rows[n]["l_time"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(JMP.MDL.jmp_merchantlog model)
 {
     return(dal.Update(model));
 }
Example #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(JMP.MDL.jmp_merchantlog model)
 {
     return(dal.Add(model));
 }