Пример #1
0
        /// <summary>
        /// Đổ dữ liệu vào khung chi tiết khi click chuột vào bảng
        /// </summary>
        private void gridControl1_MouseDown(object sender, MouseButtonEventArgs e)
        {
            try
            {
                ProductTypeTableModel item        = (ProductTypeTableModel)gridControl1.SelectedItem;
                Models.ProductType    productType = App.productTypeController.GetProductTypeById(item.Id);

                txtProductTypeId.Text         = productType.Id + "";
                txtProductTypeCreateTime.Text = productType.CreateTime.ToString("dd/MM/yyyy");
                txtProductTypeCreatedBy.Text  = productType.Account?.Name ?? "";

                txtProductTypeName.Text   = productType.Name;
                txtProductTypeDetail.Text = productType.Detail;

                if (productType.ParentProductType != null)
                {
                    try
                    {
                        List <Models.ProductType> cboxList = cbProductTypeParentName.ItemsSource as List <Models.ProductType>;
                        cbProductTypeParentName.SelectedItem = cboxList.Single(m => m.Id == productType.ParentId);
                    }
                    catch (Exception)
                    {
                        cbProductTypeParentName.SelectedItem = null;
                    }
                }
                else
                {
                    cbProductTypeParentName.SelectedItem = null;
                }

                btnAddProductType.IsEnabled         = true;
                btnAddProductType_Cancel.Visibility = Visibility.Hidden;
                btnAddProductType_Cancel.IsEnabled  = false;

                btnSaveChangeProductType.Visibility = Visibility.Visible;
                btnSaveChangeProductType.IsEnabled  = true;

                btnSaveChangeProductTypeCancel.Visibility = Visibility.Visible;
                btnSaveChangeProductTypeCancel.IsEnabled  = true;

                btnDeleteProductType.Visibility = Visibility.Visible;
                btnDeleteProductType.IsEnabled  = true;

                btnSearch.Visibility = Visibility.Visible;
                btnSearch.IsEnabled  = true;

                btnRefresh.Visibility = Visibility.Visible;
                btnRefresh.IsEnabled  = true;
            }
            catch (Exception ex)
            {
            }
        }
 public List <ProductTypeTableModel> GetListTableModelBySearch(string search)
 {
     return(ProductTypeTableModel.ToListByListProductType(
                _productTypeProvider.Search(search)));
 }