Beispiel #1
0
        public int Update(Model.Operation_LogModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Operation_Log set ");
            strSql.Append("Mobile=@Mobile,OrderCode=@OrderCode,LStatus=@LStatus,Status=@Status,OperationType=@OperationType,Description=@Description,CreateTime=@CreateTime,UpdateTime=@UpdateTime,UserName=@UserName,Remark=@Remark,HideContent=@HideContent ");
            strSql.Append(" where Id=@Id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Mobile", DbTool.FixSqlParameter(model.Mobile))
                ,                           new SqlParameter("@OrderCode", DbTool.FixSqlParameter(model.OrderCode))
                ,                           new SqlParameter("@LStatus", DbTool.FixSqlParameter(model.LStatus))
                ,                           new SqlParameter("@Status", DbTool.FixSqlParameter(model.Status))
                ,                           new SqlParameter("@OperationType", DbTool.FixSqlParameter(model.OperationType))
                ,                           new SqlParameter("@Description", DbTool.FixSqlParameter(model.Description))
                ,                           new SqlParameter("@CreateTime", DbTool.FixSqlParameter(model.CreateTime))
                ,                           new SqlParameter("@UpdateTime", DbTool.FixSqlParameter(model.UpdateTime))
                ,                           new SqlParameter("@UserName", DbTool.FixSqlParameter(model.UserName))
                ,                           new SqlParameter("@Remark", DbTool.FixSqlParameter(model.Remark))
                ,                           new SqlParameter("@HideContent", DbTool.FixSqlParameter(model.HideContent))
                ,                           new SqlParameter("@Id", model.Id)
            };


            return(SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql.ToString(), parameters));
        }
Beispiel #2
0
        public int Add(Model.Operation_LogModel model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into  [Operation_Log]");
            strSql.Append("(Mobile,OrderCode,LStatus,Status,OperationType,Description,CreateTime,UpdateTime,UserName,Remark,HideContent)");
            strSql.Append(" values (@Mobile,@OrderCode,@LStatus,@Status,@OperationType,@Description,@CreateTime,@UpdateTime,@UserName,@Remark,@HideContent)");
            strSql.Append(";select SCOPE_IDENTITY()");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Mobile", DbTool.FixSqlParameter(model.Mobile))
                ,                           new SqlParameter("@OrderCode", DbTool.FixSqlParameter(model.OrderCode))
                ,                           new SqlParameter("@LStatus", DbTool.FixSqlParameter(model.LStatus))
                ,                           new SqlParameter("@Status", DbTool.FixSqlParameter(model.Status))
                ,                           new SqlParameter("@OperationType", DbTool.FixSqlParameter(model.OperationType))
                ,                           new SqlParameter("@Description", DbTool.FixSqlParameter(model.Description))
                ,                           new SqlParameter("@CreateTime", DbTool.FixSqlParameter(model.CreateTime))
                ,                           new SqlParameter("@UpdateTime", DbTool.FixSqlParameter(model.UpdateTime))
                ,                           new SqlParameter("@UserName", DbTool.FixSqlParameter(model.UserName))
                ,                           new SqlParameter("@Remark", DbTool.FixSqlParameter(model.Remark))
                ,                           new SqlParameter("@HideContent", DbTool.FixSqlParameter(model.HideContent))
            };


            return(DbTool.ConvertObject <int>(SqlHelper.ExecuteScalar(conn, CommandType.Text, strSql.ToString(), parameters), 0));
        }
Beispiel #3
0
        protected Model.Operation_LogModel AutoBindDataReader(SqlDataReader dr, params string[] fields)
        {
            var model = new Model.Operation_LogModel();

            if (DbTool.HasFields("Id", fields))
            {
                model.Id = DbTool.ConvertObject <System.Int32>(dr["Id"]);
            }
            if (DbTool.HasFields("Mobile", fields))
            {
                model.Mobile = DbTool.ConvertObject <System.String>(dr["Mobile"]);
            }
            if (DbTool.HasFields("OrderCode", fields))
            {
                model.OrderCode = DbTool.ConvertObject <System.String>(dr["OrderCode"]);
            }
            if (DbTool.HasFields("LStatus", fields))
            {
                model.LStatus = DbTool.ConvertObject <System.Int32>(dr["LStatus"]);
            }
            if (DbTool.HasFields("Status", fields))
            {
                model.Status = DbTool.ConvertObject <System.Int32>(dr["Status"]);
            }
            if (DbTool.HasFields("OperationType", fields))
            {
                model.OperationType = DbTool.ConvertObject <System.String>(dr["OperationType"]);
            }
            if (DbTool.HasFields("Description", fields))
            {
                model.Description = DbTool.ConvertObject <System.String>(dr["Description"]);
            }
            if (DbTool.HasFields("CreateTime", fields))
            {
                model.CreateTime = DbTool.ConvertObject <System.DateTime>(dr["CreateTime"]);
            }
            if (DbTool.HasFields("UpdateTime", fields))
            {
                model.UpdateTime = DbTool.ConvertObject <System.DateTime>(dr["UpdateTime"]);
            }
            if (DbTool.HasFields("UserName", fields))
            {
                model.UserName = DbTool.ConvertObject <System.String>(dr["UserName"]);
            }
            if (DbTool.HasFields("Remark", fields))
            {
                model.Remark = DbTool.ConvertObject <System.String>(dr["Remark"]);
            }
            if (DbTool.HasFields("HideContent", fields))
            {
                model.HideContent = DbTool.ConvertObject <System.String>(dr["HideContent"]);
            }

            return(model);
        }
Beispiel #4
0
 protected void BindDataReader(Model.Operation_LogModel model, SqlDataReader dr)
 {
     model.Id            = DbTool.ConvertObject <System.Int32>(dr["Id"]);
     model.Mobile        = DbTool.ConvertObject <System.String>(dr["Mobile"]);
     model.OrderCode     = DbTool.ConvertObject <System.String>(dr["OrderCode"]);
     model.LStatus       = DbTool.ConvertObject <System.Int32>(dr["LStatus"]);
     model.Status        = DbTool.ConvertObject <System.Int32>(dr["Status"]);
     model.OperationType = DbTool.ConvertObject <System.String>(dr["OperationType"]);
     model.Description   = DbTool.ConvertObject <System.String>(dr["Description"]);
     model.CreateTime    = DbTool.ConvertObject <System.DateTime>(dr["CreateTime"]);
     model.UpdateTime    = DbTool.ConvertObject <System.DateTime>(dr["UpdateTime"]);
     model.UserName      = DbTool.ConvertObject <System.String>(dr["UserName"]);
     model.Remark        = DbTool.ConvertObject <System.String>(dr["Remark"]);
     model.HideContent   = DbTool.ConvertObject <System.String>(dr["HideContent"]);
 }
Beispiel #5
0
        public Model.Operation_LogModel GetModel(int Id)
        {
            string sql = "select top 1 * from Operation_Log where Id =" + Id;

            Model.Operation_LogModel model = new Model.Operation_LogModel();
            SqlDataReader            dr    = SqlHelper.ExecuteReader(conn, CommandType.Text, sql.ToString());

            if (dr.Read())
            {
                //var fields = DbTool.GetReaderFieldNames(dr);
                //model = AutoBindDataReader(dr, fields);
                BindDataReader(model, dr);
            }
            dr.Close();
            return(model);
        }
Beispiel #6
0
        public List <Model.Operation_LogModel> GetModelList()
        {
            List <Model.Operation_LogModel> result = new List <Model.Operation_LogModel>();
            string sql = "select * from Operation_Log where 1=1";

            Model.Operation_LogModel model = new Model.Operation_LogModel();
            SqlDataReader            dr    = SqlHelper.ExecuteReader(conn, CommandType.Text, sql.ToString());

            //var fields = DbTool.GetReaderFieldNames(dr);
            while (dr.Read())
            {
                //model = AutoBindDataReader(dr, fields);
                model = new Model.Operation_LogModel();
                BindDataReader(model, dr);
                result.Add(model);
            }
            dr.Close();
            return(result);
        }