Пример #1
0
        public Dictionary <string, string> ToDictionary()
        {
            var options = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(FaxNumber))
            {
                options.Add("faxNumber", FaxNumber);
            }
            if (!string.IsNullOrEmpty(Contact))
            {
                options.Add("contact", Contact);
            }
            if (PostponeTime.HasValue)
            {
                options.Add("postponeTime", PostponeTime.Value.ToString("s") + "Z");
            }
            if (RetriesToPerform != null)
            {
                options.Add("retriesToPerform", RetriesToPerform.ToString());
            }
            if (!string.IsNullOrEmpty(Csid))
            {
                options.Add("csid", Csid);
            }
            if (!string.IsNullOrEmpty(PageHeader))
            {
                options.Add("pageHeader", PageHeader);
            }
            if (!string.IsNullOrEmpty(Reference))
            {
                options.Add("reference", Reference);
            }
            if (!string.IsNullOrEmpty(ReplyAddress))
            {
                options.Add("replyAddress", ReplyAddress);
            }
            if (PageSize.HasValue)
            {
                options.Add("pageSize", PageSize.ToCamelCase());
            }
            if (ShouldScale.HasValue)
            {
                options.Add("fitToPage", ShouldScale.Value? "scale" : "noscale");
            }
            if (PageOrientation.HasValue)
            {
                options.Add("pageOrientation", PageOrientation.ToCamelCase());
            }
            if (PageResolution.HasValue)
            {
                options.Add("resolution", PageResolution.ToCamelCase());
            }
            if (PageRendering.HasValue)
            {
                options.Add("rendering", PageRendering.ToCamelCase());
            }
            return(options);
        }
Пример #2
0
        public static int GetPageCount( PageInfoCollection pages, PageResolution res, DateTime min, DateTime max )
        {
            int count = 0;

            for ( int i = 0; i < pages.Count; ++i )
            {
                if ( res != PageResolution.None && pages[i].Resolution != res )
                    continue;

                DateTime ts = pages[i].TimeResolved;

                if ( ts >= min && ts < max )
                    ++count;
            }

            return count;
        }
Пример #3
0
        public PageResolution GetResolution(out string resolvedBy, out DateTime timeResolved)
        {
            for (int i = m_Responses.Count - 1; i >= 0; --i)
            {
                ResponseInfo   resp = m_Responses[i];
                PageResolution res  = ResFromResp(resp.Message);

                if (res != PageResolution.None)
                {
                    resolvedBy   = resp.SentBy;
                    timeResolved = resp.TimeStamp;
                    return(res);
                }
            }

            resolvedBy   = m_SentBy;
            timeResolved = m_TimeSent;
            return(PageResolution.None);
        }
Пример #4
0
        public void UpdateResolver()
        {
            string         resolvedBy;
            DateTime       timeResolved;
            PageResolution res = GetResolution(out resolvedBy, out timeResolved);

            if (m_History != null && IsStaffResolution(res))
            {
                Resolver = m_History.GetStaffInfo(resolvedBy);
            }
            else
            {
                Resolver = null;
            }

            m_ResolvedBy   = resolvedBy;
            m_TimeResolved = timeResolved;
            m_Resolution   = res;
        }
Пример #5
0
        public void UpdateResolver()
        {
            string         resolvedBy;
            DateTime       timeResolved;
            PageResolution res = this.GetResolution(out resolvedBy, out timeResolved);

            if (this.m_History != null && this.IsStaffResolution(res))
            {
                this.Resolver = this.m_History.GetStaffInfo(resolvedBy);
            }
            else
            {
                this.Resolver = null;
            }

            this.m_ResolvedBy   = resolvedBy;
            this.m_TimeResolved = timeResolved;
            this.m_Resolution   = res;
        }
Пример #6
0
        public static int GetPageCount(PageInfoCollection pages, PageResolution res, DateTime min, DateTime max)
        {
            int count = 0;

            for (int i = 0; i < pages.Count; ++i)
            {
                if (res != PageResolution.None && pages[i].Resolution != res)
                {
                    continue;
                }

                DateTime ts = pages[i].TimeResolved;

                if (ts >= min && ts < max)
                {
                    ++count;
                }
            }

            return(count);
        }
Пример #7
0
		public bool IsStaffResolution( PageResolution res )
		{
			return ( res == PageResolution.Handled );
		}
Пример #8
0
		public void UpdateResolver()
		{
			string resolvedBy;
			DateTime timeResolved;
			PageResolution res = GetResolution( out resolvedBy, out timeResolved );

			if ( m_History != null && IsStaffResolution( res ) )
				Resolver = m_History.GetStaffInfo( resolvedBy );
			else
				Resolver = null;

			m_ResolvedBy = resolvedBy;
			m_TimeResolved = timeResolved;
			m_Resolution = res;
		}
Пример #9
0
        private BarGraph GraphHourlyPages(PageInfoCollection pages, PageResolution res, string title, string fname)
        {
            int[] totals = new int[24];
            int[] counts = new int[24];

            DateTime[] dates = new DateTime[24];

            DateTime max = DateTime.UtcNow;
            DateTime min = max - TimeSpan.FromDays(7.0);

            bool sentStamp = (res == PageResolution.None);

            for (int i = 0; i < pages.Count; ++i)
            {
                if (res != PageResolution.None && pages[i].Resolution != res)
                {
                    continue;
                }

                DateTime ts = (sentStamp ? pages[i].TimeSent : pages[i].TimeResolved);

                if (ts >= min && ts < max)
                {
                    DateTime date = ts.Date;
                    TimeSpan time = ts.TimeOfDay;

                    int hour = time.Hours;

                    totals[hour]++;

                    if (dates[hour] != date)
                    {
                        counts[hour]++;
                        dates[hour] = date;
                    }
                }
            }

            BarGraph barGraph = new BarGraph(title, fname, 10, "Time", "Pages", BarGraphRenderMode.Lines)
            {
                FontSize = 6
            };

            for (int i = 7; i <= totals.Length + 7; ++i)
            {
                int val;

                if (counts[i % totals.Length] == 0)
                {
                    val = 0;
                }
                else
                {
                    val = (totals[i % totals.Length] + (counts[i % totals.Length] / 2)) / counts[i % totals.Length];
                }

                int realHours = i % totals.Length;
                int hours;

                if (realHours == 0)
                {
                    hours = 12;
                }
                else if (realHours > 12)
                {
                    hours = realHours - 12;
                }
                else
                {
                    hours = realHours;
                }

                barGraph.Items.Add(hours + (realHours >= 12 ? " PM" : " AM"), val);
            }

            return(barGraph);
        }
Пример #10
0
		private BarGraph GraphHourlyPages( PageInfoCollection pages, PageResolution res, string title, string fname )
		{
			int[] totals = new int[24];
			int[] counts = new int[24];
			
			DateTime[] dates = new DateTime[24];

			DateTime max = DateTime.UtcNow;
			DateTime min = max - TimeSpan.FromDays( 7.0 );

			bool sentStamp = ( res == PageResolution.None );

			for ( int i = 0; i < pages.Count; ++i )
			{
				if ( res != PageResolution.None && pages[i].Resolution != res )
					continue;

				DateTime ts = ( sentStamp ? pages[i].TimeSent : pages[i].TimeResolved );

				if ( ts >= min && ts < max )
				{
					DateTime date = ts.Date;
					TimeSpan time = ts.TimeOfDay;

					int hour = time.Hours;

					totals[hour]++;

					if ( dates[hour] != date )
					{
						counts[hour]++;
						dates[hour] = date;
					}
				}
			}

			BarGraph barGraph = new BarGraph( title, fname, 10, "Time", "Pages", BarGraphRenderMode.Lines );

			barGraph.FontSize = 6;

			for ( int i = 7; i <= totals.Length+7; ++i )
			{
				int val;

				if ( counts[i%totals.Length] == 0 )
					val = 0;
				else
					val = (totals[i%totals.Length] + (counts[i%totals.Length] / 2)) / counts[i%totals.Length];

				int realHours = i%totals.Length;
				int hours;

				if ( realHours == 0 )
					hours = 12;
				else if ( realHours > 12 )
					hours = realHours - 12;
				else
					hours = realHours;

				barGraph.Items.Add( hours + (realHours >= 12 ? " PM" : " AM"), val );
			}

			return barGraph;
		}
Пример #11
0
 public bool IsStaffResolution(PageResolution res)
 {
     return(res == PageResolution.Handled);
 }
Пример #12
0
 public int GetPageCount(PageResolution res, DateTime min, DateTime max)
 {
     return StaffHistory.GetPageCount(this.m_Pages, res, min, max);
 }
Пример #13
0
 public int GetPageCount(PageResolution res, DateTime min, DateTime max)
 {
     return(StaffHistory.GetPageCount(m_Pages, res, min, max));
 }
Пример #14
0
 private void SetPageResolution(ControllerContext filterContext, PageResolution pageResolution)
 {
     filterContext.Controller.ViewBag.PageResolution = PageResolution.Retrieved;
 }
Пример #15
0
        /// <summary>
        /// For placing images you want to get the optimal pixelresolution for a certain size
        /// This method calculates the Pixel Size which would be the optimum regarding the default printers' resolution
        /// </summary>
        /// <param name="MM">mm size of image you want to put on a canvas</param>
        /// <returns>pixel size needed to optimally use the printers resolution</returns>
        public static Size MM2PixelsDefaultDPI(Size MM)
        {
            PageResolution pr = GetDefaultPrinterQueue().UserPrintTicket.PageResolution;

            return(new Size((int)((MM.Width / 25.4) * (double)pr.X), (int)((MM.Height / 25.4) * (double)pr.Y)));
        }
Пример #16
0
        public void UpdateResolver()
        {
            string resolvedBy;
            DateTime timeResolved;
            PageResolution res = this.GetResolution(out resolvedBy, out timeResolved);

            if (this.m_History != null && this.IsStaffResolution(res))
                this.Resolver = this.m_History.GetStaffInfo(resolvedBy);
            else
                this.Resolver = null;

            this.m_ResolvedBy = resolvedBy;
            this.m_TimeResolved = timeResolved;
            this.m_Resolution = res;
        }