Beispiel #1
0
        public CanPhuBDO LayTheoId(int iD)
        {
            CanPhuBDO dm = null;

            try
            {
                var nguon = db.CAN_PHU.Where(x => x.ID == iD).Select(x => new CanPhuBDO
                {
                    ID                = x.ID,
                    Ten               = x.Ten,
                    BHR               = (int)x.BHR,
                    ThoiGianChuanBi   = (float)x.Thoi_gian_chuan_bi,
                    TocDoMetGio       = (int)x.Toc_do_met,
                    PhiNgVLM2         = (int)x.Phi_ngvl_m2,
                    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,
                    ThuTu             = (int)x.Thu_tu
                }).SingleOrDefault();
                dm = nguon;
            }
            catch { }

            return(dm);
        }
Beispiel #2
0
        public string Sua(CanPhuBDO entityBDO)
        {
            CAN_PHU entity = db.CAN_PHU.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);
        }
Beispiel #3
0
        public static string Sua(CanPhu canPhu)
        {
            var canPhuLogic = new CanPhuLogic();
            var itemBDO     = new CanPhuBDO();

            ChuyenDoiGiayDTOThanhBDO(canPhu, itemBDO);
            return(canPhuLogic.Sua(itemBDO));
        }
Beispiel #4
0
 private void ChuyenBDOThanhDAO(CanPhuBDO entityBDO, CAN_PHU entityDAO)
 {
     entityDAO.ID                    = entityBDO.ID;
     entityDAO.Ten                   = entityBDO.Ten;
     entityDAO.BHR                   = entityBDO.BHR;
     entityDAO.Toc_do_met            = entityBDO.TocDoMetGio;
     entityDAO.Phi_ngvl_m2           = entityBDO.PhiNgVLM2;
     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.Thu_tu                = entityBDO.ThuTu;
 }
Beispiel #5
0
 private static void ChuyenDoiGiayDTOThanhBDO(CanPhu canPhuDTO, CanPhuBDO canPhuBDO)
 {
     canPhuBDO.ID                = canPhuDTO.ID;
     canPhuBDO.Ten               = canPhuDTO.Ten;
     canPhuBDO.BHR               = canPhuDTO.BHR;
     canPhuBDO.TocDoMetGio       = canPhuDTO.TocDoMetGio;
     canPhuBDO.ThoiGianChuanBi   = canPhuDTO.ThoiGianChuanBi;
     canPhuBDO.DayLoiNhuan       = canPhuDTO.DayLoiNhuan;
     canPhuBDO.DaySoLuong        = canPhuDTO.DaySoLuong;
     canPhuBDO.PhiNgVLM2         = canPhuDTO.PhiNgVLM2;
     canPhuBDO.Ma_01             = canPhuDTO.Ma_01;
     canPhuBDO.DonViTinh         = canPhuDTO.DonViTinh;
     canPhuBDO.DaySoLuongNiemYet = canPhuDTO.DaySoLuongNiemYet;
     canPhuBDO.ThuTu             = canPhuDTO.ThuTu;
 }
Beispiel #6
0
 public string Them(CanPhuBDO entityBDO)
 {
     throw new NotImplementedException();
 }
Beispiel #7
0
 public string Sua(CanPhuBDO canPhuBDO)
 {
     return(canPhuDAO.Sua(canPhuBDO));
 }