Exemple #1
0
 private void LoadAttributes()
 {
     client.LoadAttributes();
     foreach (Attribute attribute in client.Attributes)
     {
         this.clbAttributes.Items.Add(attribute.Description, attribute.Checked);
     }
 }
Exemple #2
0
 private void cboClientName_SelectedChangeCommitted(object sender, EventArgs e)
 {
     bDirty = true;
     client = new Client(Convert.ToInt32(this.cboClientName.SelectedValue.ToString()), true);
     this.rtbClientDetails.Clear();
     this.rtbClientDetails.Text = client.AddressLine1 + Environment.NewLine + client.Town + Environment.NewLine + client.Postcode + Environment.NewLine + client.MobilePhone;
     this.rtbClientDetails.Tag  = client.AddressLine1 + Environment.NewLine + client.Town + Environment.NewLine + client.Postcode;
     client.LoadAttributes();
     LoadAttributes();
     collNotes = client.ClientNotes;
     LoadNotestoListView();
     rtbClientPhone.Clear();
     rtbClientPhone.Text += "Home Phone = " + (client.HomePhone == null ? string.Empty : client.HomePhone) + System.Environment.NewLine;
     rtbClientPhone.Text += "MobilePhone = " + (client.MobilePhone == null ? string.Empty : client.MobilePhone) + System.Environment.NewLine;
 }
        private void SetUpJob(int jobid)
        {
            job    = new Job(jobid);
            client = new Client(job.ClientID, true);

            dtAppt = job.JobDate.AddHours(job.joblegs[0].PickUpTime.Hour).AddMinutes(job.joblegs[0].PickUpTime.Minute);
            client.LoadAttributes();
            LoadAttributes();
            this.rtbClientDetails.Text       = job.ClientName + Environment.NewLine + job.ClientAddressLine1 + Environment.NewLine + ((job.ClientAddressLine2 == string.Empty) ? "" : job.ClientAddressLine2 + Environment.NewLine);
            this.rtbClientDetails.Text      += job.ClientTown + Environment.NewLine + job.ClientPostCode;
            this.dtpLeg1.Value               = job.JobDate;
            this.radWheelchairYes.Checked    = job.DVCWheelchair;
            this.cboDriverLeg1.SelectedValue = job.joblegs[0].DriverID;

            this.rtbNotes.Text = job.Notes;
            //this.cboJobStatus.SelectedValue = job.StatusID;
            this.radOneWay.Checked = (job.joblegs.Count == 1);
            //this.rad2Leg.Checked = (!this.radOneWay.Checked && !this.radReturn.Checked);
            this.cboPickUp1Hour.SelectedValue   = job.joblegs[0].PickUpTime.Hour;
            this.cboPickUp1Minute.SelectedValue = job.joblegs[0].PickUpTime.Minute;
            this.cboAppt1Hour.SelectedValue     = job.joblegs[0].AppointmentTime.Hour;
            this.cboAppt1Minute.SelectedValue   = job.joblegs[0].AppointmentTime.Minute;

            this.cboLeg1From.SelectedValue = job.joblegs[0].PickUpDestinationID == 0 ? -1 : job.joblegs[0].PickUpDestinationID;
            this.cboLeg1To.SelectedValue   = job.joblegs[0].DropDestinationID == 0 ? -1 : job.joblegs[0].DropDestinationID;


            if (job.joblegs.Count > 1)
            {
                this.cboPickUp2Hour.SelectedValue   = job.joblegs[1].PickUpTime.Hour;
                this.cboPickUp2Minute.SelectedValue = job.joblegs[1].PickUpTime.Minute;
                this.cboLeg2From.SelectedValue      = job.joblegs[1].PickUpDestinationID == 0 ? -1 : job.joblegs[1].PickUpDestinationID;
                this.cboLeg2To.SelectedValue        = job.joblegs[1].DropDestinationID == 0 ? -1 : job.joblegs[1].DropDestinationID;

                cboLeg2From_SelectedIndexChanged(new object(), new EventArgs());
                cboLeg2To_SelectedIndexChanged(new object(), new EventArgs());
            }

            //cboLeg1To_SelectedIndexChanged(new object(), new EventArgs());

            radOneWay.Checked      = job.joblegs.Count == 1;
            dtpLeg1.Enabled        = !(job.joblegs[0].DriverID > 0);
            lblDateChange1.Visible = lblDateChange2.Visible = lblDateChange3.Visible = job.joblegs[0].DriverID > 0;

            cboLeg1To.Enabled   = true;
            cboLeg1From.Enabled = true;
            cboLeg1From_SelectedIndexChanged(new object(), new EventArgs());
        }
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (this.txtClientID.Text == "0")
            {
                MessageBox.Show("No client has been selected", "Client Edit");
                bDirty = false;
                return;
            }

            Client client = querybyID.FirstOrDefault();

            client.Title        = this.cboTitle.SelectedText.ToString();
            client.TitleID      = System.Convert.ToInt32(this.cboTitle.SelectedValue.ToString());
            client.FirstName    = this.txtFirstName.Text;
            client.MiddleName   = this.txtMiddleName.Text;
            client.Surname      = this.txtSurname.Text;
            client.AddressLine1 = this.txtAddressLine1.Text;
            client.AddressLine2 = this.txtAddressLine2.Text;
            client.Town         = this.txtTown.Text;
            client.HomePhone    = this.txtHomePhone.Text;
            client.MobilePhone  = this.txtMobilePhone.Text;
            client.Postcode     = this.mskPostCode.Text;
            client.DateOfBirth  = this.dtpDOB.Value;
            client.Email        = this.txtEmail.Text;
            client.isActive     = this.radActiveYes.Checked;
            client.LoadAttributes();

            string msg = client.Update();

            //now add in the attributes.
            for (Int32 i = 0; i < this.clbAttributes.Items.Count; i++)
            {
                client.Attributes[i].CheckedNew = this.clbAttributes.GetItemChecked(i);
                client.Attributes[i].LinkID     = client.ClientID;
                client.Attributes[i].Update(Attribute.AttributeType.client);
            }

            collClient.PopulateClients();

            if (msg == "Successfully updated Client")
            {
                MessageBox.Show(client.Update(), "client update");
                bDirty = false;
            }

            LoadListView(queryCurrent);
        }
        private void LoadClient(IEnumerable <Client> querybyID)
        {
            Client client = querybyID.FirstOrDefault();

            this.cboTitle.SelectedValue = client.TitleID;
            this.txtClientID.Text       = client.ClientID.ToString();
            this.txtFirstName.Text      = client.FirstName;
            this.txtMiddleName.Text     = client.MiddleName;
            this.txtSurname.Text        = client.Surname;
            this.txtAddressLine1.Text   = client.AddressLine1;
            this.txtAddressLine2.Text   = client.AddressLine2;
            this.txtTown.Text           = client.Town;
            this.txtHomePhone.Text      = client.HomePhone;
            this.txtMobilePhone.Text    = client.MobilePhone;
            this.mskPostCode.Text       = client.Postcode;
            this.dtpDOB.Value           = client.DateOfBirth;
            this.txtEmail.Text          = client.Email;
            this.radActiveYes.Checked   = client.isActive;
            this.radActiveNo.Checked    = !client.isActive;
            client.LoadAttributes();
            LoadAttributes(client);
        }