Ejemplo n.º 1
0
        public int Update(OrderSendProductInfo model)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"update OrderSendProduct set Qty = @Qty,PickQty = @PickQty,Status = @Status,LastUpdatedDate = @LastUpdatedDate 
			            where OrderId = @OrderId and ProductId = @ProductId and CustomerId = @CustomerId
					    "                    );

            SqlParameter[] parms =
            {
                new SqlParameter("@OrderId",         SqlDbType.UniqueIdentifier),
                new SqlParameter("@ProductId",       SqlDbType.UniqueIdentifier),
                new SqlParameter("@CustomerId",      SqlDbType.UniqueIdentifier),
                new SqlParameter("@Qty",             SqlDbType.Float),
                new SqlParameter("@PickQty",         SqlDbType.Float),
                new SqlParameter("@Status",          SqlDbType.NVarChar,20),
                new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime)
            };
            parms[0].Value = model.OrderId;
            parms[1].Value = model.ProductId;
            parms[2].Value = model.CustomerId;
            parms[3].Value = model.Qty;
            parms[4].Value = model.PickQty;
            parms[5].Value = model.Status;
            parms[6].Value = model.LastUpdatedDate;

            return(SqlHelper.ExecuteNonQuery(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), parms));
        }
Ejemplo n.º 2
0
        public int Insert(OrderSendProductInfo model)
        {
            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"insert into OrderSendProduct (OrderId,ProductId,CustomerId,Qty,PickQty,Status,LastUpdatedDate)
			            values
						(@OrderId,@ProductId,@CustomerId,@Qty,@PickQty,@Status,@LastUpdatedDate)
			            "            );

            SqlParameter[] parms =
            {
                new SqlParameter("@OrderId",         SqlDbType.UniqueIdentifier),
                new SqlParameter("@ProductId",       SqlDbType.UniqueIdentifier),
                new SqlParameter("@CustomerId",      SqlDbType.UniqueIdentifier),
                new SqlParameter("@Qty",             SqlDbType.Float),
                new SqlParameter("@PickQty",         SqlDbType.Float),
                new SqlParameter("@Status",          SqlDbType.NVarChar,20),
                new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime)
            };
            parms[0].Value = model.OrderId;
            parms[1].Value = model.ProductId;
            parms[2].Value = model.CustomerId;
            parms[3].Value = model.Qty;
            parms[4].Value = model.PickQty;
            parms[5].Value = model.Status;
            parms[6].Value = model.LastUpdatedDate;

            return(SqlHelper.ExecuteNonQuery(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), parms));
        }
Ejemplo n.º 3
0
        public IList <OrderSendProductInfo> GetList()
        {
            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"select OrderId,ProductId,CustomerId,Qty,PickQty,Status,LastUpdatedDate 
			            from OrderSendProduct
					    order by LastUpdatedDate "                    );

            IList <OrderSendProductInfo> list = new List <OrderSendProductInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString()))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrderSendProductInfo model = new OrderSendProductInfo();
                        model.OrderId         = reader.GetGuid(0);
                        model.ProductId       = reader.GetGuid(1);
                        model.CustomerId      = reader.GetGuid(2);
                        model.Qty             = reader.GetDouble(3);
                        model.PickQty         = reader.GetDouble(4);
                        model.Status          = reader.GetString(5);
                        model.LastUpdatedDate = reader.GetDateTime(6);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
Ejemplo n.º 4
0
        public IList <OrderSendProductInfo> GetList(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"select count(*) from OrderSendProduct ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            totalRecords = (int)SqlHelper.ExecuteScalar(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms);

            if (totalRecords == 0)
            {
                return(new List <OrderSendProductInfo>());
            }

            sb.Clear();
            int startIndex = (pageIndex - 1) * pageSize + 1;
            int endIndex   = pageIndex * pageSize;

            sb.Append(@"select * from(select row_number() over(order by LastUpdatedDate) as RowNumber,
			          OrderId,ProductId,CustomerId,Qty,PickQty,Status,LastUpdatedDate
					  from OrderSendProduct "                    );
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            IList <OrderSendProductInfo> list = new List <OrderSendProductInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrderSendProductInfo model = new OrderSendProductInfo();
                        model.OrderId         = reader.GetGuid(1);
                        model.ProductId       = reader.GetGuid(2);
                        model.CustomerId      = reader.GetGuid(3);
                        model.Qty             = reader.GetDouble(4);
                        model.PickQty         = reader.GetDouble(5);
                        model.Status          = reader.GetString(6);
                        model.LastUpdatedDate = reader.GetDateTime(7);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
Ejemplo n.º 5
0
        public IList <OrderSendProductInfo> GetListByJoin(string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"select osp.OrderId,osp.ProductId,osp.CustomerId,osp.Qty,osp.PickQty,osp.Status,osp.LastUpdatedDate
                        ,p.ProductCode,p.ProductName,c.Coded CustomerCode,c.Named CustomerName
                        from OrderSendProduct osp 
                        left join Product p on p.Id = osp.ProductId
                        left join Customer c on c.Id = osp.CustomerId
                        ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.Append("order by osp.LastUpdatedDate ");

            var list = new List <OrderSendProductInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrderSendProductInfo model = new OrderSendProductInfo();
                        model.OrderId         = reader.GetGuid(0);
                        model.ProductId       = reader.GetGuid(1);
                        model.CustomerId      = reader.GetGuid(2);
                        model.Qty             = reader.GetDouble(3);
                        model.PickQty         = reader.GetDouble(4);
                        model.Status          = reader.GetString(5);
                        model.LastUpdatedDate = reader.GetDateTime(6);

                        model.ProductCode  = reader.IsDBNull(7) ? "" : reader.GetString(7);
                        model.ProductName  = reader.IsDBNull(8) ? "" : reader.GetString(8);
                        model.CustomerCode = reader.IsDBNull(9) ? "" : reader.GetString(9);
                        model.CustomerName = reader.IsDBNull(10) ? "" : reader.GetString(10);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
Ejemplo n.º 6
0
        public OrderSendProductInfo GetModel(Guid orderId, Guid productId, Guid customerId)
        {
            OrderSendProductInfo model = null;

            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"select top 1 OrderId,ProductId,CustomerId,Qty,PickQty,Status,LastUpdatedDate 
			            from OrderSendProduct
						where OrderId = @OrderId and ProductId = @ProductId and CustomerId = @CustomerId "                        );
            SqlParameter[] parms =
            {
                new SqlParameter("@OrderId",    SqlDbType.UniqueIdentifier),
                new SqlParameter("@ProductId",  SqlDbType.UniqueIdentifier),
                new SqlParameter("@CustomerId", SqlDbType.UniqueIdentifier)
            };
            parms[0].Value = orderId;
            parms[1].Value = productId;
            parms[2].Value = customerId;

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), parms))
            {
                if (reader != null)
                {
                    if (reader.Read())
                    {
                        model                 = new OrderSendProductInfo();
                        model.OrderId         = reader.GetGuid(0);
                        model.ProductId       = reader.GetGuid(1);
                        model.CustomerId      = reader.GetGuid(2);
                        model.Qty             = reader.GetDouble(3);
                        model.PickQty         = reader.GetDouble(4);
                        model.Status          = reader.GetString(5);
                        model.LastUpdatedDate = reader.GetDateTime(6);
                    }
                }
            }

            return(model);
        }
Ejemplo n.º 7
0
        public IList <OrderSendProductInfo> GetList(string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(500);

            sb.Append(@"select OrderId,ProductId,CustomerId,Qty,PickQty,Status,LastUpdatedDate
                        from OrderSendProduct ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.Append("order by LastUpdatedDate ");

            IList <OrderSendProductInfo> list = new List <OrderSendProductInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        OrderSendProductInfo model = new OrderSendProductInfo();
                        model.OrderId         = reader.GetGuid(0);
                        model.ProductId       = reader.GetGuid(1);
                        model.CustomerId      = reader.GetGuid(2);
                        model.Qty             = reader.GetDouble(3);
                        model.PickQty         = reader.GetDouble(4);
                        model.Status          = reader.GetString(5);
                        model.LastUpdatedDate = reader.GetDateTime(6);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
Ejemplo n.º 8
0
 public int Update(OrderSendProductInfo model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 9
0
 public int Insert(OrderSendProductInfo model)
 {
     return(dal.Insert(model));
 }
Ejemplo n.º 10
0
        public IList <OrderSendProductInfo> GetListByJoin(int pageIndex, int pageSize, out int totalRecords, string sqlWhere, params SqlParameter[] cmdParms)
        {
            var sb = new StringBuilder(500);

            sb.Append(@"select count(*) from OrderSendProduct osp 
                      left join Product p on p.Id = osp.ProductId 
                      left join Customer c on c.Id = osp.CustomerId
                      ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            totalRecords = (int)SqlHelper.ExecuteScalar(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms);

            if (totalRecords == 0)
            {
                return(new List <OrderSendProductInfo>());
            }

            sb.Clear();
            int startIndex = (pageIndex - 1) * pageSize + 1;
            int endIndex   = pageIndex * pageSize;

            sb.Append(@"select * from(select row_number() over(order by osp.LastUpdatedDate desc) as RowNumber,
			          osp.OrderId,osp.ProductId,osp.CustomerId,osp.Qty,osp.PickQty,osp.Status,osp.LastUpdatedDate
                      ,p.ProductCode,p.ProductName,c.Coded CustomerCode,c.Named CustomerName
					  from OrderSendProduct osp 
                      left join Product p on p.Id = osp.ProductId
                      left join Customer c on c.Id = osp.CustomerId
                      ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            var list = new List <OrderSendProductInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.WmsDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        var model = new OrderSendProductInfo();
                        model.OrderId         = reader.GetGuid(1);
                        model.ProductId       = reader.GetGuid(2);
                        model.CustomerId      = reader.GetGuid(3);
                        model.Qty             = reader.GetDouble(4);
                        model.PickQty         = reader.GetDouble(5);
                        model.Status          = reader.GetString(6);
                        model.LastUpdatedDate = reader.GetDateTime(7);

                        model.ProductCode  = reader.IsDBNull(8) ? "" : reader.GetString(8);
                        model.ProductName  = reader.IsDBNull(9) ? "" : reader.GetString(9);
                        model.CustomerCode = reader.IsDBNull(10) ? "" : reader.GetString(10);
                        model.CustomerName = reader.IsDBNull(11) ? "" : reader.GetString(11);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }