public static List <OrderTrackingLogEntity> SelectOrderTrackingLog(SqlConnection connection, int orderId) { var listLog = new List <OrderTrackingLogEntity>(); var parameters = new[] { new SqlParameter("@orderId", orderId) }; using (var dataReader = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure, "存储过程", parameters)) { while (dataReader.Read()) { var tblOrderTrackingLog = new OrderTrackingLogEntity { PkId = dataReader.GetTuhuValue <int>(0), OrderId = dataReader.GetTuhuValue <int>(1), OrderStatus = dataReader.GetTuhuString(2), DeliveryStatus = dataReader.GetTuhuString(3), LogisticTaskStatus = dataReader.GetTuhuString(4), CreateTime = dataReader.GetTuhuValue <DateTime>(5), Description = dataReader.GetTuhuString(6), IsOver = dataReader.GetTuhuValue <bool>(7), InstallStatus = dataReader.GetTuhuString(8) }; listLog.Add(tblOrderTrackingLog); } } return(listLog); }
public static void Add(SqlConnection connection, OrderTrackingLogEntity tblOrderTrackingLog) { var parameters = new[] { new SqlParameter("@OrderId", tblOrderTrackingLog.OrderId), new SqlParameter("@OrderStatus", tblOrderTrackingLog.OrderStatus ?? string.Empty), new SqlParameter("@DeliveryStatus", tblOrderTrackingLog.DeliveryStatus ?? string.Empty), new SqlParameter("@LogisticTaskStatus", tblOrderTrackingLog.LogisticTaskStatus ?? string.Empty), new SqlParameter("@CreateTime", tblOrderTrackingLog.CreateTime), new SqlParameter("@Description", tblOrderTrackingLog.Description ?? string.Empty), new SqlParameter("@IsOver", tblOrderTrackingLog.IsOver), new SqlParameter("@InstallStatus", tblOrderTrackingLog.InstallStatus ?? string.Empty) }; SqlHelper.ExecuteNonQueryV2(connection, CommandType.StoredProcedure, "Order_InsertOrderTrackingLog", parameters); }
/// <summary> /// /// </summary> /// <param name="orderid">订单号</param> /// <param name="orderStatus">订单状态</param> /// <param name="deliveryStatus">配送状态</param> /// <param name="installStatus">安装状态</param> /// <param name="logisticTaskStatus">物流状态</param> /// <param name="descriptionType">描述类型</param> /// <returns></returns> public void Add(int orderid, string orderStatus, string deliveryStatus, string installStatus, string logisticTaskStatus, DescriptionType descriptionType) { //获取描述类型 var desType = GetEnumDesc(descriptionType); var tblOrderTrackingLog = new OrderTrackingLogEntity { OrderId = orderid, OrderStatus = orderStatus, DeliveryStatus = deliveryStatus, InstallStatus = installStatus, LogisticTaskStatus = logisticTaskStatus, CreateTime = DateTime.Now, IsOver = descriptionType.Equals(DescriptionType.Delivery3Received) || descriptionType.Equals(DescriptionType.Install2Installed) }; if (!string.IsNullOrEmpty(desType)) { string desCription; //获取配置好的描述 XmlDataSource.NodeCollection.TryGetValue(desType, out desCription); tblOrderTrackingLog.Description = desCription; } _dbManager.Execute(conn => DalOrderTrackingLog.Add(conn, tblOrderTrackingLog)); }