Exemplo n.º 1
0
        public List <KPI> GetKPIsByPerson(int personId)
        {
            if (personId <= 0)
            {
                throw new ArgumentException("The code of person cannot be zero.");
            }

            string userName       = HttpContext.Current.User.Identity.Name;
            int    firstDayOfWeek = Artexacta.App.Configuration.Configuration.GetFirstDayOfWeek();

            List <KPI> theList = new List <KPI>();
            KPI        theData = null;

            try
            {
                KPIDS.KPIDataTable theTable = theAdapter.GetKPIsByPerson(personId, userName, firstDayOfWeek);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (KPIDS.KPIRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Error en GetKPIsByPerson para personId: " + personId.ToString() + " y userName: " + userName, exc);
                throw new ArgumentException(Resources.DataDetails.MessageErrorKpisByPerson);
            }

            return(theList);
        }
Exemplo n.º 2
0
        //Delete
        public void Delete(string kpiId)
        {
            KPI kpi = db.KPIs.Find(kpiId);

            db.KPIs.Remove(kpi);
            Save();
        }
Exemplo n.º 3
0
        private static KPI FillRecord(KPIDS.KPIRow row)
        {
            KPI theNewRecord = new KPI(
                row.kpiID,
                row.name,
                row.IsorganizationIDNull() ? 0 : row.organizationID,
                row.IsareaIDNull() ? 0 : row.areaID,
                row.IsprojectIDNull() ? 0 : row.projectID,
                row.IsactivityIDNull() ? 0 : row.activityID,
                row.IspersonIDNull() ? 0 : row.personID,
                row.unitID,
                row.directionID,
                row.strategyID,
                row.IsstartDateNull() ? DateTime.MinValue : row.startDate,
                row.reportingUnitID,
                row.IstargetPeriodNull() ? 0 : row.targetPeriod,
                row.allowsCategories,
                row.IscurrencyNull() ? "" : row.currency,
                row.IscurrencyUnitIDNull() ? "" : row.currencyUnitID,
                row.kpiTypeID);

            theNewRecord.OrganizationName = row.IsorganizationNameNull() ? "" : row.organizationName;
            theNewRecord.AreaName         = row.IsareaNameNull() ? "" : row.areaName;
            theNewRecord.ProjectName      = row.IsprojectNameNull() ? "" : row.projectName;
            theNewRecord.ActivityName     = row.IsactivityNameNull() ? "" : row.activityName;
            theNewRecord.PersonName       = row.IspersonNameNull() ? "" : row.personName;
            theNewRecord.Progress         = row.IsprogressNull() ? 0 : row.progress;
            theNewRecord.Trend            = row.IstrendNull() ? 0 : row.trend;
            theNewRecord.IsOwner          = row.IsisOwnerNull() ? false : Convert.ToBoolean(row.isOwner);

            return(theNewRecord);
        }
Exemplo n.º 4
0
        public void OnGet()
        {
            Log.Error("Test error from index.cshtml");

            KPI.LogKPI(KPI.AD_CLICK);
            KPI.LogKPI(KPI.AD_VIEW);
        }
Exemplo n.º 5
0
        private DataSet AddFirstDataSet()
        {
            var dataSet = new DataSet();

            if (KPI.ToUpper() == "SALES PERFORMANCE VS COMPETITORS")
            {
                dataSet.Attributes.Add("renderas", "Area");
            }
            dataSet.Attributes.Add("seriesName", WidgetName == "HomeTrendChart"?Input.Rows.First().Values[0]:Input.Rows.First().Values[1]);
            dataSet.Attributes.Add("parentYAxis", "P");

            if (!UncheckedItems.ToUpper().Contains("TOTAL"))
            {
                dataSet.Attributes.Add("color", ColorListDataSource.ColorOfTotal);
            }
            dataSet.Set = new List <Set>();

            foreach (var val in KPI.ToUpper() == "SALES" ? Input.Rows.First().Values.Skip(2) : Input.Rows.First().Values.Skip(3))
            {
                var set1 = new Set();
                set1.Attributes.Add("value", val == "--" ? "0" : val);
                dataSet.Set.Add(set1);
            }
            return(dataSet);
        }
Exemplo n.º 6
0
    private void LoadKpiData()
    {
        int kpiId  = Convert.ToInt32(KpiIdHiddenField.Value);
        int userId = UserBLL.GetUserIdByUsername(User.Identity.Name);

        UserIdHiddenField.Value = userId.ToString();

        KPI kpi = KPIBLL.GetKPIById(kpiId);

        KpiNameLiteral.Text = kpi.Name;

        //Inicializo los valores conocidos
        string     lang   = LanguageUtilities.GetLanguageFromContext();
        KPITypeBLL theBll = new KPITypeBLL();
        KPIType    type   = theBll.GetKPITypesByID(kpi.KpiTypeID, lang);

        KpiType.Text = type != null ? type.TypeName : kpi.KpiTypeID;
        //WebServiceId.Text = "<div class='col-md-4 col-sm-4'>Web Service ID:</div><div class='col-md-8 col-sm-8'>SERV-Reliavility</div>";
        ReportingUnit.Text = kpi.ReportingUnitName;
        KpiTarget.Text     = (kpi.TargetPeriod == 0 ? Resources.KpiDetails.NoTargetLabel : kpi.TargetPeriod + " " + kpi.ReportingUnitID);

        //if (caso <= 50)
        //{
        //    StartingDate.Text = "<div class='col-md-4 col-sm-4'>Starting Date:</div><div class='col-md-8 col-sm-8'>01/15/16</div>";
        //    MeanTimeGraphic.Visible = true;
        //    MeanTimeProgress.Visible = true;
        //}
        //else
        //{
        StartingDate.Text = kpi.StartDate != DateTime.MinValue ? kpi.StartDate.ToShortDateString() : "-";
        RevenueCollectionGraphic.Visible = true;
        //RevenueCollectionProgress.Visible = true;
        ChartControl.KpiId               = kpiId;
        ExportControl.KpiId              = kpiId;
        StatsControl.KpiId               = kpiId;
        MeasurementsControl.KpiId        = kpiId;
        MeasurementsControl.Unit         = kpi.UnitID;
        MeasurementsControl.Currency     = kpi.Currency;
        MeasurementsControl.CurrencyUnit = kpi.CurrencyUnitForDisplay;

        UnitIdHiddenField.Value       = kpi.UnitID;
        CurrencyHiddenField.Value     = kpi.Currency;
        CurrencyUnitHiddenField.Value = kpi.CurrencyUnitForDisplay;

        //CurrencyUnitBLL currencyUnitBll = new CurrencyUnitBLL();
        //CurrencyUnit currencyUnit = currencyUnitBll.GetCurrencyUnitsById(lang, ;

        //MeasurementsControl.Currency = kpi.Currency;

        //}

        List <KPICategoyCombination> categories = KPICategoryCombinationBLL.GetCategoryItemsCombinatedByKpiId(kpiId);

        if (categories.Count > 0)
        {
            CategoriesRepeater.DataSource = categories;
            CategoriesRepeater.DataBind();
            CategoriesPanel.Visible = true;
        }
    }
Exemplo n.º 7
0
        public List <KPI> GetKPIsBySearch(string whereClause)
        {
            if (string.IsNullOrEmpty(whereClause))
            {
                whereClause = "1=1";
            }

            List <KPI> theList = new List <KPI>();
            KPI        theData = null;

            string username       = HttpContext.Current.User.Identity.Name.ToString();
            int    firstDayOfWeek = Artexacta.App.Configuration.Configuration.GetFirstDayOfWeek();

            try
            {
                KPIDS.KPIDataTable theTable = theAdapter.GetKPIBySearch(username, whereClause, firstDayOfWeek);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (KPIDS.KPIRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error(Resources.Kpi.MessageErrorKPIList + " by search.", exc);
                throw new Exception(Resources.Kpi.MessageErrorKPIList);
            }

            return(theList);
        }
Exemplo n.º 8
0
        public IHttpActionResult DeshabilitarKPI(int id)
        {
            KPI kPI = db.KPIs.Where(b => b.KPIID == id).Include(b => b.Parametro).FirstOrDefault();

            kPI.Estado          = false;
            db.Entry(kPI).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!KPIExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.OK));
        }
Exemplo n.º 9
0
 public ActionResult Edit([Bind(Include = "ID,CreationDate,Name,Objective,FormulaValue")] KPI kPI)
 {
     if (ModelState.IsValid)
     {
         try
         {
             kpiRepo.UpdateKPI(kPI);
             kpiRepo.Save();
             this.AddToastMessage("KPI", "KPI edited successfully", ToastType.Success);
             return(Json(new { success = true }));
         }
         catch (DbUpdateException sqlExc)
         {
             var sqlException = sqlExc.GetBaseException() as SqlException;
             if (sqlException != null)
             {
                 logger.Error(sqlExc.ToString());
                 this.AddToastMessage("KPI", "KPI already exists, please verify.", ToastType.Error);
             }
             else
             {
                 throw;
             }
         }
     }
     return(PartialView("PartialKPI/_editKPI", kPI));
 }
Exemplo n.º 10
0
        public async Task <IHttpActionResult> PostKPI([FromBody] KPI kPI)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            try
            {
                kPI.FK_KPICategory = kPI.KPICategory.ID;
                kPI.KPICategory    = null;

                kPI.FK_Unit = kPI.Unit.ID;
                kPI.Unit    = null;


                db.KPIs.Add(kPI);
                await db.SaveChangesAsync();

                kPI.KPICategory = db.KPICategories.SingleOrDefault(c => c.ID == kPI.FK_KPICategory);
                kPI.Unit        = db.Units.SingleOrDefault(c => c.ID == kPI.FK_Unit);

                return(CreatedAtRoute("DefaultApi", new { id = kPI.ID }, kPI));
            }
            catch (Exception e)
            {
                return(InternalServerError());
            }
        }
Exemplo n.º 11
0
        public IHttpActionResult PutKPI(int id, KPI kPI)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != kPI.Id)
            {
                return(BadRequest());
            }

            db.Entry(kPI).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!KPIExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 12
0
 public ActionResult Create([Bind(Include = "ID,CreationDate,Name,Objective,FormulaValue")] KPI kPI)
 {
     if (ModelState.IsValid)
     {
         try
         {
             kpiRepo.InsertKPI(kPI);
             kpiRepo.Save();
             this.AddToastMessage("KPI", "KPI created successfully!", ToastType.Success);
             return(RedirectToAction("Index"));
         }
         catch (DbUpdateException ex)
         {
             var sqlException = ex.GetBaseException() as SqlException;
             if (sqlException != null)
             {
                 logger.Error(ex.ToString());
                 this.AddToastMessage("KPI", "KPI already exists, please verify.", ToastType.Error);
             }
             else
             {
                 throw;
             }
         }
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 13
0
        public ActionResult Finish(KPI model, HttpPostedFileWrapper upload)
        {
            model.id = model.id > 0 ? -model.id : model.id;
            if (ModelState.IsValid)
            {
                using (var scope = new TransactionScope())
                {
                    var user = User.Identity.Name.Split('@')[0];
                    var KPI  = db.KPIs.Find(model.id);
                    if (KPI.Email != user && KPI.KP1.Email != user)
                    {
                        return(HttpNotFound());
                    }
                    KPI.KetQua          = model.KetQua;
                    KPI.GhiChu2         = model.GhiChu2;
                    KPI.Filename        = upload?.FileName;
                    db.Entry(KPI).State = EntityState.Modified;

                    LogInfo(model);
                    db.SaveChanges();

                    if (upload != null)
                    {
                        upload.SaveAs(Server.MapPath("~/App_Data/") + -model.id);
                    }

                    scope.Complete();
                    return(RedirectToAction("Details", new { id = -KPI.idKPI }));
                }
            }

            ViewBag.Names = db.KpiUsers.First().Names;
            return(View(db.KPIs.Find(model.id)));
        }
Exemplo n.º 14
0
        public ActionResult Update(KPI model)
        {
            model.id = model.id > 0 ? -model.id : model.id;
            if (ModelState.IsValid)
            {
                var user = User.Identity.Name.Split('@')[0];
                var KPI  = db.KPIs.Find(model.id);
                if (KPI.Email != user && KPI.KP1.Email != user)
                {
                    return(HttpNotFound());
                }
                KPI.MucTieu         = model.MucTieu;
                KPI.TyTrong         = model.TyTrong;
                KPI.ChiTieu         = model.ChiTieu;
                KPI.DonViTinh       = model.DonViTinh;
                KPI.GhiChu          = model.GhiChu;
                KPI.Email           = model.Email ?? user;
                db.Entry(KPI).State = EntityState.Modified;

                LogInfo(model);
                db.SaveChanges();
                return(RedirectToAction("Details", new { id = -KPI.idKPI }));
            }

            ViewBag.Names = db.KpiUsers.First().Names;
            return(View(db.KPIs.Find(model.id)));
        }
Exemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Attributes["mode"] != null)
            {
                int         mode       = int.Parse(this.Attributes["mode"]);
                TimePeriods timePeriod = new TimePeriods();
                switch (mode)
                {
                case 1:
                    timePeriod.SetLast30Days();
                    break;

                case 2:
                    timePeriod.SetWeekDays();
                    break;

                case 3:
                    timePeriod.SetMonthDays();
                    break;

                case 4:
                    timePeriod.SetYearDays();
                    break;
                }

                KPI kpi = new KPI();
                ordersByUserDS = kpi.GetOrdersByCreator(timePeriod.StartDate, timePeriod.EndDate);
            }
        }
Exemplo n.º 16
0
        // GET: KPIs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            KPI kPI = db.KPIs.Find(id);

            if (kPI == null)
            {
                return(HttpNotFound());
            }



            ViewBag.Farms = db.Farms.Where(x => x.RegionId == kPI.RegionId).ToList();
            //ViewBag.Year = new SelectList(Enumerable.Range(DateTime.Now.Year - 10, 30).Select(x => new SelectListItem
            //{
            //    Value = x.ToString(),
            //    Text = x.ToString()
            //}),kPI.Year);
            //ViewBag.Year = Enumerable.Range(DateTime.Now.Year - 10, 30).ToList();
            //ViewBag.Year = Enumerable.Range(DateTime.Now.Year - 10, 30).Select(x => new SelectListItem
            //{
            //    Value = x.ToString(),
            //    Text= x.ToString()
            //});
            return(View(kPI));
        }
Exemplo n.º 17
0
        public static KPI GetKPIById(int kpiId)
        {
            if (kpiId <= 0)
            {
                throw new ArgumentException(Resources.Organization.MessageZeroAreaId);
            }

            KPI theData = null;

            try
            {
                KPITableAdapter    localAdapter = new KPITableAdapter();
                KPIDS.KPIDataTable theTable     = localAdapter.GetKPIById(kpiId);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    KPIDS.KPIRow theRow = theTable[0];
                    theData = FillRecord(theRow);
                }
            }
            catch (Exception exc)
            {
                log.Error(Resources.Kpi.MessageErrorKpiInformation + " KpiId: " + kpiId, exc);
                throw new Exception(Resources.Kpi.MessageErrorKpiInformation);
            }

            return(theData);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Saving KPI Details
        /// </summary>
        /// <param name="kpiViewModel"></param>
        /// <returns></returns>
        public bool SaveKPIDetails(KPIViewModel kpiViewModel)
        {
            try
            {
                if (kpiViewModel != null)
                {
                    KPI kpiDTO = new KPI();
                    kpiDTO.KPIID          = kpiViewModel.KPIID;
                    kpiDTO.KPIDescription = kpiViewModel.KPIDescription;

                    kpiDTO.Source = new CheckListType();
                    kpiDTO.Source.CheckListTypeID   = kpiViewModel.Source.CheckListTypeID;
                    kpiDTO.Source.CheckListTypeCode = kpiViewModel.Source.CheckListTypeCode;
                    kpiDTO.Source.CheckListTypeName = kpiViewModel.Source.CheckListTypeName;
                    kpiDTO.Source.RecordStatus      = kpiViewModel.Source.RecordStatus;

                    kpiDTO.Measure             = new Measure();
                    kpiDTO.Measure.MeasureId   = kpiViewModel.Measure.MeasureId;
                    kpiDTO.Measure.MeasureText = kpiViewModel.Measure.MeasureText;

                    kpiDTO.Standard   = kpiViewModel.Standard;
                    kpiDTO.AlertLevel = kpiViewModel.AlertLevel;

                    kpiDTO.KPIMeasure = new KPIMeasure();
                    kpiDTO.KPIMeasure.KpimeasureId    = kpiViewModel.KPIMeasure.KpimeasureId;
                    kpiDTO.KPIMeasure.Measure         = kpiViewModel.KPIMeasure.Measure;
                    kpiDTO.KPIMeasure.CheckListTypeId = kpiViewModel.KPIMeasure.CheckListTypeId;
                    kpiDTO.KPIMeasure.RecordStatus    = kpiViewModel.KPIMeasure.RecordStatus;

                    kpiDTO.IsHeatMapItem = kpiViewModel.IsHeatMapItem;
                    kpiDTO.HeatMapScore  = kpiViewModel.HeatMapScore;
                    kpiDTO.IsUniversal   = kpiViewModel.IsUniversal;
                    kpiDTO.RecordStatus  = kpiViewModel.RecordStatus;

                    kpiDTO.KPIAlert                           = new KPIAlert();
                    kpiDTO.KPIAlert.KPIAlertId                = kpiViewModel.KPIAlertId;
                    kpiDTO.KPIAlert.SendAlert                 = kpiViewModel.SendAlert;
                    kpiDTO.KPIAlert.SendAlertTitle            = kpiViewModel.SendAlertTitle;
                    kpiDTO.KPIAlert.SendToRelationshipManager = kpiViewModel.SendToRelationshipManager;
                    kpiDTO.KPIAlert.SendToBillingManager      = kpiViewModel.SendToBillingManager;
                    kpiDTO.KPIAlert.EscalateAlert             = kpiViewModel.EscalateAlert;
                    kpiDTO.KPIAlert.EscalateAlertTitle        = kpiViewModel.EscalateAlertTitle;
                    kpiDTO.KPIAlert.EscalateTriggerTime       = kpiViewModel.EscalateTriggerTime;
                    kpiDTO.KPIAlert.IncludeKPITarget          = kpiViewModel.IncludeKPITarget;
                    kpiDTO.KPIAlert.IncludeDeviationTarget    = kpiViewModel.IncludeDeviationTarget;
                    kpiDTO.KPIAlert.IsSla                     = kpiViewModel.IsSla;
                    return(_kpiRepository.SaveKPIs(kpiDTO));
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                _logger.Log(ex, LogLevel.Error, ex.Message);
                return(false);
            }
        }
Exemplo n.º 19
0
        public async Task <IActionResult> Update([FromBody] KPI input)
        {
            unitOfWork.KPIRepository.UpdateKPI(input);

            await unitOfWork.SaveAsync();

            return(Ok(input));
        }
Exemplo n.º 20
0
        public DataSet GetDataSimple(DateTime startDate, DateTime endDate)
        {
            DataSet dsKPI = null;
            KPI     kpi   = new KPI();

            dsKPI = kpi.GetEOTL(startDate, endDate);
            return(dsKPI);
        }
 public void Filter_Status_KPIPersonal()
  {
      //Установка значения фильтра
      app.filterHelper.setCheckBoxFilter("Любой статус", "Завершенные", "Любой статус");
      //Проверка  результата
      KPI testKPI = app.kpiHelper.getKPIFromTable();
      Assert.AreEqual(100, testKPI.KPIProgress);
  }
Exemplo n.º 22
0
        public ActionResult DeleteConfirmed(string id)
        {
            KPI kpi = db.KPIs.Find(id);

            db.KPIs.Remove(kpi);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 23
0
        public DataSet GetDataSimple(DateTime startDate, DateTime endDate)
        {
            DataSet dsKPI = null;
            KPI     kpi   = new KPI();

            dsKPI = kpi.GetOrdersByStateForPeriod(startDate, endDate, "1,2,3,4,5,6");
            return(dsKPI);
        }
Exemplo n.º 24
0
        public void Filter_Filial_KPI()
        {
            //Установка значения фильтра
            app.filterHelper.setCheckBoxFilter("Все филиалы", "Филиал", "Все филиалы");
            //Проверка  результата
            KPI testKPI = app.kpiHelper.getKPIFromTable();

            Assert.AreEqual("Сотрудник Владелец", testKPI.KPIEmployee);
        }
Exemplo n.º 25
0
        public ActionResult DeleteConfirmed(int id)
        {
            KPI kPI = kpiRepo.GetKPIByID(id);

            kpiRepo.DeleteKPI(id);
            kpiRepo.Save();
            this.AddToastMessage("KPI", "KPI has been deleted.", ToastType.Success);
            return(Json(new { success = true }));
        }
        public void Find_KPIPersonal()
        {
            //Установка значения поиска
            app.filterHelper.setFindText("KPI");
            //Проверка  результата
            KPI testKPI = app.kpiHelper.getKPIFromTable();

            Assert.AreEqual("KPI", testKPI.KPIName);
        }
Exemplo n.º 27
0
        //Фильтр по должности
        public void Filter_Position_KPI()
        {
            //Установка значения фильтра
            app.filterHelper.setCheckBoxFilter("Все должности", "Бухгалтер", "Все должности");
            //Проверка  результата
            KPI testKPI = app.kpiHelper.getKPIFromTable();

            Assert.AreEqual("Сотрудник Владелец", testKPI.KPIEmployee);
        }
Exemplo n.º 28
0
        //Фильтр по подразделению
        public void Filter_Department_KPI()
        {
            //Установка значения фильтра
            app.filterHelper.setCheckBoxFilter("Все подразделения", "Keepteam", "Все подразделения");
            //Проверка  результата
            KPI testKPI = app.kpiHelper.getKPIFromTable();

            Assert.AreEqual("Сотрудник Владелец", testKPI.KPIEmployee);
        }
Exemplo n.º 29
0
 public ActionResult Edit([Bind(Include = "Id,Description,YTD,Mes_Efectivo,Anio_Efectivo")] KPI kPI)
 {
     if (ModelState.IsValid)
     {
         db.Entry(kPI).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(kPI));
 }
Exemplo n.º 30
0
 public ActionResult Edit([Bind(Include = "ID,KPIName")] KPI kpi)
 {
     if (ModelState.IsValid)
     {
         db.Entry(kpi).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(kpi));
 }
Exemplo n.º 31
0
        KPI ExtractStatsValue(string strStats)
        {
            KPI kpi = new KPI();
            string[] statsArr = strStats.Split(':');

            kpi.KPIName = statsArr[0];
            kpi.KPIValue = int.Parse(statsArr[1]);
            kpi.Dt = DateTime.UtcNow;

            return kpi;
        }
Exemplo n.º 32
0
        public void Create_KPI(KPI kpi)
        {
            //клик по кнопке добавления
            app.userHelper.clickAddKPIButton();
            //создание KPI
            app.kpiHelper.createKPI(kpi);

            //создание тестового KPI для сравнения
            KPI testKPI = app.kpiHelper.getKPIPopup();
            //Проверка соответствия двух отпусков.
            Assert.IsTrue(app.kpiHelper.CompareKPI(kpi, testKPI));
        }
Exemplo n.º 33
0
        public void Edit_KPI(KPI kpi)
        {
            app.kpiHelper.openFirstKPI();
            //Очистка значений попапа
            app.kpiHelper.clearKPIPopup();
            //Редактирование KPI
            app.kpiHelper.editKPI(kpi);
            //создание тестового KPI для сравнения
            KPI testKPI = app.kpiHelper.getKPIPopup();

            //Проверка соответствия двух отпусков.
            Assert.IsTrue(app.kpiHelper.CompareKPI(kpi, testKPI));
        }
Exemplo n.º 34
0
 public bool CompareKPI(KPI KPI1, KPI KPI2)
 {
     KPI1.WriteToConsole();
     KPI2.WriteToConsole();
     return
         KPI1.KPIName == KPI2.KPIName &&
         KPI1.KPIDate == KPI2.KPIDate &&
         KPI1.KPIEmployee == KPI2.KPIEmployee &&
         KPI1.KPIDescription == KPI2.KPIDescription &&
         KPI1.KPIProgress == KPI2.KPIProgress &&
         KPI1.KPIMeasuring == KPI2.KPIMeasuring &&
         KPI1.KPIActions == KPI2.KPIActions;
 }
Exemplo n.º 35
0
 public void editKPI(KPI kpi)
 {
     //заполнение полей создания KPI
     pages.newKPIPopup.ensurePageLoaded();
     pages.newKPIPopup.setNameField(kpi.KPIName);
     pages.newKPIPopup.setDateField(kpi.KPIDate);
     pages.newKPIPopup.setDescriptionField(kpi.KPIDescription);
     //pages.newKPIPopup.setEmployeeField(kpi.KPIEmployee);
     pages.newKPIPopup.setProgressBar(kpi.KPIProgress);
     pages.newKPIPopup.setActionsField(kpi.KPIActions);
     pages.newKPIPopup.setMeasuringField(kpi.KPIMeasuring);
     pages.newKPIPopup.addClick();
     refreshpage();
 }
Exemplo n.º 36
0
        private KPI CreateServerTooBusyPctKpi(KPIList kpiList)
        {
            KPI stbPct = new KPI();
            stbPct.KPIName = "ServerTooBusyPct";
            stbPct.Dt = DateTime.UtcNow;

            KPI stb = kpiList.FindKpiByName("ServerTooBusyCount");
            KPI rr = kpiList.FindKpiByName("RawRequests");

            if (rr.KPIValue > 0)
            {
                stbPct.KPIValue = (stb.KPIValue * 100) / rr.KPIValue;
            }
            else
            {
                stbPct.KPIValue = 0;
            }

            return stbPct;
        }
Exemplo n.º 37
0
 public void HubInvoke(string methodName, KPI kpi)
 {
     erpTicker.Invoke(methodName, kpi).Wait();
 }
Exemplo n.º 38
0
        KPI ExtractStatsValue(XmlNode n, string nodeName, string KPIName)
        {
            KPI kpi = new KPI();
            kpi.KPIName = KPIName;
            if (n != null)
            {
                kpi.KPIValue = int.Parse(n.SelectSingleNode(nodeName).InnerText);
            }
            else
            {
                kpi.KPIValue = 0;
            }

            kpi.Dt = DateTime.UtcNow;

            return kpi;
        }
Exemplo n.º 39
0
        /// <summary>
        /// Stats for bad requests KPI
        /// </summary>
        /// <param name="isBadRequest"></param>
        /// <returns></returns>
        KPI CreateBadRequestKPI(bool isBadRequest)
        {
            KPI brPct = new KPI();
            brPct.KPIName = "BadRequests";
            brPct.Dt = DateTime.UtcNow;

            if (isBadRequest)
            {
                brPct.KPIValue = 1;
            }
            else
            {
                brPct.KPIValue = 0;
            }
            return brPct;
        }
Exemplo n.º 40
0
 //Insert
 public void Insert(KPI kpi)
 {
     db.KPIs.Add(kpi);
     Save();
 }
Exemplo n.º 41
0
 //Update
 public void Update(KPI kpi)
 {
     db.Entry(kpi).State = EntityState.Modified;
     Save();
 }
Exemplo n.º 42
0
        public KPI getKPIPopup()
        {
            openFirstKPI();
            //переход к первой записи
            pages.newKPIPopup.ensurePageLoaded();
            KPI kpi = new KPI();
            kpi.KPIDate = pages.newKPIPopup.getDate();
            kpi.KPIDescription = pages.newKPIPopup.getDescription();
            kpi.KPIEmployee = pages.newKPIPopup.getEmployee();
            kpi.KPIMeasuring = pages.newKPIPopup.getMeasuring();
            kpi.KPIActions = pages.newKPIPopup.getActions();
            kpi.KPIName = pages.newKPIPopup.getName();
            kpi.KPIProgress = pages.newKPIPopup.getProgress();

            pages.newKPIPopup.closePopup();

            return kpi;
        }
Exemplo n.º 43
0
 public void createKPI(KPI kpi)
 {
     editKPI(kpi);
 }
Exemplo n.º 44
0
        /*  public KPI getKPIFromPersonalTable() пока закомментировал, потому как нет разницы в персональной и общей таблице
        {
            KPI kpi = new KPI();
            kpi.KPIName = pages.personalKPIPage.getKPIName();
            kpi.KPIDate = pages.personalKPIPage.getKPIDate();
            kpi.KPIProgress = pages.personalKPIPage.getKPIProgress();

            return kpi;
        }*/
        public KPI getKPIFromTable()
        {
            KPI kpi = new KPI();
            kpi.KPIName = pages.personalKPIPage.getKPIName();
            kpi.KPIDate = pages.personalKPIPage.getKPIDate();
            kpi.KPIProgress = pages.personalKPIPage.getKPIProgress();
            kpi.KPIEmployee = pages.personalKPIPage.getKPIEmployee();

            return kpi;
        }