Example #1
0
        protected virtual DataSet GenerateDataSet()
        {
            var dataset = new TrackingListDataSet();

            AddAdditionalDataToDataSet(dataset);
            AddTrackingDataToDataSet(dataset);
            return(dataset);
        }
Example #2
0
        /// <summary>
        /// Добавление дополнительной информации
        /// </summary>
        /// <param name="trackingListDataSet"></param>
        private void AddAdditionalDataToDataSet(TrackingListDataSet trackingListDataSet)
        {
            var reportFooterPrepared = new GlobalTermsProvider()["ReportFooterPrepared"].ToString();
            var reportFooterLink     = new GlobalTermsProvider()["ProductWebsite"].ToString();

            _dateAsOf = DateTime.Today.ToString("dd MM yyyy");

            trackingListDataSet.AdditionalDataTAble.AddAdditionalDataTAbleRow(_reportTitle, _operatorLogotype, _filterSelection, _dateAsOf, _footer, reportFooterPrepared, reportFooterLink, _formName, _released?.ToString(), _received?.ToString());
        }
Example #3
0
        private void AddTrackingDataToDataSet(TrackingListDataSet trackingListDataSet)
        {
            foreach (var transferRecord in _transferRecords)
            {
                var    date = transferRecord.TransferDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
                var    goodClass = transferRecord.GoodsClass;
                var    reason = transferRecord.Reason;
                var    description = transferRecord.Description;
                var    remark = transferRecord.Remarks;
                var    fromTo = "";
                string descriptionOn = "", descriptionOff = "";
                var    quantity = $"{transferRecord.ParentComponent.QuantityIn:0.##}" +
                                  (transferRecord.ParentComponent.Measure != null ? " " + transferRecord.ParentComponent.Measure + "(s)" : "");
                var component = transferRecord.ParentComponent;

                if (transferRecord.FromAircraft != null)
                {
                    fromTo = "Aircraft: " + transferRecord.FromAircraft;
                }
                if (transferRecord.FromStore != null)
                {
                    fromTo        = "Store: " + transferRecord.FromStore;
                    descriptionOn = component.Description + " " +
                                    transferRecord.Position
                                    + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber;
                }
                if (transferRecord.FromSpecialist != null)
                {
                    fromTo         = "Employee: " + transferRecord.FromSpecialist;
                    descriptionOff = component.Description + " " +
                                     transferRecord.Position
                                     + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber;
                }
                if (transferRecord.FromSupplier != null)
                {
                    fromTo         = $"Supplier: {transferRecord.FromSupplier} / {transferRecord.FromSupplier.SupplierClass}";
                    descriptionOff = component.Description + " " +
                                     transferRecord.Position
                                     + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber;
                }
                if (transferRecord.FromBaseComponent != null)
                {
                    if (fromTo != "")
                    {
                        fromTo += " ";
                    }
                    fromTo        += "Base Component:" + transferRecord.FromBaseComponent;
                    descriptionOff = component.Description + " " +
                                     transferRecord.Position
                                     + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber;
                }
                if (transferRecord.FromAircraft == null && transferRecord.FromBaseComponent == null && transferRecord.FromStore == null)
                {
                    if (_currentStore != null)
                    {
                        descriptionOff = component.Description + " " +
                                         transferRecord.Position
                                         + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber;
                    }
                    else
                    {
                        descriptionOn = component.Description + " " +
                                        transferRecord.Position
                                        + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber;
                    }
                }


                if (transferRecord.DestinationObject != null)
                {
                    if (fromTo != "")
                    {
                        fromTo += " ";
                    }
                    fromTo += "=> " + GetDestinationObjectString(transferRecord);
                }


                var onOff = "";

                if (!string.IsNullOrEmpty(descriptionOn))
                {
                    onOff += $"On: {descriptionOn} ";
                }
                if (!string.IsNullOrEmpty(descriptionOff))
                {
                    onOff += $"On: {descriptionOff} ";
                }

                trackingListDataSet.TrackingDataTable.AddTrackingDataTableRow(date, fromTo, goodClass.ToString(), quantity, reason.ToString(), onOff, description, remark);
            }
        }