public int insertServiceProduct(serviceProducts tempService)
 {
     int result = 1;
     try
     {
         using (SqlConnection con = new SqlConnection(conString))
         {
             con.Open();
             SqlCommand cmd = new SqlCommand("InsertServiceProd", con);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@serv_ID", tempService.ServiceProID);
             cmd.Parameters.AddWithValue("@serv_Code", tempService.ServiceProName);
             cmd.Parameters.AddWithValue("@serv_Name", tempService.ServiceProName);
             cmd.Parameters.AddWithValue("@serv_Description", tempService.ServiceProDesc);
             cmd.Parameters.AddWithValue("@serv_Price", tempService.ServiceProPrice);
             result = (Int32)cmd.ExecuteScalar();
             con.Close();
         }
     }
     catch (Exception e)
     {
         result = 0;
     }
     return result;
 }
 public Boolean addNewServiceProduct(serviceProducts service)
 {
     ServiceProdDataAccess spda1 = new ServiceProdDataAccess();
     int insertResult = spda1.insertServiceProduct(service);
     if (insertResult.Equals(1))
         return true;
     else
         return false;
 }
Beispiel #3
0
 public billingItem(int billItemId, serviceProducts service, products product
                    , int quantiy, decimal total, String type)
 {
     this.billItemId = billItemId;
     this.service    = service;
     this.product    = product;
     this.quantiy    = quantiy;
     this.total      = total;
     this.type       = type;
 }
        private void btnAddService_Click(object sender, EventArgs e)
        {
            String sCode = ((txtServiceCode.Text).Replace(" ", string.Empty)).Clone().ToString();
            String sName = ((txtServiceName.Text).Replace(" ", string.Empty)).Clone().ToString();
            String sPrice = ((txtServicePrice.Text).Replace(" ", string.Empty)).Clone().ToString();

            if (sCode == "")
            {
                servcodeVerifyMessage.Show();
                hideLabelsTimer();
            }
            else if (sName == "")
            {
                servnameVerifyMessage.Show();
                hideLabelsTimer();
            }
            else if (sPrice == "")
            {
                servPrcVerify.Show();
                hideLabelsTimer();
            }
            else
            {
                String psName = (txtServiceName.Text).Clone().ToString();
                String psCode = (txtServiceCode.Text).Clone().ToString();
                String psDesc = (txtServiceDsc.Text).Clone().ToString();
                decimal psPrice = decimal.Parse((txtServicePrice.Text).Clone().ToString());
                serviceProducts newService = new serviceProducts(-1, psCode, psName, psDesc, psPrice);
                stockDataManipulations stockDataManipulations = new stockDataManipulations();
                Boolean newServiceInsertionFlag = stockDataManipulations.addNewServiceProduct(newService);
                if (newServiceInsertionFlag)
                {
                    servInsertionSuccessMsg.Show();
                    hideLabelsTimer();
                }
                else
                {
                    serviceInsertFailureMsg.Show();
                    hideLabelsTimer();
                }
            }
        }
 private void itemDataBindings(List<serviceProducts> services)
 {
     Dictionary<serviceProducts, string> item = new Dictionary<serviceProducts, string>();
     serviceProducts service = new serviceProducts(-1, null, "Default", null, 0);
     item.Add(service, "Default");
     foreach (serviceProducts serviceItm in services)
     {
         item.Add(serviceItm, serviceItm.ServiceProName);
     }
     txtItem.DataSource = new BindingSource(item, null);
     txtItem.DisplayMember = "Value";
     txtItem.ValueMember = "Key";
 }