Exemplo n.º 1
0
        void EditService()
        {
            try {
                if (lvServices.SelectedItems.Count > 0)
                {
                    ContPointOfSale.isChangeServiceDetail = true;
                    ContPointOfSale.serviceNo             = lvServices.SelectedItems[0].SubItems[0].Text;
                    ContPointOfSale.plateNo         = lvServices.SelectedItems[0].SubItems[1].Text;
                    ContPointOfSale.vehicleType     = lvServices.SelectedItems[0].SubItems[2].Text;
                    ContPointOfSale.brand           = lvServices.SelectedItems[0].SubItems[3].Text;
                    ContPointOfSale.model           = lvServices.SelectedItems[0].SubItems[4].Text;
                    ContPointOfSale.color           = lvServices.SelectedItems[0].SubItems[5].Text;
                    ContPointOfSale.serviceRendered = lvServices.SelectedItems[0].SubItems[6].Text;
                    string temp = ContPointOfSale.serviceRendered;
                    for (int i = 0; i < temp.Length; i++)
                    {
                        if (temp[i + 1] == '(')
                        {
                            ContPointOfSale.serviceName = temp.Substring(0, i);
                            break;
                        }
                    }
                    ContPointOfSale.payment      = lvServices.SelectedItems[0].SubItems[7].Text;
                    ContPointOfSale.employees    = lvServices.SelectedItems[0].SubItems[8].Text;
                    ContPointOfSale.addedService = lvServices.SelectedItems[0].SubItems[9].Text;
                    frmPosAddService frmposaddservice = new frmPosAddService();
                    frmposaddservice.ShowDialog();
                    //frmPosAddService.isCancelled = false;
                    //if (!frmPosAddService.isCancelled) {
                    lvServices.SelectedItems[0].SubItems[1].Text = ContPointOfSale.plateNo;
                    lvServices.SelectedItems[0].SubItems[2].Text = ContPointOfSale.vehicleType;
                    lvServices.SelectedItems[0].SubItems[3].Text = ContPointOfSale.brand;
                    lvServices.SelectedItems[0].SubItems[4].Text = ContPointOfSale.model;
                    lvServices.SelectedItems[0].SubItems[5].Text = ContPointOfSale.color;
                    lvServices.SelectedItems[0].SubItems[6].Text = ContPointOfSale.serviceRendered;
                    lvServices.SelectedItems[0].SubItems[7].Text = decimal.Parse(ContPointOfSale.payment).ToString("C");
                    lvServices.SelectedItems[0].SubItems[8].Text = ContPointOfSale.employees;
                    lvServices.SelectedItems[0].SubItems[9].Text = ContPointOfSale.addedService;
                    //}

                    AddTotalService();
                }
            } catch (Exception ex) {
                Console.WriteLine("error" + ex.Message);
                //throw; some rocks
            }
        }
Exemplo n.º 2
0
 private void btnAddService_Click(object sender, EventArgs e)
 {
     ContPointOfSale.plateNo = ContPointOfSale.vehicleType = ContPointOfSale.brand = ContPointOfSale.model = ContPointOfSale.color = ContPointOfSale.serviceRendered = ContPointOfSale.payment = ContPointOfSale.employees = ContPointOfSale.addedService = ContPointOfSale.employeesID = ContPointOfSale.addedServicesID = "";
     contPos.CustInf(cboCustName.Text); // to save the customer name
     if (cboCustName.Text == "")
     {
         MessageBox.Show("Please provide customer information", "Point of Sale", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         frmPosAddService frmAddService = new frmPosAddService();
         frmAddService.ShowDialog();
         if (ContPointOfSale.plateNo == "" || ContPointOfSale.plateNo == null)
         {
             //do nothing
         }
         else
         {
             ListViewItem listitem = new ListViewItem(((lvServices.Items.Count) + 1).ToString());
             listitem.SubItems.Add(ContPointOfSale.plateNo);
             listitem.SubItems.Add(ContPointOfSale.vehicleType);
             listitem.SubItems.Add(ContPointOfSale.brand);
             listitem.SubItems.Add(ContPointOfSale.model);
             listitem.SubItems.Add(ContPointOfSale.color);
             listitem.SubItems.Add(ContPointOfSale.serviceRendered);
             listitem.SubItems.Add(decimal.Parse(ContPointOfSale.payment).ToString("C"));
             listitem.SubItems.Add(ContPointOfSale.employees);
             listitem.SubItems.Add(ContPointOfSale.addedService);
             listitem.SubItems.Add(ContPointOfSale.employeesID);
             listitem.SubItems.Add(ContPointOfSale.addedServicesID);
             listitem.SubItems.Add("Ongoing"); //12
             listitem.SubItems.Add("0");       //13
             lvServices.Items.Add(listitem);
             AddTotalService();
         }
     }
 }