Exemple #1
0
        protected void btnOWRSave_Click(object sender, EventArgs e)
        {
            SelectedTab = 3;

            int selectedLocationKey = lcOWR.LocationKey;

            if (selectedLocationKey == 0)
            {
                lblOWRIndividualUploadStatus.Text      = "Error - please select Location";
                lblOWRIndividualUploadStatus.ForeColor = System.Drawing.Color.Red;
                return;
            }

            try
            {
                byte selectedDayOfWeekKey = Byte.Parse(ddlOWRDayOfWeek.SelectedValue);
                if (selectedDayOfWeekKey == 0)
                {
                    lblOWRIndividualUploadStatus.Text      = "Error - please select Day Of Week";
                    lblOWRIndividualUploadStatus.ForeColor = System.Drawing.Color.Red;
                    return;
                }

                decimal parameterValue = Decimal.Parse(tbOWRParameter.Text);

                int?result = 0;

                using (FleetDemandDataContext dc = new FleetDemandDataContext())
                {
                    dc.OneWayInsert(validFrom: DateTime.Today,
                                    validFromDateKey: Int32.Parse(DateTime.Today.ToString("yyyyMMdd")),
                                    countryKey: lcOWR.CountryKey,
                                    locationKey: selectedLocationKey,
                                    dayKey: selectedDayOfWeekKey,
                                    oneWay: parameterValue,
                                    addedBy: Rad.Security.ApplicationAuthentication.GetGlobalId(),
                                    uploadedDate: DateTime.Today,
                                    uploadedDateKey: Int32.Parse(DateTime.Today.ToString("yyyyMMdd")),
                                    resultCode: ref result);

                    if (result == 0)
                    {
                        lblOWRIndividualUploadStatus.Text = "Success - Parameter Updated";
                    }
                    else
                    {
                        lblOWRIndividualUploadStatus.Text      = "Error";
                        lblOWRIndividualUploadStatus.ForeColor = System.Drawing.Color.Red;
                    }
                }

                OWRLogDataBind();
            }
            catch (Exception ex)
            {
                lblOWRIndividualUploadStatus.Text      = "Error - " + ex.Message;
                lblOWRIndividualUploadStatus.ForeColor = System.Drawing.Color.Red;
                return;
            }
        }
Exemple #2
0
        protected void ExecuteSSISPackage(string filePath, byte packageId, ref long?executionId)
        {
            //throw new IOException(String.Format("File saved as {0}. Please contact RAD Team to run import job {1}", filePath, packageId));

            using (FleetDemandDataContext dc = new FleetDemandDataContext())
            {
                int?resultCode = -1;

                dc.UploadParameterFile(
                    packageId: packageId,
                    addedby: Rad.Security.ApplicationAuthentication.GetGlobalId(),
                    csvFilePath: filePath,
                    uploadedDate: DateTime.Today.ToString("yyyyMMdd"),
                    validfrom: DateTime.Today.ToString("yyyyMMdd"),
                    executionId: ref executionId,
                    resultCode: ref resultCode
                    );

                if (resultCode != 0)
                {
                    throw new IOException("SSIS asynchronous job initialization failed. Please contact RAD team.");
                }
            }
        }
Exemple #3
0
        protected void btnRPDSave_Click(object sender, EventArgs e)
        {
            SelectedTab = 2;

            int selectedLocationKey = lcRPD.LocationKey;
            int selectedCarClassKey = lcRPD.CarClassKey;

            if (selectedLocationKey == 0)
            {
                lblRPDIndividualUploadStatus.Text      = "Error - please select Location";
                lblRPDIndividualUploadStatus.ForeColor = System.Drawing.Color.Red;
                return;
            }

            if (selectedCarClassKey == 0)
            {
                lblRPDIndividualUploadStatus.Text      = "Error - please select Car Class";
                lblRPDIndividualUploadStatus.ForeColor = System.Drawing.Color.Red;
                return;
            }


            try
            {
                string   monthYear = RPDDate.Text;
                DateTime dateTime  = DateTime.ParseExact(monthYear, "MMMM yyyy", System.Globalization.CultureInfo.InvariantCulture);

                decimal parameterValue = Decimal.Parse(tbRPDParameter.Text);

                int?result = 0;

                using (FleetDemandDataContext dc = new FleetDemandDataContext())
                {
                    dc.AvgRpdInsert(validFrom: DateTime.Today,
                                    validFromDateKey: Int32.Parse(DateTime.Today.ToString("yyyyMMdd")),
                                    countryKey: lcRPD.CountryKey,
                                    locationKey: selectedLocationKey,
                                    reportDateKey: Int32.Parse(dateTime.ToString("yyyyMMdd")),
                                    carClassKey: selectedCarClassKey,
                                    avgRpd: parameterValue,
                                    addedBy: Rad.Security.ApplicationAuthentication.GetGlobalId(),
                                    uploadedDate: DateTime.Today,
                                    uploadedDateKey: Int32.Parse(DateTime.Today.ToString("yyyyMMdd")),
                                    resultCode: ref result);

                    if (result == 0)
                    {
                        lblRPDIndividualUploadStatus.Text = "Success - Parameter Updated";
                    }
                    else
                    {
                        lblRPDIndividualUploadStatus.Text      = "Error";
                        lblRPDIndividualUploadStatus.ForeColor = System.Drawing.Color.Red;
                    }
                }

                RPDLogDataBind();
            }
            catch (Exception ex)
            {
                lblRPDIndividualUploadStatus.Text      = "Error - " + ex.Message;
                lblRPDIndividualUploadStatus.ForeColor = System.Drawing.Color.Red;
                return;
            }
        }