public void Car()
        {
            string CarPol = dRow.ItemArray.GetValue(5).ToString();

            connect.sql_string = "SELECT * FROM Car WHERE CarID = " + CarPol;
            Car_ds             = connect.GetConnection;
            dRowCar            = Car_ds.Tables[0].Rows[0];
            String carReg = EncypherDecypher.Decypher(dRowCar.ItemArray.GetValue(1).ToString());

            tbCarRegistration.Text = carReg;
            String chasisNo = EncypherDecypher.Decypher(dRowCar.ItemArray.GetValue(2).ToString());

            tbChasisNumber.Text = chasisNo;
            String carMake = EncypherDecypher.Decypher(dRowCar.ItemArray.GetValue(3).ToString());

            tbCarMake.Text = carMake;
            String carModel = EncypherDecypher.Decypher(dRowCar.ItemArray.GetValue(4).ToString());

            tbCarModel.Text = carModel;
            String carEngineSize = EncypherDecypher.Decypher(dRowCar.ItemArray.GetValue(5).ToString());

            tbCarEngineSize.Text = carEngineSize;
            String estimatedWorth = EncypherDecypher.Decypher(dRowCar.ItemArray.GetValue(6).ToString());

            cbEstimatedWorth.Text = estimatedWorth;
        }
        public void Customer()
        {
            string CustPol = dRow.ItemArray.GetValue(3).ToString();

            connect.sql_string = "SELECT * FROM Customer WHERE CustomerID = " + CustPol;
            Cust_ds            = connect.GetConnection;
            dRowCustomer       = Cust_ds.Tables[0].Rows[0];
            String firstName = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(1).ToString());

            tbFirstName.Text = firstName;
            String Surname = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(2).ToString());

            tbSurname.Text = Surname;
            String Title = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(3).ToString());

            cbTitle.Text = Title;
            String Street = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(4).ToString());

            tbStreet.Text = Street;
            String Town = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(5).ToString());

            tbTown.Text = Town;
            String County = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(6).ToString());

            cbCounty.Text = County;
            String Eircode = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(7).ToString());

            tbEircode.Text = Eircode;
            String dateOfBirth = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(8).ToString());

            dpDateOfBirth.Text = dateOfBirth;
            String contactNumber = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(9).ToString());

            tbContactNumber.Text = contactNumber;
            String licenceType = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(10).ToString());

            cbLicenceType.Text = licenceType;
            String licenceNo = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(11).ToString());

            tbLicenceNo.Text = licenceNo;
            String licenceIssued = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(12).ToString());

            dpLicenceIssued.Text = licenceIssued;
            String penaltyPoints = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(13).ToString());

            tbPenaltyPoints.Text = penaltyPoints;
            String noClaims = EncypherDecypher.Decypher(dRowCustomer.ItemArray.GetValue(14).ToString());

            if (noClaims.Equals("TRUE"))
            {
                cbNoClaims.Checked = true;
            }
            else
            {
                cbNoClaims.Checked = false;
            }
        }
Exemplo n.º 3
0
 void dgvUsers_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == 2 || e.ColumnIndex == 5 || e.ColumnIndex == 6 || e.ColumnIndex == 7 && e.RowIndex != this.dgvUsers.NewRowIndex)
         {
             if (e != null && !String.IsNullOrEmpty(e.Value as string))
             {
                 if (IsEncrypted(e.Value.ToString()))
                 {
                     // MessageBox.Show(e.Value.ToString(), "encrypting");
                     e.Value = EncypherDecypher.Decypher(e.Value.ToString());
                 }
             }
         }
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message, e.Value.ToString());
     }
 }
        public void NewDriver()
        {
            string DrivePol = dRow.ItemArray.GetValue(4).ToString();

            connect.sql_string = "SELECT * FROM Customer WHERE CustomerID = " + DrivePol;
            Driver_ds          = connect.GetConnection;
            var temp = dRow.ItemArray.GetValue(4);

            if (!dRow.ItemArray.GetValue(4).Equals((object)0))
            {
                dRowDriver = Driver_ds.Tables[0].Rows[0];


                String firstName = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(1).ToString());
                tbnFirstName.Text = firstName;
                String Surname = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(2).ToString());
                tbnSurname.Text = Surname;
                String Title = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(3).ToString());
                cbnTitle.Text = Title;
                String Street = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(4).ToString());
                tbnStreet.Text = Street;
                String Town = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(5).ToString());
                tbnTown.Text = Town;
                String County = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(6).ToString());
                cbnCounty.Text = County;
                String Eircode = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(7).ToString());
                tbnEircode.Text             = Eircode;
                dpnDateOfBirth.Format       = DateTimePickerFormat.Custom;
                dpnDateOfBirth.CustomFormat = "dd MMMM yyyy";
                String dateOfBirth = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(8).ToString());
                dpnDateOfBirth.Text = dateOfBirth;
                String contactNumber = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(9).ToString());
                tbnContactNumber.Text = contactNumber;
                String licenceType = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(10).ToString());
                cbnLicenceType.Text = licenceType;
                String licenceNo = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(11).ToString());
                tbnLicenceNumber.Text         = licenceNo;
                dpnLicenceIssued.Format       = DateTimePickerFormat.Custom;
                dpnLicenceIssued.CustomFormat = "dd MMMM yyyy";
                String licenceIssued = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(12).ToString());
                dpnLicenceIssued.Text = licenceIssued;
                String penaltyPoints = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(13).ToString());
                tbnPenaltyPoints.Text = penaltyPoints;
                String noClaims = EncypherDecypher.Decypher(dRowDriver.ItemArray.GetValue(14).ToString());
                if (noClaims.Equals("TRUE"))
                {
                    cbnNoClaims.Checked = true;
                }
                else
                {
                    cbnNoClaims.Checked = false;
                }
            }
            else
            {
                tbnFirstName.Clear();
                tbnSurname.Clear();
                cbnTitle.Text = (" ");
                tbnStreet.Clear();
                tbnTown.Clear();
                cbnCounty.Text = (" ");
                tbnEircode.Clear();
                dpnDateOfBirth.Format       = DateTimePickerFormat.Custom;
                dpnDateOfBirth.CustomFormat = " ";
                tbnContactNumber.Clear();
                cbnLicenceType.Text = (" ");
                tbnLicenceNumber.Clear();
                dpnLicenceIssued.Format       = DateTimePickerFormat.Custom;
                dpnLicenceIssued.CustomFormat = " ";
                tbnPenaltyPoints.Clear();
                cbnNoClaims.Checked = false;
            }
        }