public Boolean saveCustomPackage(customService customService)
 {
     return true;
 }
Ejemplo n.º 2
0
        private void btnAddService_Click(object sender, EventArgs e)
        {
            String custServName = ((txtServiceName.Text).Replace(" ", string.Empty)).Clone().ToString();
            if (custServName == "")
            {
                snameVerify.Show();
                hideLabelsTimer();
            }
            else if (!(addCustomServiceGrid.RowCount > 0))
            {
                verifyServiceItems.Show();
                hideLabelsTimer();
            }
            else
            {
                List<customServiceEntities> serviceItems = new List<customServiceEntities>();
                foreach (DataGridViewRow row in addCustomServiceGrid.Rows)
                {
                    string type = row.Cells[0].Value.ToString();
                    string name = row.Cells[1].Value.ToString();
                    string description = row.Cells[2].Value.ToString();
                    string price = row.Cells[3].Value.ToString();
                    string productId = row.Cells[4].Value.ToString();
                    string serviceId = row.Cells[5].Value.ToString();

                    customServiceEntities customServiceEntities = new customServiceEntities(type, name, description,
                        decimal.Parse(price), int.Parse(productId), int.Parse(serviceId));
                    serviceItems.Add(customServiceEntities);
                }

                String custServiceName = txtServiceName.Text;
                String addedValue = valueAddedText.Text;
                calculateTotal();
                decimal valueAdded = 0;
                if (valueAddedText.Text != "" && valueAddedText.Text != null)
                {
                    valueAdded = decimal.Parse(addedValue);
                }
                customService customService = new customService(0, custServiceName, serviceItems,
                    valueAdded, total);
                stockDataManipulations stockDataManipulations = new stockDataManipulations();
                Boolean verifyResult = stockDataManipulations.saveCustomPackage(customService);
                if (verifyResult)
                {
                    custServInsertionSuccessMsg.Show();
                    hideLabelsTimer();
                }
                else
                {
                    custServInsertFailureMsg.Show();
                    hideLabelsTimer();
                }
            }
        }