Пример #1
0
        public async Task<IActionResult> PutTelephone([FromRoute] int id, [FromBody] Telephone telephone)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != telephone.TelephoneId)
            {
                return BadRequest();
            }

            _context.Entry(telephone).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TelephoneExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return NoContent();
        }
Пример #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult result = MessageBox.Show("Voulez-vous supprimer cet enregistrement ?", "Suppression personne", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (result == DialogResult.Yes)
                {
                    ITelephone t = new Telephone();
                    t.Id = int.Parse(txtId.Text);
                    t.Supprimer(t.Id);

                    MessageBox.Show("Suppresion effectué", "Suppresion personne", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    this.RefreshDG();
                }
                else
                {
                    MessageBox.Show("Suppression Annulée", "Suppresion personne", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Echec de suppression " + ex.Message, "Suppresion personne", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally
            {
                ImplementeConnexion.Instance.Conn.Close();
            }
        }
Пример #3
0
 public void telephoneSize(Telephone pFrom)
 {
     if (pFrom._countryCode != 7)
     {
         SqlContext.Pipe.Send("Это не русский номер");
     }
 }
        public async Task <IActionResult> Edit(int id, [Bind("Id,CountryCode,AreaCode,Number")] Telephone telephone)
        {
            if (id != telephone.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(telephone);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TelephoneExists(telephone.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(telephone));
        }
Пример #5
0
 protected void UnloadData(Telephone tel)
 {
     tel.Number = txtNumber.Text;
     tel.Type   = ddlType.SelectedValue;
     if (hc != null)
     {
         tel.HealthcareCompany = hc;
     }
     if (cl != null)
     {
         tel.Clinic = cl;
     }
     if (pat != null)
     {
         tel.Person = pat;
     }
     if (cus != null)
     {
         tel.Person = cus;
     }
     if (prof != null)
     {
         tel.Person = prof;
     }
 }
Пример #6
0
        public static List <Telephone> FetchUserTelephoneData(String username)
        {
            List <Telephone> telephones = new List <Telephone>();

            ConnectToDatabase();

            SqlCommand cmd = new SqlCommand("USP_FETCH_TEL_USU", connection);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@usuario", SqlDbType.VarChar, 50).Value = username;

            SqlDataReader dataReader;

            dataReader = cmd.ExecuteReader();

            while (dataReader.Read())
            {
                Telephone telephone = new Telephone();

                telephone.owner       = dataReader["fld_cod_cli"].ToString();
                telephone.phoneNumber = dataReader["fld_tel_cli"].ToString();
                telephone.phoneType   = dataReader["fld_desc_tip"].ToString();
                telephone.phoneState  = dataReader["fld_desc_est"].ToString();

                telephones.Add(telephone);
            }

            return(telephones);
        }
 public void Update(Telephone obj)
 {
     using (var session = _context.OpenSession())
     {
         session.Save(obj);
     }
 }
Пример #8
0
        private void cmdModifieTelephone_Click(object sender, EventArgs e)
        {
            try
            {
                if (telephone != null)
                {
                    if (dgvTelephone.SelectedRows.Count > 0)
                    {
                        telephone = (Telephone)dgvTelephone.SelectedRows[0].DataBoundItem;

                        telephone.Modifier();
                        MessageBox.Show("Modification éffectué", "Modification", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        try
                        {
                            dgvTelephone.DataSource = Factory.Instance.GetTelephones(telephone.Id_utilisateur);
                        }
                        catch (Exception) { }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Echec de la modification, " + ex.Message, "Modification", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #9
0
        private void dgvTelephone_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                if (dgvTelephone.SelectedRows.Count > 0)
                {
                    IPersonne  p = new Personne();
                    ITelephone t = new Telephone();

                    t = (ITelephone)dgvTelephone.SelectedRows[0].DataBoundItem;

                    txtId.Text       = t.Id.ToString();
                    txtInitial.Text  = t.Initial;
                    txtNumero.Text   = t.Numero;
                    cboPersonne.Text = p.OnePersonne(t.Id_proprietaire).ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erreur lors de la sélection d'un téléphone, " + ex.Message, "Sélection téléphone", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally
            {
                ImplementeConnexion.Instance.Conn.Close();
            }
        }
Пример #10
0
        private void ProfessionalData(ProfessionalInvoice Invoice)
        {
            Professional profesional = Invoice.Professional;

            professionalname = profesional.ComercialName;

            foreach (Address item in profesional.Addresses)
            {
                if (item.Type == "Primary")
                {
                    professionaladdress = item;
                }
            }

            foreach (Telephone item in profesional.Telephones)
            {
                if (item.Type == "Primary")
                {
                    professionaltelf = item;
                }
            }

            foreach (Email item in profesional.Emails)
            {
                if (item.Type == "Primary")
                {
                    professionalemail = item;
                }
            }

            professionalnif = profesional.VATIN;
        }
Пример #11
0
        static void Main(string[] args)
        {

            #region Setup
            //opret jesper
            var tlfJesper = new Telephone("88888888", "TeleDanmark", "Erhverv");
            var mailJesper = new Email("*****@*****.**");
            var adr1 = new Adress("Ringvej", "7a", "8000", "Aarhus C");
            var adr2 = new Adress("Landmands vej", "1", "2900", "Hellerup");
            var personJesper = new Person(tlfJesper, adr1, "Jesper", "Jespersen", "Jes", "Mand", mailJesper);

            //giv jesper en alternativ adresse
            AltAdresse jesperAlternativ = new AltAdresse();
            jesperAlternativ.AlternativeAdress = adr2;
            jesperAlternativ.TypeOfAdress = "Secondary";
            personJesper.altAdresser.Add(jesperAlternativ);

            //opret Peter
            var tlf2 = new Telephone("77777777", "TeleDanmark", "Erhverv");
            var mailPeter = new Email("*****@*****.**");
            //peter bor sammen med Jesper på samme primær adresse
            var person2 = new Person(tlf2, adr1, "Peter", "Jensen", "", "Mand", mailPeter);

            DocumentDBUnitOfWork x = new DocumentDBUnitOfWork(new DBContext());

            x._PersonRepository.AddUser(personJesper).Wait();
            var person = x._PersonRepository.GetUserByEmail(mailJesper.UniqueEmail);
            Console.WriteLine("fandt: \n" + person.GivenName + " " + person.MiddleName + " " + person.FamilyName);
            x._PersonRepository.DeleteUserByEmail(mailJesper.UniqueEmail);

            #endregion

        }
Пример #12
0
        public IEnumerable <IResource> CollectIncluded(Telephone telephone, IncludeQuery includeQuery)
        {
            ISet <IResource> included = new HashSet <IResource>();

            if (includeQuery.Contains("country") && telephone.Country != null)
            {
                included.Add(_mapper.Map <CountryDto>(telephone.Country));
            }
            if (includeQuery.Contains("telephone-type") && telephone.TelephoneType != null)
            {
                included.Add(_mapper.Map <TelephoneTypeDto>(telephone.TelephoneType));
            }
            if (includeQuery.Contains("customer") && telephone.Customer != null)
            {
                included.Add(_mapper.Map <CustomerDto>(telephone.Customer));
            }
            if (includeQuery.Contains("contact") && telephone.Contact != null)
            {
                included.Add(_mapper.Map <ContactDto>(telephone.Contact));
            }
            if (includeQuery.Contains("builidng") && telephone.Building != null)
            {
                included.Add(_mapper.Map <BuildingDto>(telephone.Building));
            }

            return(included);
        }
Пример #13
0
        public async Task <bool> ModifierTelephone(Telephone telephone)
        {
            bool done     = false;
            int  idclient = 0;

            try
            {
                bool exist = grandhotel.Email.Any(x => x.Adresse == telephone.Email);
                if (exist)
                {
                    idclient = grandhotel.Email
                               .Where(x => x.Adresse == telephone.Email)
                               .Select(x => x.IdClient).FirstOrDefault();
                    var anciennumero = grandhotel.Telephone.Where(x => x.Numero == telephone.AncienNumero && x.IdClient == idclient).FirstOrDefault();
                    anciennumero.Numero   = telephone.Numero;
                    anciennumero.Pro      = telephone.Pro;
                    anciennumero.CodeType = telephone.CodeType;
                    grandhotel.Telephone.Update(anciennumero);
                    await grandhotel.SaveChangesAsync();

                    done = true;
                }
            }
            catch (Exception ex)
            {
            }
            return(done);
        }
        public bool InteressentMandatoryFill()
        {
            try
            {
                Language.SendKeys(LanguagesEnglishVersion.English);
                Title.EnterText(Titles.Ms);
                FirstName.EnterText(string.Format("{0}", Name));
                LastName.EnterText(string.Format("{0}", Name));
                Email.EnterText(Emails.HrmTest);
                Telephone.EnterText("084-2565584");

                Nationality.Click();
                PropertiesCollection.Sleep500();
                page1NationalityGerman.Click();

                Submit.Click();

                while (!ReadyThankyou())
                {
                    ;
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public static void Parse(Token token, ref VCard vcard)
        {
            if (string.IsNullOrWhiteSpace(token.Values[0]))
            {
                return;
            }

            var telephone  = new Telephone();
            var preference = token.AdditionalKeyMembers.FirstOrDefault(x => x.Key == "PREF");
            var type       = token.AdditionalKeyMembers.FirstOrDefault(x => x.Key == "TYPE");

            if (type.Key == null)
            {
                type = token.AdditionalKeyMembers.FirstOrDefault(x => x.Key != "PREF");
            }

            telephone.Preference = preference.Value.ConvertTo <int>();
            telephone.Type       = TelephoneTypeLookup.Parse(type.Value != "" ? type.Value : type.Key);
            telephone.Number     = token.Values[0];

            var telephones = (List <Telephone>)vcard.Telephones ?? new List <Telephone>();

            telephones.Add(telephone);
            vcard.Telephones = telephones;
        }
Пример #16
0
        static void Main(string[] args)
        {
            EFUnitOfWork UOW = new EFUnitOfWork();
            //opret jesper
            var tlfJesper    = new Telephone("88888888", "TeleDanmark", "Erhverv");
            var mailJesper   = new Email("*****@*****.**");
            var adr1         = new Adress("Ringvej", "7a", "8000", "Aarhus C");
            var adr2         = new Adress("Landmands vej", "1", "2900", "Hellerup");
            var personJesper = new Person(tlfJesper, adr1, "Jesper", "Jespersen", "Jes", "Mand", mailJesper);

            //giv jesper en alternativ adresse
            AltAdresse jesperAlternativ = new AltAdresse();

            jesperAlternativ.AlternativeAdress = adr2;
            jesperAlternativ.TypeOfAdress      = "Secondary";
            personJesper.altAdresser.Add(jesperAlternativ);

            //opret Peter
            var tlf2      = new Telephone("77777777", "TeleDanmark", "Erhverv");
            var mailPeter = new Email("*****@*****.**");
            //peter bor sammen med Jesper på samme primær adresse
            var person2 = new Person(tlf2, adr1, "Peter", "Jensen", "", "Mand", mailPeter);

            UOW.addPerson(personJesper);
            UOW.addPerson(person2);
            UOW.Commit();

            PersonIndex newIndex = new PersonIndex();

            var x = UOW.GetPersonByEmail("*****@*****.**");

            newIndex.PrintPerson(x.Result);
        }
Пример #17
0
        public async Task <IActionResult> Edit(int id, [Bind("TelephoneId,TelephoneModel,TelephoneCout,TelephoneCouleur,ManufacturierId")] Telephone telephone)
        {
            if (id != telephone.TelephoneId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(telephone);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TelephoneExists(telephone.TelephoneId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ManufacturierId"] = new SelectList(_context.Manufacturier, "ManufacturierId", "ManufacturierMarque", telephone.ManufacturierId);
            return(View(telephone));
        }
Пример #18
0
        private void HealthcareCompanyData(AriClinicContext ctx1)
        {
            HealthcareCompany healthcare = CntAriCli.GetHealthCompany(ctx1);

            companyname = healthcare.Name;

            foreach (Address item in healthcare.Addresses)
            {
                if (item.Type == "Primary")
                {
                    companyaddress = item;
                }
            }

            foreach (Telephone item in healthcare.Telephones)
            {
                if (item.Type == "Primary")
                {
                    companytelf = item;
                }
            }

            foreach (Email item in healthcare.Emails)
            {
                if (item.Type == "Primary")
                {
                    companyemail = item;
                }
            }

            companynif = healthcare.VATIN;
        }
Пример #19
0
        public async Task <Telephone> CreateTelephone(Telephone newTelephone)
        {
            await _context.AddAsync(newTelephone);

            await _context.SaveChangesAsync();

            return(newTelephone);
        }
Пример #20
0
        public ContactChange(Contact contact)
        {
            this.Email = contact.Email;
            this.Voice = contact.Voice;
            this.Fax = contact.Fax;

            this.PostalInfo = contact.PostalInfo;
        }
        public void IsNull_Passing_Valid_Values_Returns_False(string prefix, long number)
        {
            var expected = false;

            var actual = Telephone.Create(prefix, number);

            Assert.AreEqual(expected, actual.IsNull);
        }
Пример #22
0
 public PhoneNumberDTO(Telephone T)
 {
     PersonID     = T.PersonRefId;
     Phonecompany = T.PhoneCompany;
     Phonenumber  = T.TelephoneNumber;
     Usage        = T.UsageOfTlf;
     telephoneId  = T.telephoneID;
 }
Пример #23
0
 private void Start()
 {
     door      = FindObjectOfType <Door>();
     telephone = FindObjectOfType <Telephone>();
     StartCoroutine(PhoneCallCoroutine());
     gm            = FindObjectOfType <GameManager>();
     messagesPanel = FindObjectOfType <ErrandPanel>();
 }
        public ActionResult DeleteConfirmed(long id)
        {
            Telephone telephone = db.Telephones.Find(id);

            db.Telephones.Remove(telephone);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #25
0
        public bool Manager_Ajouter_Telephone(int id, string a, string b, string c, string d, string e, string f, string g, string h, string i, string j, string k, string l, string m)
        {
            Telephone NewTelephone = new Telephone {
                Title = a, Image = b, Note = c, TopPrix = d, Conclusion = e, PointFort1 = f, PointFort2 = g, PointFort3 = h, PointFaible1 = i, PointFaible2 = j, PointFaible3 = k, Article1 = l, Article2 = m
            };

            return(tab_marque[id].Ajouter(NewTelephone));
        }
Пример #26
0
        public ContactChange(Contact contact)
        {
            this.Email = contact.Email;
            this.Voice = contact.Voice;
            this.Fax   = contact.Fax;

            this.PostalInfo = contact.PostalInfo;
        }
Пример #27
0
 public static void RemoveTelephone(this VCard vcard, Telephone telephone)
 {
     if (vcard.Telephones != null)
     {
         var PhoneList = vcard.Telephones as List <Telephone>;
         PhoneList.Remove(telephone);
     }
 }
 public bool IsValid(Telephone telephone)
 {
     if (!_numberValidator.LengthValidator(telephone.TelephoneNumber, 10))
     {
         return(false);
     }
     return(true);
 }
        public void OperatorNotEqual_Passing_Valid_Values_Returns_True(string prefix, long number)
        {
            var left  = Telephone.Create(prefix, number);
            var right = Telephone.Create("4344", 9999999999);

            var isEqual = left != right;

            Assert.IsTrue(isEqual);
        }
        public void Equals_Passing_Valid_Values_Returns_True(string prefix, long number)
        {
            var left  = Telephone.Create(prefix, number);
            var right = Telephone.Create(prefix, number);

            var isEqual = left.Equals(right);

            Assert.IsTrue(isEqual);
        }
        public void ToString_Passing_Valid_Values_Returns_Value_String_Format(string prefix, long number)
        {
            var expected = $"{prefix} {number}";
            var result   = Telephone.Create(prefix, number);

            var actual = result.ToString();

            Assert.AreEqual(expected, actual);
        }
Пример #32
0
        public ContactChange(Contact contact)
        {
            this.Email = contact.Email;
            this.Voice = contact.Voice;
            this.Fax = contact.Fax;

            this.PostalInfo = contact.PostalInfo;
            this.DiscloseFlag = contact.DiscloseFlag;
            this.DiscloseMask = contact.DiscloseMask;
        }
Пример #33
0
        public Object Post(TelephoneResource telephoneResource)
        {
            LogRequest();

            if (telephoneResource == null) { return "Telephone is required"; }
            if (telephoneResource.Number == null) { return "Telephone.Number is required"; }
            if (telephoneResource.EmployeeId <= 0) { return "Telephone.EmployeeId is required"; }

            var telephone = new Telephone
            {
                Number = SafeTrim(telephoneResource.Number),
                EmployeeId = telephoneResource.EmployeeId
            };
            _db.Telephones.Add(telephone);
            _db.SaveChanges();

            return telephone;
        }
Пример #34
0
 internal void SavePhoneNumbers()
 {
     if(PhoneOneEntry.Text.Length > 0)
        {
     PhoneTypes selType = GetPhoneType(POneOptionMenu);
     if(phoneOne == null)
     {
      phoneOne = new Telephone(
       PhoneOneEntry.Text,
       (selType | PhoneTypes.preferred));
      currentContact.AddTelephoneNumber(phoneOne);
     }
     else
     {
      phoneOne.Types = (selType | PhoneTypes.preferred);
      phoneOne.Number = PhoneOneEntry.Text;
     }
        }
        else
        {
     if(phoneOne != null)
     {
      phoneOne.Delete();
     }
        }
        if(PhoneTwoEntry.Text.Length > 0)
        {
     PhoneTypes selType = GetPhoneType(PTwoOptionMenu);
     if(phoneTwo == null)
     {
      phoneTwo = new Telephone(PhoneTwoEntry.Text, selType);
      currentContact.AddTelephoneNumber(phoneTwo);
     }
     else
     {
      phoneTwo.Types = selType;
      phoneTwo.Number = PhoneTwoEntry.Text;
     }
        }
        else
        {
     if(phoneTwo != null)
     {
      phoneTwo.Delete();
     }
        }
        if(PhoneThreeEntry.Text.Length > 0)
        {
     PhoneTypes selType = GetPhoneType(PThreeOptionMenu);
     if(phoneThree == null)
     {
      phoneThree = new Telephone(PhoneThreeEntry.Text, selType);
      currentContact.AddTelephoneNumber(phoneThree);
     }
     else
     {
      phoneThree.Types = selType;
      phoneThree.Number = PhoneThreeEntry.Text;
     }
        }
        else
        {
     if(phoneThree != null)
     {
      phoneThree.Delete();
     }
        }
        if(PhoneFourEntry.Text.Length > 0)
        {
     PhoneTypes selType = GetPhoneType(PFourOptionMenu);
     if(phoneFour == null)
     {
      phoneFour = new Telephone(PhoneFourEntry.Text, selType);
      currentContact.AddTelephoneNumber(phoneFour);
     }
     else
     {
      phoneFour.Types = selType;
      phoneFour.Number = PhoneFourEntry.Text;
     }
        }
        else
        {
     if(phoneFour != null)
     {
      phoneFour.Delete();
     }
        }
 }
Пример #35
0
 internal void PopulatePhoneType(PhoneTypes types)
 {
     foreach(Telephone phone in currentContact.GetTelephoneNumbers())
        {
     if( types != PhoneTypes.preferred )
     {
      if( (phone.Types & PhoneTypes.preferred) ==
        PhoneTypes.preferred)
      {
       continue;
      }
     }
     if( (phone.Types & types) != types)
     {
      continue;
     }
     if(phoneOne == null)
     {
      phoneOne = phone;
      PhoneOneEntry.Text = phone.Number;
      SetPhoneOptionMenu(POneOptionMenu, phone.Types);
     }
     else if(phoneTwo == null)
     {
      phoneTwo = phone;
      PhoneTwoEntry.Text = phone.Number;
      SetPhoneOptionMenu(PTwoOptionMenu, phone.Types);
     }
     else if(phoneThree == null)
     {
      phoneThree = phone;
      PhoneThreeEntry.Text = phone.Number;
      SetPhoneOptionMenu(PThreeOptionMenu, phone.Types);
     }
     else if(phoneFour == null)
     {
      phoneFour = phone;
      PhoneFourEntry.Text = phone.Number;
      SetPhoneOptionMenu(PFourOptionMenu, phone.Types);
     }
        }
 }
Пример #36
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     Telephone ds = new Telephone();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
Пример #37
0
 private void Init()
 {
     Version = 0;
     Name = new Name();
     Nickname = string.Empty;
     Photo = null;
     Birthday = new DateTime();
     Telephone = new Telephone[0];
     Email = new Email[0];
     Mailer = string.Empty;
     Title = string.Empty;
     Role = string.Empty;
     Logo = null;
     Agent = null;
     Organization = new Organization();
 }
Пример #38
0
 public virtual int Update(Telephone.TelephoneRegisterDataTable dataTable) {
     return this.Adapter.Update(dataTable);
 }
Пример #39
0
 private void AddNewTelephone(ref Telephone telephone, ref TextBox editBox)
 {
     telephone = new Telephone(editBox.Text);
        try
        {
     editBox.DataBindings.Add("Text", telephone, "Number");
     contact.AddTelephoneNumber(telephone);
        }
        catch (SimiasException e)
        {
     e.LogError();
     MessageBox.Show("An error occurred while adding the telephone number.  Please see the log file for additional information.", "Add Telephone Number Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        catch (Exception e)
        {
     logger.Debug(e, "Adding telephone number");
     MessageBox.Show("An error occurred while adding the telephone number.  Please see the log file for additional information.", "Add Telephone Number Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
 }
Пример #40
0
 protected void LoadData(Telephone tel)
 {
     txtTelephoneId.Text = tel.TelephoneId.ToString();
     txtNumber.Text = tel.Number;
     LoadTypeCombo(tel);
 }
Пример #41
0
 protected bool CreateChange()
 {
     if (!DataOk())
         return false;
     if (telephoneId == 0)
     {
         Telephone tel = new Telephone();
         UnloadData(tel);
         ctx.Add(tel);
     }
     else
     {
         Telephone tel = (from t in ctx.Telephones
                          where t.TelephoneId == telephoneId
                          select t).FirstOrDefault<Telephone>();
         UnloadData(tel);
     }
     ctx.SaveChanges();
     return true;
 }
Пример #42
0
 public static Telephone CreateTelephone(int ID, byte[] rowVersion, string phoneNumber, string phoneType, string is1stPreferNumber, string is2ndPreferNumber, string createBy, global::System.DateTime createTime, string createOffice, string modifyBy, global::System.DateTime modifyTime, string modifyOffice, int caller_Telephone)
 {
     Telephone telephone = new Telephone();
     telephone.Id = ID;
     telephone.RowVersion = rowVersion;
     telephone.PhoneNumber = phoneNumber;
     telephone.PhoneType = phoneType;
     telephone.Is1stPreferNumber = is1stPreferNumber;
     telephone.Is2ndPreferNumber = is2ndPreferNumber;
     telephone.CreateBy = createBy;
     telephone.CreateTime = createTime;
     telephone.CreateOffice = createOffice;
     telephone.ModifyBy = modifyBy;
     telephone.ModifyTime = modifyTime;
     telephone.ModifyOffice = modifyOffice;
     telephone.Caller_Telephone = caller_Telephone;
     return telephone;
 }
Пример #43
0
 public void AddToTelephones(Telephone telephone)
 {
     base.AddObject("Telephones", telephone);
 }
Пример #44
0
 private void ProcessLines(string[] lines)
 {
     if (lines.Contains("begin:vcard".ToUpper()) || lines.Contains("begin:vcard") || lines.Contains("end:vcard".ToUpper()) || lines.Contains("begin:vcard"))
         foreach (string line in lines)
         {
             try
             {
                 object[] parsedLine = ParseLine(line);
                 switch ((parsedLine[0] as string))
                 {
                     case "version":
                         {
                             Version = (float)parsedLine[1];
                             break;
                         }
                     case "n":
                         {
                             Name = parsedLine[1] as Name;
                             break;
                         }
                     case "nickname":
                         {
                             Nickname = parsedLine[1] as string;
                             break;
                         }
                     case "photo":
                         {
                             Photo = parsedLine[1] as Bitmap;
                             break;
                         }
                     case "bday":
                         {
                             Birthday = (DateTime)parsedLine[1];
                             break;
                         }
                     case "tel":
                         {
                             Telephone[] tmp = Telephone;
                             Telephone = new Telephone[tmp.Length + 1];
                             tmp.CopyTo(Telephone, 0);
                             Telephone[tmp.Length] = parsedLine[1] as Telephone;
                             break;
                         }
                     case "email":
                         {
                             Email[] tmp = Email;
                             Email = new Email[tmp.Length + 1];
                             tmp.CopyTo(Email, 0);
                             Email[tmp.Length] = parsedLine[1] as Email;
                             break;
                         }
                     case "mailer":
                         {
                             Mailer = parsedLine[1] as string;
                             break;
                         }
                     case "title":
                         {
                             Title = parsedLine[1] as string;
                             break;
                         }
                     case "role":
                         {
                             Role = parsedLine[1] as string;
                             break;
                         }
                     case "logo":
                         {
                             Logo = parsedLine[1] as Bitmap;
                             break;
                         }
                     case "agent":
                         {
                             if (parsedLine[1] is string)
                                 Agent = parsedLine[1] as string;
                             else
                                 Agent = parsedLine[1] as vCard;
                             break;
                         }
                     case "org":
                         {
                             Organization = parsedLine[1] as Organization;
                             break;
                         }
                     default:
                         break;
                 }
             }
             catch (Exception)
             {
             }
         }
     else
         return;
 }
Пример #45
0
 private object[] ParseLine(string line)
 {
     object[] res = new object[2];
     Match m = Regex.Match(line, "^(?<tag>[A-Za-z]*)[:;]");
     if (m.Success)
     {
         string tag = m.Groups["tag"].Value;
         line = line.Replace(string.Format("{0}:", tag), "");
         switch (tag.ToLower())
         {
             case "version":
                 {
                     Match ma = Regex.Match(line, @"(?<version>[\d.]+)");
                     res[0] = "version";
                     res[1] = float.Parse(ma.Groups["version"].Value);
                     return res;
                 }
             case "fn":
                 {
                     return null;
                 }
             case "n":
                 {
                     Match ma = Regex.Match(line, @":(?<familyname>[\w\W\s]*);(?<givenname>[\w\W\s]*);(?<additionalnames>[\w\W\s]*);(?<honorificprefixes>[\w\W\s]*);(?<honorificsuffixes>[\w\W\s]*)");
                     res[0] = "n";
                     res[1] = new Name()
                     {
                         FamilyName = ma.Groups["familyname"].Value,
                         GivenName = ma.Groups["givenname"].Value,
                         AdditionalNames = ma.Groups["additionalnames"].Value,
                         HonorificPrefixes = ma.Groups["honorificprefixes"].Value,
                         HonorificSuffixes = ma.Groups["honorificsuffixes"].Value
                     };
                     return res;
                 }
             case "nickname":
                 {
                     Match ma = Regex.Match(line, "(?<nickname>[A-Za-z,]*)$");
                     res[0] = "nickname";
                     res[1] = ma.Groups["nickname"].Value;
                     return res;
                 }
             case "photo":
                 {
                     Match ma = Regex.Match(line, "=(?<encoding>.);");
                     res[0] = "photo";
                     res[1] = null;
                     if (ma.Success)
                     {
                         Match mb = Regex.Match(line, @"(?<binarydata>[\w]+)$");
                         res[1] = new Bitmap(new MemoryStream(Encoding.ASCII.GetBytes(mb.Groups["binarydata"].Value)));
                     }
                     else
                     {
                         Match mb = Regex.Match(line, @"uri:(?<value>[\w\W]+)$");
                         byte[] data = new WebClient().DownloadData(new Uri(mb.Groups["value"].Value));
                         res[1] = new Bitmap(new MemoryStream(data));
                     }
                     return res;
                 }
             case "bday":
                 {
                     Match ma = Regex.Match(line, ":(?<date>[0-9-:TtZz,]*)$");
                     res[0] = "bday";
                     Match mb = Regex.Match(ma.Groups["date"].Value, "(?<year>[0-9]+)[-/.](?<month>[0-9]+)[-/.](?<day>[0-9]+)");
                     res[1] = new DateTime(int.Parse(mb.Groups["year"].Value), int.Parse(mb.Groups["month"].Value), int.Parse(mb.Groups["day"].Value));
                     return res;
                 }
             case "tel":
                 {
                     Match ma = Regex.Match(line, @";(?<types>[A-Za-z,]*):(?<number>[-+\d]+)");
                     res[0] = "tel";
                     if (ma.Captures.Count > 0)
                     {
                         MatchCollection mb = Regex.Matches(ma.Groups["types"].Value, "(?<type>[A-Za-z]+)");
                         res[1] = new Telephone()
                         {
                             Number = ma.Groups["number"].Value,
                             Type = new TelephoneType[mb.Count]
                         };
                         for (int i = 0; i < mb.Count; i++)
                             (res[1] as Telephone).Type[i] = (TelephoneType)Enum.Parse(typeof(TelephoneType), mb[i].Value, true);
                     }
                     else
                     {
                         ma = Regex.Match(line, @"(?<number>[-+\d]+)");
                         res[1] = new Telephone()
                         {
                             Number = ma.Groups["number"].Value,
                             Type = new TelephoneType[1] { TelephoneType.home }
                         };
                     }
                     return res;
                 }
             case "email":
                 {
                     Match ma = Regex.Match(line, @"(?<types>[A-Za-z,]*):(?<email>[\w\W]+)");
                     res[0] = "email";
                     MatchCollection mb = Regex.Matches(ma.Groups["types"].Value, "(?<type>[A-Za-z]+)");
                     res[1] = new Email()
                     {
                         Address = ma.Groups["email"].Value,
                         Type = new EmailType[mb.Count]
                     };
                     for (int i = 0; i < mb.Count; i++)
                         (res[1] as Email).Type[i] = (EmailType)Enum.Parse(typeof(EmailType), mb[i].Value, true);
                     return res;
                 }
             case "mailer":
                 {
                     Match ma = Regex.Match(line, @":(?<mailer>[\w\d\s\W]+)$");
                     res[0] = "mailer";
                     res[1] = ma.Groups["mailer"].Value;
                     return res;
                 }
             case "title":
                 {
                     Match ma = Regex.Match(line, @":(?<title>[\w\W\s]*)$");
                     res[0] = "title";
                     res[1] = ma.Groups["title"].Value.Replace(@"\", "");
                     return res;
                 }
             case "role":
                 {
                     Match ma = Regex.Match(line, @":(?<role>[\w\W\s]*)$");
                     res[0] = "role";
                     res[1] = ma.Groups["role"].Value.Replace(@"\", "");
                     return res;
                 }
             case "logo":
                 {
                     Match ma = Regex.Match(line, "=(?<encoding>.);");
                     res[0] = "logo";
                     res[1] = null;
                     if (ma.Success)
                     {
                         Match mb = Regex.Match(line, @"(?<binarydata>[\w]+)$");
                         res[1] = new Bitmap(new MemoryStream(Encoding.ASCII.GetBytes(mb.Groups["binarydata"].Value)));
                     }
                     else
                     {
                         Match mb = Regex.Match(line, @"uri:(?<value>[\w\W]+)$");
                         byte[] data = new WebClient().DownloadData(new Uri(mb.Groups["value"].Value));
                         res[1] = new Bitmap(new MemoryStream(data));
                     }
                     return res;
                 }
             case "agent":
                 {
                     res[0] = "agent";
                     if (line.ToLower().Contains("begin:vcard") && line.ToLower().Contains("end:vcard"))
                     {
                         string[] splitedLines = line.Replace("\\;", ";").Split(new string[1] { "\\n" }, StringSplitOptions.RemoveEmptyEntries);
                         vCard agent = new vCard();
                         agent.Load(splitedLines);
                         res[1] = agent;
                     }
                     else
                     {
                         Match ma = Regex.Match(line, @"uri:(?<value>[\w\W]+)$");
                         res[1] = ma.Groups["value"].Value;
                     }
                     return res;
                 }
             case "org":
                 {
                     Match ma = Regex.Match(line, @":(?<organization>[\w\W\s]*)$");
                     res[0] = "org";
                     Match mb = Regex.Match(ma.Groups["organization"].Value.Replace(@"\", ""), @"(?<organizationname>[\w\W\s]*);(?<organizationunit1>[\w\W\s]*);(?<organizationunit2>[\w\W\s]*)");
                     res[1] = new Organization()
                     {
                         OrganizationName = mb.Groups["organizationname"].Value,
                         OrganizationUnit1 = mb.Groups["organizationunit1"].Value,
                         OrganizationUnit2 = mb.Groups["organizationunit2"].Value
                     };
                     return res;
                 }
             default:
                 {
                     return null;
                 }
         }
     }
     return null;
 }
Пример #46
0
 private void LoadAddresses()
 {
     try
        {
     int n = 1;
     foreach(Email tmpMail in contact.GetEmailAddresses())
     {
      DomainUpDown emailLabel;
      if (tmpMail.Preferred)
      {
       eMail1 = tmpMail;
       email1.DataBindings.Add("Text", eMail1, "Address");
       emailLabel = emailLabel1;
      }
      else
      {
       switch (n)
       {
        case 1:
     eMail2 = tmpMail;
     email2.DataBindings.Add("Text", eMail2, "Address");
     emailLabel = emailLabel2;
     break;
        case 2:
     eMail3 = tmpMail;
     email3.DataBindings.Add("Text", eMail3, "Address");
     emailLabel = emailLabel3;
     break;
        default:
     eMail4 = tmpMail;
     email4.DataBindings.Add("Text", eMail4, "Address");
     emailLabel = emailLabel4;
     break;
       }
       n++;
      }
      if ((tmpMail.Types & EmailTypes.work) == EmailTypes.work)
      {
       emailLabel.SelectedIndex = 0;
      }
      else if ((tmpMail.Types & EmailTypes.personal) == EmailTypes.personal)
      {
       emailLabel.SelectedIndex = 1;
      }
      else if ((tmpMail.Types & EmailTypes.other) == EmailTypes.other)
      {
       emailLabel.SelectedIndex = 2;
      }
     }
        }
        catch (SimiasException e)
        {
     e.LogError();
     MessageBox.Show("An error occurred while reading email addresses.  Please see the log file for additional information.", "Email Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        catch (Exception e)
        {
     logger.Debug(e, "Reading email addresses");
     MessageBox.Show("An error occurred while reading email addresses.  Please see the log file for additional information.", "Email Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        try
        {
     int n = 1;
     foreach(Telephone tmpPhone in contact.GetTelephoneNumbers())
     {
      DomainUpDown phoneLabel;
      if (tmpPhone.Preferred)
      {
       telephone1 = tmpPhone;
       phone1.DataBindings.Add("Text", telephone1, "Number");
       phoneLabel = phoneLabel1;
      }
      else
      {
       switch (n)
       {
        case 1:
     telephone2 = tmpPhone;
     phone2.DataBindings.Add("Text", telephone2, "Number");
     phoneLabel = phoneLabel2;
     break;
        case 2:
     telephone3 = tmpPhone;
     phone3.DataBindings.Add("Text", telephone3, "Number");
     phoneLabel = phoneLabel3;
     break;
        default:
     telephone4 = tmpPhone;
     phone4.DataBindings.Add("Text", telephone4, "Number");
     phoneLabel = phoneLabel4;
     break;
       }
       n++;
      }
      if ((tmpPhone.Types & (PhoneTypes.work | PhoneTypes.voice)) == (PhoneTypes.work | PhoneTypes.voice))
      {
       phoneLabel.SelectedIndex = 0;
      }
      else if ((tmpPhone.Types & (PhoneTypes.work | PhoneTypes.fax)) == (PhoneTypes.work | PhoneTypes.fax))
      {
       phoneLabel.SelectedIndex = 1;
      }
      else if ((tmpPhone.Types & (PhoneTypes.home | PhoneTypes.voice)) == (PhoneTypes.home | PhoneTypes.voice))
      {
       phoneLabel.SelectedIndex = 2;
      }
      else if ((tmpPhone.Types & PhoneTypes.cell) == PhoneTypes.cell)
      {
       phoneLabel.SelectedIndex = 3;
      }
      else if ((tmpPhone.Types & PhoneTypes.pager) == PhoneTypes.pager)
      {
       phoneLabel.SelectedIndex = 4;
      }
     }
        }
        catch (SimiasException e)
        {
     e.LogError();
     MessageBox.Show("An error occurred while reading telephone numbers.  Please see the log file for additional information.", "Telephone Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        catch (Exception e)
        {
     logger.Debug(e, "Reading telephone numbers");
     MessageBox.Show("An error occurred while reading telephone numbers.  Please see the log file for additional information.", "Telephone Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        try
        {
     int n = 1;
     foreach (IM im in contact.GetInstantMessageAccounts())
     {
      DomainUpDown imLocation;
      if (im.Preferred)
      {
       iM1 = im;
       im1.DataBindings.Add("Text", iM1, "Address");
       imLocation = im1Location;
       imLabel1.DataBindings.Add("Text", iM1, "Provider");
      }
      else
      {
       switch (n)
       {
        case 1:
     iM2 = im;
     im2.DataBindings.Add("Text", iM2, "Address");
     imLocation = im2Location;
     imLabel2.DataBindings.Add("Text", iM2, "Provider");
     break;
        default:
     iM3 = im;
     im3.DataBindings.Add("Text", iM3, "Address");
     imLocation = im3Location;
     imLabel3.DataBindings.Add("Text", iM3, "Provider");
     break;
       }
       n++;
      }
      if ((im.Types & IMTypes.work) == IMTypes.work)
      {
       imLocation.SelectedIndex = 0;
      }
      else if ((im.Types & IMTypes.home) == IMTypes.home)
      {
       imLocation.SelectedIndex = 1;
      }
      else if ((im.Types & IMTypes.other) == IMTypes.other)
      {
       imLocation.SelectedIndex = 2;
      }
     }
        }
        catch (SimiasException e)
        {
     e.LogError();
     MessageBox.Show("An error occurred while reading IM addresses.  Please see the log file for additional information.", "IM Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        catch (Exception e)
        {
     logger.Debug(e, "Reading IM addresses");
     MessageBox.Show("An error occurred while reading IM addresses.  Please see the log file for additional information.", "IM Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        try
        {
     foreach(Address addr in contact.GetAddresses())
     {
      if((addr.Types & AddressTypes.work) == AddressTypes.work)
      {
       if (workAddress == null)
       {
        workAddress = addr;
        workStreet.DataBindings.Add("Text", workAddress, "Street");
        workAddress2.DataBindings.Add("Text", workAddress, "ExtendedAddress");
        workCity.DataBindings.Add("Text", workAddress, "Locality");
        workState.DataBindings.Add("Text", workAddress, "Region");
        workZip.DataBindings.Add("Text", workAddress, "PostalCode");
        workCountry.DataBindings.Add("Text", workAddress, "Country");
       }
      }
      else if((addr.Types & AddressTypes.home) == AddressTypes.home)
      {
       if (homeAddress == null)
       {
        homeAddress = addr;
        homeStreet.DataBindings.Add("Text", homeAddress, "Street");
        homeAddress2.DataBindings.Add("Text", homeAddress, "ExtendedAddress");
        homeCity.DataBindings.Add("Text", homeAddress, "Locality");
        homeState.DataBindings.Add("Text", homeAddress, "Region");
        homeZip.DataBindings.Add("Text", homeAddress, "PostalCode");
        homeCountry.DataBindings.Add("Text", homeAddress, "Country");
       }
      }
      else
      {
       if (otherAddress == null)
       {
        otherAddress = addr;
        otherStreet.DataBindings.Add("Text", otherAddress, "Street");
        otherAddress2.DataBindings.Add("Text", otherAddress, "ExtendedAddress");
        otherCity.DataBindings.Add("Text", otherAddress, "Locality");
        otherState.DataBindings.Add("Text", otherAddress, "Region");
        otherZip.DataBindings.Add("Text", otherAddress, "PostalCode");
        otherCountry.DataBindings.Add("Text", otherAddress, "Country");
       }
      }
     }
        }
        catch (SimiasException e)
        {
     e.LogError();
     MessageBox.Show("An error occurred while reading addresses.  Please see the log file for additional information.", "Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        catch (Exception e)
        {
     logger.Debug(e, "Reading addresses");
     MessageBox.Show("An error occurred while reading addresses.  Please see the log file for additional information.", "Address Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
        return;
 }
Пример #47
0
 private void SetTelephoneType(ref Telephone telephone, ref DomainUpDown type)
 {
     PhoneTypes phoneTypes = telephone.Types & PhoneTypes.preferred;
        switch (type.SelectedIndex)
        {
     case 0:
      telephone.Types = phoneTypes | PhoneTypes.work | PhoneTypes.voice;
      break;
     case 1:
      telephone.Types = phoneTypes | PhoneTypes.work | PhoneTypes.fax;
      break;
     case 2:
      telephone.Types = phoneTypes | PhoneTypes.home | PhoneTypes.voice;
      break;
     case 3:
      telephone.Types = phoneTypes | PhoneTypes.cell;
      break;
     default:
      telephone.Types = phoneTypes | PhoneTypes.pager;
      break;
        }
 }
Пример #48
0
 protected void UnloadData(Telephone tel)
 {
     tel.Number = txtNumber.Text;
     tel.Type = ddlType.SelectedValue;
     if (hc != null)
         tel.HealthcareCompany = hc;
     if (cl != null)
         tel.Clinic = cl;
     if (pat != null)
         tel.Person = pat;
     if (cus != null)
         tel.Person = cus;
     if (prof != null)
         tel.Person = prof;
 }
Пример #49
0
 public virtual int Update(Telephone dataSet) {
     return this.Adapter.Update(dataSet, "TelephoneRegister");
 }
Пример #50
0
    protected void LoadTypeCombo(Telephone tel)
    {
        ddlType.Items.Clear(); // clear all previous options
        ddlType.Items.Add(new ListItem(Resources.ConstantsResource.Primary, "Primary"));
        ddlType.Items.Add(new ListItem(Resources.ConstantsResource.Secondary, "Secondary"));

        if (tel != null)
        {
            ddlType.SelectedValue = tel.Type;
        }
    }
Пример #51
0
 public virtual int Fill(Telephone.TelephoneRegisterDataTable dataTable) {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
Пример #52
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     Telephone ds = new Telephone();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "TelephoneRegisterDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
Пример #53
0
 private void AddProperties(Contact cContact)
 {
     if (this.propertyList != null)
        {
     foreach(string propertyString in this.propertyList)
     {
      Regex p = new Regex(@";");
      IEnumerator propertyTokens = p.Split(propertyString).GetEnumerator();
      while(propertyTokens.MoveNext())
      {
       Regex o = new Regex(@"=");
       IEnumerator propValueTokens = o.Split((string) propertyTokens.Current).GetEnumerator();
       while(propValueTokens.MoveNext())
       {
        string token = (string) propValueTokens.Current;
        token.ToLower();
        if (token.StartsWith("org"))
        {
     if (propValueTokens.MoveNext())
     {
      cContact.Organization = (string) propValueTokens.Current;
     }
        }
        else
        if (token == "blog")
        {
     if (propValueTokens.MoveNext())
     {
      if (verbose == true)
      {
       Console.WriteLine("Updating the blog attribute to: " + (string) propValueTokens.Current);
      }
      cContact.Blog = (string) propValueTokens.Current;
     }
        }
        else
        if (token == "url")
        {
     if (propValueTokens.MoveNext())
     {
      cContact.Url = (string) propValueTokens.Current;
     }
        }
        else
        if (token == "title")
        {
     if (propValueTokens.MoveNext())
     {
      cContact.Title = (string) propValueTokens.Current;
     }
        }
        else
        if (token == "role")
        {
     if (propValueTokens.MoveNext())
     {
      cContact.Role = (string) propValueTokens.Current;
     }
        }
        else
        if (token == "workforceid")
        {
     if (propValueTokens.MoveNext())
     {
      cContact.WorkForceID = (string) propValueTokens.Current;
     }
        }
        else
        if (token == "birthday" || token == "bday")
        {
     if (propValueTokens.MoveNext())
     {
      cContact.Birthday = (string) propValueTokens.Current;
     }
        }
        else
        if (token == "email")
        {
     if (propValueTokens.MoveNext())
     {
      Regex x = new Regex(@":");
      IEnumerator enumTokens1 =
       x.Split((string) propValueTokens.Current).GetEnumerator();
      if (enumTokens1.MoveNext())
      {
       EmailTypes eTypes = 0;
       Email cMail = new Email();
       cMail.Address = (string) enumTokens1.Current;
       if (verbose == true)
       {
        Console.WriteLine("Adding email address: " + cMail.Address);
       }
       while(enumTokens1.MoveNext())
       {
        string typeToken = (string) enumTokens1.Current;
        typeToken.ToLower();
        if (typeToken == "preferred")
        {
     if (verbose == true)
     {
      Console.WriteLine("   Preferred");
     }
     cMail.Preferred = true;
        }
        else
        if (typeToken == "work")
        {
     if (verbose == true)
     {
      Console.WriteLine("   Work");
     }
     eTypes |= EmailTypes.work;
        }
        else
        if (typeToken == "personal")
        {
     if (verbose == true)
     {
      Console.WriteLine("   Personal");
     }
     eTypes |= EmailTypes.personal;
        }
        else
        if (typeToken == "other")
        {
     eTypes |= EmailTypes.other;
        }
       }
       if (eTypes != 0)
       {
        cMail.Types = eTypes;
       }
       cContact.AddEmailAddress(cMail);
      }
     }
        }
        else
        if (token == "tel")
        {
     if (propValueTokens.MoveNext())
     {
      Regex x = new Regex(@":");
      IEnumerator enumTokens1 =
       x.Split((string) propValueTokens.Current).GetEnumerator();
      if (enumTokens1.MoveNext())
      {
       PhoneTypes pTypes = 0;
       Telephone cPhone = new Telephone();
       cPhone.Number = (string) enumTokens1.Current;
       if (verbose == true)
       {
        Console.WriteLine("Adding telephone number: " + cPhone.Number);
       }
       while(enumTokens1.MoveNext())
       {
        string typeToken = (string) enumTokens1.Current;
        typeToken.ToLower();
        if (typeToken.StartsWith("pref"))
        {
     if (verbose == true)
     {
      Console.WriteLine("Preferred");
     }
     cPhone.Preferred = true;
        }
        else
        if (typeToken == "work")
        {
     if (verbose == true)
     {
      Console.WriteLine("Work");
     }
     pTypes |= PhoneTypes.work;
        }
        else
        if (typeToken == "home")
        {
     if (verbose == true)
     {
      Console.WriteLine("Home");
     }
     pTypes |= PhoneTypes.home;
        }
        else
        if (typeToken == "other")
        {
     pTypes |= PhoneTypes.other;
        }
        else
        if (typeToken == "msg")
        {
     pTypes |= PhoneTypes.msg;
        }
        else
        if (typeToken == "bbs")
        {
     pTypes |= PhoneTypes.bbs;
        }
        else
        if (typeToken == "car")
        {
     pTypes |= PhoneTypes.car;
        }
        else
        if (typeToken == "cell")
        {
     pTypes |= PhoneTypes.cell;
        }
        else
        if (typeToken == "fax")
        {
     pTypes |= PhoneTypes.fax;
        }
        else
        if (typeToken == "isdn")
        {
     pTypes |= PhoneTypes.isdn;
        }
        else
        if (typeToken == "modem")
        {
     pTypes |= PhoneTypes.modem;
        }
        else
        if (typeToken == "pager")
        {
     pTypes |= PhoneTypes.pager;
        }
        else
        if (typeToken == "pcs")
        {
     pTypes |= PhoneTypes.pcs;
        }
        else
        if (typeToken == "video")
        {
     pTypes |= PhoneTypes.video;
        }
        else
        if (typeToken == "voip")
        {
     pTypes |= PhoneTypes.voip;
        }
       }
       if (pTypes != 0)
       {
        cPhone.Types = pTypes;
       }
       cContact.AddTelephoneNumber(cPhone);
      }
     }
        }
        else
        if (token == "managerid")
        {
     if (propValueTokens.MoveNext())
     {
      cContact.ManagerID = (string) propValueTokens.Current;
     }
        }
        else
        if (token == "note")
        {
     if (propValueTokens.MoveNext())
     {
      cContact.Note = (string) propValueTokens.Current;
     }
        }
        else
        if (token == "nickname")
        {
     if (propValueTokens.MoveNext())
     {
      cContact.Nickname = (string) propValueTokens.Current;
     }
        }
       }
      }
     }
     cContact.Commit();
        }
 }