Exemplo n.º 1
0
        /// <summary>
        /// Appointment Grid Refresh
        /// </summary>
        protected void OnAppointmentGridRefresh(object sender, StoreRefreshDataEventArgs e)
        {
            try {
                var start = Int32.Parse(e.Parameters["start"]);
                var limit = Int32.Parse(e.Parameters["limit"]);
                var end   = start + limit;
                var data  = new List <object>(limit);

                var cacheKey = WebUtility.GetCacheKeyName(UserData, "appointments");
                var datas    = HttpRuntime.Cache[cacheKey] as List <AppointmentInfo>;
                if (datas == null)
                {
                    datas = AddDataToCache();
                }
                if (datas != null && datas.Count > 0)
                {
                    if (end > datas.Count)
                    {
                        end = datas.Count;
                    }
                    for (int i = start; i < end; i++)
                    {
                        data.Add(new {
                            Index        = i + 1,
                            LscID        = datas[i].LscID,
                            LscName      = datas[i].LscName,
                            Id           = datas[i].Id,
                            StartTime    = WebUtility.GetDateString(datas[i].StartTime),
                            EndTime      = WebUtility.GetDateString(datas[i].EndTime),
                            LscIncluded  = datas[i].LscIncluded == WebUtility.DefaultInt32 ? "N" : datas[i].LscIncluded.ToString(),
                            StaIncluded  = datas[i].StaIncluded,
                            DevIncluded  = datas[i].DevIncluded,
                            ProjectId    = datas[i].ProjectId,
                            ProjectName  = datas[i].ProjectName,
                            Creater      = datas[i].Creater,
                            ContactPhone = datas[i].ContactPhone,
                            CreatedTime  = WebUtility.GetDateString(datas[i].CreatedTime)
                        });
                    }
                }

                e.Total = (datas != null ? datas.Count : 0);
                AppointmentGridStore.DataSource = data;
                AppointmentGridStore.DataBind();
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Appointment Grid Refresh
        /// </summary>
        protected void OnAppointmentGridRefresh(object sender, StoreRefreshDataEventArgs e)
        {
            try {
                var start = Int32.Parse(e.Parameters["start"]);
                var limit = Int32.Parse(e.Parameters["limit"]);
                var end   = start + limit;
                var data  = new List <object>(limit);

                var cacheKey = WebUtility.GetCacheKeyName(UserData, "project-report-entities");
                var datas    = HttpRuntime.Cache[cacheKey] as List <ProjectReportPageEntity>;
                if (datas == null)
                {
                    datas = AddDataToCache();
                }
                if (datas != null && datas.Count > 0)
                {
                    if (end > datas.Count)
                    {
                        end = datas.Count;
                    }
                    for (int i = start; i < end; i++)
                    {
                        data.Add(new {
                            Index                = i + 1,
                            LscID                = datas[i].Area.LscID,
                            LscName              = datas[i].Area.LscName,
                            Area1ID              = datas[i].Area.Area1ID,
                            Area1Name            = datas[i].Area.Area1Name,
                            Area2ID              = datas[i].Area.Area2ID,
                            Area2Name            = datas[i].Area.Area2Name,
                            Area3ID              = datas[i].Area.Area3ID,
                            Area3Name            = datas[i].Area.Area3Name,
                            ProjectCount         = datas[i].Projects.Count,
                            ProjectTime          = TimeSpan.FromSeconds(datas[i].Time).TotalMinutes,
                            ProjectException     = datas[i].ExProjects.Count,
                            ProjectExceptionRate = String.Format("{0:P2}", datas[i].Projects.Count > 0 ? (double)datas[i].ExProjects.Count / (double)datas[i].Projects.Count : 0)
                        });
                    }
                }

                e.Total = (datas != null ? datas.Count : 0);
                AppointmentGridStore.DataSource = data;
                AppointmentGridStore.DataBind();
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }