示例#1
0
        public Defects Validate(FileModel file, List <YearlyData> records)
        {
            Defects defects = new Defects {
                FileName = file.Name
            };

            if (records == null || !records.Any())
            {
                defects.Errors.Add("No data found in file.");
                return(defects);
            }

            YearValidator yearValidator = new YearValidator(defects);

            foreach (var record in records)
            {
                defects = yearValidator.Validate(record);
            }

            ProductNameValidator productNameValidator = new ProductNameValidator(defects);

            foreach (var record in records)
            {
                defects = productNameValidator.Validate(record);
            }

            defects = new ProductName().FindDifferentCasing(defects, records);

            return(defects);
        }
示例#2
0
        //需要调用窗体名称
        System.Windows.Forms.Control INetUserControl.CreateControl(UFSoft.U8.Framework.Login.UI.clsLogin login, string MenuID, string Paramters)
        {
            UFSoft.U8.Framework.LoginContext.UserData LoginInfo = new UFSoft.U8.Framework.LoginContext.UserData();
            LoginInfo = login.GetLoginInfo();
            string conn = LoginInfo.ConnString;

            conn = Utils.ConvertConn(conn);
            DbHelperSQL.connectionString = conn;

            string sLogUserid   = LoginInfo.UserId;
            string sLogUserName = LoginInfo.UserName;
            string sLogDate     = LoginInfo.operDate;
            string sAccID       = LoginInfo.AccID;

            ClsUserRight clsUser = new ClsUserRight();

            if (clsUser.chkRight(login, "TH_2_09"))
            {
                Defects fm = new Defects();
                fm.Conn      = conn;
                fm.sUserID   = sLogUserid;
                fm.sUserName = sLogUserName;
                fm.sLogDate  = sLogDate;
                fm.sAccID    = sAccID;

                this._Title = "Defects";

                return(fm);
            }
            else
            {
                return(null);
            }
        }
示例#3
0
 public void Reset()
 {
     defectCountBeforeCheck = 0;
     Defects.Clear();
     SeverityBitmask.SetAll();
     ConfidenceBitmask.SetAll();
 }
        public async Task <Defects> CreateDefectAsync(Defects defect)
        {
            _dbContext.Defects.Add(defect);
            await _dbContext.SaveChangesAsync();

            return(defect);
        }
示例#5
0
文件: Program.cs 项目: Tilps/Stash
 static void Main(string[] args)
 {
     Defects c = new Defects();
     object o = c.maxSum(75, 20, new double[] { 0, 0, 35, 49, 75 }, new double[] { 15, 20, 0, 20, 6.2934 });
     PrintObj(o, 0);
     System.Console.In.ReadLine();
 }
示例#6
0
 public override string ToString()
 {
     return
         ($"--------------------------\n" +
          $"Id: {Id}\n" +
          $"Price: {Price}\n" +
          $"Uploader username: {UploaderUsername}\n" +
          $"Upload date: {UploadDate}\n" +
          $"Brand: {Brand}\n" +
          $"Model: {Model}\n" +
          $"Used: {Used}\n" +
          $"Date of purchase: {DateOfPurchase}\n" +
          $"Engine data:\n{Engine}\n" + // print all engine data: volume, hp, kw, type, fuel type
          $"Chassis type: {ChassisType}\n" +
          $"Color: {Color}\n" +
          $"Gearbox type: {GearboxType}\n" + // print all gearbox data: gearbox type, number of gears
          $"Kilometers driven: {TotalKilometersDriven}\n" +
          $"Drive wheels: {DriveWheels}\n" +
          $"Defects:\n{Defects.ToString<string>()}" +
          $"Steering wheel side: {SteeringWheelPosition}\n" +
          $"Number of doors: {NumberOfDoors}\n" +
          $"Seats: {Seats}\n" +
          $"Nex vehicle inspection date: {NextVehicleInspection}\n" +
          $"Wheel size: {WheelSize}\n" +
          $"Weight: {Weight}\n" +
          $"Euro emissions standard: {EuroStandard}\n" +
          $"Origin country: {OriginalPurchaseCountry}\n" +
          $"VIN: {Vin}\n" +
          $"Additional properties: \n{AdditionalProperties.ToString<string>()}" +
          $"Images: {Images.Count} (not shown)\n" +
          $"Comment: {Comment}\n" +
          $"Hidden: {Hidden}\n" +
          $"--------------------------");
 }
        public void ReturnsViewResultWithDefectsModel()
        {
            // Arrange
            var defects = new Defects();

            // Act
            var result = (ViewResult)_target.Index(defects);

            // Arrange
            Assert.That(result, Is.TypeOf <ViewResult>());
            Assert.That(result.Model, Is.TypeOf <Defects>());
        }
示例#8
0
        public ActionResult Index(string inputID, string inputName, string inputPlaceN, string inputLine, string inputTurno)
        {
            Logger.InitLogger();
            if (inputID == "" || inputName == "" || inputPlaceN == "" || inputLine == "" || inputTurno == "")
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Одно из полей пусто!');window.location.href = 'Index';</script>"));
            }
            else
            {
                try
                {
                    using (SqlConnection cn = new SqlConnection())
                    {
                        cn.ConnectionString = @"Data Source=patrin.ddns.net,1433;Initial Catalog=OIProject;Persist Security Info=True;User ID=sa;Password=18swlgnm";
                        cn.Open();

                        using (SqlCommand command = cn.CreateCommand())
                        {
                            command.CommandText = string.Format("INSERT INTO Employee (ID, PlaceN, Line, Name, Turno) VALUES ('{0}','{1}','{2}','{3}','{4}')", inputID, inputPlaceN, inputLine, inputName, inputTurno);
                            command.ExecuteNonQuery();
                            command.CommandText = string.Format("INSERT INTO Auth (ID, Password, Powers) VALUES ('{0}','{1}','{2}')", inputID, "0000", "Работник");
                            command.ExecuteNonQuery();
                        }
                        cn.Close();
                        Employess load     = new Employess();
                        Tablets   load_tab = new Tablets();
                        Defects   load_def = new Defects();

                        ArrayList allData = new ArrayList();

                        load.LoadData();
                        load_tab.PingAndLoadTablets();
                        load_def.LoadDefects();

                        allData.Add(load);
                        allData.Add(load_def);
                        allData.Add(load_tab);
                        Logger.Log.Info("Добавление работника в БД");
                        return(View(allData));
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log.Error(ex.Message);
                    return(Content("<script language='javascript' type='text/javascript'>alert('Ошибка в ходе добавления!" + ex.Message + "');window.location.href = 'Index';</script>"));
                }
            }
        }
示例#9
0
        public Defects CreateDefect()
        {
            var defect = new Defects
            {
                DefectTypeId          = DefectTypeId,
                DefectQualifierTypeId = DefectQualifierId,
                DateCreatedOffset     = DateTime.UtcNow,
                CreatedByUserId       = CreatedByUserId,
                ProjectId             = ProjectId,
                BugId                   = BugId,
                DefectModelTypeId       = DefectModelTypeId,
                OriginDateCreatedOffset = OriginDateCreatedOffset
            };

            return(defect);
        }
示例#10
0
        protected Lot CreateLot(out List <LotAttributeDefect> lotAttributeDefects, Defects defects = null, Attributes attributes = null)
        {
            lotAttributeDefects = new List <LotAttributeDefect>();
            var lot = new Lot
            {
                LotDefects = new List <LotDefect>(),
                Attributes = (attributes ?? new Attributes()).Where(a => a.Value != null).Select(a => new LotAttribute
                {
                    AttributeShortName = a.NameKey.AttributeNameKey_ShortName,
                    AttributeValue     = a.Value.Value
                }).ToList()
            };

            foreach (var defect in defects ?? new Defects())
            {
                LotDefect lotDefect;
                if (defect.Name != null)
                {
                    lotDefect = lot.AddNewDefect(defect.Name.DefectType, defect.Name.Name);
                    lotAttributeDefects.Add(new LotAttributeDefect
                    {
                        AttributeShortName        = defect.Name.ShortName,
                        DefectId                  = lotDefect.DefectId,
                        OriginalAttributeValue    = defect.Value,
                        OriginalAttributeMinLimit = defect.Min,
                        OriginalAttributeMaxLimit = defect.Max
                    });
                }
                else
                {
                    lotDefect = lot.AddNewDefect(defect.DefectType, defect.Description);
                }

                if (defect.Resolution)
                {
                    lotDefect.Resolution = new LotDefectResolution
                    {
                        ResolutionType = ResolutionTypeEnum.DataEntryCorrection,
                        Description    = "resolution"
                    };
                }
            }

            return(lot);
        }
        public Defects FindDifferentCasing(Defects defects, List <YearlyData> records)
        {
            var distinctCaseSensitiveProductNames = GetAllDistinctCaseSensitiveProductNames(records);

            SortedSet <string> lowerCasedProductNames = new SortedSet <string>();

            foreach (var product in distinctCaseSensitiveProductNames)
            {
                lowerCasedProductNames.Add(product.ToLower());
            }

            if (lowerCasedProductNames.Count < distinctCaseSensitiveProductNames.Length)
            {
                int num = distinctCaseSensitiveProductNames.Length - lowerCasedProductNames.Count;
                defects.Warnings.Add("Found " + num + " cases where one record product name is the same name but with different case to another record product name.");
            }

            return(defects);
        }
 public void Attacked(GameObject attacker, int damage, Defects.Defect defect)
 {
     damageShowTime=damageShowTimer;
     if(activeAbil!=Abilities.AbilityType.shield)
     {
         block=false;
         if(curDefect==null && defect!=null)
         {
             receivedDefect=true;
             curDefect=defect;
             earnedDefect=true;
         }
         receivedDamage+=damage;
         this.hp-=damage;
         if(this.hp<=0)
             this.Die();
     }
     else
         block=true;
 }
示例#13
0
 public DefectCountByTypeCommand(Defects defects)
 {
     _defects = defects;
 }
示例#14
0
        /// <summary>
        /// 偏差修正
        /// </summary>
        /// <param name="citFilePath">cit文件路径</param>
        /// <param name="iicFilePath">iic文件路径</param>
        /// <param name="listIC">里程修正结果集合</param>
        /// <param name="cyjg">采样点</param>
        /// <param name="gjtds">通道数量</param>
        /// <param name="sKmInc">增减里程</param>
        /// <param name="listETC">偏差类型</param>
        public void ExceptionFix(string citFilePath, string iicFilePath, List <IndexSta> listIC, List <ExceptionType> listETC)
        {
            List <Defects> listDC = new List <Defects>();

            try
            {
                using (OleDbConnection sqlconn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + iicFilePath + ";Persist Security Info=True"))
                {
                    string       sqlCreate = "select RecordNumber,maxpost,maxminor from fix_defects where maxval2 is null or maxval2<>-200";
                    OleDbCommand sqlcom    = new OleDbCommand(sqlCreate, sqlconn);
                    sqlconn.Open();
                    OleDbDataReader oleDBdr = sqlcom.ExecuteReader();
                    while (oleDBdr.Read())
                    {
                        Defects dc = new Defects();
                        dc.iRecordNumber = int.Parse(oleDBdr.GetValue(0).ToString());
                        dc.iMaxpost      = int.Parse(oleDBdr.GetValue(1).ToString());
                        dc.dMaxminor     = double.Parse(oleDBdr.GetValue(2).ToString());
                        listDC.Add(dc);
                    }

                    oleDBdr.Close();
                    sqlconn.Close();
                }
                Application.DoEvents();
            }
            catch
            {
            }

            FileInformation fi = citHelper.GetFileInformation(citFilePath);

            //
            List <Milestone>       listMilestone = citHelper.GetAllMileStone(citFilePath);
            List <cPointFindMeter> listcpfm      = new List <cPointFindMeter>();

            for (int i = 0; i < listMilestone.Count; i++)
            {
                cPointFindMeter cpfm = new cPointFindMeter();
                cpfm.lLoc   = listMilestone[i].mFilePosition;
                cpfm.lMeter = Convert.ToInt64(listMilestone[i].mKm * 100000 + listMilestone[i].mMeter * 100);

                listcpfm.Add(cpfm);
            }


            for (int i = 0; i < listDC.Count; i++)
            {
                for (int j = 0; j < listcpfm.Count; j++)
                {
                    if (listcpfm[j].lMeter == listDC[i].GetMeter())
                    {
                        int iValue = PointToMeter(listIC, listcpfm[j].lLoc, fi.iChannelNumber, fi.iKmInc);
                        if (iValue > 0)
                        {
                            listDC[i].bFix      = true;
                            listDC[i].iMaxpost  = iValue / 1000;
                            listDC[i].dMaxminor = iValue % 1000;
                        }
                        break;
                    }
                }
            }


            //将修正后的偏差数据存储到iic中

            try
            {
                using (OleDbConnection sqlconn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + iicFilePath + ";Persist Security Info=True"))
                {
                    string       sqlCreate = "";
                    OleDbCommand sqlcom    = new OleDbCommand(sqlCreate, sqlconn);
                    sqlconn.Open();
                    for (int i = 0; i < listDC.Count; i++)
                    {
                        if (listDC[i].bFix)
                        {
                            sqlcom.CommandText = "update fix_defects set maxpost=" + listDC[i].iMaxpost.ToString() +
                                                 ",maxminor=" + listDC[i].dMaxminor.ToString() + ",maxval2=-200 where RecordNumber=" + listDC[i].iRecordNumber.ToString();
                            sqlcom.ExecuteNonQuery();
                        }
                    }
                    sqlconn.Close();
                }
                Application.DoEvents();
            }
            catch
            {
            }
        }
 public ProductNameValidator(Defects defects)
 {
     _defects = defects;
 }
示例#16
0
        public ActionResult Defects(int?page)
        {
            try
            {
                Logger.InitLogger();
                ClaimsIdentity user  = (ClaimsIdentity)(User.Identity);
                string         type  = string.Empty;
                string         right = string.Empty;

                IEnumerable <Claim> claims = user.Claims;

                try
                {
                    type  = claims.ElementAt(4).Type;
                    right = claims.ElementAt(4).Value;
                }
                catch (Exception ex)
                {
                    Logger.Log.Error("Попытка несанкционированный доступ!" + ex.Message);
                    return(Redirect("/Account/Login"));
                }
                if (type == "Rights" && right == "Администратор" || right == "Работник ОК" || right == "Ремонтная служба")
                {
                    Defects load_def = new Defects();

                    bool check = load_def.CheckNewDefects();

                    if (check)
                    {
                        ViewBag.Message = "OK";
                    }
                    ArrayList allData = new ArrayList();
                    load_def.LoadDefects();

                    IEnumerable <string> workplaces = new string[] {};

                    using (SqlConnection cn = new SqlConnection())
                    {
                        cn.ConnectionString = @"Data Source=patrin.ddns.net,1433;Initial Catalog=OIProject;Persist Security Info=True;User ID=sa;Password=18swlgnm";
                        cn.Open();

                        using (SqlCommand command = cn.CreateCommand())
                        {
                            command.CommandText = string.Format("SELECT NameWorkPlace,PlaceN FROM WorkPlaces WHERE WorkPlaces.NameWorkPlace IS NOT NULL");
                            using (SqlDataReader dr = command.ExecuteReader())
                            {
                                while (dr.Read())
                                {
                                    workplaces = workplaces.Concat(new string[] { dr[0].ToString() + "—" + dr[1].ToString() });
                                }
                            }
                        }
                        cn.Close();
                    }

                    ViewBag.Notifications = workplaces;

                    allData.Add(load_def);
                    var model = load_def.Data2.ToList();

                    int pageNumber = page ?? 1;
                    int pageSize   = 5;
                    return(View(model.ToPagedList(pageNumber, pageSize)));
                }
                else
                {
                    return(View("ErrorRight"));
                }
            }
            catch (Exception ex)
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Ошибка в ходе загрузки страницы!" + ex.Message + "');window.location.href = 'Index';</script>"));
            }
        }
示例#17
0
 public IActionResult Index(Defects defects)
 {
     return(View(defects));
 }
 public YearValidator(Defects defects)
 {
     _defects = defects;
 }
示例#19
0
 public DefectCountByCreatorCommand(Defects defects)
 {
     _defects = defects;
 }
 public DefectCountOfSeverityByCreatorCommand(Defects defects)
 {
     _defects = defects;
 }
示例#21
0
 public DefectCountByInjectionStageCommand(Defects defects)
 {
     _defects = defects;
 }
示例#22
0
        public ActionResult Index()
        {
            try
            {
                Logger.InitLogger();
                ClaimsIdentity user  = (ClaimsIdentity)(User.Identity);
                string         type  = string.Empty;
                string         right = string.Empty;

                IEnumerable <Claim> claims = user.Claims;

                try
                {
                    type  = claims.ElementAt(4).Type;
                    right = claims.ElementAt(4).Value;
                }
                catch (Exception ex)
                {
                    Logger.Log.Error("Попытка несанкционированного доступа!" + ex.Message);
                    return(Redirect("/Account/Login"));
                }
                if (type == "Rights" && right == "Администратор" || right == "Работник ОК")
                {
                    string browser    = HttpContext.Request.Browser.Browser;
                    string user_agent = HttpContext.Request.UserAgent;


                    Employess load     = new Employess();
                    Tablets   load_tab = new Tablets();
                    Defects   load_def = new Defects();

                    ArrayList allData = new ArrayList();

                    load.LoadData();
                    load_tab.PingAndLoadTablets();
                    load_def.LoadDefects();

                    allData.Add(load);
                    allData.Add(load_def);
                    allData.Add(load_tab);

                    if (user_agent.Contains("Chrome") || (user_agent.Contains("Mozilla")))
                    {
                        Logger.Log.Info("Загружена главная страница");
                        return(View(allData));
                    }
                    else
                    {
                        return(Content("<script language='javascript' type='text/javascript'>alert('Сайт в данном браузере работает некорректно! Дальнейшая работа невозможна!');window.location.href = 'Index';</script>"));
                    }
                }

                else
                {
                    return(View("ErrorRight"));
                }
            }
            catch (Exception ex)
            {
                return(Content("<script language='javascript' type='text/javascript'>alert('Ошибка загрузки главной страницы!" + ex.Message + "');window.location.href = 'Index';</script>"));
            }
        }
 public DefectCountOfSeverityByProductCommand(Defects defects)
 {
     _defects = defects;
 }
示例#24
0
        static void Main(string[] args)
        {
            // BasicConfigurator replaced with XmlConfigurator.
            XmlConfigurator.Configure(new System.IO.FileInfo(logConfigFile));

            OptionSet optSet = new OptionSet()
            {
                { "t|task-id=", "the task Id.", v => taskId = v },
                { "h|help", "show this message and exit", v => show_help = v != null },
            };

            // Parse the command line parameters.
            List <string> extra;

            try
            {
                extra = optSet.Parse(args);
            }
            catch (OptionException e)
            {
                log.Error(string.Format("An error occurred when parsing command line parameters: {0}", e.Message));
                return;
            }

            // Show help or usage.
            if (show_help)
            {
                ShowHelp(optSet);
                return;
            }

            if (EmployeesReader.Employees == null || EmployeesReader.Employees.Count == 0)
            {
                log.Error("An error occurred when reading employee settings.");
                return;
            }

            if (EagleEyeSettingsReader.Settings == null || !EagleEyeSettingsReader.Settings.IsValid())
            {
                log.Error("An error occurred when reading eagleeye settings.");
                return;
            }

            // ccollab data source
            ICcollabDataSource ccollabDataGenerator = new CcollabDataGenerator();

            // ccollab reviews charts related
            Reviews reviews = new Reviews(ccollabDataGenerator);

            if (reviews.GetValidRecords() == null || reviews.GetValidRecords().Count == 0)
            {
                log.Info("No valid review records.");
            }
            else
            {
                ReviewsManager reviewsManager = new ReviewsManager
                                                (
                    new ReviewCountByMonthCommand(reviews),
                    new ReviewCountByProductCommand(reviews),
                    new ReviewCountByCreatorCommand(reviews),
                    new CommentDensityUploadedByProductCommand(reviews),
                    new CommentDensityChangedByProductCommand(reviews),
                    new DefectDensityUploadedByProductCommand(reviews),
                    new DefectDensityChangedByProductCommand(reviews),
                    new InspectionRateByMonthFromProductCommand(reviews),
                    new DefectDensityChangedByMonthCommand(reviews),
                    new CommentDensityChangedByMonthCommand(reviews)
                                                );

                reviewsManager.GenerateReviewCountByMonth();
                reviewsManager.GenerateReviewCountByProduct();
                reviewsManager.GenerateReviewCountByEmployeeOfProduct();
                reviewsManager.GenerateCodeCommentDensityUploaded();
                reviewsManager.GenerateCodeCommentDensityChanged();
                reviewsManager.GenerateCodeDefectDensityUploaded();
                reviewsManager.GenerateCodeDefectDensityChanged();
                reviewsManager.GenerateInspectionRateByMonth();
                reviewsManager.GenerateDefectDensityChangedByMonth();
                reviewsManager.GenerateCommentDensityChangedByMonth();
            }

            // ccollab defects charts related
            Defects defects = new Defects(ccollabDataGenerator);

            if (defects.GetValidRecords() == null || defects.GetValidRecords().Count == 0)
            {
                log.Info("No valid defect records.");
            }
            else
            {
                DefectsManager defectsManager = new DefectsManager
                                                (
                    new DefectCountByProductCommand(defects),
                    new DefectCountByInjectionStageCommand(defects),
                    new DefectCountByTypeCommand(defects),
                    new DefectCountByCreatorCommand(defects),
                    new DefectCountOfTypeByProductCommand(defects),
                    new DefectCountOfTypeByCreatorCommand(defects),
                    new DefectCountOfSeverityByProductCommand(defects),
                    new DefectCountOfSeverityByCreatorCommand(defects)
                                                );

                defectsManager.GenerateDefectCountByProduct();
                defectsManager.GenerateDefectCountByInjectionStage();
                defectsManager.GenerateDefectCountByType();
                defectsManager.GenerateDefectCountByCreator();
                defectsManager.GenerateDefectCountOfTypeByProduct();
                defectsManager.GenerateDefectCountOfTypeByCreator();
                defectsManager.GenerateDefectSeverityByProduct();
                defectsManager.GenerateDefectSeverityCountByCreator();
            }

            // notify task state
            if (string.IsNullOrWhiteSpace(taskId))
            {
                log.Error("No task id provided, so unable to notify EagleEye task state.");
            }
            else
            {
                NotifyTaskStatus(taskId, true);
            }

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
示例#25
0
 public DefectCountOfTypeByProductCommand(Defects defects)
 {
     _defects = defects;
 }