示例#1
0
        public AddEdgeForm(Edgetape existing)
        {
            InitializeComponent();

            haveEdit = existing;
            //populate Lam Companies
            string command = "SELECT * FROM EdgetapeCompanies";
            using (SqlConnection connection = new SqlConnection(SQLDB.GetConnectionString()))
            {
                SqlDataReader reader = SQLDB.doSQLSelect(command, null, null, null, 0, connection);
                List<EdgeCompanies> dataSource = new List<EdgeCompanies>();
                while (reader.Read())
                {
                    IDataRecord record = (IDataRecord)reader;
                    dataSource.Add(new EdgeCompanies() { Name = record["edgetape_company"].ToString(), ID = record["edgetape_company_id"].ToString() });
                }
                edgeCompanyCombo.DataSource = dataSource;
                edgeCompanyCombo.DisplayMember = "Name";
                edgeCompanyCombo.ValueMember = "ID";
            }
            using (SqlConnection connection = new SqlConnection(SQLDB.GetConnectionString()))
            {
                //populate Lam types.
                command = "SELECT * FROM EdgetapeThickness";
                SqlDataReader reader = SQLDB.doSQLSelect(command, null, null, null, 0, connection);
                List<EdgeThickness> dataSource2 = new List<EdgeThickness>();
                while (reader.Read())
                {
                    IDataRecord record = (IDataRecord)reader;
                    dataSource2.Add(new EdgeThickness() { Name = record["edgetape_thickness"].ToString(), ID = record["edgetape_thickness_id"].ToString() });
                }
                edgeThicknessCombo.DataSource = dataSource2;
                edgeThicknessCombo.DisplayMember = "Name";
                edgeThicknessCombo.ValueMember = "ID";
            }

            if (existing != null)
            {
                edgeCodeBox.Text = existing.EdgetapeCode;
                edgeColourBox.Text = existing.Colour;
                edgeCompanyCombo.SelectedValue = existing.CompanyID;
                edgeEstimatedArrivalPicker.Value = existing.EstimatedArrival;
                edgeJobNumberBox.Text = existing.JobNumber.ToString();
                edgeQuantityBox.Text = existing.Quantity.ToString();
                edgeThicknessCombo.SelectedValue = existing.ThicknessID;

            }
        }
示例#2
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.");
         }
     }
 }