コード例 #1
0
        public DataError AddDataError(DataError error)
        {
            var returnValue = context.DataErrors.Add(error);

            context.SaveChanges();
            return(returnValue);
        }
コード例 #2
0
        public static Department ToDALDepartment(this DepartmentFixed department, int retailerId, DataErrorDAL dataErrorDAL)
        {
            if (department == null)
            {
                return(null);
            }

            try
            {
                Department result = new Department
                {
                    RetailerId  = retailerId,
                    Id          = department.DepartmentId.ToInt(),
                    Description = department.Description.RemoveTrailCommaAndSanitize()
                };

                return(result);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                DataError dataError = new DataError {
                    RetailerId = retailerId, Source = InputFileType.Items, ElementId = department.DepartmentId.ToInt()
                };
                dataErrorDAL.InsertDataError(dataError);
                return(null);
            }
        }
コード例 #3
0
 public byte InsertTransaction(Transaction transaction)
 {
     try
     {
         ExecuteNonQuery("usp_Insert_Transaction", transaction);
         return(0);
     }
     catch (Exception ex)
     {
         string note = ex.Message;
         if (ex.Message.Contains("dbo.Item_"))
         {
             note = string.Format("Error inserting transaction. Transaction number: {0}. Item with SKU: {1} does not exist!", transaction.Number, transaction.SKU);
         }
         else if (ex.Message.Contains("dbo.Department_"))
         {
             note = string.Format("Error inserting transaction. Transaction number: {0}. DepartmentId: {1} does not exist!", transaction.Number, transaction.DepartmentId);
         }
         DataError dataError = new DataError {
             RetailerId = transaction.RetailerId, Source = InputFileType.Transactions, ElementId = transaction.SKU ?? -1, Note = note
         };
         DataErrDAL.InsertDataError(dataError);
         return(1);
     }
 }
コード例 #4
0
ファイル: 2568.cs プロジェクト: kubiix/StyleCop
        /// <summary>
        /// Sets current position of recDataAccess.Record based on the input parameter record bookmark
        /// </summary>
        /// <param name="dataError">Determines whether to throw in case the bookmark is not valid.</param>
        /// <param name="bookmark">Bookmark of the record. Must not be null.</param>
        internal override void SetPosition(DataError dataError, byte[] bookmark)
        {
            if (bookmark == null)
            {
                throw new ArgumentNullException("bookmark");
            }

            Debug.Assert(this.Record != null);

            NavRecordId recordId = new NavRecordId(bookmark);

            if (this.Record.ALRecordId != recordId)
            {
                if (this.Record.ALCurrentKeyIndex == NavKeyRef.ALPrimaryKeyIndex && dataError == DataError.TrapError)
                {
                    if (!this.Record.ALGet(dataError, recordId))
                    {
                        this.Record.SetPrimaryKeyFieldValues(recordId);
                    }
                }
                else
                {
                    this.Record.ALGet(dataError, recordId);
                }
            }
        }
コード例 #5
0
ファイル: DataErrorUtil.cs プロジェクト: GSA/HRIT-QMS-3.1
        public static DataErrorViewModel MapToViewModel(UserViewModel userVM, DataError svcDataError, string useCase, List <ModuleMenuItem> moduleMenuItems)
        {
            string logSnippet = new StringBuilder("[")
                                .Append(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"))
                                .Append("][DataErrorUtil][MapToViewModel] => ")
                                .ToString();

            Console.WriteLine(logSnippet + $"(svcDataError.Histories == null): {svcDataError.Histories == null}");
            Console.WriteLine(logSnippet + $"(svcDataError.Histories.Count)..: {svcDataError.Histories.Count}");

            DataErrorViewModel vmDataError = new DataErrorViewModel();

            vmDataError.UserId      = userVM.UserId;
            vmDataError.DataErrorId = svcDataError.DataErrorId;
            vmDataError.DataErrorIdForAddComment = svcDataError.DataErrorId;
            vmDataError.CreatedAt           = svcDataError.CreatedAt;
            vmDataError.IsAssignable        = (userVM.CanAssignTasks && svcDataError.IsAssignable);
            vmDataError.AssignedToUser      = svcDataError.AssignedToUser;
            vmDataError.Status              = svcDataError.Status;
            vmDataError.CorrectiveActionId  = svcDataError.CorrectiveActionId;
            vmDataError.Employee            = svcDataError.Employee;
            vmDataError.QmsErrorCode        = svcDataError.QmsErrorCode;
            vmDataError.DataElement         = svcDataError.DataElement;
            vmDataError.QmsErrorMessageText = svcDataError.QmsErrorMessageText;
            vmDataError.Comments            = svcDataError.Comments;
            vmDataError.Histories           = svcDataError.Histories;
            vmDataError.IsReadOnly          = svcDataError.IsReadOnly;
            vmDataError.UseCase             = useCase;
            vmDataError.Controller          = MenuUtil.FindControllerForUseCase(useCase, moduleMenuItems);
            vmDataError.EmployeeName        = svcDataError.Employee.SearchResultValue;
            vmDataError.Details             = svcDataError.Details;

            return(vmDataError);
        }
コード例 #6
0
        /// <summary>
        /// Поиск всех параметров по пользовательскому запросу в DataSet.РасчетныеПараметры
        /// (с одним входным параметром являющимся именем расчётной величины).
        /// </summary>
        /// <remarks></remarks>
        private void ВычислитьРасчетныеПараметры()
        {
            // Иммитатор()' отладка
            try
            {
                ВычислениеОсновных();

                // занести вычисленные значения
                // вместо последовательного извлечения применяется обход по коллекции
                // .CalculatedDataTable.FindByИмяПараметра(conCalc1).ВычисленноеЗначениеВСИ = Calc1
                // ...
                // .CalculatedDataTable.FindByИмяПараметра(conCalc10).ВычисленноеЗначениеВСИ = Calc10

                foreach (string keysCalc in calcParam.CalcDictionary.Keys.ToArray())
                {
                    mProjectManager.CalculatedDataTable.FindByИмяПараметра(keysCalc).ВычисленноеЗначениеВСИ = calcParam.CalcDictionary[keysCalc];
                }

                // расчетные вспомогательные ...
            }
            catch (Exception ex)
            {
                // перенаправление встроенной ошибки
                DataError?.Invoke(this, new DataErrorEventArgs(ex.Message, $"Процедура: {nameof(ВычислитьРасчетныеПараметры)}"));
            }
        }
コード例 #7
0
        internal void sendOrganizationalMessage(DataError ehriError, NtfNotificationevent ne, QmsWorkitemcomment comment)
        {
            List<SecUser> users = getReviewersInOrg(ehriError.AssignedToOrgId.Value);
            string[] emails = new string[users.Count];
            NtfNotification notification = new NtfNotification();
            notification.CreatedAt = DateTime.Now;
            notification.Title = string.Format(ne.TitleTemplate,ehriError.Id);
            notification.Message = formatMessage(ehriError,comment);
            notification.HasBeenRead = 0;
            notification.WorkitemId = ehriError.Id;
            notification.WorkItemTypeCode = WorkItemTypeEnum.CorrectiveActionRequest;
            notification.SendAsEmail = 0; //Changed from 1 so it doesn't send
            notification.NotificationEventId = ne.NotificationEventId;

            int i = 0;
            foreach(var user in users)
            {
                NtfNotification newNotification = notification.Clone();
                newNotification.UserId = user.UserId;
                context.Add(newNotification);
                emails[i] = user.EmailAddress;
                i++;

            }
            context.SaveChanges();            
            send(emails,notification.Title,notification.Message);
        }
コード例 #8
0
        void RemoteDataServiceDataFailed(object sender, DataError e)
        {
            DateTime lastDate;

            DateTime.TryParse(StorageService.Instance.UpdatedDate, out lastDate);

            UpdatingError?.Invoke(this, new DataFailedArgs(e, lastDate));
        }
コード例 #9
0
ファイル: 2568.cs プロジェクト: kubiix/StyleCop
        /// <summary>
        /// Abstraction around NavRecord.Insert
        /// </summary>
        /// <param name="errorLevel">Indicates how to handle errors.</param>
        /// <param name="runApplicationTrigger">Indicates whether to run OnInsert table trigger.</param>
        /// <param name="belowRec">Parameter is not used.</param>
        /// <returns>Returns true on success.</returns>
        public virtual Boolean Insert(DataError errorLevel, Boolean runApplicationTrigger, Boolean belowRec)
        {
            if (this.Record == null)
            {
                return(false);
            }

            return(this.Record.Insert(errorLevel, runApplicationTrigger, true));
        }
コード例 #10
0
        public void InsertDataError(DataError error)
        {
            ExecuteNonQuery("usp_Insert_DataError", error);

            if (OnDataError != null)
            {
                OnDataError();
            }
        }
コード例 #11
0
ファイル: 2568.cs プロジェクト: kubiix/StyleCop
        /// <summary>
        /// Abstraction around NavRecord.DELETE
        /// </summary>
        /// <param name="errorLevel">Indicates how to handle errors.</param>
        /// <param name="runApplicationTrigger">Indicates whether to run OnDelete table trigger.</param>
        /// <returns>Returns true on success.</returns>
        public virtual Boolean Delete(DataError errorLevel, Boolean runApplicationTrigger)
        {
            if (this.Record == null)
            {
                return(false);
            }

            return(this.Record.Delete(errorLevel, runApplicationTrigger, true));
        }
コード例 #12
0
        /* Public */

        public Controller(SerialPortStream port)
        {
            Buffer                    = new StringBuilder(16);
            TerminalQueue             = new BlockingCollectionQueue();
            DataQueue                 = new BlockingCollectionQueue();
            Port                      = port;
            Port.DataReceived        += Port_DataReceived;
            DataErrorEventThreadStart = (object x) => { DataError?.Invoke(this, (DataErrorEventArgs)x); };
            DeviceErrorThreadStart    = (object x) => { DeviceError?.Invoke(this, (TerminalEventArgs)x); };
        }
コード例 #13
0
ファイル: 2568.cs プロジェクト: kubiix/StyleCop
        /// <summary>
        /// Abstraction around NavRecord.RENAME
        /// </summary>
        /// <param name="errorLevel">Indicates how to handle errors.</param>
        /// <returns>Returns true on success.</returns>
        public virtual Boolean Rename(DataError errorLevel)
        {
            if (this.Record == null)
            {
                return(false);
            }

            this.Record.Rename(false, errorLevel);
            return(true);
        }
コード例 #14
0
ファイル: 2568.cs プロジェクト: kubiix/StyleCop
 /// <summary>
 /// Sets current position of recDataAccess.Record based on the record bookmark
 /// </summary>
 /// <param name="dataError">Determines whether to throw in case the bookmark is not valid.</param>
 /// <param name="bookmark">Bookmark of the record. Must not be null.</param>
 internal override void SetPosition(DataError dataError, byte[] bookmark)
 {
     if (bookmark == null)
     {
         throw new ArgumentNullException("bookmark");
     }
     if (this.Form.Bookmark.GetBytes() != bookmark)
     {
         this.Form.SetBookmark(dataError, bookmark);
     }
 }
コード例 #15
0
ファイル: 2568.cs プロジェクト: kubiix/StyleCop
        /// <summary>
        /// Abstraction around NavRecord.RENAME
        /// </summary>
        /// <param name="errorLevel">Indicates how to handle errors.</param>
        /// <returns>Returns true on success.</returns>
        public override Boolean Rename(DataError errorLevel)
        {
            // Rename runs the record OnRename trigger, and afterwards sets notification through Form.Rename
            if (base.Rename(errorLevel))
            {
                this.Form.Rename();
                return(true);
            }

            return(false);
        }
コード例 #16
0
        private void handleDataFileList(List <FileInfo> lstFiles)
        {
            if (lstFiles == null)
            {
                return;
            }

            foreach (FileInfo fi in lstFiles)
            {
                if (!Directory.Exists(workingFolder))
                {
                    Directory.CreateDirectory(workingFolder);
                }

                // check if file is in use by another process
                if (IsFileLocked(fi))
                {
                    continue;
                }

                // Copy the file to the working folder
                String workingFile = Path.Combine(workingFolder, fi.Name);
                File.Copy(fi.FullName, workingFile, true);
                File.Delete(fi.FullName);

                FileInfo fiWorking = new FileInfo(workingFile);

                DataError err = handleFile(ref fiWorking);

                switch (err)
                {
                case DataError.NO_ERROR:
                    moveToArchiveFolder(fiWorking);
                    break;

                case DataError.DB_ERROR:
                    moveToQueueFolder(fiWorking);
                    break;

                case DataError.UNVALID_FORMAT:
                    moveToSuspectFolder(fiWorking);
                    break;

                case DataError.CONNECTION_FAILED:
                    moveToQueueFolder(fiWorking);
                    break;

                default:
                    moveToSuspectFolder(fiWorking);
                    break;
                }
            }
        }
コード例 #17
0
ファイル: 2568.cs プロジェクト: kubiix/StyleCop
        /// <summary>
        /// Abstraction around NavRecord.Modify
        /// </summary>
        /// <param name="errorLevel">The error level.</param>
        /// <param name="runTrigger">Indicates whether to run triggers.</param>
        /// <returns>Returns true on success.</returns>
        public override Boolean Modify(DataError errorLevel, Boolean runTrigger)
        {
            if (this.SourceMetadata != null && this.SourceMetadata.ModifyAllowed)
            {
                if (this.Form.Modify())
                {
                    return(base.Modify(errorLevel, runTrigger));
                }
            }

            return(false);
        }
コード例 #18
0
ファイル: 2568.cs プロジェクト: kubiix/StyleCop
        /// <summary>
        /// Abstraction around NavRecord.DELETE
        /// </summary>
        /// <param name="errorLevel">The error level.</param>
        /// <param name="runTrigger">Indicates whether to run triggers.</param>
        /// <returns>Returns true on success.</returns>
        public override Boolean Delete(DataError errorLevel, Boolean runTrigger)
        {
            if (this.SourceMetadata != null && this.SourceMetadata.DeleteAllowed)
            {
                if (this.Form.Delete())
                {
                    return(base.Delete(errorLevel, runTrigger));
                }
            }

            return(false);
        }
コード例 #19
0
ファイル: 2568.cs プロジェクト: kubiix/StyleCop
        /// <summary>
        /// Abstraction around NavRecord.Insert
        /// </summary>
        /// <param name="errorLevel">Indicates how to handle errors.</param>
        /// <param name="runApplicationTrigger">Indicates whether to run OnInsert table trigger.</param>
        /// <param name="belowXRec">Flag passed through to form triggers indicating whether there is a previous row to copy from.</param>
        /// <returns>Returns true on success.</returns>
        public override Boolean Insert(DataError errorLevel, Boolean runApplicationTrigger, bool belowXRec)
        {
            if (this.SourceMetadata != null && this.SourceMetadata.InsertAllowed)
            {
                if (this.Form.Insert(belowXRec))
                {
                    return(base.Insert(errorLevel, runApplicationTrigger, belowXRec));
                }
            }

            return(false);
        }
コード例 #20
0
        public virtual bool Add(T itemToAdd)
        {
            if (!DataError.IsBlank(itemToAdd))
            {
                throw Error.BadAct("Attempted to Save() invalid Repo Item.");
            }

            if (this.Has(itemToAdd))
            {
                return(false);
            }

            _list.Add(itemToAdd);
            RaiseAdded(itemToAdd);
            return(true);
        }
コード例 #21
0
 public byte InsertDepartment(Department dept)
 {
     try
     {
         ExecuteNonQuery("usp_Insert_Department", dept);
         return(0);
     }
     catch (Exception ex)
     {
         DataError dataError = new DataError {
             RetailerId = dept.RetailerId, Source = InputFileType.Departments, ElementId = dept.Id, Note = ex.Message
         };
         DataErrDAL.InsertDataError(dataError);
         return(1);
     }
 }
コード例 #22
0
ファイル: ItemDAL.cs プロジェクト: SethC/Nstox_WebService
 public byte DeleteItem(int retailerId, Int64 sku)
 {
     try
     {
         ExecuteNonQuery("usp_Delete_Item", new { RetailerId = retailerId, SKU = sku });
         return(0);
     }
     catch (Exception ex)
     {
         DataError dataError = new DataError {
             RetailerId = retailerId, Source = InputFileType.Items, ElementId = sku, Note = ex.Message
         };
         DataErrDAL.InsertDataError(dataError);
         return(1);
     }
 }
コード例 #23
0
 public byte DeleteDepartment(int retailerId, int id)
 {
     try
     {
         ExecuteNonQuery("usp_Delete_Department", new { RetailerId = retailerId, Id = id });
         return(0);
     }
     catch (Exception ex)
     {
         DataError dataError = new DataError {
             RetailerId = retailerId, Source = InputFileType.Departments, ElementId = id, Note = ex.Message
         };
         DataErrDAL.InsertDataError(dataError);
         return(1);
     }
 }
コード例 #24
0
        public static Item ToDALItem(this ItemFixed item, int retailerId, JobAudit job, DataErrorDAL dataErrorDAL)
        {
            if (item == null)
            {
                return(null);
            }
            try
            {
                string sDepIp = item.DepartmentID.RemoveTrailComma();
                int    depId  = 0;
                if (!string.IsNullOrEmpty(sDepIp))
                {
                    depId = Convert.ToInt32(sDepIp);
                }

                Item result = new Item
                {
                    RetailerId       = retailerId,
                    SKU              = item.ItemID.ToLong(),
                    Description      = item.ReceiptDescription.RemoveTrailCommaAndSanitize(),
                    DepartmentId     = item.DepartmentID.ToNullableInt(),
                    PriceGroup       = item.PriceGroupId.ToInt(),
                    ProductGroup     = item.MixMatchIdFiveDigit.ToInt(),
                    Category7        = item.FoodStampFlag.ToBool(),
                    Category8        = item.NoneMerchandiseID.ToBool(),
                    Category9        = item.StoreCouponFlag.ToBool(),
                    Category10       = item.WICFlag.ToBool(),
                    Size             = item.Size.RemoveTrailComma(),
                    Unit             = item.Unit.RemoveTrailComma(),
                    CurrentUnitPrice = item.CenterPrice.ToDouble(),
                    QtyPrice         = item.RetailPrice.ToDouble(),
                    QtyBreak         = item.UnitQuantity.ToInt()
                };

                return(result);
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                DataError dataError = new DataError {
                    RetailerId = retailerId, Source = InputFileType.Items, ElementId = item.ItemID.ToLong(), Note = "Items file parse error! Row is wrongly formatted!"
                };
                dataErrorDAL.InsertDataError(dataError);
                job.IncrementError(1);
                return(null);
            }
        }
コード例 #25
0
ファイル: ItemDAL.cs プロジェクト: SethC/Nstox_WebService
 public byte UpdateItem(Item item, Item oldItem)
 {
     try
     {
         ExecuteNonQuery("usp_Insert_ItemAudit", new { RetailerId = item.RetailerId, SKU = item.SKU, OldValue = oldItem.ToXML(), NewValue = item.ToXML() });
         ExecuteNonQuery("usp_Update_Item", item);
         return(0);
     }
     catch (Exception ex)
     {
         DataError dataError = new DataError {
             RetailerId = item.RetailerId, Source = InputFileType.Items, ElementId = item.SKU, Note = ex.Message
         };
         DataErrDAL.InsertDataError(dataError);
         return(1);
     }
 }
コード例 #26
0
 public byte UpdateDepartment(Department dept, Department oldDept)
 {
     try
     {
         ExecuteNonQuery("usp_Insert_DepartmentAudit", new { RetailerId = dept.RetailerId, DepartmentId = dept.Id, OldValue = oldDept.ToXML(), NewValue = dept.ToXML() });
         ExecuteNonQuery("usp_Update_Department", dept);
         return(0);
     }
     catch (Exception ex)
     {
         DataError dataError = new DataError {
             RetailerId = dept.RetailerId, Source = InputFileType.Departments, ElementId = dept.Id, Note = ex.Message
         };
         DataErrDAL.InsertDataError(dataError);
         return(1);
     }
 }
コード例 #27
0
        internal string formatMessage(DataError ehriError, QmsWorkitemcomment comment)
        {
            template = "EHRI Error ID: {0}<br/>Employee: {1}-{2}<br/>Error Details: {3}<br/>{4}<br/<br/>Updated on: {5}<br/><br/>";
            string dateToUse = ehriError.UpdatedAt.HasValue ? ehriError.UpdatedAt.Value.ToShortDateString() : ehriError.CreatedAt.ToShortDateString();

            message = string.Format(template,ehriError.Id,ehriError.EmplId, ehriError.Employee.FullName,ehriError.QmsErrorCode,ehriError.QmsErrorMessageText,dateToUse);
            string commentTemplate = "Latest Comment:{0}<br/> by {1} on {2}";
            if(comment != null)
            {
                string commentText = string.Format(commentTemplate,comment.Message,comment.Author.DisplayName,comment.CreatedAt.ToShortDateString());
                message += commentText;
            }
            else
            {
                message += "No comments have been made.";
            }

            return message;
        }
コード例 #28
0
        internal void sendIndividualMessage(DataError ehriError, NtfNotificationevent ne, User submitter, QmsWorkitemcomment comment)
        {
            if(submitter.UserId != ehriError.CreatedByUserId.Value) // if the person doing the action is the originator they don't get a message since they did the action
            {

                SecUser user;
                NtfNotification notification = new NtfNotification();
                notification.CreatedAt = DateTime.Now;
                notification.HasBeenRead = 0;
                notification.Title = string.Format(ne.TitleTemplate,ehriError.Id); //HRQMS - EHRI Error Closed ({0})
                notification.WorkitemId = ehriError.Id;
                notification.WorkItemTypeCode = WorkItemTypeEnum.CorrectiveActionRequest;
                notification.SendAsEmail = 0; //Changed from 1 so it doesn't send
                notification.NotificationEventId = ne.NotificationEventId;
                notification.Message = formatMessage(ehriError,comment);
                switch(ne.NotificationEventCode)
                {
                  
                    case EhriErrorNotificationType.EHRI_Assigned:
                        notification.UserId = ehriError.AssignedToUserId.Value;
                        break;
                    case EhriErrorNotificationType.EHRI_Returned:
                        notification.UserId = ehriError.CreatedByUserId.Value;
                        break;
                    case EhriErrorNotificationType.EHRI_Closed:
                        notification.UserId = ehriError.CreatedByUserId.Value;
                        break;                    
                    default:
                        //not a indivual message type
                        break;
                }

                if(notification.UserId > 0) //0 = System user - no need to notify.
                {
                    context.Add(notification);
                    context.SaveChanges();
                    user = userRepository.RetrieveByUserId(notification.UserId);
                    send(user.EmailAddress,notification.Title,notification.Message);
                }

            }
        }
コード例 #29
0
        public void AddDataErrorMustCallDataErrorsAdd()
        {
            //Arrange
            var mockContext = new Mock <DataContext>();
            var mockSet     = new Mock <FakeDbSet <DataError> >();

            mockContext
            .Setup(context => context.DataErrors)
            .Returns(mockSet.Object);
            var entry = new DataError {
                Id = 3
            };
            var sut = new DataEntriesUnitOfWork(() => mockContext.Object);

            //Act
            sut.AddDataError(entry);

            //Assert
            mockSet.Verify(set => set.Add(It.Is <DataError>(e => e.Id == 3)));
        }
コード例 #30
0
        /// <summary>
        /// Поиск всех параметров по пользовательскому запросу в DataSet.MeasurementDataTable
        /// (с одним входным параметром являющимся именем связи для реального измеряемого канала Сервера).
        /// </summary>
        /// <remarks></remarks>
        private void ИзвлечьЗначенияИзмеренныхПараметров()
        {
            try
            {
                var _with2 = mProjectManager.MeasurementDataTable;
                //'расчетные параметры
                //Tбокса = .FindByИмяПараметра(conTбокса).ЗначениеВСИ '	температура в боксе
                //Барометр = .FindByИмяПараметра(conБарометр).ЗначениеВСИ '	БРС1-М
                //'учет атмосферного давления - относительного давления воздуха
                //B = Барометр / кон735_6
                //ДавлениеВоздухаНаВходе = .FindByИмяПараметра(conДавлениеВоздухаНаВходе).ЗначениеВСИ + B

                // вместо последовательного извлечения применяется обход по коллекции
                // inputArg.ARG1 = .FindByИмяПараметра(InputArgument.conARG1).ЗначениеВСИ
                // ...
                // inputArg.ARG10 = .FindByИмяПараметра(InputArgument.conARG10).ЗначениеВСИ
                //inputArg.Барометр = .FindByИмяПараметра("Барометр").ЗначениеВСИ
                //inputArg.InputArgDictionary("Барометр") = 100

                foreach (string keysArg in inParam.InputArgDictionary.Keys.ToArray())
                {
                    double Si = _with2.FindByИмяПараметра(keysArg).ЗначениеВСИ;
                    inParam.InputArgDictionary[keysArg] = _with2.FindByИмяПараметра(keysArg).ЗначениеВСИ;
                }

                //' иттератор по коллекции как KeyValuePair objects.
                //For Each kvp As KeyValuePair(Of String, Double) In inputArg.InputArgDictionary
                //    'Console.WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value)
                //    inputArg.InputArgDictionary(kvp.Key) = .FindByИмяПараметра(kvp.Key).ЗначениеВСИ
                //Next

                //For Each value As Double In inputArg.InputArgDictionary.Values
                //    Console.WriteLine("Value = {0}", value)
                //Next
            }
            catch (Exception ex)
            {
                //перенаправление встроенной ошибки
                DataError?.Invoke(this, new DataErrorEventArgs(ex.Message, $"Процедура: {nameof(ИзвлечьЗначенияИзмеренныхПараметров)}"));
            }
        }
コード例 #31
0
        public override void CheckForErrors()
        {
            base.CheckForErrors();

            if(m_ParentEditor == null || m_ParentEditor.ErrorsBar == null)
                return;

            if(m_thLinkedPart == null || m_thLinkedPart.BodyPart == null)
            {
                if(!m_ParentEditor.ErrorsBar.Errors.Contains(DataError.GenerateID(this, DiagramError.enumErrorTypes.RigidBodyNotSet)))
                {
                    DataError deError = new DataError(this, DiagramError.enumErrorLevel.Error, DiagramError.enumErrorTypes.RigidBodyNotSet,
                        "The reference for the rigid body '" + this.Text + "' is not set.");
                    m_ParentEditor.ErrorsBar.Errors.Add(deError.ID, deError);
                }
            }
            else
            {
                if(m_ParentEditor.ErrorsBar.Errors.Contains(DataError.GenerateID(this, DiagramError.enumErrorTypes.RigidBodyNotSet)))
                    m_ParentEditor.ErrorsBar.Errors.Remove(DataError.GenerateID(this, DiagramError.enumErrorTypes.RigidBodyNotSet));
            }
        }
コード例 #32
0
        public override void CheckForErrors()
        {
            base.CheckForErrors();

            if(m_ParentEditor == null || m_ParentEditor.ErrorsBar == null)
                return;

            if(m_thLinkedPart == null || m_thLinkedPart.BodyPart == null)
            {
                if(!m_ParentEditor.ErrorsBar.Errors.Contains(DataError.GenerateID(this, DiagramError.enumErrorTypes.MuscleNotSet)))
                {
                    DataError deError = new DataError(this, DiagramError.enumErrorLevel.Error, DiagramError.enumErrorTypes.MuscleNotSet,
                        "The reference for the " + this.TypeName + " '" + this.Text + "' is not set.");
                    m_ParentEditor.ErrorsBar.Errors.Add(deError.ID, deError);
                }
            }
            else
            {
                if(m_ParentEditor.ErrorsBar.Errors.Contains(DataError.GenerateID(this, DiagramError.enumErrorTypes.MuscleNotSet)))
                    m_ParentEditor.ErrorsBar.Errors.Remove(DataError.GenerateID(this, DiagramError.enumErrorTypes.MuscleNotSet));

                //We need to check and see if there are any other muscle types with this same linked muscle body part.
                //There should only be one muscle behavioral node with this muscle ID
                if(this.Organism != null && this.Organism.BehavioralNodes != null)
                {
                    VortexAnimatTools.DataObjects.Behavior.Nodes.Muscle doMuscle;
                    bool bMatchFound = false;
                    foreach (DictionaryEntry deEntry in this.Organism.BehavioralNodes)
                    {
                        if(deEntry.Value != null && Util.IsTypeOf(deEntry.Value.GetType(), typeof(VortexAnimatTools.DataObjects.Behavior.Nodes.Muscle), false))
                        {
                            doMuscle = (VortexAnimatTools.DataObjects.Behavior.Nodes.Muscle) deEntry.Value;

                            if(doMuscle.LinkedPart != null && doMuscle.LinkedPart.BodyPart != null && doMuscle.LinkedPart.BodyPart.ID == m_thLinkedPart.BodyPart.ID && doMuscle != this)
                                bMatchFound = true;
                        }
                    }

                    if(bMatchFound)
                    {
                        if(!m_ParentEditor.ErrorsBar.Errors.Contains(DataError.GenerateID(this, DiagramError.enumErrorTypes.MuscleIDDuplicate)))
                        {
                            DataError deError = new DataError(this, DiagramError.enumErrorLevel.Error, DiagramError.enumErrorTypes.MuscleIDDuplicate,
                                "The body part id for the " + this.TypeName + " '" + this.Text + "' is used by more than one muscle reference. This can cause interference in setting the membrane voltage for the muscle. Instead use one motor neuron and have it do any integration of different inputs.");
                            m_ParentEditor.ErrorsBar.Errors.Add(deError.ID, deError);
                        }
                    }
                    else
                    {
                        if(m_ParentEditor.ErrorsBar.Errors.Contains(DataError.GenerateID(this, DiagramError.enumErrorTypes.MuscleIDDuplicate)))
                            m_ParentEditor.ErrorsBar.Errors.Remove(DataError.GenerateID(this, DiagramError.enumErrorTypes.MuscleIDDuplicate));
                    }
                }
            }
        }
コード例 #33
0
 /// <summary>
 /// Initializes a new instance of the <c>DataException</c> class.
 /// </summary>
 public DataException(string message, Exception inner, DataError code)
     : base(message, inner)
 {
     _code = code;
 }
コード例 #34
0
 /// <summary>
 /// Initializes a new instance of the <c>DataException</c> class.
 /// </summary>
 public DataException(DataError code)
     : base("Data operation failed.")
 {
     _code = code;
 }
コード例 #35
0
 /// <summary>
 /// Initializes a new instance of the <c>DataException</c> class.
 /// </summary>
 public DataException(string message, DataError code)
     : base(message)
 {
     _code = code;
 }