private void PopulateDepartmentSalesData() { // load the datagrid with data BindingSource bind = new BindingSource(); SalesDepartmentData sdData = new SalesDepartmentData(); dt = sdData.GetDepartmentSalesDataByDateID(SalesDateId); dgSalesDept.AutoGenerateColumns = false; // In the properties window, create a collection of headers and edit their name.. // then set the named column[nameofcolumn] to the // datapropertyname, which is the 'header' of the datatable that was loaded with the data. // dgSalesDept.Columns["hdrSalesDateId"].DataPropertyName = "DateId"; dgSalesDept.Columns["hdrSalesDeptId"].DataPropertyName = "SalesDeptId"; dgSalesDept.Columns["hdrSalesDept"].DataPropertyName = "SalesDept"; dgSalesDept.Columns["hdrQuantity"].DataPropertyName = "SalesCount"; dgSalesDept.Columns["hdrTotal"].DataPropertyName = "Amount"; //bind.DataSource = dt; dgSalesDept.DataSource = dt; //dgSalesDept. }
private int GetSalesDeptIDByName(string deptName) { int deptId; SalesDepartmentData dept = new SalesDepartmentData(); deptId = dept.GetDeptIDByName(deptName); return(deptId); }
private void btnNext2_Click(object sender, EventArgs e) { // updates or inserts the Sales Department data. // update the dataabase // Create a list with all teh data from datagrid SalesDepartmentData salesdata = new FuelCenterDB.SalesDepartmentData(); //int rows = 0; //for (int x = 0; x <= dt.columns.count - 1; x++) //{ // lblresults2.text += dt.columns[x].columnname; //} //rows = salesdata.insertsalesdatalistdb(dt, salesdata.dasql); //pnlregister.visible = true; Debug.Write("the btnNExt was clicked"); }