예제 #1
0
 private void dashBoardPages_SelectedPageChanged(object sender, EventArgs e)
 {
     if (dashBoardPages.SelectedPage == dashboardPage)
     {
         DashboardControl dashboardControl = new DashboardControl();
         dashboardControl.Dock = DockStyle.Fill;
         dashboardPage.Controls.Add(dashboardControl);
     }
     else if (dashBoardPages.SelectedPage == customerPage)
     {
         CustomerControl customerControl = new CustomerControl();
         customerControl.Dock = DockStyle.Fill;
         customerPage.Controls.Add(customerControl);
     }
     else if (dashBoardPages.SelectedPage == productsPage)
     {
         ProductControl productControl = new ProductControl();
         productControl.Dock = DockStyle.Fill;
         productsPage.Controls.Add(productControl);
     }
     else if (dashBoardPages.SelectedPage == supplierPage)
     {
         SupplierControl supplierControl = new SupplierControl();
         supplierControl.Dock = DockStyle.Fill;
         supplierPage.Controls.Add(supplierControl);
     }
     else if (dashBoardPages.SelectedPage == purchasingPage)
     {
         PurchasingControl purchasingControl = new PurchasingControl();
         purchasingControl.Dock = DockStyle.Fill;
         purchasingPage.Controls.Add(purchasingControl);
     }
 }
 public SupplierDashboard(MainWindow Main, SupplierCollection supps)
 {
     InitializeComponent();
     SetMainWindowRef(Main);
     foreach (Supplier Supp in supps)
     {
         var refcontrol = new SupplierControl();
         try
         {
             var suppcount    = Supp.Mixdown.Count;
             var DiscontCount = SQLServer.MSSelectData("SELECT COUNT(*) FROM whldata.sku_supplierdata WHERE SupplierName ='" + Supp.Code + "' AND isDiscontinued='True' ;") as ArrayList;
             refcontrol.FullSupplierName.Text = Supp.Name;
             refcontrol.SupplierCode.Text     = Supp.Code;
             refcontrol.TotalLines.Text       = suppcount.ToString() + " Lines";
             refcontrol.Discontinued.Text     = (DiscontCount[0] as ArrayList)[0].ToString() + " Discontinued";
             refcontrol.SupplierCodeInternal  = Supp.Code;
             refcontrol.SupplierInternal      = Supp;
             refcontrol.MouseUp += Refcontrol_MouseUp;
             refcontrol.TouchUp += Refcontrol_TouchUp;
         }
         catch (InvalidCastException)
         {
             continue;
         }
         catch (NullReferenceException)
         {
             continue;
         }
         finally
         {
             SupplierStackPanel.Children.Add(refcontrol);
         }
     }
 }
예제 #3
0
        private void btnCari_Click(object sender, EventArgs e)
        {
            var list = new SupplierControl();

            try
            {
                if (txtCari.Text != null && list.SearchSupplier(txtCari.Text) != null)
                {
                    buttonUbah.Enabled = true;
                    supplier           = list.SearchSupplier(txtCari.Text);

                    txtNamaSupplier.Text        = supplier.Nama_Supplier;
                    txtAlamatSupplier.Text      = supplier.Alamat_Supplier;
                    txtNomorTelponSupplier.Text = supplier.Phone_Supplier;

                    txtNamaSupplier.Enabled        = true;
                    txtAlamatSupplier.Enabled      = true;
                    txtNomorTelponSupplier.Enabled = true;
                }
                else
                {
                    MessageBox.Show("Pencarian Tidak Ditemukan");
                    throw null;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
예제 #4
0
        private void buttonTampilSupplier_Click(object sender, EventArgs e)
        {
            txtCari.Enabled = true;
            btnCari.Enabled = true;

            stat = "supplier";
            var ctrl = new SupplierControl();

            dataGridViewTampil.DataSource = ctrl.ShowSupplier();
        }
예제 #5
0
        private void buttonUbah_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtCari.Text.Trim()))
                {
                    MessageBox.Show("Text Pencarian Tidak Boleh Kosong");
                    throw null;
                }
                if (string.IsNullOrEmpty(txtNamaSupplier.Text.Trim()))
                {
                    MessageBox.Show("Nama Supplier Tidak Boleh Kosong");
                    throw null;
                }
                if (!Regex.Match(txtNamaSupplier.Text, @"^[a-zA-Z]+$").Success)
                {
                    MessageBox.Show("Nama Supplier Tidak Boleh Mengandung Angka");
                    throw null;
                }
                if (string.IsNullOrEmpty(txtAlamatSupplier.Text.Trim()))
                {
                    MessageBox.Show("Alamat Supplier Tidak Boleh Kosong");
                    throw null;
                }
                if (string.IsNullOrEmpty(txtNomorTelponSupplier.Text.Trim()))
                {
                    MessageBox.Show("Nomor Telpon Pegawai Tidak Boleh Kosong");
                    throw null;
                }


                var list = new SupplierControl();
                supplier = new Supplier(txtNamaSupplier.Text, txtAlamatSupplier.Text, txtNomorTelponSupplier.Text, FormLogin.id_pegawai);
                ValidateNumberOnly(txtNomorTelponSupplier.Text);
                list.UpdateSupplier(supplier, txtCari.Text);

                txtNamaSupplier.Enabled        = false;
                txtAlamatSupplier.Enabled      = false;
                txtNomorTelponSupplier.Enabled = false;

                MessageBox.Show("Data Berhasil Diubah");
                buttonUbah.Enabled = false;
            }
            catch (NumberOnlyException ex)
            {
                Console.WriteLine(ex.ToString());
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
예제 #6
0
        private void buttonHapus_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtCari.Text.Trim()))
                {
                    MessageBox.Show("Text Pencarian Kosong");
                    throw null;
                }

                var list = new SupplierControl();
                list.DeleteSupplier(txtCari.Text);
                MessageBox.Show("Data Berhasil Dihapus");
                buttonHapus.Enabled = false;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
 private void CreateNewTab(SupplierControl sender)
 {
     MainWindowRef.NewTab(new SupplierData(MainWindowRef, sender.SupplierInternal));
 }
예제 #8
0
        private void btnCari_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtCari.Text.Trim()))
                {
                    MessageBox.Show("Text Pencarian Kosong");
                    throw null;
                }

                if (stat == "customer")
                {
                    var ctrl = new CustomerControl();
                    if (ctrl.SearchCustomer(txtCari.Text) == null)
                    {
                        MessageBox.Show("Pencarian Tidak Ditemukan");
                        throw null;
                    }
                    else
                    {
                        List <Customer> CustomerList = new List <Customer>();
                        CustomerList.Add(ctrl.SearchCustomer(txtCari.Text));
                        dataGridViewTampil.DataSource = CustomerList;
                    }
                }
                else if (stat == "hewan")
                {
                    var ctrl = new HewanControl();
                    if (ctrl.SearchHewan(txtCari.Text) == null)
                    {
                        MessageBox.Show("Pencarian Tidak Ditemukan");
                        throw null;
                    }
                    else
                    {
                        List <Hewan> HewanList = new List <Hewan>();
                        HewanList.Add(ctrl.SearchHewan(txtCari.Text));
                        dataGridViewTampil.DataSource = HewanList;
                    }
                }
                else if (stat == "jenishewan")
                {
                    var ctrl = new JenisHewanControl();
                    if (ctrl.SearchJenisHewan(txtCari.Text) == null)
                    {
                        MessageBox.Show("Pencarian Tidak Ditemukan");
                        throw null;
                    }
                    else
                    {
                        List <JenisHewan> JenisHewanList = new List <JenisHewan>();
                        JenisHewanList.Add(ctrl.SearchJenisHewan(txtCari.Text));
                        dataGridViewTampil.DataSource = JenisHewanList;
                    }
                }
                else if (stat == "layanan")
                {
                    var ctrl = new LayananControl();
                    if (ctrl.SearchLayanan(txtCari.Text) == null)
                    {
                        MessageBox.Show("Pencarian Tidak Ditemukan");
                        throw null;
                    }
                    else
                    {
                        List <Layanan> LayananList = new List <Layanan>();
                        LayananList.Add(ctrl.SearchLayanan(txtCari.Text));
                        dataGridViewTampil.DataSource = LayananList;
                    }
                }
                else if (stat == "pegawai")
                {
                    var ctrl = new PegawaiControl();
                    if (ctrl.SearchPegawai(txtCari.Text) == null)
                    {
                        MessageBox.Show("Pencarian Tidak Ditemukan");
                        throw null;
                    }
                    else
                    {
                        List <Pegawai> PegawaiList = new List <Pegawai>();
                        PegawaiList.Add(ctrl.SearchPegawai(txtCari.Text));
                        dataGridViewTampil.DataSource = PegawaiList;
                    }
                }
                else if (stat == "produk")
                {
                    string           connStr     = "datasource=127.0.0.1;port=3306;username=root;password=;database=kouvee;Convert Zero Datetime=True;";
                    MySqlConnection  conn        = new MySqlConnection(connStr);
                    string           selectQuery = "SELECT * FROM produk WHERE NAMA_PRODUK = '" + txtCari.Text + "'";
                    MySqlCommand     command     = new MySqlCommand(selectQuery, conn);
                    MySqlDataAdapter da          = new MySqlDataAdapter(command);
                    DataTable        table       = new DataTable();
                    da.Fill(table);

                    if (table.Rows.Count == 0)
                    {
                        MessageBox.Show("Pencarian Tidak Ditemukan");
                        da.Dispose();
                        throw null;
                    }
                    else
                    {
                        dataGridViewTampil.DataSource = table;
                        DataGridViewImageColumn imageColumn = new DataGridViewImageColumn();
                        imageColumn = (DataGridViewImageColumn)dataGridViewTampil.Columns[9];
                        dataGridViewTampil.Columns[8].Visible = false;
                        imageColumn.ImageLayout = DataGridViewImageCellLayout.Stretch;
                        da.Dispose();
                    }
                }
                else if (stat == "supplier")
                {
                    var ctrl = new SupplierControl();
                    if (ctrl.SearchSupplier(txtCari.Text) == null)
                    {
                        MessageBox.Show("Pencarian Tidak Ditemukan");
                        throw null;
                    }
                    else
                    {
                        List <Supplier> SupplierList = new List <Supplier>();
                        SupplierList.Add(ctrl.SearchSupplier(txtCari.Text));
                        dataGridViewTampil.DataSource = SupplierList;
                    }
                }
                else if (stat == "ukuranhewan")
                {
                    var ctrl = new UkuranHewanControl();
                    if (ctrl.SearchUkuran(txtCari.Text) == null)
                    {
                        MessageBox.Show("Pencarian Tidak Ditemukan");
                        throw null;
                    }
                    else
                    {
                        List <UkuranHewan> UkuranHewanList = new List <UkuranHewan>();
                        UkuranHewanList.Add(ctrl.SearchUkuran(txtCari.Text));
                        dataGridViewTampil.DataSource = UkuranHewanList;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }