Пример #1
0
 internal static Staff CreateStaff(StaffTypeEnum staffType)
 {
     return(new Staff(
                "01",
                new PersonName("Simpson", "Bart", null, null, null, null),
                Sex.M,
                null,            // title
                null,            // license
                null,            // billing
                staffType,
                null,
                new List <EmailAddress>(),
                new List <Address>(),
                new List <TelephoneNumber>(),
                new Dictionary <string, string>(),
                new HashedSet <StaffGroup>()));
 }
Пример #2
0
		internal static Staff CreateStaff(StaffTypeEnum staffType)
		{
			return new Staff(
				"01",
				new PersonName("Simpson", "Bart", null, null, null, null),
				Sex.M,
				null,   // title
				null,   // license
				null,   // billing
				staffType,
				null,
				new List<EmailAddress>(),
				new List<Address>(),
				new List<TelephoneNumber>(),
				new Dictionary<string, string>(),
				new HashedSet<StaffGroup>());
		}
Пример #3
0
        /// <summary>
        /// Import staff from CSV format.
        /// </summary>
        /// <param name="rows">
        /// Each string in the list must contain 25 CSV fields, as follows:
        ///     0 - UserName
        ///     1 - StaffType
        ///     2 - Id
        ///     3 - FamilyName
        ///     4 - GivenName
        ///     5 - MiddleName
        ///     6 - Prefix
        ///     7 - Suffix
        ///     8 - Degree
        /// </param>
        /// <param name="context"></param>
        public override void Import(List <string> rows, IUpdateContext context)
        {
            _context = context;

            List <Staff> importedStaff = new List <Staff>();

            foreach (string row in rows)
            {
                string[] fields = ParseCsv(row, _numFields);

                string userName = fields[0];

                StaffTypeEnum staffType = context.GetBroker <IEnumBroker>().Find <StaffTypeEnum>(fields[1]);

                string staffId         = fields[2];
                string staffFamilyName = fields[3];
                string staffGivenName  = fields[4];
                string staffMiddlename = fields[5];
                string staffPrefix     = fields[6];
                string staffSuffix     = fields[7];
                string staffDegree     = fields[8];

                Staff staff = GetStaff(staffId, importedStaff);

                if (staff == null)
                {
                    staff = new Staff();

                    staff.Id       = staffId;
                    staff.Type     = staffType;
                    staff.Name     = new PersonName(staffFamilyName, staffGivenName, staffMiddlename, staffPrefix, staffSuffix, staffDegree);
                    staff.UserName = userName;

                    _context.Lock(staff, DirtyState.New);

                    importedStaff.Add(staff);
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 根据XML 反序列化
        /// </summary>
        /// <param name="xmlNode"></param>
        /// <returns></returns>
        private BIFStruct UnSerializePoint(XmlNode xmlNode)
        {
            BIFStruct bif = new BIFStruct();

            int arrayNo = 0;

            int.TryParse(xmlNode.SelectSingleNode("ArrayNo").InnerText, out arrayNo);

            string pointNo = xmlNode.SelectSingleNode("PointNo").InnerText;

            double height = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("Height").InnerText, out height);

            double distance = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("Distance").InnerText, out distance);

            StaffTypeEnum staffType = ("Upright" == xmlNode.SelectSingleNode("StaffType").InnerText ? StaffTypeEnum.Upright
                : StaffTypeEnum.Down);

            string referNo = xmlNode.SelectSingleNode("ReferNo").InnerText;

            MeasureTypeEnum measureType = MeasureTypeEnum.I;

            switch (xmlNode.SelectSingleNode("MeasureType").InnerText)
            {
            case "B": measureType = MeasureTypeEnum.B; break;

            case "I": measureType = MeasureTypeEnum.I; break;

            case "F": measureType = MeasureTypeEnum.F; break;

            default: measureType = MeasureTypeEnum.I; break;
            }

            string isReferNo = xmlNode.SelectSingleNode("IsReferNo").InnerText;

            double elevation = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("Elevation").InnerText, out elevation);

            double designElevation = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("DesignElevation").InnerText, out designElevation);

            double cut = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("Cut").InnerText, out cut);

            double fill = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("Fill").InnerText, out fill);

            double deltaHeight = 0.0;

            double.TryParse(xmlNode.SelectSingleNode("DeltaHeight").InnerText, out deltaHeight);

            bif.ArrayNo         = arrayNo;
            bif.PointNo         = pointNo;
            bif.Height          = height;
            bif.Distance        = distance;
            bif.StaffType       = staffType;
            bif.ReferNo         = referNo;
            bif.MeasureType     = measureType;
            bif.IsReferNo       = isReferNo;
            bif.Elevation       = elevation;
            bif.DesignElevation = designElevation;
            bif.Cut             = cut;
            bif.Fill            = fill;
            bif.DeltaHeightDh   = deltaHeight;

            return(bif);
        }