Example #1
0
        //---To get the details from the N4 data base based on the Date of Event----End-----Carrier Out Bound Intended Change

        //---To get the details from the N4 data base based on the Date of Event----Start-----Destination Change
        public void getDataForDestinationChange()
        {
            DateTime        fdt         = Convert.ToDateTime(FromTimeDateTimePicker.Value.ToString());
            string          fromdt      = fdt.ToString("dd-MM-yy HH:MM");
            DateTime        tdt         = Convert.ToDateTime(ToTimeDateTimePicker.Value.ToString());
            string          todt        = tdt.ToString("dd-MM-yy HH:MM");
            string          CONN_STRING = ConfigurationManager.ConnectionStrings["con1"].ConnectionString;
            OleDbConnection dbCon       = new OleDbConnection(CONN_STRING);

            dbCon.Open();
            string Query = "SELECT g.DES Change, a.placed_time ChangeTime,a.APPLIED_TO_NATURAL_KEY ContainerNo, b.prior_value FromValue, b.new_value ToValue,f.ID Line, " +
                           "c.FREIGHT_KIND Freight,c.CATEGORY Category,e.ID Facility,c.GOODS_AND_CTR_WT_KG Wt, a.note Note " +
                           "FROM navis.SRV_EVENT a, " +
                           "navis.SRV_EVENT_FIELD_CHANGES b, " +
                           "navis.INV_UNIT c, " +
                           "navis.SRV_EVENT_TYPES d, " +
                           "navis.ARGO_FACILITY e, " +
                           "navis.REF_BIZUNIT_SCOPED f, " +
                           "NAVIS.KPCL_EVENT g " +
                           "WHERE a.gkey = b.EVENT_GKEY AND " +
                           "a.APPLIED_TO_NATURAL_KEY = c.ID " +
                           "AND a.EVENT_TYPE_GKEY = d.GKEY " +
                           "AND a.FACILITY_GKEY = e.GKEY " +
                           "AND c.LINE_OP = f.GKEY " +
                           "AND b.METAFIELD_ID=g.NAME " +
                           "AND b.METAFIELD_ID='gdsDestination'" +
                           "and a.placed_time between TO_TIMESTAMP ('" + fromdt + "', 'DD/MM/RR HH24:MI:SS.FF')and TO_TIMESTAMP ('" + todt + "', 'DD/MM/RR HH24:MI:SS.FF')";
            OleDbCommand        cmd            = new OleDbCommand(Query, dbCon);
            OleDbDataAdapter    da             = new OleDbDataAdapter(cmd);
            OleDbCommandBuilder commandBuilder = new OleDbCommandBuilder(da);

            dt.Locale = System.Globalization.CultureInfo.InvariantCulture;
            da.Fill(dt);
            da.Fill(ds, "Query");
            kryptonDataGridView1.DataMember = "Query";
            kryptonDataGridView1.DataSource = ds;
            kryptonDataGridView1.Visible    = true;

            DataSet dataReport = new DataSet();

            da.Fill(dataReport, "DataTable");
            BillableEventsReport myDataReport = new BillableEventsReport();

            myDataReport.SetDataSource(dataReport);
            rptBillableEventsReport.ReportSource = myDataReport;
            dbCon.Close();
        }