Exemple #1
0
        public MayKhoanBoGocBDO DocTheoId(int iD)
        {
            MayKhoanBoGocBDO dm = null;

            try
            {
                var nguon = db.MAY_KHOAN_BO_GOC.Where(x => x.ID == iD).Select(x => new MayKhoanBoGocBDO
                {
                    ID                = x.ID,
                    Ten               = x.ten,
                    DienGiai          = x.dien_giai,
                    BHR               = (int)x.BHR,
                    ThoiGianChuanBi   = (float)x.thoi_gian_chuan_bi,
                    TieuDe            = x.tieu_de,
                    TocDoBlockGio     = (int)x.toc_do_block_gio,
                    PhiDungCuMoiBlock = (int)x.phi_dung_cu_theo_block,
                    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);
        }
Exemple #2
0
        public string Sua(MayKhoanBoGocBDO entityBDO)
        {
            MAY_KHOAN_BO_GOC entity = db.MAY_KHOAN_BO_GOC.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);
        }
Exemple #3
0
        public static string Sua(MayKhoanBoGoc khoanBoGoc)
        {
            var khoanBoGocLogic = new MayKhoanBoGocLogic();
            var itemBDO         = new MayKhoanBoGocBDO();

            ChuyenDoiDTOThanhBDO(khoanBoGoc, itemBDO);
            return(khoanBoGocLogic.Sua(itemBDO));
        }
Exemple #4
0
        public static string Them(MayKhoanBoGoc boiBiaCung)
        {
            var khoanBoGoclLogic = new MayKhoanBoGocLogic();
            var itemBDO          = new MayKhoanBoGocBDO();

            ChuyenDoiDTOThanhBDO(boiBiaCung, itemBDO);
            return(khoanBoGoclLogic.Them(itemBDO));
        }
Exemple #5
0
 private void ChuyenBDOThanhDAO(MayKhoanBoGocBDO entityBDO, MAY_KHOAN_BO_GOC entityDAO)
 {
     entityDAO.ID                     = entityBDO.ID;
     entityDAO.ten                    = entityBDO.Ten;
     entityDAO.dien_giai              = entityBDO.DienGiai;
     entityDAO.BHR                    = entityBDO.BHR;
     entityDAO.toc_do_block_gio       = entityBDO.TocDoBlockGio;
     entityDAO.tieu_de                = entityBDO.TieuDe;
     entityDAO.phi_dung_cu_theo_block = entityBDO.PhiDungCuMoiBlock;
     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;
 }
Exemple #6
0
 private static void ChuyenDoiDTOThanhBDO(MayKhoanBoGoc itemDTO, MayKhoanBoGocBDO itemBDO)
 {
     itemBDO.ID                = itemDTO.ID;
     itemBDO.Ten               = itemDTO.Ten;
     itemBDO.BHR               = itemDTO.BHR;
     itemBDO.TieuDe            = itemDTO.TieuDe;
     itemBDO.TocDoBlockGio     = itemDTO.TocDoBlockGio;
     itemBDO.PhiDungCuMoiBlock = itemDTO.PhiDungCuMoiBlock;
     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;
 }
Exemple #7
0
        public string Them(MayKhoanBoGocBDO entityBDO)
        {
            string kq = "";

            try
            {
                kq = KiemTraTrung(entityBDO.Ten);
                if (kq != "")
                {
                    return(kq);
                }
                MAY_KHOAN_BO_GOC entity = new MAY_KHOAN_BO_GOC();
                ChuyenBDOThanhDAO(entityBDO, entity);
                db.MAY_KHOAN_BO_GOC.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);
        }
 public string Sua(MayKhoanBoGocBDO khoanBoGocBDO)
 {
     return(khoanBoGocDAO.Sua(khoanBoGocBDO));
 }
 public string Them(MayKhoanBoGocBDO khoanBoGocBDO)
 {
     return(khoanBoGocDAO.Them(khoanBoGocBDO));
 }