Esempio n. 1
0
        public string Sua(MayBoiNhieuLopBDO entityBDO)
        {
            MAY_BOI_NHIEU_LOP entity = db.MAY_BOI_NHIEU_LOP.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);
        }
Esempio n. 2
0
        public MayBoiNhieuLopBDO DocTheoId(int iD)
        {
            MayBoiNhieuLopBDO dm = null;

            try
            {
                var nguon = db.MAY_BOI_NHIEU_LOP.Where(x => x.ID == iD).Select(x => new MayBoiNhieuLopBDO
                {
                    ID                = x.ID,
                    Ten               = x.ten,
                    DienGiai          = x.dien_giai,
                    BHR               = (int)x.BHR,
                    ThoiGianChuanBi   = (float)x.thoi_gian_chuan_bi,
                    TocDoTamGio       = (int)x.toc_do_tam_gio,
                    PhiKeoMetVuong    = (int)x.phi_keo_met_vuong,
                    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);
        }
Esempio n. 3
0
        public static string Sua(MayBoiNhieuLop boiBiaCung)
        {
            var boiNhieuLopLogic = new MayBoiNhieuLopLogic();
            var itemBDO          = new MayBoiNhieuLopBDO();

            ChuyenDoiDTOThanhBDO(boiBiaCung, itemBDO);
            return(boiNhieuLopLogic.Sua(itemBDO));
        }
Esempio n. 4
0
 private static void ChuyenDoiDTOThanhBDO(MayBoiNhieuLop itemDTO, MayBoiNhieuLopBDO itemBDO)
 {
     itemBDO.ID                = itemDTO.ID;
     itemBDO.Ten               = itemDTO.Ten;
     itemBDO.BHR               = itemDTO.BHR;
     itemBDO.TocDoTamGio       = itemDTO.TocDoTamGio;
     itemBDO.PhiKeoMetVuong    = itemDTO.PhiKeoMetVuong;
     itemBDO.ThoiGianChuanBi   = itemDTO.ThoiGianChuanBi;
     itemBDO.DayLoiNhuan       = itemDTO.DayLoiNhuan;
     itemBDO.DaySoLuong        = itemDTO.DaySoLuong;
     itemBDO.Ma_01             = itemDTO.Ma_01;
     itemBDO.DonViTinh         = itemDTO.DonViTinh;
     itemBDO.DaySoLuongNiemYet = itemDTO.DaySoLuongNiemYet;
     itemBDO.DienGiai          = itemDTO.DienGiai;
     itemBDO.ThuTu             = itemDTO.ThuTu;
 }
Esempio n. 5
0
 private void ChuyenBDOThanhDAO(MayBoiNhieuLopBDO entityBDO, MAY_BOI_NHIEU_LOP entityDAO)
 {
     entityDAO.ID                    = entityBDO.ID;
     entityDAO.ten                   = entityBDO.Ten;
     entityDAO.dien_giai             = entityBDO.DienGiai;
     entityDAO.BHR                   = entityBDO.BHR;
     entityDAO.toc_do_tam_gio        = entityBDO.TocDoTamGio;
     entityDAO.phi_keo_met_vuong     = entityBDO.PhiKeoMetVuong;
     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;
 }
Esempio n. 6
0
        public string Them(MayBoiNhieuLopBDO entityBDO)
        {
            string kq = "";

            try
            {
                kq = KiemTraTrung(entityBDO.Ten);
                if (kq != "")
                {
                    return(kq);
                }
                MAY_BOI_NHIEU_LOP entity = new MAY_BOI_NHIEU_LOP();
                ChuyenBDOThanhDAO(entityBDO, entity);
                db.MAY_BOI_NHIEU_LOP.Add(entity);
                db.SaveChanges();
                kq = string.Format("Mục tin:{0}", entity.ID);
            }
            catch
            {
                kq = string.Format("Thêm Mục tin {0} lỗi!", entityBDO.ID);
            }
            return(kq);
        }
Esempio n. 7
0
 public string Sua(MayBoiNhieuLopBDO boiBiaCungBDO)
 {
     return(boiNhieuLopDAO.Sua(boiBiaCungBDO));
 }
Esempio n. 8
0
 public string Them(MayBoiNhieuLopBDO boiBiaCungBDO)
 {
     return(boiNhieuLopDAO.Them(boiBiaCungBDO));
 }