Beispiel #1
0
        /// <summary>
        /// 新增报损主表
        /// </summary>
        /// <param name="chuku"></param>
        /// <returns></returns>
        public static int AddBaoSun(Breakage zhu)
        {
            StorageEntities ent = new StorageEntities();

            ent.Breakage.Add(zhu);
            return(ent.SaveChanges());
        }
        public async Task <IEnumerable <GetTestDto> > AddBreakageAsync(AddBreakageDto addBreakageDto)
        {
            // GetTestDto testDto = null;
            Test test = await _context.Tests
                        .Where(t => t.Id == addBreakageDto.TestId)
                        .Include(t => t.Tags)
                        .Include(t => t.Breakage)
                        .SingleOrDefaultAsync();

            if (test != null)
            {
                Breakage breakage = _mapper.Map <Breakage>(addBreakageDto);
                await _context.Breakages.AddAsync(breakage);

                await _context.SaveChangesAsync();

                // testDto = _mapper.Map<GetTestDto>(test);
            }
            List <Test> tests = await _context.Tests
                                .Include(t => t.Tags)
                                .Include(t => t.Breakage)
                                .ToListAsync();

            return(tests.Select(t => _mapper.Map <GetTestDto>(t)).ToList());
        }
Beispiel #3
0
 /// <summary>
 ///添加报损主表
 /// </summary>
 /// <param name="zhu"></param>
 /// <returns></returns>
 public ActionResult AddBaoSun(Breakage zhu)
 {
     zhu.State         = 2;
     zhu.CreationTime  = DateTime.Now;
     zhu.DataState     = true;
     zhu.operationType = "电脑";
     return(Json(BLL.XBY.BreakageManager.AddBaoSun(zhu), JsonRequestBehavior.AllowGet));
 }
Beispiel #4
0
        /// <summary>
        /// 审核报损单
        /// </summary>
        /// <param name="danhao"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public static int BaoSunShenHe(string danhao, int state)
        {
            StorageEntities ent = new StorageEntities();
            Breakage        obj = ent.Breakage.Find(danhao);

            obj.State = state;
            return(ent.SaveChanges());
        }
Beispiel #5
0
        /// <summary>
        /// 删除报损单
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static int ShanChuBaoSun(string id)
        {
            StorageEntities ent = new StorageEntities();
            Breakage        obj = ent.Breakage.Find(id);

            obj.DataState = false;
            return(ent.SaveChanges());
        }
        public async Task <GetBreakageDto> GetBreakageAsync(int id)
        {
            GetBreakageDto breakageDto = null;
            Breakage       breakage    = await _context.Breakages
                                         .Where(b => b.Id == id)
                                         .FirstOrDefaultAsync();

            if (breakage != null)
            {
                breakageDto = _mapper.Map <GetBreakageDto>(breakage);
            }
            return(breakageDto);
        }
Beispiel #7
0
 public BreakageIEF(Breakage obj, my_db_for_db_2Entities _db)
 {
     InitializeComponent();
     db = _db;
     if (obj == null)
     {
         breakageBindingSource.DataSource = new Breakage();
         db.Breakage.Add(breakageBindingSource.Current as Breakage);
     }
     else
     {
         breakageBindingSource.DataSource = obj;
         db.Breakage.Attach(breakageBindingSource.Current as Breakage);
     }
 }
        public async Task <ActionResult> EditBreakage(EditBreakageDto editBreakageDto)
        {
            Breakage breakage = await _breakageRepo.GetDBBreakageAsync(editBreakageDto.Id);

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

            _mapper.Map(editBreakageDto, breakage);
            _breakageRepo.Update(breakage);
            if (await _breakageRepo.SaveAllAsync())
            {
                return(NoContent());
            }

            return(BadRequest("Failed to update breakage"));
        }
 public void Update(Breakage breakage)
 {
     _context.Entry(breakage).State = EntityState.Modified;
 }
Beispiel #10
0
 /// <summary>
 /// 新增报损主表
 /// </summary>
 /// <param name="chuku"></param>
 /// <returns></returns>
 public static int AddBaoSun(Breakage zhu)
 {
     return(DAL.XBY.BreakageService.AddBaoSun(zhu));
 }
 public DescriptionOfBreakForm(Breakage br)
 {
     this.br = br;
     InitializeComponent();
 }