Esempio n. 1
0
 public void UpdateByOrderId(RefundInfo refundInfo)
 {
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("update Hishop_OrderRefund set AdminRemark=@AdminRemark,ApplyForTime=@ApplyForTime,HandleStatus=@HandleStatus,HandleTime=@HandleTime,Operator=@Operator,RefundRemark=@RefundRemark where OrderId =@OrderId");
     this.database.AddInParameter(sqlStringCommand, "AdminRemark", DbType.String, refundInfo.AdminRemark);
     this.database.AddInParameter(sqlStringCommand, "ApplyForTime", DbType.String, refundInfo.ApplyForTime);
     this.database.AddInParameter(sqlStringCommand, "HandleStatus", DbType.Int32, refundInfo.HandleStatus);
     this.database.AddInParameter(sqlStringCommand, "HandleTime", DbType.DateTime, refundInfo.HandleTime);
     this.database.AddInParameter(sqlStringCommand, "Operator", DbType.String, refundInfo.Operator);
     this.database.AddInParameter(sqlStringCommand, "RefundRemark", DbType.String, refundInfo.RefundRemark);
     this.database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, refundInfo.OrderId);
     this.database.ExecuteNonQuery(sqlStringCommand);
 }
Esempio n. 2
0
 private bool SetGroupBuyFailed(int groupBuyId)
 {
     IDataReader reader;
     StringBuilder builder = new StringBuilder();
     builder.Append("update Hishop_Orders set OrderStatus = 6 where GroupBuyId = @GroupBuyId and OrderStatus = 2;");
     builder.AppendFormat("update Hishop_Orders set OrderStatus = 4,CloseReason='{0}' where GroupBuyId = @GroupBuyId and OrderStatus = 1;", "团购失败,自动关闭");
     builder.Append("UPDATE Hishop_GroupBuy SET Status = 5,SoldCount = 0 WHERE GroupBuyId = @GroupBuyId AND (select Count(1) from Hishop_Orders where GroupBuyId = @GroupBuyId and OrderStatus = 6) >0;");
     builder.Append("UPDATE Hishop_GroupBuy SET Status = 4,SoldCount = 0 WHERE GroupBuyId = @GroupBuyId AND (select Count(1) from Hishop_Orders where GroupBuyId = @GroupBuyId and OrderStatus = 6) =0;");
     builder.Append("  select OrderId,TelPhone,CellPhone,ShippingRegion+[Address] as [Address],ShipTo from Hishop_Orders where GroupBuyId = @GroupBuyId and OrderStatus = 6; ");
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());
     this.database.AddInParameter(sqlStringCommand, "GroupBuyId", DbType.Int32, groupBuyId);
     using (reader = this.database.ExecuteReader(sqlStringCommand))
     {
         RefundInfo refundInfo = new RefundInfo();
         RefundDao dao = new RefundDao();
         while (reader.Read())
         {
             refundInfo.OrderId = reader["OrderId"].ToString();
             refundInfo.RefundRemark = "团购失败,申请退款";
             refundInfo.ApplyForTime = DateTime.Now;
             refundInfo.HandleStatus = RefundInfo.Handlestatus.Applied;
             dao.AddRefund(refundInfo);
         }
     }
     builder.Clear();
     builder.Append("select c.SkuId,c.Quantity from Hishop_GroupBuy a left join Hishop_Orders b on a.GroupBuyId = b.GroupBuyId left join Hishop_OrderItems c on b.OrderId = c.OrderId left join Hishop_SKUs d on c.SkuId = d.SkuId where a.GroupBuyId =@GroupBuyId and b.OrderStatus = 6");
     sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());
     this.database.AddInParameter(sqlStringCommand, "GroupBuyId", DbType.Int32, groupBuyId);
     Dictionary<string, int> source = new Dictionary<string, int>();
     using (reader = this.database.ExecuteReader(sqlStringCommand))
     {
         while (reader.Read())
         {
             Dictionary<string, int> dictionary2;
             string str2;
             string key = reader.GetString(0);
             if (!source.ContainsKey(key))
             {
                 source[key] = 0;
             }
             (dictionary2 = source)[str2 = key] = dictionary2[str2] + reader.GetInt32(1);
         }
     }
     builder.Clear();
     for (int i = 0; i < source.Count; i++)
     {
         builder.AppendFormat("update Hishop_SKUs set Stock=Stock+{1} where SKUId = '{0}';", source.ElementAt<KeyValuePair<string, int>>(i).Key, source.ElementAt<KeyValuePair<string, int>>(i).Value);
     }
     this.database.ExecuteNonQuery(CommandType.Text, builder.ToString());
     return true;
 }
Esempio n. 3
0
 public void AddRefund(RefundInfo refundInfo)
 {
     StringBuilder builder = new StringBuilder();
     builder.AppendFormat("insert into Hishop_OrderRefund(OrderId,ApplyForTime,RefundRemark,HandleStatus) values('{0}','{1}','{2}',{3})", new object[] { refundInfo.OrderId, refundInfo.ApplyForTime, refundInfo.RefundRemark, (int) refundInfo.HandleStatus });
     this.database.ExecuteNonQuery(CommandType.Text, builder.ToString());
 }
Esempio n. 4
0
 public static void AddRefund(RefundInfo refundInfo)
 {
     new RefundDao().AddRefund(refundInfo);
 }