Inheritance: System.Item
 /// <summary>
 /// Result type should be disabled and of appropriate value for some categories
 /// </summary>
 private void CheckFixedResultType(Category c)
 {
     if (c != null && c.Fixed && c.Type == FixedCategory.Length)
     {
         viewModel.ResultType = PipeTestResultType.Diapason;
         resultType.ReadOnly = true;
         isActive.ReadOnly = true;
         frequencyType.ReadOnly = true;
     }
     else
     {
         resultType.ReadOnly = false;
         isActive.ReadOnly = false;
         frequencyType.ReadOnly = false;
     }
 }
示例#2
0
        private bool SeedRequired()
        {
            try
            {
                firstSetupRepo.BeginTransaction();
                #region PipeTestCategory

                Category category = new Category { Name = "Измерение длины", IsActive = true, Fixed = true, ResultType = "int", Type = FixedCategory.Length };
                firstSetupRepo.CategoryRepo.Save(category);

                #endregion
                firstSetupRepo.Commit();


                firstSetupRepo.BeginTransaction();
                #region Joint weld operation

                JointOperation weldOperation = new JointOperation()
                {
                    IsActive = true,
                    IsRequired = true,
                    Type = JointOperationType.Weld,
                    Name = "Сварка стыка"
                };
                firstSetupRepo.JointOperationRepo.Save(weldOperation);

                #endregion
                firstSetupRepo.Commit();

            #region --- CannedMessage ---

            try
            {
                string fileName = Path.Combine(Directories.Seeding, "defectList.txt");
                string[] lines = System.IO.File.ReadAllLines(fileName, Encoding.Default);

                var cannedMessageList = new List<CannedMessage>(lines.Length);

                for (int i = 0; i < lines.LongLength; ++i)
                {
                    string[] tmp = lines[i].Split('\t');

                    cannedMessageList.Add(new CannedMessage {Language = tmp[0], IdDefect = tmp[1], Text = tmp[2]});
                }

                firstSetupRepo.BeginTransaction();
                cannedMessageList.ForEach(s => firstSetupRepo.CannedMessageRepo.Save(s));
                firstSetupRepo.Commit();
                cannedMessageList.ForEach(s => firstSetupRepo.CannedMessageRepo.Evict(s));
            }
            catch(Exception e)
            {
                log.Warn(string.Format("The file specified in path was not found or path is in an invalid format: {0}", e.Message));
            }

            #endregion // --- CannedMessage ---
            }
            catch(RepositoryException ex)
            {
                log.Warn(this.GetType().Name + " | " + ex.ToString());
            }
            return false;
        }