private void FillData(string StartDate, string EndDate, string ListOfProductionLines) { try { Array.Clear(LastApprochmentInfo, 0, LastApprochmentInfo.Length); this.Cursor = Cursors.WaitCursor; this.radScheduler1.Appointments.Clear(); radScheduler1.Resources.Clear(); var persianCulture = new PersianCulture(); System.Threading.Thread.CurrentThread.CurrentCulture = persianCulture; System.Threading.Thread.CurrentThread.CurrentUICulture = persianCulture; SchedulerNavigatorLocalizationProvider.CurrentProvider = new CustomSchedulerNavigatorLocalizationProvider(); Color[] colors = new Color[] { Color.LightBlue, Color.LightBlue, Color.LightBlue, Color.LightBlue, Color.LightBlue, Color.LightBlue, Color.LightBlue, Color.LightBlue, Color.LightBlue }; if (LSTProrudtionLines1.CheckedItems.Count > 1) { BLL.Cls_PublicOperations.Dt = BllDeviceLine.GetAllResourceForShowSummeryCurrentState(ListOfProductionLines); for (int i = 0; i < BLL.Cls_PublicOperations.Dt.DefaultView.Count; i++) { Resource resource = new Resource(); resource.Id = new EventId(BLL.Cls_PublicOperations.Dt.DefaultView[i]["ProductLineId"].ToString()); resource.Name = BLL.Cls_PublicOperations.Dt.DefaultView[i]["GroupShowName"].ToString(); resource.Color = colors[rand.Next(0, 8)]; this.radScheduler1.Resources.Add(resource); LastApprochmentInfo[i, 0] = BLL.Cls_PublicOperations.Dt.DefaultView[i]["ProductLineId"].ToString(); } } else { BLL.Cls_PublicOperations.Dt = BllDeviceLine.GetDeviceLineByProductLineId(LSTProrudtionLines1.CheckedItems[0].Value.ToString()); for (int i = 0; i < BLL.Cls_PublicOperations.Dt.Rows.Count; i++) { Resource resource = new Resource(); resource.Id = new EventId(BLL.Cls_PublicOperations.Dt.DefaultView[i]["id"].ToString()); resource.Name = BLL.Cls_PublicOperations.Dt.DefaultView[i]["LineDesc"].ToString(); resource.Color = colors[0]; this.radScheduler1.Resources.Add(resource); LastApprochmentInfo[i, 0] = BLL.Cls_PublicOperations.Dt.DefaultView[i]["id"].ToString(); } } BLL.Cls_PublicOperations.Dt = BllClient.GetAllClientData(StartDate, EndDate, ListOfProductionLines); int totalHours; for (int i = 0; i < BLL.Cls_PublicOperations.Dt.DefaultView.Count; i++) { this.radScheduler1.Backgrounds.Add(new AppointmentBackgroundInfo(this.radScheduler1.Backgrounds.Count + 1, "test", Color.FromArgb(Convert.ToInt32(BLL.Cls_PublicOperations.Dt.DefaultView[i]["color"].ToString())))); totalHours = 0; totalHours = Convert.ToInt32(BLL.Cls_PublicOperations.Dt.DefaultView[i]["duration"].ToString()); // (DateTime.Parse(dt.DefaultView[i]["MiladiFinishDateTime"].ToString()) - DateTime.Parse(dt.DefaultView[i]["MiladiStartDateTime"].ToString())).TotalSeconds; DateTime Start = new DateTime(); DateTime end = new DateTime(); Start = DateTime.Parse(BLL.Cls_PublicOperations.Dt.DefaultView[i]["MiladiStartDateTime"].ToString()); end = DateTime.Parse(BLL.Cls_PublicOperations.Dt.DefaultView[i]["MiladiFinishDateTime"].ToString()); Appointment app = new Appointment(Start.AddSeconds(1), end, (Math.Round((double)totalHours / 60)).ToString()); app.StatusId = Convert.ToInt32(BLL.Cls_PublicOperations.Dt.DefaultView[i]["DeviceStateID"].ToString()); if (LSTProrudtionLines1.CheckedItems.Count > 1) { app.ResourceId = this.radScheduler1.Resources.GetById(BLL.Cls_PublicOperations.Dt.DefaultView[i]["ProductLineId"].ToString()).Id; } else { app.ResourceId = this.radScheduler1.Resources.GetById(BLL.Cls_PublicOperations.Dt.DefaultView[i]["id"].ToString()).Id; } app.BackgroundId = this.radScheduler1.Backgrounds[this.radScheduler1.Backgrounds.Count - 1].Id; if (BLL.Cls_PublicOperations.Dt.DefaultView[i]["color"].ToString() == "16777215") { app.Visible = false; } if (LSTProrudtionLines1.CheckedItems.Count > 1) { if (BLL.Cls_PublicOperations.Dt.DefaultView[i]["StateId"].ToString() == "0" && BLL.Cls_PublicOperations.Dt.DefaultView[i]["DeActiveStateForShowGroupOk"].ToString() == "False") { app.Visible = false; } if (BLL.Cls_PublicOperations.Dt.DefaultView[i]["StateId"].ToString() == "1" && BLL.Cls_PublicOperations.Dt.DefaultView[i]["ActiveStateForShowGroupOk"].ToString() == "False") { app.Visible = false; } } this.radScheduler1.Appointments.Add(app); if (LSTProrudtionLines1.CheckedItems.Count > 1) { var coordinates = LastApprochmentInfo.CoordinatesOf(BLL.Cls_PublicOperations.Dt.DefaultView[i]["ProductLineId"].ToString()); LastApprochmentInfo[coordinates.Item1, 1] = BLL.Cls_PublicOperations.Dt.DefaultView[i]["DeviceStateID"].ToString(); } else { var coordinates = LastApprochmentInfo.CoordinatesOf(BLL.Cls_PublicOperations.Dt.DefaultView[i]["id"].ToString()); LastApprochmentInfo[coordinates.Item1, 1] = BLL.Cls_PublicOperations.Dt.DefaultView[i]["DeviceStateID"].ToString(); } } this.radScheduler1.GroupType = GroupType.Resource; this.radScheduler1.ActiveViewType = SchedulerViewType.Timeline; this.radScheduler1.GetTimelineView().GroupSeparatorWidth = 0; this.radScheduler1.GetTimelineView().ResourcesPerView = this.radScheduler1.Resources.Count; this.radScheduler1.GetTimelineView().ShowTimescale(Timescales.Minutes); RadSchedulerLocalizationProvider.CurrentProvider = new CustomSchedulerLocalizationProvider(); if (IsFirstLoad == true) { IsFirstLoad = false; } TimelineGroupingByResourcesElement timelineElement = this.radScheduler1.SchedulerElement.ViewElement as TimelineGroupingByResourcesElement; SchedulerUIHelper.BringAppointmentIntoView(this.radScheduler1.Appointments[this.radScheduler1.Appointments.Count - 1], this.radScheduler1); timelineElement.ResourceHeaderWidth = 135; timelineElement.ResourcesHeader.TextOrientation = Orientation.Vertical; timelineElement.ResourcesHeader.Font = HeaderFont; this.Cursor = Cursors.Default; } catch (Exception E) { this.Cursor = Cursors.Default; } }