コード例 #1
0
        /// <summary>
        /// Новый прибор.
        /// </summary>
        public Device(MyBaseCard Card, string DNID, string DTID, bool OA, bool R, bool C, bool V, bool WR, string A, string Com, string PL, bool W, string S, string WO)
        {
            this.Card    = Card;
            DeviceItemID = DNID;

            if (OA == false)
            {
                DevicePassportID  = DNID == "" ? "" : ApplicationCard.UniversalCard.GetItemPropertyValue(DNID.ToGuid(), "Паспорт прибора").ToString();
                DeviceNumber      = DNID == "" ? "" : ApplicationCard.UniversalCard.GetItemName(DNID.ToGuid());
                ShortDeviceNumber = DNID == "" ? "" : ApplicationCard.UniversalCard.GetItemPropertyValue(DNID.ToGuid(), "Номер прибора").ToString();
                string Year = DNID == "" ? "" : ApplicationCard.UniversalCard.GetItemPropertyValue(DNID.ToGuid(), "Год прибора").ToString();
                ShortDeviceNumber = ShortDeviceNumber.Length == 4 ? ShortDeviceNumber : ShortDeviceNumber + "/" + Year;
                RowData SpecConditions = Card.CardScript.Session.CardManager.GetCardData(new Guid(DevicePassportID)).Sections[CardOrd.Properties.ID].FindRow("@Name = 'Особые условия по СО и ГО'");
                SpecialConditions = SpecConditions.GetString("Value") != null?SpecConditions.GetString("Value") : "";
            }
            else
            {
                DevicePassportID = "";
                DeviceNumber     = "";
            }

            DeviceTypeID    = DTID == "" ? "" : DTID;
            DeviceType      = DTID == "" ? "" : ApplicationCard.UniversalCard.GetItemName(DTID.ToGuid());
            OnlyAccessories = OA;
            Repair          = R;
            Calibrate       = C;
            Verify          = V;
            WarrantyRepair  = WR;
            Wash            = W;
            Accessories     = A == "" ? "" : A;
            Comments        = Com == "" ? "" : Com;
            Services        = FormattingService(this.Repair, this.Calibrate, this.Verify);
            PackedListData  = PL == "" ? "" : PL;
            PackedListID    = "";
            Sensors         = S == "" ? "" : S;
            ServiceCardID   = WO;
            DeviceName      = this.DeviceNumber == "" ? "Комплектующие для " + this.DeviceType : this.DeviceType + " №" + this.ShortDeviceNumber;

            if (Sensors != "")
            {
                List <String> SelectedSensors = Sensors.Split(';').Where(s => !String.IsNullOrEmpty(s.Trim())).ToList();
                for (Int32 j = 0; j < SelectedSensors.Count; j++)
                {
                    String[] Sensor = SelectedSensors[j].Trim().Split(' ');
                    if (Sensor.Length >= 2)
                    {
                        RowData        CurrentDeviceRow      = GetDeviceRow(Sensor[1], Sensor[0]);
                        string         CurrentPassportId     = CurrentDeviceRow.ChildSections[0].FindRow("@Name = 'Паспорт прибора'").GetString("Value");
                        string         CurrentDeviceTypeID   = CurrentDeviceRow.ChildSections[0].FindRow("@Name = 'Наименование прибора'").GetString("Value");
                        string         CurrentDeviceTypeName = ApplicationCard.UniversalCard.GetItemName(CurrentDeviceTypeID);
                        AdditionalWare NewWare = new AdditionalWare(Card.CardScript, SelectedSensors[j], CurrentPassportId, CurrentDeviceRow.Id.ToString(), CurrentDeviceTypeID, CurrentDeviceTypeName);
                        AdditionalWaresList.Add(NewWare);
                    }
                }
            }

            if (ServiceCardID != "")
            {
                CardData ServiceCard = Card.CardScript.Session.CardManager.GetCardData(new Guid(ServiceCardID));
                RowData  Adjustment  = ServiceCard.Sections[RefServiceCard.Adjustment.ID].FirstRow;
                RowData  MainInfo    = ServiceCard.Sections[RefServiceCard.MainInfo.ID].FirstRow;
                this.VoidWarranty        = Adjustment.GetBoolean(RefServiceCard.Adjustment.VoidWarranty) == null ? false : (bool)Adjustment.GetBoolean(RefServiceCard.Adjustment.VoidWarranty);
                this.DoubleCost          = Adjustment.GetBoolean(RefServiceCard.Adjustment.DoubleCost) == null ? false : (bool)Adjustment.GetBoolean(RefServiceCard.Adjustment.DoubleCost);
                this.DescriptionOfReason = Adjustment.GetString(RefServiceCard.Adjustment.DescriptionOfReason) == null ? "" : Adjustment.GetString(RefServiceCard.Adjustment.DescriptionOfReason).ToString();
                this.RefusalToRepair     = (int)MainInfo.GetInt32(RefServiceCard.MainInfo.Status) == (int)RefServiceCard.MainInfo.State.Failure ? true : false;
            }
        }