예제 #1
0
 /// <summary>
 /// 根据销售id删除SalePig表里数据
 /// </summary>
 /// <param name="saleId">销售id</param>
 /// <returns></returns>
 public bool DelSalePigService(long saleId)
 {
     var salePigService = new SalePigService();
     foreach (sale_pig salePig in salePigService.FindBySaleId(saleId))
     {
         salePigService = new SalePigService();
         salePigService.Delete(salePigService.Find(salePig.Id));
     }
     return true;
 }
예제 #2
0
        /// <summary>
        ///     更新修改淘汰信息
        /// </summary>
        /// <param name="updateInfo">淘汰信息页面类</param>
        /// <returns></returns>
        public bool UpdateEliminateInfo(EliminateInfo updateInfo)
        {
            var salesService = new SaleService();
            var salePigService = new SalePigService();
            task task = new TaskService().FindByTaskNumber(updateInfo.TaskNumber);
            var pigInfo = new PigInfo();
            int count = 0;
            if (task == null) return false;
            foreach (sale sale in salesService.FindByTaskId(task.Id))
            {
                sale.EmployeeId = long.Parse(updateInfo.EmployeeName);
                sale.Memo = updateInfo.Meno;
                salesService.Update(sale);
                List<sale_pig> saleList = salePigService.FindBySaleId(sale.Id);
                foreach (sale_pig salePig in saleList)
                {
                    pigInfo.SetState(salePig.PigId, false);
                    if (count < updateInfo.EliminateInfoPigDetail.Count)
                    {
                        salePig.PigId =
                            long.Parse(updateInfo.EliminateInfoPigDetail[count].Pig);
                        salePig.Time = updateInfo.EliminateInfoPigDetail[count].DetailTime;
                        salePigService.Update(salePig);
                        pigInfo.SetState(long.Parse(updateInfo.EliminateInfoPigDetail[count].Pig), true);
                    }
                    else
                    {
                        salePigService = new SalePigService();
                        salePigService.Delete(salePigService.Find(salePig.Id));
                    }
                    count++;
                }
                for (; count < updateInfo.EliminateInfoPigDetail.Count; count++)
                {
                    salePigService.Insert(new sale_pig
                    {
                        SaleId = sale.Id,
                        PigId = long.Parse(updateInfo.EliminateInfoPigDetail[count].Pig),
                        Time = updateInfo.EliminateInfoPigDetail[count].DetailTime
                    });
                    pigInfo.SetState(long.Parse(updateInfo.EliminateInfoPigDetail[count].Pig), true);
                }
            }

            return true;
        }
예제 #3
0
 /// <summary>
 ///     删除淘汰的相关信息
 /// </summary>
 /// <param name="taskNumber">任务编号</param>
 /// <returns></returns>
 public bool DelEliminateInfo(string taskNumber)
 {
     var salesService = new SaleService();
     var salePigService = new SalePigService();
     var taskStatusTypeService = new TaskStatusTypeService();
     var pigInfo = new PigInfo();
     task task = new TaskService().FindByTaskNumber(taskNumber);
     if (task == null) return false;
     foreach (sale sale in salesService.FindByTaskId(task.Id))
     {
         foreach (sale_pig EliminatePig in salePigService.FindBySaleId(sale.Id))
         {
             salePigService = new SalePigService();
             salePigService.Delete(salePigService.Find(EliminatePig.Id));
             pigInfo.SetState(EliminatePig.Id, false);
         }
         salesService = new SaleService();
         salesService.Delete(salesService.Find(sale.Id));
     }
      task_status_type taskStatusType = taskStatusTypeService.FindByName("已完成");
      task.TaskStatusId = taskStatusType.Id;
     return true;
 }
예제 #4
0
 /// <summary>
 ///     删除销售的相关信息
 /// </summary>
 /// <param name="taskNumber">任务编号</param>
 /// <returns></returns>
 public bool DelsalesInfo(string taskNumber)
 {
     var salesService = new SaleService();
     var salePigService = new SalePigService();
     var pigInfo = new PigInfo();
     task task = new TaskService().FindByTaskNumber(taskNumber);
     if (task == null) return false;
     foreach (sale sale in salesService.FindByTaskId(task.Id))
     {
         foreach (sale_pig salePig in salePigService.FindBySaleId(sale.Id))
         {
             salePigService = new SalePigService();
             salePigService.Delete(salePigService.Find(salePig.Id));
             pigInfo.SetState(salePig.Id, false);
         }
         salesService = new SaleService();
         salesService.Delete(salesService.Find(sale.Id));
     }
     return true;
 }