private void AddTheSupplierBtn_Click(object sender, RoutedEventArgs e)
        {
            var image = imageEdit1.Source as BitmapImage;
            byte[] photo = ImageToByteArray(image);

            string comanyName = CompanyTxtBox.Text;
            string contactTitle = TitleContactTxtBox.Text;
            string contactName = NameContactTxtBox.Text;
            string address = AdresseTxtBox.Text;
            string country = CountryTxtBox.Text;
            string region = RegionTxtBox.Text;
            string city = CityTxtBox.Text;
            string postalCode = ZipCodeTxtBox.Text;
            string homePage = WebSiteTxtBox.Text;
            string email = EmailTxtBox.Text;
            string rC = RcTxtBox.Text;
            string nF = NsTxtBox.Text;
            string nIs = NisTxtBox.Text;
            string aI = AiTxtBox.Text;
            string phone = TelephonTxtBox.Text;
            string fax = FaxTxtBox.Text;
            const int status = 0;
            SuppliersManager sc = new SuppliersManager();
            String result = sc.AddNewProvider(comanyName, contactTitle, contactName, address,
                country, region, city, postalCode, phone, homePage, email, fax, rC, nF, nIs, aI, status, photo);
            DXMessageBox.Show(this,result);
            ClearSupplierFields();
        }
 public StatisticsView(string animationName)
 {
     InitializeComponent();
     _purchaseClient = new PurchaseClient();
     _orderClient = new OrderClient();
     _productClient = new ProductManger();
     _suppliersManager = new SuppliersManager();
     _customersManager = new CustomersManager();
     if (string.IsNullOrEmpty(animationName)) return;
     Storyboard animation = (Storyboard)Application.Current.Resources[animationName];
     LayoutRoot.BeginStoryboard(animation);
 }
 public ListSuppliersView(string animationName, TabHelper hlp)
 {
     InitializeComponent();
     TabHlp = hlp;
     if (!string.IsNullOrEmpty(animationName))
     {
         Storyboard animation = (Storyboard) Application.Current.Resources[animationName];
         LayoutRoot.BeginStoryboard(animation);
     }
     _provider = new Provider();
     _supplierClient = new SuppliersManager();
 }
        public ListSalesView(string animationName, TabHelper hlp)
        {
            InitializeComponent();
            _tabHlp = hlp;

            _supplierClient = new SuppliersManager();
            _purchaseClient = new PurchaseClient();
            EditPurchaseBtn.Visibility = Visibility.Collapsed;
            CancelPurchaseBtn.Visibility = Visibility.Collapsed;
            image1.Visibility = Visibility.Collapsed;
            image2.Visibility = Visibility.Collapsed;

            _purchaseDetailsManager = new PurchaseDetailsManager();
            cc = new CategorysClient();

            mc = new CategorysManager();
            if (string.IsNullOrEmpty(animationName)) return;
            Storyboard animation = (Storyboard)Application.Current.Resources[animationName];
            LayoutRoot.BeginStoryboard(animation);
        }
        public AddPurchaseView(string animationName, TabHelper hlp)
        {
            InitializeComponent();
            Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");
            _tabHlp = hlp;
            _productsSelSelected = new List<ProduitsSel>();
            //produit = new Products();
            _productManger = new ProductManger();

            _tvaClient = new TvaClient();
            TvaComboBox.ItemsSource = _tvaClient.GetTvaValues();

            _suppliersManager = new SuppliersManager();
            _productManger.ResetUnitsOnOrder();
            _productSelected = new List<Product>();
            if (string.IsNullOrEmpty(animationName)) return;
            var animation = (Storyboard) Application.Current.Resources[animationName];
            LayoutRoot.BeginStoryboard(animation);
        }
        private void ProviderTableView_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (ProviderGridControl.VisibleRowCount == 0) return;
            int rowHandle = ProviderGridControl.View.FocusedRowHandle;
            if (rowHandle < 0) return;
             SuppliersManager suppliersManager=new SuppliersManager();
            string companyName = ProviderGridControl.GetCellValue(rowHandle, "CompanyName").ToString();
            _getProvider = suppliersManager.GetProviderByName(companyName);

            if (_getProvider == null) return;
            LoadPurchasesOfProvider(_getProvider);
        }
        private void DeleteSupplierBtn_Click(object sender, RoutedEventArgs e)
        {
            if (ProviderGridControl.VisibleRowCount == 0) return;

            if (
                DXMessageBox.Show(this, "Êtes-vous sûr de vouloir supprimer ce fournisseur?", "Confirmation",
                    MessageBoxButton.YesNo) == MessageBoxResult.No) return;

            int rowHandle = ProviderGridControl.View.FocusedRowHandle;

            SuppliersManager suppliersManager = new SuppliersManager();
            Provider provider =
                suppliersManager.GetProviderByName(ProviderGridControl.GetCellValue(rowHandle, "CompanyName").ToString());

            if (provider == null) return;
            suppliersManager.DesactivateProvider(provider);
            RefreshBtn_OnClick(null, null);
        }
        private void ProviderTableView_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (ProviderGridControl.VisibleRowCount == 0) return;
            int rowHandle = ProviderGridControl.View.FocusedRowHandle;
            if (rowHandle < 0) return;
            SuppliersManager suppliersManager = new SuppliersManager();
            Provider provider = suppliersManager.GetProviderByName(ProviderGridControl.GetCellValue(rowHandle, "CompanyName").ToString());

            if (provider == null) return;
            LoadProviderFields(provider);
        }
        private void EditSupplierBtn_Click(object sender, RoutedEventArgs e)
        {
            if (ProviderGridControl.VisibleRowCount == 0) return;

            if (
                DXMessageBox.Show(this, "Êtes-vous sûr de vouloir modifier ce fournisseur?", "Confirmation",
                    MessageBoxButton.YesNo) == MessageBoxResult.No) return;

            int rowHandle = ProviderGridControl.View.FocusedRowHandle;
            var suppliersManager = new SuppliersManager();
            var provider =
                suppliersManager.GetProviderByName(ProviderGridControl.GetCellValue(rowHandle, "CompanyName").ToString());

            if (provider == null) return;

            var image = ImageEdit1.Source as BitmapImage;
            byte[] photo = ImageToByteArray(image);

            string comanyName = CompanyTxtBox.Text;
            string contactTitle = TitleContactTxtBox.Text;
            string contactName = NameContactTxtBox.Text;
            string address = AdresseTxtBox.Text;
            string country = CountryTxtBox.Text;
            string region = RegionTxtBox.Text;
            string city = CityTxtBox.Text;
            string postalCode = ZipCodeTxtBox.Text;
            string homePage = WebSiteTxtBox.Text;
            string email = EmailTxtBox.Text;
            string rC = RcTxtBox.Text;
            string nF = NsTxtBox.Text;
            string nIs = NisTxtBox.Text;
            string aI = AiTxtBox.Text;
            string phone = TelephonTxtBox.Text;
            string fax = FaxTxtBox.Text;
            const int status = 0;

            String result = suppliersManager.UpdateProvider(provider, comanyName, contactTitle, contactName, address,
                country, region, city, postalCode, phone, homePage, email, fax, rC, nF, nIs, aI, status, photo);
            DXMessageBox.Show(this, result);
            RefreshBtn_OnClick(null, null);
        }