コード例 #1
0
 public void xoaLoaiDocGia(string maLoai)
 {
     if (string.IsNullOrEmpty(maLoai))
     {
         MessageBox.Show("Vui lòng chọn dữ liệu để xoá.");
         return;
     }
     if (MessageBox.Show("Bạn có muốn xoá?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         LOAIDOCGIA l = db.LOAIDOCGIAs.Where(a => a.MaLoaiDocGia == int.Parse(maLoai)).FirstOrDefault();
         if (l != null)
         {
             l.TinhTrangXoa = true;
             db.SubmitChanges();
             MessageBox.Show("Xoá thành công.");
             return;
         }
         else
         {
             MessageBox.Show("Xoá không thành công.");
             return;
         }
     }
     else
     {
         return;
     }
 }
コード例 #2
0
 public void OpenEditClientType()
 {
     this.DialogContent         = ClientTypeForm;
     ClientTypeForm.DataContext = this;
     IsDialogOpen       = true;
     SelectedClientType = new LOAIDOCGIA();
 }
コード例 #3
0
        public void themLoaiDocGia(string tenLDG)
        {
            if (string.IsNullOrEmpty(tenLDG))
            {
                MessageBox.Show("Vui lòng nhập đẩy đủ thông tin.");
                return;
            }

            LOAIDOCGIA newItem = new LOAIDOCGIA();

            newItem.TenLoaiDocGia = tenLDG;
            newItem.TinhTrangXoa  = false;
            try
            {
                db.LOAIDOCGIAs.InsertOnSubmit(newItem);
                db.SubmitChanges();
                MessageBox.Show("Thêm thành công.");
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Thêm không thành công.");
                return;
            }
        }
コード例 #4
0
 public void Cancel()
 {
     Client     = dataProvider.GetClient(x => x.MADG == Client.MADG);
     LoaiDocGia = ClientTypeList.FirstOrDefault(x => x.MALDG == Client.MALDG);
     if (string.IsNullOrEmpty(Client.HINHANH) == true || File.Exists(Client.HINHANH) == false)
     {
         Client.HINHANH = @"/Resources/Images/ClientAccount/DefaultAccount.png";
     }
 }
コード例 #5
0
 private void frmThemLoaiDocGia_Load(object sender, EventArgs e)
 {
     try
     {
         LOAIDOCGIA ldg = LOAIDOCGIABUS.Instance.GetLoaiDocGia()[LOAIDOCGIABUS.Instance.GetLoaiDocGia().Count - 1];
         idLast = ldg.MaLoaiDocGia.ToString();
     }
     catch
     {
         idLast = "";
     }
     txbMaLoaiDocGia.Text = HelpGUI.AutoIncreaseID.Load_AutoIncreaseID("LDG", idLast, 3);
 }
コード例 #6
0
 public ClientDetailViewModel(DataProvider dataProvider, IEventAggregator eventAggregator) : base(dataProvider, eventAggregator)
 {
     Client = dataProvider.SelectedClient;
     if (string.IsNullOrEmpty(Client.HINHANH) == true || File.Exists(Client.HINHANH) == false)
     {
         Client.HINHANH = @"/Resources/Images/ClientAccount/DefaultAccount.png";
     }
     ClientTypeList    = dataProvider.GetList <LOAIDOCGIA>();
     LoaiDocGia        = ClientTypeList.FirstOrDefault(x => x.MALDG == Client.MALDG);
     Client.LOAIDOCGIA = ClientTypeList.FirstOrDefault(x => x.MALDG == Client.MALDG);
     BorrowList        = new BindableCollection <CTSACH>();
     BorrowBillList    = dataProvider.GetPMS(x => x.MADG == Client.MADG);
     Amount            = dataProvider.LibraryRules.SACHMUONTOIDA ?? 5;
     foreach (PHIEUMUONSACH item in BorrowBillList)
     {
         Amount -= item.CTSACH.Count - item.CTPTS.Count;
     }
     MyList         = dataProvider.ReturnBookList(Client);
     ReturnBookBill = new BindableCollection <CTPTS>();
 }
コード例 #7
0
        public void suaLoaiDocGia(string maLoai, string tenLoai)
        {
            if (string.IsNullOrEmpty(maLoai))
            {
                MessageBox.Show("Vui lòng chọn dữ liệu để sửa.");
                return;
            }
            LOAIDOCGIA l = db.LOAIDOCGIAs.Where(a => a.MaLoaiDocGia == int.Parse(maLoai)).FirstOrDefault();

            if (l != null)
            {
                l.TenLoaiDocGia = tenLoai;
                db.SubmitChanges();
                MessageBox.Show("Sửa thành công.");
                return;
            }
            else
            {
                MessageBox.Show("Sửa không thành công.");
                return;
            }
        }