private void Phone1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         Phone2.Focus();
     }
 }
Example #2
0
 private void Phone1_TextChanged(object sender, EventArgs e)
 {
     if (Phone1.TextLength == 3)
     {
         Phone2.Focus();
     }
 }
        public async Task MappingDifferentKeyspaceSingleExplicitAsync_AsParameter()
        {
            const string cqlType1  = "CREATE TYPE phone2 (alias2 text, number2 text, country_code2 int, verified_at timestamp, phone_type text)";
            const string cqlTable1 = "CREATE TABLE users2 (id int PRIMARY KEY, main_phone frozen<phone2>)";

            var cluster     = GetNewTemporaryCluster();
            var newKeyspace = TestUtils.GetUniqueKeyspaceName().ToLowerInvariant();
            var session     = cluster.Connect();

            session.CreateKeyspaceIfNotExists(newKeyspace);
            session.ChangeKeyspace(newKeyspace);

            session.Execute(cqlType1);
            session.Execute(cqlTable1);

            await session.UserDefinedTypes.DefineAsync(
                UdtMap.For <Phone>("phone", KeyspaceName)
                .Map(v => v.Alias, "alias")
                .Map(v => v.CountryCode, "country_code")
                .Map(v => v.Number, "number"),
                UdtMap.For <Phone2>("phone2")
                .Map(v => v.Alias, "alias2")
                .Map(v => v.CountryCode, "country_code2")
                .Map(v => v.Number, "number2")
                ).ConfigureAwait(false);

            var phone = new Phone
            {
                Alias       = "home phone",
                Number      = "85 988888888",
                CountryCode = 55
            };
            var phone2 = new Phone2
            {
                Alias       = "home phone2",
                Number      = "85 988888811",
                CountryCode = 66
            };

            session.Execute(new SimpleStatement($"INSERT INTO {KeyspaceName}.users (id, main_phone) values (1, ?)", phone));
            var rs    = session.Execute($"SELECT * FROM {KeyspaceName}.users WHERE id = 1");
            var row   = rs.First();
            var value = row.GetValue <Phone>("main_phone");

            session.Execute(new SimpleStatement("INSERT INTO users2 (id, main_phone) values (1, ?)", phone2));
            rs  = session.Execute("SELECT * FROM users2 WHERE id = 1");
            row = rs.First();
            var value2 = row.GetValue <Phone2>("main_phone");

            Assert.AreEqual(phone, value);
            Assert.AreEqual(phone2, value2);
        }
Example #4
0
        public override bool Collect(AbstractDataCollector <TEntity> collector)
        {
            if (collector == null)
            {
                return(false);
            }

            ActiveCollector = collector;

            ID = ((ISupplierViewer)ActiveCollector.ActiveViewer).ID;

            if (ActiveDBItem == null)
            {
                return(false);
            }

            if (FirstName != null)
            {
                ((Person_cu)ActiveDBItem).FirstName_P = FirstName.ToString();
            }

            if (SecondName != null)
            {
                ((Person_cu)ActiveDBItem).SecondName_P = SecondName.ToString();
            }

            if (ThirdName != null)
            {
                ((Person_cu)ActiveDBItem).ThirdName_P = ThirdName.ToString();
            }

            if (FourthName != null)
            {
                ((Person_cu)ActiveDBItem).FourthName_P = FourthName.ToString();
            }

            if (MaritalStatus != null)
            {
                ((Person_cu)ActiveDBItem).MaritalStatus_P_ID = Convert.ToInt32(MaritalStatus);
            }

            if (Gender != null)
            {
                ((Person_cu)ActiveDBItem).Gender = Convert.ToBoolean(Gender);
            }

            if (BirthDate != null)
            {
                ((Person_cu)ActiveDBItem).BirthDate = Convert.ToDateTime(BirthDate);
            }

            if (Mobile1 != null)
            {
                ((Person_cu)ActiveDBItem).Mobile1 = Mobile1.ToString();
            }

            if (Mobile2 != null)
            {
                ((Person_cu)ActiveDBItem).Mobile2 = Mobile2.ToString();
            }

            if (Phone1 != null)
            {
                ((Person_cu)ActiveDBItem).Phone1 = Phone1.ToString();
            }

            if (Phone2 != null)
            {
                ((Person_cu)ActiveDBItem).Phone2 = Phone2.ToString();
            }

            if (Address != null)
            {
                ((Person_cu)ActiveDBItem).Address = Address.ToString();
            }

            if (Email != null)
            {
                ((Person_cu)ActiveDBItem).EMail = Email.ToString();
            }

            if (IdentificationCardType != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardType_P_ID = Convert.ToInt32(IdentificationCardType);
            }

            if (IdentificationCardNumber != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardNumber = IdentificationCardNumber.ToString();
            }

            if (IdentificationCardIssueDate != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardIssuingDate = Convert.ToDateTime(IdentificationCardIssueDate);
            }

            if (IdentificationCardExpirationDate != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardExpirationDate = Convert.ToDateTime(IdentificationCardExpirationDate);
            }

            if (((Person_cu)ActiveDBItem).Supplier_cu == null)
            {
                ((Person_cu)ActiveDBItem).Supplier_cu = new Supplier_cu();
            }

            if (InternalCode != null)
            {
                ((Person_cu)ActiveDBItem).Supplier_cu.InternalCode = InternalCode.ToString();
            }

            if (((Person_cu)ActiveDBItem).Supplier_cu != null)
            {
                ((Person_cu)ActiveDBItem).Supplier_cu.IsOnDuty = true;
            }

            ((Person_cu)ActiveDBItem).IsOnDuty = true;
            switch (((ISupplierViewer)ActiveCollector.ActiveViewer).CommonTransactionType)
            {
            case DB_CommonTransactionType.DeleteExisting:
                ((Person_cu)ActiveDBItem).IsOnDuty = false;
                if (((Person_cu)ActiveDBItem).Supplier_cu != null)
                {
                    ((Person_cu)ActiveDBItem).Supplier_cu.IsOnDuty = false;
                }
                break;
            }

            RelatedViewers = ((ISupplierViewer)ActiveCollector.ActiveViewer).RelatedViewers;

            return(true);
        }
Example #5
0
        public override bool Collect(AbstractDataCollector <TEntity> collector)
        {
            if (collector == null)
            {
                return(false);
            }

            ActiveCollector = collector;

            ID = ((IDoctorViewer)ActiveCollector.ActiveViewer).ID;

            if (ActiveDBItem == null)
            {
                return(false);
            }

            if (((Person_cu)ActiveDBItem).Doctor_cu == null)
            {
                ((Person_cu)ActiveDBItem).Doctor_cu = new Doctor_cu();
            }

            if (((Person_cu)ActiveDBItem).User_cu == null)
            {
                ((Person_cu)ActiveDBItem).User_cu = new User_cu();
            }

            #region General Person Details

            if (FirstName_P != null)
            {
                ((Person_cu)ActiveDBItem).FirstName_P = FirstName_P.ToString();
            }

            if (SecondName_P != null)
            {
                ((Person_cu)ActiveDBItem).SecondName_P = SecondName_P.ToString();
            }

            if (ThirdName_P != null)
            {
                ((Person_cu)ActiveDBItem).ThirdName_P = ThirdName_P.ToString();
            }

            if (FourthName_P != null)
            {
                ((Person_cu)ActiveDBItem).FourthName_P = FourthName_P.ToString();
            }

            if (Gender != null)
            {
                ((Person_cu)ActiveDBItem).Gender = Convert.ToBoolean(Gender);
            }

            if (MaritalStatusID != null)
            {
                ((Person_cu)ActiveDBItem).MaritalStatus_P_ID = Convert.ToInt32(MaritalStatusID);
            }

            if (BirthDate != null)
            {
                ((Person_cu)ActiveDBItem).BirthDate = Convert.ToDateTime(BirthDate);
            }

            if (Phone1 != null)
            {
                ((Person_cu)ActiveDBItem).Phone1 = Phone1.ToString();
            }

            if (Phone2 != null)
            {
                ((Person_cu)ActiveDBItem).Phone2 = Phone2.ToString();
            }

            if (Address != null)
            {
                ((Person_cu)ActiveDBItem).Address = Address.ToString();
            }

            if (EMail != null)
            {
                ((Person_cu)ActiveDBItem).EMail = EMail.ToString();
            }

            if (IdentificationCardTypeID != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardType_P_ID = Convert.ToInt32(IdentificationCardTypeID);
            }

            if (IdentificationCardNumber != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardNumber = IdentificationCardNumber.ToString();
            }

            if (IdentificationCardIssuingDate != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardIssuingDate = Convert.ToDateTime(IdentificationCardIssuingDate);
            }

            if (IdentificationCardExpirationDate != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardExpirationDate = Convert.ToDateTime(IdentificationCardExpirationDate);
            }

            if (Mobile1 != null)
            {
                ((Person_cu)ActiveDBItem).Mobile1 = Mobile1.ToString();
            }

            if (Mobile2 != null)
            {
                ((Person_cu)ActiveDBItem).Mobile2 = Mobile2.ToString();
            }

            ((Person_cu)ActiveDBItem).IsOnDuty = true;

            #endregion

            #region User Details

            if (InternalCode != null)
            {
                ((Person_cu)ActiveDBItem).User_cu.InternalCode = InternalCode.ToString();
            }

            if (LoginName != null)
            {
                ((Person_cu)ActiveDBItem).User_cu.LoginName = LoginName.ToString();
            }

            if (Password != null)
            {
                ((Person_cu)ActiveDBItem).User_cu.Password = Password.ToString();
            }

            ((Person_cu)ActiveDBItem).User_cu.OragnizationID = (int)ApplicationStaticConfiguration.Organization;

            ((Person_cu)ActiveDBItem).User_cu.IsOnDuty = true;

            #endregion

            #region Doctor Details

            if (InternalCode != null)
            {
                ((Person_cu)ActiveDBItem).Doctor_cu.InternalCode = InternalCode.ToString();
            }

            if (DoctorRankID != null)
            {
                ((Person_cu)ActiveDBItem).Doctor_cu.DoctorRank_P_ID = Convert.ToInt32(DoctorRankID);
            }

            if (DoctorSpecializationID != null)
            {
                ((Person_cu)ActiveDBItem).Doctor_cu.DoctorSpecialization_P_ID = Convert.ToInt32(DoctorSpecializationID);
            }

            if (DoctorCategoryID != null)
            {
                ((Person_cu)ActiveDBItem).Doctor_cu.DoctorCategory_CU_ID = Convert.ToInt32(DoctorCategoryID);
            }

            if (DoctorProfessionalFees != null)
            {
                ((Person_cu)ActiveDBItem).Doctor_cu.DoctorProfessionalFeesIssuingType_P_ID = Convert.ToInt32(DoctorProfessionalFees);
            }

            if (DoctorTaxTypeID != null)
            {
                ((Person_cu)ActiveDBItem).Doctor_cu.DoctorTaxType_CU_ID = Convert.ToInt32(DoctorTaxTypeID);
            }

            if (PrivateMobile != null)
            {
                ((Person_cu)ActiveDBItem).Doctor_cu.PrivateMobile = PrivateMobile.ToString();
            }

            if (Description != null)
            {
                ((Person_cu)ActiveDBItem).Doctor_cu.Description = Description.ToString();
            }

            ((Person_cu)ActiveDBItem).Doctor_cu.IsOnDuty = true;

            #endregion

            switch (((IDoctorViewer)ActiveCollector.ActiveViewer).CommonTransactionType)
            {
            case DB_CommonTransactionType.DeleteExisting:
                ((Person_cu)ActiveDBItem).IsOnDuty           = false;
                ((Person_cu)ActiveDBItem).User_cu.IsOnDuty   = false;
                ((Person_cu)ActiveDBItem).Doctor_cu.IsOnDuty = false;
                break;
            }

            RelatedViewers = ((IDoctorViewer)ActiveCollector.ActiveViewer).RelatedViewers;

            return(true);
        }
        public string GetAllProperties()
        {
            string fullName = (Name.Trim() == "" ? ("") : Name.Trim())
                              + (MiddleName.Trim() == "" ? ("") : " " + MiddleName.Trim())
                              + (Surname.Trim() == "" ? ("") : " " + Surname.Trim());

            string generalInfo = (fullName == "" ? ("") : fullName + "\r\n")
                                 + (Nickname == "" ? ("") : Nickname.Trim() + "\r\n")
                                 + (Title == "" ? ("") : Title.Trim() + "\r\n")
                                 + (Company == "" ? ("") : Company.Trim() + "\r\n")
                                 + (Address.Trim() == "" ? ("") : Address.Trim() + "\r\n");

            string phones = (HomePhone == "" ? ("") : "H: " + HomePhone.Trim() + "\r\n")
                            + (MobilePhone == "" ? ("") : "M: " + MobilePhone.Trim() + "\r\n")
                            + (WorkPhone == "" ? ("") : "W: " + WorkPhone.Trim() + "\r\n")
                            + (Fax == "" ? ("") : "F:" + Fax.Trim() + "\r\n");

            string emails = (Email1 == "" ? ("") : "" + Email1.Trim() + "\r\n")
                            + (Email2 == "" ? ("") : "" + Email2.Trim() + "\r\n")
                            + (Email3 == "" ? ("") : "" + Email3.Trim() + "\r\n")
                            + (Homepage == "" ? ("") : "Homepage:" + "\r\n" + Homepage.Trim() + "\r\n");

            string dateOfBirth = "";

            if (DayOfBirth != "-" && DayOfBirth != "0" || MonthOfBirth != "-" ||
                YearOfBirth != "")
            {
                dateOfBirth = "Birthday "
                              + (DayOfBirth == "-" || DayOfBirth == "0" ? ("") : DayOfBirth + ". ")
                              + (MonthOfBirth == "-" ? ("") : MonthOfBirth + " ")
                              + (YearOfBirth == "" ? ("") : YearOfBirth + " (" +
                                 (DateTime.Now.Year - Convert.ToInt32(YearOfBirth)).ToString() + ")" + "\r\n");
            }

            string dateOfAnn = "";

            if (DayOfAnn != "-" && DayOfAnn != "0" || MonthOfAnn != "-" ||
                YearOfAnn != "")
            {
                dateOfAnn = "Anniversary "
                            + (DayOfAnn == "-" ? ("") : DayOfAnn + ". ")
                            + (MonthOfAnn == "-" ? ("") : MonthOfAnn + " ")
                            + (YearOfAnn == "" ? ("") : YearOfAnn + " (" +
                               (DateTime.Now.Year - Convert.ToInt32(YearOfAnn)).ToString() + ")\r\n");
            }

            string dates = (dateOfBirth == "" ? ("") : dateOfBirth)
                           + (dateOfAnn == "" ? ("") : dateOfAnn);

            string additional = (Address2 == "" ? ("") : Address2.Trim() + "\r\n")
                                + (Phone2 == "" ? ("") : "\r\nP: " + Phone2.Trim() + "\r\n")
                                + (Notes == "" ? ("") : "\r\n" + Notes.Trim());

            string allProperties = ((generalInfo == "" ? ("") : generalInfo)
                                    + (phones == "" ? ("") : "\r\n" + phones)
                                    + (emails == "" ? ("") : "\r\n" + emails)
                                    + (dates == "" ? ("") : "\r\n" + dates)
                                    + (additional == "" ? ("") : "\r\n" + additional)).Trim();

            return(allProperties);
        }
        /// <summary>
        /// Get the GEDCOM 5.5 lines for the data in this object.
        /// Lines start at the given level
        /// </summary>
        /// <param name="sw">
        /// A <see cref="TextWriter"/>
        /// </param>
        /// <param name="level">
        /// A <see cref="int"/>
        /// </param>
        public void Output(TextWriter sw, int level)
        {
            sw.Write(Environment.NewLine);
            sw.Write(Util.IntToString(level));
            sw.Write(" ADDR");

            if (!string.IsNullOrEmpty(AddressLine))
            {
                sw.Write(" ");

                Util.SplitLineText(sw, AddressLine, level, 60, 3, true);
            }

            string levelStr     = null;
            string levelPlusOne = null;

            if (!string.IsNullOrEmpty(AddressLine1))
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(level + 1);
                }

                string line = AddressLine1.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" ADR1 ");
                if (line.Length <= 60)
                {
                    sw.Write(AddressLine1);
                }
                else
                {
                    sw.Write(line.Substring(0, 60));
                    System.Diagnostics.Debug.WriteLine("Truncating AddressLine1");
                }
            }

            if (!string.IsNullOrEmpty(AddressLine2))
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(level + 1);
                }

                string line = AddressLine2.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" ADR2 ");
                if (line.Length <= 60)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 60));
                    System.Diagnostics.Debug.WriteLine("Truncating AddressLine2");
                }
            }

            if (!string.IsNullOrEmpty(AddressLine3))
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(level + 1);
                }

                string line = AddressLine3.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" ADR3 ");
                if (line.Length <= 60)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 60));
                    System.Diagnostics.Debug.WriteLine("Truncating AddressLine3");
                }
            }

            if (!string.IsNullOrEmpty(City))
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(level + 1);
                }

                string line = City.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" CITY ");
                if (line.Length <= 60)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 60));
                    System.Diagnostics.Debug.WriteLine("Truncating City");
                }
            }

            if (!string.IsNullOrEmpty(State))
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(level + 1);
                }

                string line = State.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" STAE ");
                if (line.Length <= 60)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 60));
                    System.Diagnostics.Debug.WriteLine("Truncating State");
                }
            }

            if (!string.IsNullOrEmpty(PostCode))
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(level + 1);
                }

                string line = PostCode.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" POST ");
                if (line.Length <= 10)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 10));
                    System.Diagnostics.Debug.WriteLine("Truncating PostCode");
                }
            }

            if (!string.IsNullOrEmpty(Country))
            {
                if (levelPlusOne == null)
                {
                    levelPlusOne = Util.IntToString(level + 1);
                }

                string line = Country.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelPlusOne);
                sw.Write(" CTRY ");
                if (line.Length <= 60)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 60));
                    System.Diagnostics.Debug.WriteLine("Truncating Country");
                }
            }

            if (!string.IsNullOrEmpty(Phone1))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Phone1.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" PHON ");
                if (line.Length <= 25)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 25));
                    System.Diagnostics.Debug.WriteLine("Truncating Phone1");
                }
            }

            if (!string.IsNullOrEmpty(Phone2))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Phone2.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" PHON ");
                if (line.Length <= 25)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 25));
                    System.Diagnostics.Debug.WriteLine("Truncating Phone2");
                }
            }

            if (!string.IsNullOrEmpty(Phone3))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Phone3.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" PHON ");
                if (line.Length <= 25)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 25));
                    System.Diagnostics.Debug.WriteLine("Truncating Phone3");
                }
            }

            if (!string.IsNullOrEmpty(Fax1))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Fax1.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" FAX ");
                if (line.Length <= 60)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 60));
                    System.Diagnostics.Debug.WriteLine("Truncating Fax1");
                }
            }

            if (!string.IsNullOrEmpty(Fax2))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Fax2.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" FAX ");
                if (line.Length <= 60)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 60));
                    System.Diagnostics.Debug.WriteLine("Truncating Fax2");
                }
            }

            if (!string.IsNullOrEmpty(Fax3))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Fax3.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" FAX ");
                if (line.Length <= 60)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 60));
                    System.Diagnostics.Debug.WriteLine("Truncating Fax3");
                }
            }

            if (!string.IsNullOrEmpty(Email1))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Email1.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" EMAIL ");
                if (line.Length <= 120)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 120));
                    System.Diagnostics.Debug.WriteLine("Truncating Email1");
                }
            }

            if (!string.IsNullOrEmpty(Email2))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Email2.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" EMAIL ");
                if (line.Length <= 120)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 120));
                    System.Diagnostics.Debug.WriteLine("Truncating Email2");
                }
            }

            if (!string.IsNullOrEmpty(Email3))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Email3.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" EMAIL ");
                if (line.Length <= 120)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 120));
                    System.Diagnostics.Debug.WriteLine("Truncating Email3");
                }
            }

            if (!string.IsNullOrEmpty(Www1))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Www1.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" WWW ");
                if (line.Length <= 120)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 120));
                    System.Diagnostics.Debug.WriteLine("Truncating Www1");
                }
            }

            if (!string.IsNullOrEmpty(Www2))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Www2.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" WWW ");
                if (line.Length <= 120)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 120));
                    System.Diagnostics.Debug.WriteLine("Truncating Www2");
                }
            }

            if (!string.IsNullOrEmpty(Www3))
            {
                if (levelStr == null)
                {
                    levelStr = Util.IntToString(level);
                }

                string line = Www3.Replace("@", "@@");

                sw.Write(Environment.NewLine);
                sw.Write(levelStr);
                sw.Write(" WWW ");
                if (line.Length <= 120)
                {
                    sw.Write(line);
                }
                else
                {
                    sw.Write(line.Substring(0, 120));
                    System.Diagnostics.Debug.WriteLine("Truncating Www3");
                }
            }
        }
        public override bool Collect(AbstractDataCollector <TEntity> collector)
        {
            if (collector == null)
            {
                return(false);
            }

            ActiveCollector = collector;

            ID = ((IPatientViewer)ActiveCollector.ActiveViewer).ID;

            if (ActiveDBItem == null)
            {
                return(false);
            }

            ((Person_cu)ActiveDBItem).DBCommonTransactionType =
                ((IPatientViewer)ActiveCollector.ActiveViewer).CommonTransactionType;

            if (FirstNameP != null)
            {
                ((Person_cu)ActiveDBItem).FirstName_P = FirstNameP.ToString();
            }

            if (SecondNameP != null)
            {
                ((Person_cu)ActiveDBItem).SecondName_P = SecondNameP.ToString();
            }

            if (ThirdNameP != null)
            {
                ((Person_cu)ActiveDBItem).ThirdName_P = ThirdNameP.ToString();
            }

            if (FourthNameP != null)
            {
                ((Person_cu)ActiveDBItem).FourthName_P = FourthNameP.ToString();
            }

            if (FirstNameS != null)
            {
                ((Person_cu)ActiveDBItem).FirstName_S = FirstNameS.ToString();
            }

            if (SecondNameS != null)
            {
                ((Person_cu)ActiveDBItem).SecondName_S = SecondNameS.ToString();
            }

            if (ThirdNameS != null)
            {
                ((Person_cu)ActiveDBItem).ThirdName_S = ThirdNameS.ToString();
            }

            if (FourthNameS != null)
            {
                ((Person_cu)ActiveDBItem).FourthName_S = FourthNameS.ToString();
            }

            if (PersonGender != null)
            {
                ((Person_cu)ActiveDBItem).Gender = Convert.ToBoolean(PersonGender);
            }

            if (PersonTitle != null)
            {
                ((Person_cu)ActiveDBItem).PersonTitle_P_ID =
                    Convert.ToInt32(PersonTitle);
            }

            if (Nationality != null)
            {
                ((Person_cu)ActiveDBItem).Nationality_CU_ID = Convert.ToInt32(Nationality);
            }

            if (MaritalStatus != null)
            {
                ((Person_cu)ActiveDBItem).MaritalStatus_P_ID = Convert.ToInt32(MaritalStatus);
            }

            if (DateOfBirth != null)
            {
                ((Person_cu)ActiveDBItem).BirthDate = Convert.ToDateTime(DateOfBirth);
            }

            if (((Person_cu)ActiveDBItem).Patient_cu == null)
            {
                ((Person_cu)ActiveDBItem).Patient_cu = new Patient_cu();
            }

            if (UserID != null)
            {
                ((Person_cu)ActiveDBItem).Patient_cu.InsertedBy = Convert.ToInt32(UserID);
            }

            if (InsuranceCarrier != null && InsuranceLevel != null)
            {
                InsuranceCarrier_InsuranceLevel_cu insuaCarrierInsuranceLevelCu =
                    InsuranceCarrier_InsuranceLevel_cu.ItemsList.Find(
                        item =>
                        Convert.ToInt32(item.InsuranceCarrier_CU_ID).Equals(Convert.ToInt32(InsuranceCarrier)) &&
                        Convert.ToInt32(item.InsuranceLevel_CU_ID).Equals(Convert.ToInt32(InsuranceLevel)));
                if (insuaCarrierInsuranceLevelCu != null)
                {
                    ((Person_cu)ActiveDBItem).Patient_cu.InsuranceCarrier_InsuranceLevel_CU_ID =
                        Convert.ToInt32(insuaCarrierInsuranceLevelCu.ID);
                }

                if (RelativeName != null)
                {
                    ((Person_cu)ActiveDBItem).Patient_cu.RelativeName = RelativeName.ToString();
                }

                if (RelativeAddress != null)
                {
                    ((Person_cu)ActiveDBItem).Patient_cu.RelativeAddress = RelativeAddress.ToString();
                }

                if (RelativePhone != null)
                {
                    ((Person_cu)ActiveDBItem).Patient_cu.RelativePhone = RelativePhone.ToString();
                }

                if (RelativeType != null)
                {
                    ((Person_cu)ActiveDBItem).Patient_cu.PersonRelativeType_P_ID = Convert.ToInt32(RelativeType);
                }
            }

            if (CountryOfResidence != null)
            {
                ((Person_cu)ActiveDBItem).CountryOfResidence_CU_ID = Convert.ToInt32(CountryOfResidence);
            }

            if (City != null)
            {
                ((Person_cu)ActiveDBItem).CityOfResidence_CU_ID = Convert.ToInt32(City);
            }

            if (Region != null)
            {
                ((Person_cu)ActiveDBItem).Region_CU_ID = Convert.ToInt32(Region);
            }

            if (Address != null)
            {
                ((Person_cu)ActiveDBItem).Address = Address.ToString();
            }

            if (Phone1 != null)
            {
                ((Person_cu)ActiveDBItem).Phone1 = Phone1.ToString();
            }

            if (Phone2 != null)
            {
                ((Person_cu)ActiveDBItem).Phone2 = Phone2.ToString();
            }

            if (Mobile1 != null)
            {
                ((Person_cu)ActiveDBItem).Mobile1 = Mobile1.ToString();
            }

            if (Mobile2 != null)
            {
                ((Person_cu)ActiveDBItem).Mobile2 = Mobile2.ToString();
            }

            if (Email != null)
            {
                ((Person_cu)ActiveDBItem).Mobile2 = Email.ToString();
            }

            if (Email != null)
            {
                ((Person_cu)ActiveDBItem).Mobile2 = Email.ToString();
            }

            if (IdentificationCardType != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardType_P_ID = Convert.ToInt32(IdentificationCardType);
            }

            if (IdentificationCardNumber != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardNumber = IdentificationCardNumber.ToString();
            }

            if (IdentificationCardIssuingDate != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardIssuingDate = Convert.ToDateTime(IdentificationCardIssuingDate);
            }

            if (IdentificationCardEpirationDate != null)
            {
                ((Person_cu)ActiveDBItem).IdentificationCardExpirationDate = Convert.ToDateTime(IdentificationCardEpirationDate);
            }

            ((Person_cu)ActiveDBItem).IsOnDuty = true;
            switch (CommonTransactionType)
            {
            case DB_CommonTransactionType.DeleteExisting:
                ((Person_cu)ActiveDBItem).IsOnDuty = false;
                break;
            }

            RelatedViewers = ((IPatientViewer)ActiveCollector.ActiveViewer).RelatedViewers;

            return(true);
        }
Example #9
0
        private void Button6_Click(object sender, RoutedEventArgs e)
        {
            Phone2 phone = (Phone2)this.Resources["iPhone6s"];

            phone.Price = 666; // Меняем с Google на LG
        }
Example #10
0
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            Phone2 phone = (Phone2)this.Resources["iPhone6s"]; // получаем ресурс по ключу

            MessageBox.Show(phone.Price.ToString());
        }