Esempio n. 1
0
        public static List <Travel> GetTravels(Guid organizationId, int departmentId, string type, int accountID, int projectID, int techID)
        {
            int invoiced          = -1;
            int billable          = -1;
            int hiddenFromInvoice = -1;

            switch (type)
            {
            case "invoiced":
                invoiced = 1;
                break;

            case "not_invoiced":
                invoiced = 0;
                break;

            case "not_invoiced_billable":
                invoiced = 0;
                billable = 1;
                break;

            case "not_invoiced_nonbillable":
                invoiced = 0;
                billable = 0;
                break;

            case "hidden_from_invoice":
                hiddenFromInvoice = 1;
                break;
            }
            Travels   _expenses          = new Travels(bigWebApps.bigWebDesk.Data.TicketTravelCosts.SelectTop100MostTravels(organizationId, departmentId, invoiced, accountID, projectID, techID, billable, hiddenFromInvoice));
            var       expenseTimeList    = _expenses.ToList();
            Hashtable htUserProfileImage = new Hashtable();

            foreach (Travel exp in expenseTimeList)
            {
                if (!htUserProfileImage.Contains(exp.UserEmail))
                {
                    htUserProfileImage.Add(exp.UserEmail, ProfileImageProvider.GetImageUrl(exp.UserEmail));
                }
                exp.UserProfileImage = htUserProfileImage[exp.UserEmail].ToString();
            }
            return(expenseTimeList);
        }
Esempio n. 2
0
        public static List <CommonTimeLog> GetCommonTimeLog(Guid organizationId, int departmentId, string type, int accountID,
                                                            int projectID, int techID, DateTime?start_date, DateTime?end_date, string timeZoneId)
        {
            int linkedFB          = -1;
            int invoiced          = -1;
            int billable          = -1;
            int linkedQB          = -1;
            int hiddenFromInvoice = -1;
            int onlyProjectTime   = -1;

            switch (type)
            {
            case "linked_fb":
                linkedFB = 1;
                break;

            case "unlinked_fb":
                linkedFB = 0;
                break;

            case "invoiced":
                invoiced = 1;
                break;

            case "not_invoiced":
                invoiced = 0;
                break;

            case "unlinked_fb_billable":
                linkedFB = 0;
                billable = 1;
                break;

            case "not_invoiced_billable":
                invoiced = 0;
                billable = 1;
                break;

            case "not_invoiced_nonbillable":
                invoiced = 0;
                billable = 0;
                break;

            case "hidden_from_invoice":
                hiddenFromInvoice = 1;
                break;

            case "linked_qb":
                linkedQB = 1;
                break;

            case "unlinked_qb":
                linkedQB = 0;
                break;

            case "unlinked_qb_billable":
                linkedQB = 0;
                billable = 1;
                break;

            case "no_ticket_assigned":
                onlyProjectTime = 1;
                break;
            }
            TimeZoneInfo userTimeZone = null;

            if (!string.IsNullOrEmpty(timeZoneId))
            {
                try
                {
                    userTimeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId);
                }
                catch { }
            }
            DataTable dtTimeLogs = bigWebApps.bigWebDesk.Data.Tickets.SelectTop100MostTimeLogs(organizationId, departmentId, linkedFB, invoiced, accountID, projectID,
                                                                                               techID, billable, linkedQB, hiddenFromInvoice, start_date, end_date, onlyProjectTime);

            if (userTimeZone != null)
            {
                foreach (DataRow row in dtTimeLogs.Rows)
                {
                    if (!row.IsNull("CreatedTime"))
                    {
                        row["CreatedTime"] = TimeZoneInfo.ConvertTimeFromUtc((DateTime)row["CreatedTime"], userTimeZone);
                    }
                    if (!row.IsNull("UpdatedTime"))
                    {
                        row["UpdatedTime"] = TimeZoneInfo.ConvertTimeFromUtc((DateTime)row["UpdatedTime"], userTimeZone);
                    }
                }
            }
            IEnumerable <CommonTimeLog> _commonTimeLog = new CommonTimeLogs(dtTimeLogs);
            var       commonTimeList     = _commonTimeLog.ToList();
            Hashtable htUserProfileImage = new Hashtable();

            foreach (CommonTimeLog ctl in commonTimeList)
            {
                if (!htUserProfileImage.Contains(ctl.UserEmail))
                {
                    htUserProfileImage.Add(ctl.UserEmail, ProfileImageProvider.GetImageUrl(ctl.UserEmail));
                }
                ctl.UserProfileImage = htUserProfileImage[ctl.UserEmail].ToString();
            }
            return(commonTimeList);
        }