コード例 #1
0
        public contact New()
        {
            contact contact = new entity.contact();

            contact.contact_field_value  = new List <contact_field_value>();
            contact.contact_subscription = new List <contact_subscription>();
            contact.hr_education         = new List <hr_education>();
            contact.hr_contract          = new List <hr_contract>();
            contact.hr_family            = new List <hr_family>();
            contact.hr_talent_detail     = new List <hr_talent_detail>();

            contact.id_company = CurrentSession.Id_Company;
            contact.id_user    = CurrentSession.Id_User;
            contact.is_head    = true;
            contact.is_active  = true;
            contact.lead_time  = 0;

            using (db db = new db())
            {
                if (db.contact_role.Where(c => c.is_principal == true && c.id_company == CurrentSession.Id_Company).FirstOrDefault() != null)
                {
                    int _id_contact_role = Convert.ToInt32(db.contact_role.Where(c => c.is_principal == true && c.id_company == CurrentSession.Id_Company).FirstOrDefault().id_contact_role);
                    if (_id_contact_role != 0)
                    {
                        contact.id_contact_role = _id_contact_role;
                    }
                }
            }

            return(contact);
        }
コード例 #2
0
 private void set_ContactPref(object sender, RoutedEventArgs e)
 {
     if (sbxContact.ContactID > 0)
     {
         entity.item_brand item_brand = item_brandViewSource.View.CurrentItem as entity.item_brand;
         entity.contact    contact    = db.contacts.Where(x => x.id_contact == sbxContact.ContactID).FirstOrDefault();
         if (contact != null && item_brand != null)
         {
             item_brand.id_contact = contact.id_contact;
         }
         else
         {
             MessageBox.Show("Contact not selected");
         }
     }
 }