Beispiel #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);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }