Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UpdateDirInfo"/> class.
        /// </summary>
        /// <param name="fullDir">The full dir.</param>
        /// <param name="rootDir">The root dir.</param>
        public UpdateDirInfo(string fullDir, string rootDir)
        {
            DirInfo = new DirectoryInfo(fullDir);
            Parents = new List <string>();

            FullName     = fullDir;
            RelativeName = "";
            fullDir      = fullDir.Replace(rootDir, "");

            if (fullDir.Length != 0)
            {
                RelativeName = fullDir.Substring(fullDir.IndexOf('\\') + 1);
                Parents.AddRange(RelativeName.Split('\\'));
                _current = DirInfo.Name;
                if (_current != rootDir)
                {
                    if (DirInfo.Parent != null)
                    {
                        if (DirInfo.Parent.FullName != rootDir)
                        {
                            _parent = DirInfo.Parent.Name;
                        }
                    }
                }
                _current = _current.Replace("'", "\'");
                _parent  = _parent.Replace("'", "\'");
            }
            Parents.Remove(Current);
            _isEmpty = (_current.Length == 0 && _parent.Length == 0);
        }
Beispiel #2
0
 internal string getPath()
 {
     if (RelativeName.LastIndexOf("/") > 0)
     {
         return(RelativeName.Substring(0, RelativeName.LastIndexOf("/")));
     }
     else
     {
         return(RelativeName);
     }
 }
Beispiel #3
0
        private void SortAttributes()
        {
            AttributeValues.Sort((av1, av2) =>
            {
                int result;

                // sort ObjectClass attributes to the top
                // then sort by attribute Name
                // then sort by attribute Value
                var av1IsOc = av1.Item1.Equals(ModelNames.ObjectClass, StringComparison.OrdinalIgnoreCase);
                var av2IsOc = av2.Item1.Equals(ModelNames.ObjectClass, StringComparison.OrdinalIgnoreCase);

                var av1IsRdn = RelativeName.IndexOf(String.Format("{0}={1}", av1.Item1, av1.Item2), StringComparison.OrdinalIgnoreCase) >= 0;
                var av2IsRdn = RelativeName.IndexOf(String.Format("{0}={1}", av2.Item1, av2.Item2), StringComparison.OrdinalIgnoreCase) >= 0;

                if (av1IsOc && av2IsOc)
                {
                    result = 0;
                }
                else if (av1IsOc)
                {
                    result = -1;
                }
                else if (av2IsOc)
                {
                    result = 1;
                }
                else if (av1IsRdn && av2IsRdn)
                {
                    result = av1.Item1.CompareTo(av2.Item1);
                }
                else if (av1IsRdn)
                {
                    result = -1;
                }
                else if (av2IsRdn)
                {
                    result = 1;
                }
                else
                {
                    result = av1.Item1.CompareTo(av2.Item1);
                }

                if (result == 0)
                {
                    result = av1.Item2.CompareTo(av2.Item2);
                }

                return(result);
            });
        }
Beispiel #4
0
    public byte[] Encode()
    {
        byte[] file_data = Encoding.UTF8.GetBytes(FileContent);
        byte[] msg       = new byte[4 + 2 + 256 + 256 + 4 + file_data.Length];

        Buffer.BlockCopy(ProtocolMessageFactory.Converter.GetBytes((UInt32)msg.Length - 4), 0, msg, 0, 4);
        Buffer.BlockCopy(ProtocolMessageFactory.Converter.GetBytes((UInt16)MessageType.FileContent), 0, msg, 4, 2);

        Buffer.BlockCopy(RootPath.PaddedByteArray(256), 0, msg, 6, 256);
        Buffer.BlockCopy(RelativeName.PaddedByteArray(256), 0, msg, 262, 256);
        Buffer.BlockCopy(ProtocolMessageFactory.Converter.GetBytes((UInt32)file_data.Length), 0, msg, 518, 4);
        Buffer.BlockCopy(file_data, 0, msg, 522, file_data.Length);

        return(msg);
    }
Beispiel #5
0
 public override int GetHashCode()
 {
     return(string.IsNullOrEmpty(RelativeName)
         ? Data.GetHashCode()
         : RelativeName.GetHashCode());
 }
        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);
        }