Пример #1
0
        private void GetData()
        {
            var selectedDrivers = hidSelectedDriversValues.Value;

            if (dteDateFrom.SelectedDate.HasValue && dteDateTo.SelectedDate.HasValue && (selectedDrivers.Length > 0 || cbSelectedAllDrivers.Checked))
            {
                if (cbSelectedAllDrivers.Checked)
                {
                    selectedDrivers = String.Empty;
                }

                string csvJobStatus = GetCsvJobStatus();

                Facade.IOrganisation facOrg = new Facade.Organisation();
                AllWorkForDriver = facOrg.GetAllWorkForDrivers(selectedDrivers, dteDateFrom.SelectedDate.Value, dteDateTo.SelectedDate.Value, csvJobStatus);
                BindRepeater();
            }
        }
Пример #2
0
        private void btnExportToCSV_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                var selectedDrivers = hidSelectedDriversValues.Value;
                if (dteDateFrom.SelectedDate.HasValue && dteDateTo.SelectedDate.HasValue && (selectedDrivers.Length > 0 || cbSelectedAllDrivers.Checked))
                {
                    if (cbSelectedAllDrivers.Checked)
                    {
                        selectedDrivers = String.Empty;
                    }

                    string csvJobStatus = GetCsvJobStatus();

                    Facade.IOrganisation facOrg = new Facade.Organisation();
                    AllWorkForDriver = facOrg.GetAllWorkForDrivers(selectedDrivers, dteDateFrom.SelectedDate.Value, dteDateTo.SelectedDate.Value, csvJobStatus);

                    DataTable original = AllWorkForDriver.Tables[0];
                    DataTable newTable = new DataTable();

                    newTable.Columns.Add("Driver Name");
                    newTable.Columns.Add("Order ID");
                    newTable.Columns.Add("Run ID");
                    newTable.Columns.Add("Customer Order Number");
                    newTable.Columns.Add("Delivery Order Number");
                    newTable.Columns.Add("Client");
                    newTable.Columns.Add("Rate");
                    newTable.Columns.Add("Extras");
                    newTable.Columns.Add("Collection Point");
                    newTable.Columns.Add("Delivery Point");
                    newTable.Columns.Add("Post Town");
                    newTable.Columns.Add("Delivery Date");
                    newTable.Columns.Add("No Pallets");
                    newTable.Columns.Add("Pallet Spaces");
                    newTable.Columns.Add("Weight");
                    newTable.Columns.Add("Trailer");
                    newTable.Columns.Add("Has POD");


                    for (int row = 0; row <= original.Rows.Count - 1; row++)
                    {
                        DataRow newRow = newTable.NewRow();

                        newRow[0]  = original.Rows[row][10];
                        newRow[1]  = original.Rows[row][2];
                        newRow[2]  = original.Rows[row][0];
                        newRow[3]  = original.Rows[row][5];
                        newRow[4]  = original.Rows[row][6];
                        newRow[5]  = original.Rows[row][7];
                        newRow[6]  = original.Rows[row][8];
                        newRow[7]  = original.Rows[row][12] + " extras worth " + original.Rows[row][11];
                        newRow[8]  = original.Rows[row][14];
                        newRow[9]  = original.Rows[row][16];
                        newRow[10] = original.Rows[row][17];
                        newRow[11] = original.Rows[row][19];
                        newRow[12] = original.Rows[row][21];
                        newRow[13] = original.Rows[row][22];
                        newRow[14] = original.Rows[row][23];
                        newRow[15] = original.Rows[row][27];
                        newRow[16] = original.Rows[row][24];
                        newTable.Rows.Add(newRow);
                    }

                    Session["__ExportDS"] = newTable;

                    Server.Transfer("../Reports/csvexport.aspx?filename=AllWorkForDriverExport.csv");
                }
            }
        }