예제 #1
0
        protected void Button37_Click(object sender, EventArgs e)
        {
            BPersonMonthlyWorkedTime bus = new BPersonMonthlyWorkedTime(BUser.CurrentUser.Person.ID);

            bus.GetPersonGanttChart(1392, 1, "1391/12/21", "1392/01/20");
        }
        private void Fill_GanttChartMonthlyOperation_MonthlyOperationGanttChartSchema(LoadState LS, decimal PersonnelID, int Year, int Month, string FromDate, string ToDate)
        {
            string[] retMessage = new string[4];
            IList <PersonalMonthlyReportRow> PersonnelMonthlyOperationList = null;
            IList <TaskFeatures>             TaskFeaturesList        = new List <TaskFeatures>();
            Dictionary <string, Series>      AvailableGanttSeriesDic = new Dictionary <string, Series>();

            try
            {
                this.Clear_DataPointCollection_MonthlyOperationGanttChartSchema();

                if (Session["Year_MonthlyOperationGanttChartSchema"] != null)
                {
                    if ((int)Session["Year_MonthlyOperationGanttChartSchema"] != Year)
                    {
                        Session["MonthlyOperationSource_MonthlyOperationGanttChartSchema"] = null;
                    }
                }
                if (Session["Month_MonthlyOperationGanttChartSchema"] != null)
                {
                    if ((int)Session["Month_MonthlyOperationGanttChartSchema"] != Month)
                    {
                        Session["MonthlyOperationSource_MonthlyOperationGanttChartSchema"] = null;
                    }
                }

                switch (LS)
                {
                case LoadState.Manager:
                    break;

                case LoadState.Personnel:
                    PersonnelID = BUser.CurrentUser.Person.ID;
                    break;
                }

                BPersonMonthlyWorkedTime MonthlyOperationBusiness = new BPersonMonthlyWorkedTime(PersonnelID);

                if (Session["MonthlyOperationSource_MonthlyOperationGanttChartSchema"] == null)
                {
                    PersonnelMonthlyOperationList = MonthlyOperationBusiness.GetPersonGanttChart(Year, Month, FromDate, ToDate).Reverse().ToList();
                    Session.Add("MonthlyOperationSource_MonthlyOperationGanttChartSchema", PersonnelMonthlyOperationList);
                    Session.Add("Year_MonthlyOperationGanttChartSchema", Year);
                    Session.Add("Month_MonthlyOperationGanttChartSchema", Month);
                }
                else
                {
                    PersonnelMonthlyOperationList = (IList <PersonalMonthlyReportRow>)(Session["MonthlyOperationSource_MonthlyOperationGanttChartSchema"]);
                }

                this.SetAxisLables_MonthlyOperationGanttChartSchema(MonthlyOperationBusiness, PersonnelMonthlyOperationList.Reverse().ToList());

                IList <GanttChartSettingsProxy> GanttChartSettingsProxyList = this.GetGanttChartSettings_MonthlyOperationGanttChartSchema();
                for (int i = 1; i <= PersonnelMonthlyOperationList.Count; i++)
                {
                    foreach (GanttChartSettingsProxy ganttChartSettingsProxyItem in GanttChartSettingsProxyList)
                    {
                        if (ganttChartSettingsProxyItem.ViewState)
                        {
                            string ConceptType = "Pairly" + ganttChartSettingsProxyItem.ConceptTitle;
                            PersonalMonthlyReportRowDetail personalMonthlyReportRowDetail = ((PersonalMonthlyReportRowDetail)(typeof(PersonalMonthlyReportRow).GetProperty(ConceptType).GetValue(PersonnelMonthlyOperationList[i - 1], null)));
                            foreach (IPair pair in personalMonthlyReportRowDetail.Pairs)
                            {
                                if (pair.From != pair.To)
                                {
                                    string realFromTime = string.Empty;
                                    string realToTime   = string.Empty;
                                    double FromTime     = this.ConvertScaleByMin_MonthlyOperationGanttChartSchema(pair.From, out realFromTime);
                                    double ToTime       = this.ConvertScaleByMin_MonthlyOperationGanttChartSchema(pair.To, out realToTime);
                                    Series serie        = GanttChartMonthlyOperation_MonthlyOperationGanttChartSchema.Series[ganttChartSettingsProxyItem.ConceptTitle];
                                    serie.Points.AddXY(i, FromTime, ToTime);
                                    DataPointCollection dataPointCollection = serie.Points;

                                    this.SetConceptColor_MonthlyOperationGanttChartSchema(personalMonthlyReportRowDetail, serie);

                                    this.SetDataPointFeatures_MonthlyOperationGanttChartSchema(TaskFeaturesList, ConceptType, realFromTime, realToTime, PersonnelMonthlyOperationList[i - 1], personalMonthlyReportRowDetail, serie, dataPointCollection);

                                    if (!AvailableGanttSeriesDic.ContainsKey(ganttChartSettingsProxyItem.ConceptTitle))
                                    {
                                        AvailableGanttSeriesDic.Add(ganttChartSettingsProxyItem.ConceptTitle, serie);
                                    }
                                }
                            }
                        }
                    }

                    this.SetDataPointFeatures_MonthlyOperationGanttChartSchema(TaskFeaturesList);

                    this.SetAttributes_MonthlyOperationGanttChartSchema();

                    this.CustomizeGanttLegends_MonthlyOperationGanttChartSchema(AvailableGanttSeriesDic);
                }

                this.operationYearMonthProvider.SetOperationYearMonth(Year, Month);
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                this.ErrorHiddenField_MonthlyOperationGanttChartSchema.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                this.ErrorHiddenField_MonthlyOperationGanttChartSchema.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                this.ErrorHiddenField_MonthlyOperationGanttChartSchema.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
        }