Beispiel #1
0
        private void btnShowAll_Click(object sender, EventArgs e)
        {
            if (txtBId.Text == "")
            {
                MessageBox.Show("Please Select Brand from List for update");
            }
            else
            {
                Brands brands = new Brands();
                brands.BrandID   = int.Parse(txtBId.Text);
                brands.BrandName = txtbName.Text;
                brands.ClientID  = int.Parse(txtbcid.Text);
                brands.ManagerID = int.Parse(txtbMangID.Text);

                //call the service
                ABCServices service = new ABCServices();
                StateEnum   result  = service.UpdateBrandDetails(brands);
                // check the result
                switch (result)
                {
                case StateEnum.Fail:
                    MessageBox.Show("Sorry Can't update Brand");
                    break;

                case StateEnum.Success:
                    MessageBox.Show("Brand Updated- Thank You");
                    break;
                }
                RefreshBrandList();
            }
        }
Beispiel #2
0
        private void btnUpdateClient_Click(object sender, EventArgs e)
        {
            if (txtID.Text == "")
            {
                MessageBox.Show("Please Select Client from List for update");
            }
            else
            {
                Clients clients = new Clients();
                clients.ClientID    = int.Parse(txtID.Text);
                clients.ClientName  = txtName.Text;
                clients.ClientPhone = txtPhone.Text;

                //call the service
                ABCServices service = new ABCServices();
                StateEnum   result  = service.UpdateClientDetails(clients);
                // check the result
                switch (result)
                {
                case StateEnum.Fail:
                    MessageBox.Show("Sorry Can't update Client");
                    break;

                case StateEnum.Success:
                    MessageBox.Show("Clients Details Updated- Thank You");
                    break;
                }
                RefreshList();
            }
        }
Beispiel #3
0
        // Insert Client
        private void button1_Click(object sender, EventArgs e)
        {
            Clients clients = new Clients();

            clients.ClientID    = int.Parse(txtID.Text);
            clients.ClientName  = txtName.Text;
            clients.ClientPhone = txtPhone.Text;

            // call the service
            ABCServices service = new ABCServices();
            StateEnum   result  = service.SaveClient(clients);

            // check the result
            switch (result)
            {
            case StateEnum.Fail:
                MessageBox.Show("Sorry Can't Add Client");
                break;

            case StateEnum.Success:
                MessageBox.Show("Client Added Thank you");
                break;
            }
            // Refresh List after add

            RefreshList();
            // Clear the form after save brand
            txtID.Text    = "";
            txtName.Text  = "";
            txtPhone.Text = "";
        }
Beispiel #4
0
        private void btnAddBrand_Click(object sender, EventArgs e)
        {
            Brands brands = new Brands();

            brands.BrandID   = int.Parse(txtBId.Text);
            brands.BrandName = txtbName.Text;
            brands.ClientID  = int.Parse(txtbcid.Text);
            brands.ManagerID = int.Parse(txtbMangID.Text);

            // call the service
            ABCServices service = new ABCServices();
            StateEnum   result  = service.SaveBrand(brands);

            // check the result
            switch (result)
            {
            case StateEnum.Fail:
                MessageBox.Show("Sorry Can't Add Brand");
                break;

            case StateEnum.Success:
                MessageBox.Show("New Brand Added - Thank you");
                break;
            }
            // Refresh List after add

            RefreshBrandList();

            // Clear the form after save brand
            Clear();
        }
Beispiel #5
0
        //Find Brand By ID
        private void btnSearch_Click(object sender, EventArgs e)
        {
            int         bid         = int.Parse(txtBId.Text);
            ABCServices aBCServices = new ABCServices();
            Brands      foundBrand  = aBCServices.SearchBrandByID(bid);

            //switch (foundClient.StateResult)
            //{
            //    case StateEnum.Fail:
            //        MessageBox.Show("Error");
            //        break;
            //    case StateEnum.Success:
            if (foundBrand == null)
            {
                MessageBox.Show("Employee Not Found");
            }
            else
            {
                txtBId.Text     = foundBrand.BrandID.ToString();
                txtbName.Text   = foundBrand.BrandName;
                txtbcid.Text    = foundBrand.ClientID.ToString();
                txtbMangID.Text = foundBrand.ManagerID.ToString();
            }
            // break;
        }
Beispiel #6
0
        public void RefreshList()
        {
            ABCServices    services = new ABCServices();
            List <Clients> clients  = services.FindAllClients();

            // WHY IS FOLLOWING LINES?????????
            List <int> myintlist = new List <int>();

            myintlist.Add(11);
            myintlist.Add(1001);
            myintlist.Add(10021);
            myintlist.Add(10013);
            myintlist.Add(10014);
            myintlist.Where(o => o > 999).Count();
            ListClient.Items.Clear();
            foreach (var item in clients)
            {
                ListClient.Items.Add(item.ClientID + "  - " + item.ClientName + "  - " + item.ClientPhone);
            }
        }
Beispiel #7
0
        public void RefreshBrandList()
        {
            ABCServices   services = new ABCServices();
            List <Brands> brands   = services.FindAllBrands();

            // WHY IS FOLLOWING LINES?????????
            List <int> myintlist = new List <int>();

            myintlist.Add(11);
            myintlist.Add(1001);
            myintlist.Add(10021);
            myintlist.Add(10013);
            myintlist.Add(10014);
            myintlist.Where(o => o > 999).Count();
            brandList.Items.Clear();
            foreach (var item in brands)
            {
                brandList.Items.Add(item.BrandID + "  - " + item.BrandName + "  - " + item.ClientID + " - " + item.ManagerID);
            }
        }
Beispiel #8
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         string[] arrClients = ListClient.SelectedItem.ToString().Split(' ');
         txtID.Text = arrClients[0];
         // call the service
         ABCServices services = new ABCServices();
         Clients     clients  = services.SearchClientByID(int.Parse(arrClients[0]));
         // check the result
         if (clients == null)
         {
             MessageBox.Show("Client Not Found");
         }
         else
         {
             txtName.Text  = clients.ClientName;
             txtPhone.Text = clients.ClientPhone;
         }
     }
     catch { }
 }
Beispiel #9
0
        private void btnDeleteClient_Click(object sender, EventArgs e)
        {
            Clients clients = new Clients();

            clients.ClientID    = int.Parse(txtID.Text);
            clients.ClientName  = txtName.Text;
            clients.ClientPhone = txtPhone.Text;

            ABCServices services = new ABCServices();
            StateEnum   result   = services.DeleteClient(clients);

            switch (result)
            {
            case StateEnum.Fail:
                MessageBox.Show("Can't Delete Client");
                break;

            case StateEnum.Success:
                MessageBox.Show("Client Deleted");
                break;
            }
            RefreshList();
        }
Beispiel #10
0
        public void BrandByClientID(int id)
        {
            txtbcid.Text = id.ToString();

            ABCServices services = new ABCServices();

            List <Brands> brands = services.SearchBrandByClientID(id);

            //    // WHY IS FOLLOWING LINES?????????
            List <int> myintlist = new List <int>();

            myintlist.Add(11);
            myintlist.Add(1001);
            myintlist.Add(10021);
            myintlist.Add(10013);
            myintlist.Add(10014);
            myintlist.Where(o => o > 999).Count();
            brandList.Items.Clear();
            foreach (var item in brands)
            {
                brandList.Items.Add(item.BrandID + "  -  " + item.BrandName + "  -  " + item.ManagerID);
            }
        }
Beispiel #11
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         string[] arrBrands = brandList.SelectedItem.ToString().Split(' ');
         txtBId.Text = arrBrands[0];
         // call the service
         ABCServices services = new ABCServices();
         Brands      brands   = services.SearchBrandByID(int.Parse(arrBrands[0]));
         // check the result
         if (brands == null)
         {
             MessageBox.Show("Brands Not Found");
         }
         else
         {
             txtbName.Text   = brands.BrandName;
             txtbcid.Text    = brands.ClientID.ToString();
             txtbMangID.Text = brands.ManagerID.ToString();
         }
     }
     catch { }
 }
Beispiel #12
0
        private void btnClientSearch_Click(object sender, EventArgs e)
        {
            int         cid         = int.Parse(txtID.Text);
            ABCServices aBCServices = new ABCServices();
            Clients     foundClient = aBCServices.SearchClientByID(cid);

            //switch (foundClient.StateResult)
            //{
            //    case StateEnum.Fail:
            //        MessageBox.Show("Error");
            //        break;
            //    case StateEnum.Success:
            if (foundClient == null)
            {
                MessageBox.Show("Employee Not Found");
            }
            else
            {
                txtID.Text    = foundClient.ClientID.ToString();
                txtName.Text  = foundClient.ClientName;
                txtPhone.Text = foundClient.ClientPhone;
            }
            // break;
        }
Beispiel #13
0
        private void btnDeleteBrand_Click(object sender, EventArgs e)
        {
            Brands brands = new Brands();

            brands.BrandID   = int.Parse(txtBId.Text);
            brands.BrandName = txtbName.Text;
            brands.ClientID  = int.Parse(txtbcid.Text);
            brands.ManagerID = int.Parse(txtbMangID.Text);

            ABCServices services = new ABCServices();
            StateEnum   result   = services.DeleteBrand(brands);

            switch (result)
            {
            case StateEnum.Fail:
                MessageBox.Show("Can't Delete Brand");
                break;

            case StateEnum.Success:
                MessageBox.Show("Brand Deleted");
                break;
            }
            RefreshBrandList();
        }