Example #1
0
        /// <summary>
        /// Load Form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmEditBorrowing_Load(object sender, EventArgs e)
        {
            databaseEntities db = new databaseEntities();

            // ----- Create connection to barcode reader -----
            com.ReceivedData += new ReceivedEventHandler(DataReceive);
            try
            {
                com.ConnectSP(Properties.Settings.Default.scanCOM);
            }
            catch { }

            // ----- Prepare Status Combo box -----
            cbStatus.Items.Clear();
            cbStatus.Items.Add(Lng.Get("Reserved"));
            cbStatus.Items.Add(Lng.Get("Borrowed"));
            cbStatus.Items.Add(Lng.Get("Returned"));
            cbStatus.Items.Add(Lng.Get("Canceled"));
            cbStatus.SelectedIndex = 1;

            // ----- Prepare Contacts autocomplete Context -----
            SetContactsContext();

            // ----- Set Default values -----
            dtFrom.Value = DateTime.Now;
            dtTo.Value   = DateTime.Now.AddDays(Properties.Settings.Default.DefaultBorrInterval);

            // ----- If Edit items -----
            if (ID.Count > 0)
            {
                Borrowing borr = new Borrowing();

                // ----- Find all edited items -----
                foreach (var itm in ID)
                {
                    borr = db.Borrowing.Find(itm);

                    // ----- Fill Item list -----
                    IInfo info = new IInfo();
                    info.Name = borr.Item.Trim();
                    if (borr.ItemInvNum != null)
                    {
                        info.InventoryNumber = borr.ItemInvNum.Trim();
                    }
                    if (borr.Note != null)
                    {
                        info.Note = borr.Note.Trim();
                    }

                    selItemList.Add(info);                      // Selected list
                    origItemList.Add(info);                     // Original list
                }


                // ----- Fill Person -----
                Contacts person = db.Contacts.Find(borr.PersonID);
                if (person != null)
                {
                    txtPerson.Text    = person.Name.Trim() + " " + person.Surname.Trim();
                    lblPersonNum.Text = Lng.Get("PersonNum", "Person number") + ": " + person.PersonCode.Trim();
                }

                // ----- Fill other values -----
                dtFrom.Value           = borr.From ?? DateTime.Now;
                dtTo.Value             = borr.To ?? DateTime.Now;
                cbStatus.SelectedIndex = borr.Status ?? 1;

                // ----- Fill Fast tags -----
                FastFlags flag = (FastFlags)(borr.FastTags ?? 0);
                if (flag.HasFlag(FastFlags.FLAG1))
                {
                    btnTag1.BackColor = SelectColor;
                }
                if (flag.HasFlag(FastFlags.FLAG2))
                {
                    btnTag2.BackColor = SelectColor;
                }
                if (flag.HasFlag(FastFlags.FLAG3))
                {
                    btnTag3.BackColor = SelectColor;
                }
                if (flag.HasFlag(FastFlags.FLAG4))
                {
                    btnTag4.BackColor = SelectColor;
                }
                if (flag.HasFlag(FastFlags.FLAG5))
                {
                    btnTag5.BackColor = SelectColor;
                }
                if (flag.HasFlag(FastFlags.FLAG6))
                {
                    btnTag6.BackColor = SelectColor;
                }

                PersonGuid = borr.PersonID ?? Guid.Empty;

                // ----- Update Items OLV -----
                UpdateOLV();
            }
            // ----- Lending to person -----
            else if (PersonGuid != Guid.Empty)
            {
                Guid temp = PersonGuid;
                // ----- Fill Person -----
                Contacts person = db.Contacts.Find(PersonGuid);
                if (person != null)
                {
                    txtPerson.Text    = person.Name.Trim() + " " + person.Surname.Trim();
                    lblPersonNum.Text = Lng.Get("PersonNum", "Person number") + ": " + person.PersonCode.Trim();
                }
                PersonGuid           = temp;
                txtPerson.Enabled    = false;
                btnAddPerson.Enabled = false;
                this.ActiveControl   = txtItem;
            }
        }
Example #2
0
        private void frmEditBorrowing_Load(object sender, EventArgs e)
        {
            cbItemType.Items.Clear();
            cbItemType.Items.Add(Lng.Get("Item"));
            cbItemType.Items.Add(Lng.Get("Book"));
            cbItemType.SelectedIndex = 0;

            SetContactsContext();
            SetItemsContext();

            dtFrom.Value = DateTime.Now;
            dtTo.Value   = DateTime.Now.AddDays(Properties.Settings.Default.DefaultBorrInterval);

            if (ID != Guid.Empty)
            {
                Borrowing borr = db.Borrowing.Find(ID);

                switch (borr.ItemType.Trim())
                {
                case "item":
                    cbItemType.SelectedIndex = 0;
                    break;

                case "book":
                    cbItemType.SelectedIndex = 1;
                    break;
                }



                if (cbItemType.SelectedIndex == 0)
                {
                    Items itm = db.Items.Find(borr.ItemID);
                    if (itm != null)
                    {
                        txtItem.Text = itm.Name.Trim();
                    }
                }
                else if (cbItemType.SelectedIndex == 1)
                {
                    Books book = db.Books.Find(borr.ItemID);

                    if (book != null)
                    {
                        txtItem.Text = book.Name.Trim();
                    }
                }

                // ----- Fill Inventory number
                ItemGuid = borr.ItemID ?? Guid.Empty;
                FillInventoryNumber();
                cbItemNum.Text = (borr.ItemNum ?? 1).ToString();

                Contacts person = db.Contacts.Find(borr.PersonID);
                if (person != null)
                {
                    txtPerson.Text    = person.Name.Trim() + " " + person.Surname.Trim();
                    lblPersonNum.Text = Lng.Get("PersonNum", "Person number") + ": " + person.code.Trim();
                }


                dtFrom.Value        = borr.From ?? DateTime.Now;
                dtTo.Value          = borr.To ?? DateTime.Now;
                chbReturned.Checked = borr.Returned ?? false;

                ItemGuid     = borr.ItemID ?? Guid.Empty;
                LastItemGuid = ItemGuid;
                PersonGuid   = borr.PersonID ?? Guid.Empty;
            }
        }
Example #3
0
        /// <summary>
        /// Update Lending ObjectListView
        /// </summary>
        void UpdateLendingOLV()
        {
            databaseEntities db = new databaseEntities();

            List <Lending> lend;

            // ----- Show Expired -----
            if (cbLendingShow.SelectedIndex == 1)
            {
                DateTime now = DateTime.Now;
                lend = db.Lending.Where(p => ((p.To ?? now) < DateTime.Now) && ((p.Status ?? 1) == 0 || (p.Status ?? 1) == 1)).ToList();
            }
            // ----- Show Borrowed -----
            else if (cbLendingShow.SelectedIndex == 2)
            {
                if (chbShowReturned.Checked)
                {
                    lend = db.Lending.Where(p => ((p.Status ?? 1) == 1 || (p.Status ?? 1) == 2)).ToList();
                }
                else
                {
                    lend = db.Lending.Where(p => (p.Status ?? 1) == 1).ToList();
                }
            }
            // ----- Show Reserved -----
            else if (cbLendingShow.SelectedIndex == 3)
            {
                if (chbShowReturned.Checked)
                {
                    lend = db.Lending.Where(p => ((p.Status ?? 1) == 0 || (p.Status ?? 1) == 3)).ToList();
                }
                else
                {
                    lend = db.Lending.Where(p => (p.Status ?? 1) == 0).ToList();
                }
            }
            // ----- Show All -----
            else
            {
                if (chbShowReturned.Checked)
                {
                    lend = db.Lending.ToList();
                }
                else
                {
                    lend = db.Lending.Where(p => (p.Status ?? 1) == 0 || (p.Status ?? 1) == 1).ToList();
                }
            }

            ldFastTags.Renderer     = new ImageRenderer();
            ldFastTags.AspectGetter = delegate(object x) {
                List <int> ret = new List <int>();
                if (((Lending)x).FastTags != null)
                {
                    FastFlags flag = (FastFlags)((Lending)x).FastTags;
                    if (flag.HasFlag(FastFlags.FLAG1))
                    {
                        ret.Add(0);
                    }
                    if (flag.HasFlag(FastFlags.FLAG2))
                    {
                        ret.Add(1);
                    }
                    if (flag.HasFlag(FastFlags.FLAG3))
                    {
                        ret.Add(2);
                    }
                    if (flag.HasFlag(FastFlags.FLAG4))
                    {
                        ret.Add(3);
                    }
                    if (flag.HasFlag(FastFlags.FLAG5))
                    {
                        ret.Add(4);
                    }
                    if (flag.HasFlag(FastFlags.FLAG6))
                    {
                        ret.Add(5);
                    }
                }
                return(ret);
            };
            ldFastTagsNum.AspectGetter = delegate(object x) {
                string res = "";
                if (((Lending)x).FastTags != null)
                {
                    FastFlags flag = (FastFlags)((Lending)x).FastTags;
                    if (flag.HasFlag(FastFlags.FLAG1))
                    {
                        res += "1";
                    }
                    if (flag.HasFlag(FastFlags.FLAG2))
                    {
                        res += "2";
                    }
                    if (flag.HasFlag(FastFlags.FLAG3))
                    {
                        res += "3";
                    }
                    if (flag.HasFlag(FastFlags.FLAG4))
                    {
                        res += "4";
                    }
                    if (flag.HasFlag(FastFlags.FLAG5))
                    {
                        res += "5";
                    }
                    if (flag.HasFlag(FastFlags.FLAG6))
                    {
                        res += "6";
                    }
                }
                return(res);
            };
            ldPerson.AspectGetter = delegate(object x) {
                Contacts contact = db.Contacts.Find(((Lending)x).PersonID);
                if (contact != null)
                {
                    return(contact.Name.Trim() + " " + contact.Surname.Trim());
                }
                else
                {
                    return("");
                }
            };
            ldItemType.AspectGetter = delegate(object x) {
                switch (((Lending)x).CopyType.Trim())
                {
                case "item":
                    return(Lng.Get("Item"));

                case "book":
                    return(Lng.Get("Book"));

                case "boardgame":
                    return(Lng.Get("Boardgame", "Board game"));
                }
                return(Lng.Get("Unknown"));
            };
            ldItemName.AspectGetter = delegate(object x) {
                var copy = db.Copies.Find(((Lending)x).CopyID);
                if (copy == null)
                {
                    return("");
                }
                return(global.GetLendingItemName(copy.ItemType, copy.ItemID ?? Guid.Empty));
            };
            ldItemNum.AspectGetter = delegate(object x) {
                return(0);
            };
            ldItemInvNum.AspectGetter = delegate(object x) {
                if (((Lending)x).CopyID != null)
                {
                    var copy = db.Copies.Find(((Lending)x).CopyID);
                    if (copy == null)
                    {
                        return("");
                    }
                    return(copy.InventoryNumber);
                }


                return("");
            };
            ldFrom.AspectGetter = delegate(object x) {
                if (((Lending)x).From == null)
                {
                    return("");
                }
                DateTime t = ((Lending)x).From ?? DateTime.Now;
                return(t.ToShortDateString());
            };
            ldTo.AspectGetter = delegate(object x) {
                if (((Lending)x).To == null)
                {
                    return("");
                }
                DateTime t = ((Lending)x).To ?? DateTime.Now;
                return(t.ToShortDateString());
            };
            //brStatus.Renderer = new ImageRenderer();
            ldStatus.ImageGetter = delegate(object x) {
                int status = ((Lending)x).Status ?? 1;
                if (status == 2)        // Returned
                {
                    return(6);
                }
                else if (status == 0)   // Reserved
                {
                    return(9);
                }
                else if (status == 3)   // Canceled
                {
                    return(7);
                }
                else
                {
                    return(10);         // Borrowed
                }
            };
            ldStatus.AspectGetter = delegate(object x) {
                int status = ((Lending)x).Status ?? 1;
                if (status == 2)        // Returned
                {
                    return(Lng.Get("Returned"));
                }
                else if (status == 0)   // Reserved
                {
                    return(Lng.Get("Reserved"));
                }
                else if (status == 3)   // Canceled
                {
                    return(Lng.Get("Canceled"));
                }
                else
                {
                    return(Lng.Get("Borrowed")); // Borrowed
                }
            };
            ldNote.AspectGetter = delegate(object x) {
                return(((Lending)x).Note);
            };
            olvLending.SetObjects(lend);
        }
Example #4
0
        /// <summary>
        /// Update Lending ObjectListView
        /// </summary>
        void UpdateBorrowingOLV()
        {
            databaseEntities db = new databaseEntities();


            List <Borrowing> borr;

            // ----- Show Expired -----
            if (cbBorrowingShow.SelectedIndex == 1)
            {
                DateTime now = DateTime.Now;
                borr = db.Borrowing.Where(p => ((p.To ?? now) < DateTime.Now) && ((p.Status ?? 1) == 0 || (p.Status ?? 1) == 1)).ToList();
            }
            // ----- Show Borrowed -----
            else if (cbBorrowingShow.SelectedIndex == 2)
            {
                if (chbBorrowingReturned.Checked)
                {
                    borr = db.Borrowing.Where(p => ((p.Status ?? 1) == 1 || (p.Status ?? 1) == 2)).ToList();
                }
                else
                {
                    borr = db.Borrowing.Where(p => (p.Status ?? 1) == 1).ToList();
                }
            }
            // ----- Show Reserved -----
            else if (cbBorrowingShow.SelectedIndex == 3)
            {
                if (chbBorrowingReturned.Checked)
                {
                    borr = db.Borrowing.Where(p => ((p.Status ?? 1) == 0 || (p.Status ?? 1) == 3)).ToList();
                }
                else
                {
                    borr = db.Borrowing.Where(p => (p.Status ?? 1) == 0).ToList();
                }
            }
            // ----- Show All -----
            else
            {
                if (chbBorrowingReturned.Checked)
                {
                    borr = db.Borrowing.ToList();
                }
                else
                {
                    borr = db.Borrowing.Where(p => (p.Status ?? 1) == 0 || (p.Status ?? 1) == 1).ToList();
                }
            }

            brFastTags.Renderer     = new ImageRenderer();
            brFastTags.AspectGetter = delegate(object x) {
                List <int> ret = new List <int>();
                if (((Borrowing)x).FastTags != null)
                {
                    FastFlags flag = (FastFlags)((Borrowing)x).FastTags;
                    if (flag.HasFlag(FastFlags.FLAG1))
                    {
                        ret.Add(0);
                    }
                    if (flag.HasFlag(FastFlags.FLAG2))
                    {
                        ret.Add(1);
                    }
                    if (flag.HasFlag(FastFlags.FLAG3))
                    {
                        ret.Add(2);
                    }
                    if (flag.HasFlag(FastFlags.FLAG4))
                    {
                        ret.Add(3);
                    }
                    if (flag.HasFlag(FastFlags.FLAG5))
                    {
                        ret.Add(4);
                    }
                    if (flag.HasFlag(FastFlags.FLAG6))
                    {
                        ret.Add(5);
                    }
                }
                return(ret);
            };
            brFastTagsNum.AspectGetter = delegate(object x) {
                string res = "";
                if (((Borrowing)x).FastTags != null)
                {
                    FastFlags flag = (FastFlags)((Borrowing)x).FastTags;
                    if (flag.HasFlag(FastFlags.FLAG1))
                    {
                        res += "1";
                    }
                    if (flag.HasFlag(FastFlags.FLAG2))
                    {
                        res += "2";
                    }
                    if (flag.HasFlag(FastFlags.FLAG3))
                    {
                        res += "3";
                    }
                    if (flag.HasFlag(FastFlags.FLAG4))
                    {
                        res += "4";
                    }
                    if (flag.HasFlag(FastFlags.FLAG5))
                    {
                        res += "5";
                    }
                    if (flag.HasFlag(FastFlags.FLAG6))
                    {
                        res += "6";
                    }
                }
                return(res);
            };
            brPerson.AspectGetter = delegate(object x) {
                Contacts contact = db.Contacts.Find(((Borrowing)x).PersonID);
                if (contact != null)
                {
                    return(contact.Name.Trim() + " " + contact.Surname.Trim());
                }
                else
                {
                    return("");
                }
            };
            brItemName.AspectGetter = delegate(object x) {
                return(((Borrowing)x).Item.Trim());
            };
            brItemInvNum.AspectGetter = delegate(object x) {
                if (((Borrowing)x).ItemInvNum != null)
                {
                    return(((Borrowing)x).ItemInvNum.Trim());
                }
                return("");
            };
            brFrom.AspectGetter = delegate(object x) {
                if (((Borrowing)x).From == null)
                {
                    return("");
                }
                DateTime t = ((Borrowing)x).From ?? DateTime.Now;
                return(t.ToShortDateString());
            };
            brTo.AspectGetter = delegate(object x) {
                if (((Borrowing)x).To == null)
                {
                    return("");
                }
                DateTime t = ((Borrowing)x).To ?? DateTime.Now;
                return(t.ToShortDateString());
            };
            //brStatus.Renderer = new ImageRenderer();
            brStatus.ImageGetter = delegate(object x) {
                int status = ((Borrowing)x).Status ?? 1;
                if (status == 2)        // Returned
                {
                    return(6);
                }
                else if (status == 0)   // Reserved
                {
                    return(9);
                }
                else if (status == 3)   // Canceled
                {
                    return(7);
                }
                else
                {
                    return(10);         // Borrowed
                }
            };
            brStatus.AspectGetter = delegate(object x) {
                int status = ((Borrowing)x).Status ?? 1;
                if (status == 2)        // Returned
                {
                    return(Lng.Get("Returned"));
                }
                else if (status == 0)   // Reserved
                {
                    return(Lng.Get("Reserved"));
                }
                else if (status == 3)   // Canceled
                {
                    return(Lng.Get("Canceled"));
                }
                else
                {
                    return(Lng.Get("Borrowed")); // Borrowed
                }
            };
            brNote.AspectGetter = delegate(object x) {
                if (((Borrowing)x).Note != null)
                {
                    return(((Borrowing)x).Note.Trim());
                }
                else
                {
                    return("");
                }
            };

            olvBorrowing.SetObjects(borr);
        }
Example #5
0
        /// <summary>
        /// Fill Contact values
        /// </summary>
        /// <param name="contact">Contact</param>
        private void FillContact(ref Contacts contact)
        {
            // ----- Avatar -----
            contact.Avatar = Conv.ImageToByteArray(imgAvatar.Image);

            // ----- Name -----
            contact.Name    = txtName.Text;
            contact.Surname = txtSurname.Text;
            contact.Nick    = txtNick.Text;

            if (cbSex.SelectedIndex == 1)
            {
                contact.Sex = "M";
            }
            else if (cbSex.SelectedIndex == 2)
            {
                contact.Sex = "F";
            }
            else
            {
                contact.Sex = "";
            }

            // ----- Contacts -----
            contact.Phone = GetTextFromDataItem(PhoneNums);
            contact.Email = GetTextFromDataItem(Emails);
            contact.WWW   = GetTextFromDataItem(URLs);
            contact.IM    = GetTextFromDataItem(IMs);


            // ----- Address -----
            contact.Street   = txtStreet.Text;
            contact.City     = txtCity.Text;
            contact.Region   = txtRegion.Text;
            contact.Country  = txtState.Text;
            contact.PostCode = txtPostCode.Text;

            contact.Note = txtNote.Text;
            if (chbBirth.Checked)
            {
                contact.Birth = dateBirth.Value;
            }
            else
            {
                contact.Birth = null;
            }
            contact.Tags = txtTag.Text;
            //contact.FastTags = 0;

            contact.PersonCode = txtCode.Text;
            contact.Barcode    = Conv.ToNumber(txtCode.Text);
            contact.Updated    = DateTime.Now;

            contact.Company  = txtCompany.Text;
            contact.Position = txtPosition.Text;

            contact.Active = chbActive.Checked;

            // ----- Fast tags -----
            short fastTag = 0;

            if (btnTag1.BackColor == SelectColor)
            {
                fastTag |= 0x01;
            }
            if (btnTag2.BackColor == SelectColor)
            {
                fastTag |= 0x02;
            }
            if (btnTag3.BackColor == SelectColor)
            {
                fastTag |= 0x04;
            }
            if (btnTag4.BackColor == SelectColor)
            {
                fastTag |= 0x08;
            }
            if (btnTag5.BackColor == SelectColor)
            {
                fastTag |= 0x10;
            }
            if (btnTag6.BackColor == SelectColor)
            {
                fastTag |= 0x20;
            }
            contact.FastTags = fastTag;

            // ----- Unused now -----
            if (contact.Partner == null)
            {
                contact.Partner = "";
            }
            if (contact.Childs == null)
            {
                contact.Childs = "";
            }
            if (contact.Parrents == null)
            {
                contact.Parrents = "";
            }
            if (contact.GoogleID == null)
            {
                contact.GoogleID = "";
            }
        }
Example #6
0
        /// <summary>
        /// Form Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmEditContacts_Load(object sender, EventArgs e)
        {
            com.ReceivedData += new ReceivedEventHandler(DataReceive);
            try
            {
                com.ConnectSP(Properties.Settings.Default.scanCOM);
            }
            catch { }

            PrepareCbSex();

            PreparePhone();
            PrepareEmail();
            PrepareURL();
            PrepareIM();

            // ----- New Inv Number -----
            if (TempMaxInvNum < Properties.Settings.Default.ContactStart)
            {
                TempMaxInvNum = Properties.Settings.Default.ContactStart;
            }
            else
            {
                TempMaxInvNum++;
            }
            txtCode.Text = Properties.Settings.Default.ContactPrefix + (TempMaxInvNum).ToString("D" + Properties.Settings.Default.ContactMinCharLen.ToString()) + Properties.Settings.Default.ContactSuffix;

            // ----- If Edit -> fill form -----
            if (ID != Guid.Empty)
            {
                Contacts contact = db.Contacts.Find(ID);

                // ----- Avatar -----
                imgAvatar.Image = Conv.ByteArrayToImage(contact.Avatar);

                // ----- Name -----
                txtName.Text    = contact.Name;
                txtSurname.Text = contact.Surname;
                txtNick.Text    = contact.Nick;
                if (contact.Sex.Trim() == "M")
                {
                    cbSex.SelectedIndex = 1;
                }
                else if (contact.Sex.Trim() == "F")
                {
                    cbSex.SelectedIndex = 2;
                }
                else
                {
                    cbSex.SelectedIndex = 0;
                }

                // ----- Phone -----
                PhoneNums = GetDataItem(contact.Phone);
                if (PhoneNums.Count > 0)
                {
                    cbPhone.Items.Clear();
                    for (int i = 0; i < PhoneNums.Count; i++)
                    {
                        cbPhone.Items.Add(PhoneNums[i].name);
                    }
                    if (PhoneNums.Count > 1)
                    {
                        btnDelPhone.Enabled = true;
                    }
                    SelectPhone(0);
                }
                else
                {
                    CreatePhone();
                }


                // ----- Email -----
                Emails = GetDataItem(contact.Email);
                if (Emails.Count > 0)
                {
                    cbEmail.Items.Clear();
                    for (int i = 0; i < Emails.Count; i++)
                    {
                        cbEmail.Items.Add(Emails[i].name);
                    }
                    if (Emails.Count > 1)
                    {
                        btnDelEmail.Enabled = true;
                    }
                    SelectEmail(0);
                }
                else
                {
                    CreateEmail();
                }

                // ----- URL -----
                URLs = GetDataItem(contact.WWW);
                if (URLs.Count > 0)
                {
                    cbURL.Items.Clear();
                    for (int i = 0; i < URLs.Count; i++)
                    {
                        cbURL.Items.Add(URLs[i].name);
                    }
                    if (URLs.Count > 1)
                    {
                        btnDelURL.Enabled = true;
                    }
                    SelectURL(0);
                }
                else
                {
                    CreateURL();
                }

                // ----- IM -----
                IMs = GetDataItem(contact.IM);
                if (IMs.Count > 0)
                {
                    cbIM.Items.Clear();
                    for (int i = 0; i < IMs.Count; i++)
                    {
                        cbIM.Items.Add(IMs[i].name);
                    }
                    if (IMs.Count > 1)
                    {
                        btnDelIM.Enabled = true;
                    }
                    SelectIM(0);
                }
                else
                {
                    CreateIM();
                }

                // ----- Address -----
                txtStreet.Text   = contact.Street;
                txtCity.Text     = contact.City;
                txtRegion.Text   = contact.Region;
                txtState.Text    = contact.Country;
                txtPostCode.Text = contact.PostCode;

                txtNote.Text = contact.Note;
                if (contact.Birth != null)
                {
                    chbBirth.Checked = true;
                }
                dateBirth.Value = contact.Birth ?? dateBirth.MinDate;
                txtTag.Text     = contact.Tags;
                //contact.FastTags = 0;


                txtCode.Text = contact.PersonCode;

                txtCompany.Text  = contact.Company;
                txtPosition.Text = contact.Position;

                chbActive.Checked = contact.Active ?? true;

                // ----- Fast tags -----
                FastFlags flag = (FastFlags)(contact.FastTags ?? 0);
                if (flag.HasFlag(FastFlags.FLAG1))
                {
                    btnTag1.BackColor = Color.SkyBlue;
                }
                if (flag.HasFlag(FastFlags.FLAG2))
                {
                    btnTag2.BackColor = Color.SkyBlue;
                }
                if (flag.HasFlag(FastFlags.FLAG3))
                {
                    btnTag3.BackColor = Color.SkyBlue;
                }
                if (flag.HasFlag(FastFlags.FLAG4))
                {
                    btnTag4.BackColor = Color.SkyBlue;
                }
                if (flag.HasFlag(FastFlags.FLAG5))
                {
                    btnTag5.BackColor = Color.SkyBlue;
                }
                if (flag.HasFlag(FastFlags.FLAG6))
                {
                    btnTag6.BackColor = Color.SkyBlue;
                }

                // ----- Updated -----
                lblLastUpdate.Text = Lng.Get("LastUpdate", "Last update") + ": " + (contact.Updated ?? DateTime.Now).ToString();
                lblGoogleID.Text   = "Google ID: " + contact.GoogleID;

                // ----- Unused now -----

                /*contact.Partner = "";
                 * contact.Childs = "";
                 * contact.Parrents = "";
                 * contact.GoogleID = "";*/
            }
        }