Пример #1
0
 public LongResponse CreateWithoutOrder(string deliveryCompany, string deliveryNumber, string goodsInfo, float goodsMoney, int count)
 {
     try
     {
         string   op      = ServiceContainer.GetCurrentLoginInfo().op.Number;
         DateTime minTime = this.GetDbMinTime();
         var      or      = new OrderReturn
         {
             Comment         = "",
             Count           = count,
             CreateOperator  = op,
             CreateTime      = DateTime.Now,
             DeliveryCompany = deliveryCompany,
             DeliveryNumber  = deliveryNumber,
             State           = OrderReturnState.WAITPROCESS,
             GoodsInfo       = goodsInfo,
             OrderGoodsId    = 0,
             OrderId         = 0,
             ProcessOperator = "",
             ProcessTime     = minTime,
             Reason          = OrderReturnReason.DAY7,
             Type            = OrderReturnType.NONEORDER,
             GoodsMoney      = goodsMoney,
         };
         this.dao.Save(or);
         return(new LongResponse(or.Id));
     }
     catch (Exception ex)
     {
         throw new WebFaultException <ResponseBase>(new ResponseBase(ex.Message), System.Net.HttpStatusCode.OK);
     }
 }
Пример #2
0
 public ResponseBase Update(DeliveryTemplate value)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(value.Name) || string.IsNullOrWhiteSpace(value.DeliveryCompany))
         {
             throw new Exception("运费模板名称或者快递公司名称为空");
         }
         if (this.GetFirstOrDefaultInCach(obj => obj.Name.Equals(value.Name, StringComparison.OrdinalIgnoreCase) && obj.Id != value.Id) != null)
         {
             throw new Exception("已存在相同的运费模板");
         }
         dao.Update(value);
         dao.ExcuteSqlUpdate("delete from DeliveryTemplateArea where DeliveryTemplateId=" + value.Id);
         value.UpdateTime     = DateTime.Now;
         value.UpdateOperator = ServiceContainer.GetCurrentLoginInfo().op.Number;
         foreach (var v in value.Areas)
         {
             v.Id = 0;
             v.DeliveryTemplateId = value.Id;
         }
         dao.Save(value.Areas.ToArray());
         this.AndOrReplaceInCach(value, obj => obj.Id == value.Id);
         return(ResponseBase.SUCCESS);
     }
     catch (Exception ex)
     {
         throw new WebFaultException <ResponseBase>(new ResponseBase {
             error = ex.Message
         }, System.Net.HttpStatusCode.OK);
     }
 }
Пример #3
0
 public LongResponse SaveOrUpdate(long ownerId, string name, string value)
 {
     try
     {
         //卖家只能配置自身的配置项
         ownerId = ServiceContainer.GetSellerId(ownerId);
         return(new LongResponse(this.SaveOrUpdateEx(ownerId, name, value, ServiceContainer.GetCurrentLoginInfo().op.Number)));
     }
     catch (Exception ex)
     {
         throw new WebFaultException <ResponseBase>(new ResponseBase(ex.Message), System.Net.HttpStatusCode.OK);
     }
 }
Пример #4
0
 public ResponseBase Delete(long id)
 {
     try
     {
         if (ServiceContainer.GetCurrentLoginInfo().op.Rights.Contains("用户管理") == false)
         {
             throw new Exception("当前用户没有 用户管理 权限");
         }
         this.dao.DeleteByLongId(id);
         return(ResponseBase.SUCCESS);
     }
     catch (Exception ex)
     {
         throw new WebFaultException <ResponseBase>(new ResponseBase(ex.Message), System.Net.HttpStatusCode.OK);
     }
 }
Пример #5
0
 public ResponseBase ModifyPassword(long id, string password)
 {
     try
     {
         if (ServiceContainer.GetCurrentLoginInfo().op.Rights.Contains("用户管理") == false)
         {
             throw new Exception("当前用户没有 用户管理 权限");
         }
         this.dao.ExcuteSqlUpdate("update `operator` set `password`='" + password + "' where Id=" + id);
         return(ResponseBase.SUCCESS);
     }
     catch (Exception ex)
     {
         throw new WebFaultException <ResponseBase>(new ResponseBase(ex.Message), System.Net.HttpStatusCode.OK);
     }
 }
Пример #6
0
 public LongResponse Save(DeliveryIn value)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(value.DeliveryCompany) || string.IsNullOrWhiteSpace(value.DeliveryNumber))
         {
             throw new Exception("快递公司及单号不能为空");
         }
         value.CreateTime     = DateTime.Now;
         value.CreateOperator = ServiceContainer.GetCurrentLoginInfo().op.Number;
         this.dao.Save(value);
         return(new LongResponse(value.Id));
     }
     catch (Exception ex)
     {
         throw new WebFaultException <ResponseBase>(new ResponseBase(ex.Message), System.Net.HttpStatusCode.OK);
     }
 }
Пример #7
0
 public LongResponse Save(Operator value)
 {
     try
     {
         if (ServiceContainer.GetCurrentLoginInfo().op.Rights.Contains("用户管理") == false)
         {
             throw new Exception("当前用户没有 用户管理 权限");
         }
         value.CreateTime = DateTime.Now;
         value.UpdateTime = DateTime.Now;
         this.dao.Save(value);
         return(new LongResponse(value.Id));
     }
     catch (Exception ex)
     {
         throw new WebFaultException <ResponseBase>(new ResponseBase(ex.Message), System.Net.HttpStatusCode.OK);
     }
 }
Пример #8
0
 public ResponseBase Update(Operator value)
 {
     try
     {
         if (ServiceContainer.GetCurrentLoginInfo().op.Rights.Contains("用户管理") == false)
         {
             throw new Exception("当前用户没有 用户管理 权限");
         }
         if (value.Id < 1)
         {
             throw new Exception("数据未保存过,不能直接更新");
         }
         string sql = string.Format("update `operator` set Number='{0}', Name='{1}',Phone='{2}',Rights='{3}',Enabled={4},UpdateTime=NOW() where Id={5}", value.Number, value.Name, value.Phone, value.Rights, value.Enabled ? 1 : 0, value.Id);
         this.dao.ExcuteSqlUpdate(sql);
         return(ResponseBase.SUCCESS);
     }
     catch (Exception ex)
     {
         throw new WebFaultException <ResponseBase>(new ResponseBase(ex.Message), System.Net.HttpStatusCode.OK);
     }
 }
Пример #9
0
        public LongResponse Create(long orderId, long orderGoodsId, string deliveryCompany, string deliveryNumber, OrderReturnType type, OrderReturnReason reason, int count)
        {
            try
            {
                string      op      = ServiceContainer.GetCurrentLoginInfo().op.Number;
                var         ors     = this.GetByOrderIdAndOrderGoodsId(orderId, orderGoodsId);
                OrderReturn or      = null;
                DateTime    minTime = this.GetDbMinTime();

                if (ors != null && ors.Datas.Count > 0)
                {
                    return(new LongResponse(ors.Datas[0].Id));
                }

                var o = ServiceContainer.GetService <OrderService>().GetById(orderId.ToString()).First;

                if (o == null)
                {
                    throw new Exception("订单不存在");
                }

                if ((int)o.State < (int)OrderState.SHIPPED)
                {
                    throw new Exception("订单未发货不能创建退货");
                }

                var og = o.OrderGoodss.FirstOrDefault(obj => obj.Id == orderGoodsId);

                if (og == null)
                {
                    throw new Exception("订单商品不存在");
                }

                if ((int)og.State < (int)OrderState.SHIPPED)
                {
                    throw new Exception("订单未发货不能创建退货");
                }

                or = new OrderReturn
                {
                    Comment         = "",
                    Count           = count,
                    CreateOperator  = op,
                    CreateTime      = DateTime.Now,
                    DeliveryCompany = deliveryCompany,
                    DeliveryNumber  = deliveryNumber,
                    State           = OrderReturnState.WAITPROCESS,
                    GoodsInfo       = og.Vendor + "," + og.Number + " " + og.Edtion + " " + og.Color + " " + og.Size,
                    OrderGoodsId    = orderGoodsId,
                    OrderId         = orderId,
                    ProcessOperator = "",
                    ProcessTime     = minTime,
                    Reason          = reason,
                    Type            = type,
                    GoodsMoney      = og.Price * og.Count,
                    Id         = 0,
                    NewOrderId = 0,
                };
                this.dao.Save(or);
                return(new LongResponse(or.Id));
            }
            catch (Exception ex)
            {
                throw new WebFaultException <ResponseBase>(new ResponseBase(ex.Message), System.Net.HttpStatusCode.OK);
            }
        }