Exemplo n.º 1
0
 public IHttpActionResult CreateDeliveryPower([FromBody] DeliveryPower input)
 {
     using (ctx = new YwtDbContext())
     {
         ctx.DeliveryPower.Add(input);
         ctx.SaveChanges();
         return(Ok());
     }
 }
Exemplo n.º 2
0
 public IHttpActionResult DeleteDeliveryMenu(int id)
 {
     using (ctx = new YwtDbContext())
     {
         var entity = ctx.DeliveryMenu.FirstOrDefault(m => m.Id == id);
         ctx.DeliveryMenu.Remove(entity);
         ctx.SaveChanges();
         return(Ok());
     }
 }
Exemplo n.º 3
0
 public IHttpActionResult DeleteDeliveryApplyProduct(int id)
 {
     using (ctx = new YwtDbContext())
     {
         var list = ctx.DeliveryApplyProduct.FirstOrDefault(m => m.Id == id);
         ctx.DeliveryApplyProduct.Remove(list);
         ctx.SaveChanges();
         return(Ok("删除成功"));
     }
 }
Exemplo n.º 4
0
 public IHttpActionResult Post([FromBody] DesignApply entity)
 {
     using (ctx = new YwtDbContext())
     {
         entity.apply_createTime = DateTime.Now;
         entity.apply_status     = ApplyStaus.WaitAuditing.ToString();
         ctx.DesignApply.Add(entity);
         ctx.SaveChanges();
         return(Ok(entity));
     }
 }
Exemplo n.º 5
0
 public IHttpActionResult CreateDeliveryProduct([FromBody] DeliveryProduct input)
 {
     using (ctx = new YwtDbContext())
     {
         input.LastUpdateTime = DateTime.Now;
         input.CreateTime     = DateTime.Now;
         input.Status         = 1;
         ctx.DeliveryProduct.Add(input);
         ctx.SaveChanges();
         return(Ok());
     }
 }
Exemplo n.º 6
0
        public IHttpActionResult Put(int id, DeliveryApplyPutDto input)
        {
            using (ctx = new YwtDbContext())
            {
                var entity = ctx.DeliveryApply.Include("DeliveryApplyProducts").FirstOrDefault(m => m.Id == id);

                if (null == entity)
                {
                    return(NotFound());
                }

                ctx.DeliveryApplyProduct.RemoveRange(entity.DeliveryApplyProducts);
                ctx.SaveChanges();

                input.LastUpdateTime = DateTime.Now;
                Mapper.Map <DeliveryApplyPutDto, DeliveryApply>(input, entity);

                ctx.SaveChanges();
                return(Ok(input));
            }
        }
Exemplo n.º 7
0
 public IHttpActionResult Post([FromBody] DeliveryApply input)
 {
     using (ctx = new YwtDbContext())
     {
         input.Num            = DateTime.Now.ToString("yyyyMMddHHmmss");
         input.Status         = DeliveryApplyStatus.WaitAudit.ToString();
         input.CreateTime     = DateTime.Now;
         input.LastUpdateTime = DateTime.Now;
         ctx.DeliveryApply.Add(input);
         ctx.SaveChanges();
         return(Ok(""));
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 增加pv
        /// </summary>
        /// <param name="id"></param>
        public void AddPv(int id)
        {
            using (ctx = new YwtDbContext())
            {
                var entity = ctx.ActivitySuperScholar.FirstOrDefault(m => m.Id == id);
                if (entity == null)
                {
                    return;
                }

                entity.AccessNum += 1;
                ctx.SaveChanges();
            }
        }
Exemplo n.º 9
0
 // POST api/superscholar
 public IHttpActionResult Post([FromBody] ActivitySuperScholarCreateDto input)
 {
     using (ctx = new YwtDbContext())
     {
         var entity = new ActivitySuperScholar();
         Mapper.Map <ActivitySuperScholarCreateDto, ActivitySuperScholar>(input, entity);
         entity.CreateTime = DateTime.Now;
         entity.Likes      = 0;
         entity.AccessNum  = 0;
         ctx.ActivitySuperScholar.Add(entity);
         ctx.SaveChanges();
         return(Ok(entity));
     }
 }
Exemplo n.º 10
0
        public IHttpActionResult PostDesignPlan([FromBody] DesignPlan entity)
        {
            using (ctx = new YwtDbContext())
            {
                var enty = ctx.DesignApply.FirstOrDefault(m => m.apply_id == entity.ApplyId);
                enty.plan_status = false;   //上传方案后   方案状态变为未提交

                entity.CreateTime     = DateTime.Now;
                entity.DesignFilePath = entity.DesignFilePath.Trim('"');
                ctx.DesignPlan.Add(entity);
                ctx.SaveChanges();
                return(Ok(entity));
            }
        }
Exemplo n.º 11
0
 public IHttpActionResult Put([FromBody] MoreDesignApplyDto input)
 {
     using (ctx = new YwtDbContext())
     {
         var entity = ctx.DesignApply.FirstOrDefault(m => m.apply_id == input.apply_id);
         if (null == entity)
         {
             return(NotFound());
         }
         Mapper.Map <MoreDesignApplyDto, DesignApply>(input, entity);
         ctx.SaveChanges();
         return(Ok(entity));
     }
 }
Exemplo n.º 12
0
 public IHttpActionResult DeleteDeliveryPower(int id)
 {
     using (ctx = new YwtDbContext())
     {
         var entity = ctx.DeliveryPower.FirstOrDefault(m => m.Id == id);
         if (entity == null)
         {
             return(NotFound());
         }
         ctx.DeliveryPower.Remove(entity);
         ctx.SaveChanges();
         return(Ok());
     }
 }
Exemplo n.º 13
0
        public IHttpActionResult PostDeliveryInvoice([FromBody] DeliveryInvoice input)
        {
            using (ctx = new YwtDbContext())
            {
                input.CreateTime = DateTime.Now;
                ctx.DeliveryInvoice.Add(input);
                var entity = ctx.DeliveryApply.FirstOrDefault(m => m.Id == input.ApplyId);
                entity.Status         = DeliveryApplyStatus.WaitReceived.ToString();
                entity.LastUpdateTime = DateTime.Now;

                ctx.SaveChanges();
                return(Ok(input));
            }
        }
Exemplo n.º 14
0
        public IHttpActionResult Put([FromBody] ActivitySuperScholarEditDto input)
        {
            using (ctx = new YwtDbContext())
            {
                var entity = ctx.ActivitySuperScholar.FirstOrDefault(m => m.Id == input.Id);
                if (entity == null)
                {
                    return(NotFound());
                }

                Mapper.Map <ActivitySuperScholarEditDto, ActivitySuperScholar>(input, entity);
                ctx.SaveChanges();
                return(Ok(entity));
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// 提交设计方案
        /// </summary>
        /// <returns></returns>
        public IHttpActionResult PostDesignPlanReview([FromBody] DesignApply entity)
        {
            using (ctx = new YwtDbContext())
            {
                var model = ctx.DesignApply.FirstOrDefault(m => m.apply_id == entity.apply_id);
                if (model == null)
                {
                    return(NotFound());
                }

                model.plan_status = true;
                ctx.SaveChanges();
                return(Ok());
            }
        }
Exemplo n.º 16
0
 public IHttpActionResult PostDesignApplyReview([FromBody] ReviewDesignApplyDto input)
 {
     using (ctx = new YwtDbContext())
     {
         var entity = ctx.DesignApply.FirstOrDefault(m => m.apply_id == input.apply_id);
         if (entity == null)
         {
             return(NotFound());
         }
         input.review_time = DateTime.Now;
         Mapper.Map <ReviewDesignApplyDto, DesignApply>(input, entity);
         ctx.SaveChanges();
         return(Ok(entity));
     }
 }
Exemplo n.º 17
0
 public IHttpActionResult Put(int id, [FromBody] DesignApplyDto input)
 {
     using (ctx = new YwtDbContext())
     {
         var entity = ctx.DesignApply.FirstOrDefault(m => m.apply_id == input.apply_id);
         if (null == entity)
         {
             return(NotFound());
         }
         input.apply_status = ApplyStaus.WaitAuditing.ToString();
         Mapper.Map <DesignApplyDto, DesignApply>(input, entity);
         ctx.SaveChanges();
         return(Ok(entity));
     }
 }
Exemplo n.º 18
0
 public IHttpActionResult DeleteDeliveryProduct(int pid)
 {
     using (ctx = new YwtDbContext())
     {
         var list = ctx.DeliveryApplyProduct.Where(m => m.Pid == pid);
         if (list == null || list.Count() == 0)
         {
             var entity = ctx.DeliveryProduct.FirstOrDefault(m => m.Pid == pid);
             ctx.DeliveryProduct.Remove(entity);
             ctx.SaveChanges();
             return(Ok("删除成功"));
         }
         return(Ok("删除失败,该商品已经在发货申请单中使用"));
     }
 }
Exemplo n.º 19
0
        public IHttpActionResult AddLikes([FromBody] int id)
        {
            using (ctx = new YwtDbContext())
            {
                var entity = ctx.ActivitySuperScholar.FirstOrDefault(m => m.Id == id);
                if (entity == null)
                {
                    return(NotFound());
                }

                entity.Likes += 1;
                ctx.SaveChanges();

                return(Ok(entity));
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 需求确认
        /// </summary>
        /// <param name="applyid"></param>
        /// <returns></returns>
        public IHttpActionResult ConfirmDesignApply([FromBody] DesignApply entity)
        {
            using (ctx = new YwtDbContext())
            {
                var model = ctx.DesignApply.FirstOrDefault(m => m.apply_id == entity.apply_id);
                if (model == null)
                {
                    return(NotFound());
                }

                model.apply_status   = ApplyStaus.Designing.ToString();
                model.apply_plantime = entity.apply_plantime;
                ctx.SaveChanges();
                return(Ok(entity));
            }
        }
Exemplo n.º 21
0
 public IHttpActionResult DeleteDeliveryApply(int id)
 {
     using (ctx = new YwtDbContext())
     {
         var entity = ctx.DeliveryApply.Include("DeliveryApplyProducts").FirstOrDefault(m => m.Id == id);
         if (entity.Status == DeliveryApplyStatus.Refuse.ToString())
         {
             ctx.DeliveryApply.Remove(entity);
             ctx.SaveChanges();
         }
         else
         {
             return(NotFound());
         }
         return(Ok());
     }
 }
Exemplo n.º 22
0
        /// <summary>
        /// 流程审批
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public IHttpActionResult PendingApplyInfo([FromBody] DeliveryApplyPendingDto input)
        {
            using (ctx = new YwtDbContext())
            {
                var entity = ctx.DeliveryApply.FirstOrDefault(m => m.Id == input.Id);
                entity.Img = input.Img;
                if (input.Content == "拒绝")
                {
                    entity.Status = DeliveryApplyStatus.Refuse.ToString();
                }
                else
                {
                    switch (input.Type)
                    {
                    //部们审批
                    case "department":
                        entity.DepartmentLeaderSign = input.Content;
                        entity.Status = DeliveryApplyStatus.Audited.ToString();
                        break;

                    //公司审批
                    case "company":
                        entity.CompanyLeaderSign = input.Content;
                        entity.BossSign          = input.Content;
                        entity.Status            = DeliveryApplyStatus.WaitSend.ToString();
                        break;

                    //工厂发货
                    case "factory":
                        entity.Status = DeliveryApplyStatus.WaitReceived.ToString();
                        break;
                    }
                }
                entity.LastUpdateTime = DateTime.Now;
                ctx.SaveChanges();
                return(Ok(input));
            }
        }