예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (lamCodeBox.Text == "" || lamColourBox.Text == "" || lamJobNumberBox.Text == "" || lamQuantityBox.Text == "" || lamSizeBox.Text == "")
     {
         MessageBox.Show("Please enter a value for all fields.");
     }
     else
     {
         Laminate newLam = new Laminate(Int32.Parse(lamQuantityBox.Text), lamEstimatedArrivalPicker.Value, Int32.Parse(lamJobNumberBox.Text), lamSizeBox.Text, lamCompanyCombo.ValueMember, lamColourBox.Text, lamCodeBox.Text, lamTypeCombo.ValueMember, false);
         newLam.InsertLaminate();
         this.Close();
     }
 }
예제 #2
0
        public AddLamForm(Laminate existing)
        {
            InitializeComponent();

            haveLam = existing;
            //populate Lam Companies
            string command = "SELECT * FROM LaminateCompanies";
            using (SqlConnection connection = new SqlConnection(SQLDB.GetConnectionString()))
            {
                SqlDataReader reader = SQLDB.doSQLSelect(command, null, null, null, 0, connection);
                List<LaminateCompanies> dataSource = new List<LaminateCompanies>();
                while (reader.Read())
                {
                    IDataRecord record = (IDataRecord)reader;
                    dataSource.Add(new LaminateCompanies() { Name = record["laminate_company"].ToString(), ID = record["laminate_company_id"].ToString() });
                }
                lamCompanyCombo.DataSource = dataSource;
                lamCompanyCombo.DisplayMember = "Name";
                lamCompanyCombo.ValueMember = "ID";
            }
            using (SqlConnection connection = new SqlConnection(SQLDB.GetConnectionString()))
            {
                //populate Lam types.
                command = "SELECT * FROM LaminateType";
                SqlDataReader reader = SQLDB.doSQLSelect(command, null, null, null, 0, connection);
                List<LaminateTypes> dataSource2 = new List<LaminateTypes>();
                while (reader.Read())
                {
                    IDataRecord record = (IDataRecord)reader;
                    dataSource2.Add(new LaminateTypes() { Name = record["lam_type"].ToString(), ID = record["lam_type_id"].ToString() });
                }
                lamTypeCombo.DataSource = dataSource2;
                lamTypeCombo.DisplayMember = "Name";
                lamTypeCombo.ValueMember = "ID";
            }

            if (existing != null)
            {
                lamCodeBox.Text = existing.LamCode;
                lamColourBox.Text = existing.Colour;
                lamCompanyCombo.SelectedValue = existing.CompanyID;
                lamEstimatedArrivalPicker.Value = existing.EstimatedArrival;
                lamJobNumberBox.Text = existing.JobNumber.ToString();
                lamQuantityBox.Text = existing.Quantity.ToString();
                lamSizeBox.Text = existing.Size;
                lamTypeCombo.SelectedValue = existing.LamTypeID;
            }
        }
예제 #3
0
 private void editButton_Click(object sender, EventArgs e)
 {
     if(tabControl1.SelectedTab.Name == sheetTab.Name)
     {
         if(listView1.SelectedItems.Count >= 1)
         {
             Sheet thisSheet = new Sheet(Int32.Parse(listView1.SelectedItems[0].Name));
         }
         else
         {
             MessageBox.Show("Please select an item to edit.");
         }
     }
     else if (tabControl1.SelectedTab.Name == lamTab.Name)
     {
         if (listView2.SelectedItems.Count >= 1)
         {
             Laminate thisLam = new Laminate(Int32.Parse(listView2.SelectedItems[0].Name));
         }
         else
         {
             MessageBox.Show("Please select an item to edit.");
         }
     }
     else if (tabControl1.SelectedTab.Name == edgeTab.Name)
     {
         if (listView3.SelectedItems.Count >= 1)
         {
             Edgetape thisSheet = new Edgetape(Int32.Parse(listView3.SelectedItems[0].Name));
         }
         else
         {
             MessageBox.Show("Please select an item to edit.");
         }
     }
 }