Beispiel #1
0
 private void txtProductGroupID_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Down)
     {
         txtProductGroupName.Focus();
     }
     else if (e.KeyCode == Keys.Escape)
     {
         txtProductGroupID.Text = _productGroupService.NextId();
     }
 }
 private void LoadData()
 {
     if (!string.IsNullOrEmpty(_productGroupId))
     {
         _productGroup            = _productGroupService.GetProductGrouprById(_productGroupId);
         txtProductGroupID.Text   = _productGroupId;
         txtProductGroupName.Text = _productGroup.ProductGroupName;
         txtDescription.Text      = _productGroup.Description;
         checkActive.Checked      = _productGroup.Active;
     }
     else
     {
         txtProductGroupID.Text = _productGroupService.NextId();
     }
 }
 /// <summary>
 /// Thêm mới hoặc Cập nhật thông tin Nhóm Hàng
 /// </summary>
 /// <param name="productGroupName"></param>
 private ProductGroup InsertOrUpdateProductGroup(string productGroupName)
 {
     if (!string.IsNullOrEmpty(productGroupName))
     {
         ProductGroup productGroup;
         if (!_productGroupService.CheckProductGroupNameExit(productGroupName))
         {
             productGroup = _productGroupService.GetProductGrouprByName(productGroupName);
         }
         else
         {
             productGroup = new ProductGroup()
             {
                 ProductGroupID   = _productGroupService.NextId(),
                 ProductGroupName = productGroupName,
                 CreatedBy        = _userName,
                 CreatedDate      = DateTime.Now,
                 Description      = productGroupName,
             };
             try
             {
                 _productGroupService.Add(productGroup);
             }
             catch (Exception ex)
             {
                 XtraMessageBox.Show(string.Format("Lỗi thêm Nhóm Hàng \n{0}", ex.Message));
             }
         }
         return(productGroup);
     }
     return(null);
 }
Beispiel #4
0
 public FormAddProductGroup()
 {
     InitializeComponent();
     _productGroupService   = new ProductGroupService();
     _employeeService       = new EmployeeService();
     _logService            = new LogService();
     txtProductGroupID.Text = _productGroupService.NextId();
 }