void Accept() { try { if (!CheckValidate_F()) { return; } Category_Controller _Category_Controller = new Category_Controller(); if (c_type == Convert.ToInt16(Form_Type.Insert)) { MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn thêm mới nhà cung cấp hay không?", "Thông báo", NoteBoxLevel.Question); if (MessageBoxResult.Yes == result) { Category_Info _Category_Info = new Category_Info(); _Category_Info.Category_Name = txtName.Text; decimal _id = 0; if (_Category_Controller.Category_Insert(_Category_Info, ref _id)) { NoteBox.Show("Thêm mới thành công"); c_id_insert = _id; this.Close(); } else { NoteBox.Show("Có lỗi trong quá trình thêm mới", "", NoteBoxLevel.Error); } } } else { MessageBoxResult result = NoteBox.Show("Bạn chắc chắn muốn cập nhật hay không?", "Thông báo", NoteBoxLevel.Question); if (MessageBoxResult.Yes == result) { Category_Info _Category_Info = new Category_Info(); _Category_Info.Category_Name = txtName.Text; if (_Category_Controller.Category_Update(c_Category_Info.Category_Id, _Category_Info)) { NoteBox.Show("Cập nhật dữ liệu thành công"); c_id_insert = 1; this.Close(); } else { NoteBox.Show("Có lỗi trong quá trình cập nhật dữ liệu", "", NoteBoxLevel.Error); } } } } catch (Exception ex) { CommonData.log.Error(ex.ToString()); } }
public void ByController() { var controller = new TestableController(); var maskedResult = controller.Mask(Category_Controller.GetCategories()); foreach (var category in maskedResult) { Assert.Null(category.Children); } }
Hashtable c_hs_color = new Hashtable(); // Danh sách màu Key ID #endregion #region Events private void Window_Loaded(object sender, RoutedEventArgs e) { try { dpReceiveDate.Text = DateTime.Now.ToString("dd/MM/yyyy"); txtProduct_Name.Focus(); Category_Controller _Category_Controller = new Category_Controller(); List <Category_Info> _lst = _Category_Controller.Get_All(); cboItem_Type.DisplayMemberPath = "Category_Name"; cboItem_Type.SelectedValuePath = "Category_Id"; cboItem_Type.ItemsSource = _lst; cboItem_Type.SelectedIndex = 0; Supplier_Controller _Supplier_Controller = new Supplier_Controller(); List <Supplier_Info> _lst1 = _Supplier_Controller.Get_All(); cboSupplier.DisplayMemberPath = "Supplier_Name"; cboSupplier.SelectedValuePath = "Supplier_Id"; cboSupplier.ItemsSource = _lst1; cboSupplier.SelectedIndex = 0; Allcode_Controller _Allcode_Controller = new Allcode_Controller(); List <AllCode_Info> _lst2 = _Allcode_Controller.Get_AllCode_ByCdNameCdType("PRODUCT", "UNIT"); cboUnit.SelectedValuePath = "CdValue"; cboUnit.DisplayMemberPath = "Content"; cboUnit.ItemsSource = _lst2; cboUnit.SelectedIndex = 0; Create_SoHoaDon(); } catch (Exception ex) { CommonData.log.Error(ex.ToString()); } }
public IEnumerable <Category_Controller> TestByAction() { return(this.Mask(Category_Controller.GetCategories())); }