void fillDetailsPanel(Van v) { detailsPanel.Visible = true; billNoLB.Text = billsGrid.SelectedRows[0].Cells["billno"].Value.ToString(); vanNoLB.Text = v.vehicleNo; nameLB.Text = v.Name; PhoneLB.Text = v.phone; mileageLB.Text = v.mileage; }
void vanClick(Van v) { if (billsGrid.SelectedRows.Count == 1) { fillDetailsPanel(v); } else { MetroMessageBox.Show(this, "Please select a row from bills", "Caution", MessageBoxButtons.OK, MessageBoxIcon.Stop, 200); } }
void createVan(DataRow r) { Van v = new Van(); v.id = r["id"].ToString(); v.vehicleNo = r["vehicle no"].ToString(); v.phone = r["driver no"].ToString(); v.Name = r["name"].ToString(); v.mileage = r["mileage"].ToString(); v.cnic = r["Cnic"].ToString(); vans.Add(v); createVanButton(v); }
void createVanButton(Van v) { Button b = new Button(); b.BackColor = Color.White; b.FlatAppearance.BorderSize = 0; b.FlatAppearance.MouseOverBackColor = Color.Maroon; b.FlatStyle = FlatStyle.Flat; b.Font = new Font("Segoe UI Semibold", 9.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0))); b.ForeColor = Color.DimGray; b.Image = Properties.Resources.whiteTruck; b.ImageAlign = ContentAlignment.MiddleRight; b.Name = "button" + v.id; b.Tag = v.id; b.Size = new Size(411, 40); b.Text = v.vehicleNo + ", " + v.Name + ", " + v.mileage; b.TextAlign = ContentAlignment.MiddleLeft; b.Click += (s, args) => vanClick(v); b.MouseEnter += (s, args) => mouseEnter(b); b.MouseLeave += (s, args) => mouseLeave(b); vansFlow.Controls.Add(b); }