public CanGapBDO LayTheoId(int iD) { CanGapBDO dm = null; try { var nguon = db.CAN_GAP.Where(x => x.ID == iD).Select(x => new CanGapBDO { ID = x.ID, Ten = x.Ten, BHR = (int)x.BHR, TocDoConGio = (int)x.Toc_do_con, ThoiGianChuanBi = (float)x.Thoi_gian_chuan_bi, DaySoLuong = x.Day_so_luong, DayLoiNhuan = x.Day_loi_nhuan, Ma_01 = x.ma_01, DonViTinh = x.don_vi_tinh, DaySoLuongNiemYet = x.day_so_luong_niem_yet, MotDuongCanTangThoiGianChuanBi = (float)x.mot_duong_tang_tgcb, ThuTu = (int)x.Thu_tu }).SingleOrDefault(); dm = nguon; } catch { } return(dm); }
public string Sua(CanGapBDO entityBDO) { CAN_GAP entity = db.CAN_GAP.Where(x => x.ID == entityBDO.ID).SingleOrDefault(); var kq = ""; if (entity != null) { try { kq = KiemTraTrung(entityBDO.Ten, entityBDO.ID); if (kq != "") { return(kq); } ChuyenBDOThanhDAO(entityBDO, entity); db.Entry(entity).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); kq = string.Format("Lưu mục tin {0} thành công", entity.ID);//trả về số Id } catch { kq = string.Format("Sửa mục tin {0} không thành công!", entity.ID); } } else { return(kq = string.Format("Mục tin {0} không tồn tại!", entity.ID)); } return(kq); }
public static string Sua(CanGap canGap) { CanGapLogic canGapLogic = new CanGapLogic(); var itemBDO = new CanGapBDO(); ChuyenDoiGiayDTOThanhBDO(canGap, itemBDO); return(canGapLogic.Sua(itemBDO)); }
private static void ChuyenDoiGiayBDOThanhDTO(CanGapBDO canGapBDO, CanGap canGapDTO) { canGapDTO.ID = canGapBDO.ID; canGapDTO.Ten = canGapBDO.Ten; canGapDTO.BHR = canGapBDO.BHR; canGapDTO.TocDoConGio = canGapBDO.TocDoConGio; canGapDTO.ThoiGianChuanBi = canGapBDO.ThoiGianChuanBi; canGapDTO.DayLoiNhuan = canGapBDO.DayLoiNhuan; canGapDTO.DaySoLuong = canGapBDO.DaySoLuong; canGapDTO.ThuTu = canGapBDO.ThuTu; }
private void ChuyenBDOThanhDAO(CanGapBDO entityBDO, CAN_GAP entityDAO) { entityDAO.ID = entityBDO.ID; entityDAO.Ten = entityBDO.Ten; entityDAO.BHR = entityBDO.BHR; entityDAO.Toc_do_con = entityBDO.TocDoConGio; entityDAO.Thoi_gian_chuan_bi = entityBDO.ThoiGianChuanBi; entityDAO.Day_so_luong = entityBDO.DaySoLuong; entityDAO.Day_loi_nhuan = entityBDO.DayLoiNhuan; entityDAO.ma_01 = entityBDO.Ma_01; entityDAO.don_vi_tinh = entityBDO.DonViTinh; entityDAO.day_so_luong_niem_yet = entityBDO.DaySoLuongNiemYet; entityDAO.mot_duong_tang_tgcb = entityBDO.MotDuongCanTangThoiGianChuanBi; entityDAO.Thu_tu = entityBDO.ThuTu; }
private static void ChuyenDoiGiayDTOThanhBDO(CanGap canGapDTO, CanGapBDO canGapBDO) { canGapBDO.ID = canGapDTO.ID; canGapBDO.Ten = canGapDTO.Ten; canGapBDO.BHR = canGapDTO.BHR; canGapBDO.TocDoConGio = canGapDTO.TocDoConGio; canGapBDO.ThoiGianChuanBi = canGapDTO.ThoiGianChuanBi; canGapBDO.DayLoiNhuan = canGapDTO.DayLoiNhuan; canGapBDO.DaySoLuong = canGapDTO.DaySoLuong; canGapBDO.Ma_01 = canGapDTO.Ma_01; canGapBDO.DonViTinh = canGapDTO.DonViTinh; canGapBDO.DaySoLuongNiemYet = canGapDTO.DaySoLuongNiemYet; canGapBDO.MotDuongCanTangThoiGianChuanBi = canGapDTO.MotDuongCanTangThoiGianChuanBi; canGapBDO.ThuTu = canGapDTO.ThuTu; }
public string Sua(CanGapBDO canGapBDO) { return(canGapDAO.Sua(canGapBDO)); }
public string Them(CanGapBDO entityBDO) { throw new NotImplementedException(); }