예제 #1
0
        void colImplement_Clicked(object sender, MouseEventArgs e)
        {
            SelectedType = SelectedTypes.Implement;
            ColumnItem      col = (ColumnItem)sender;
            CustomImplement ci  = EntitySet.CustomImplements.First(n => n.Value == col.Text);

            if (e.Button == MouseButtons.Left)
            {
                Input.Text = ci.Value;
                Input.AutoAddToEntities = ci.AutoAddToEntities;
                Input.DisplayName       = "Base name:";

                if (Input.ShowDialog(this) == DialogResult.OK)
                {
                    if (col.Text != Input.Text)
                    {
                        ci.Value             = Input.Text;
                        ci.AutoAddToEntities = Input.AutoAddToEntities;
                        PopulateEntitiesGrid();
                    }
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                Point pt = this.PointToScreen(e.Location);
                SelectedImplement = col.Text;
                contextMenuStrip1.Show(pt);
            }
        }
예제 #2
0
        void colAttribute_Clicked(object sender, MouseEventArgs e)
        {
            SelectedType = SelectedTypes.Attribute;
            ColumnItem      col = (ColumnItem)sender;
            CustomAttribute ca  = EntitySet.CustomAttributes.First(a => a.RawName == col.Text);

            if (e.Button == MouseButtons.Left)
            {
                FormAttributeEditor form = new FormAttributeEditor(ca.RawName, ca.RawArgumentString, ca.AutoAddToEntities);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    if (col.Text != ca.RawName)
                    {
                        ca.RawName           = form.RawName;
                        ca.RawArgumentString = form.RawArgumentString;
                        ca.AutoAddToEntities = form.AutoAddToEntities;
                        PopulateEntitiesGrid();
                    }
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                Point pt = this.PointToScreen(e.Location);
                SelectedAttribute = col.Text;
                contextMenuStrip1.Show(pt);
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User _loggedUser = HttpContext.Current.Session["LoggedUser"] as User;

            if (!Page.IsPostBack)
            {
                DivGridSection.Visible = false;
                DivGridCrew.Visible    = false;
                DivGridDept.Visible    = false;
                DivGridEmp.Visible     = false;
                DivShiftGrid.Visible   = false;
                DivLocGrid.Visible     = false;
                DivTypeGrid.Visible    = false;
                ReportViewer1.Visible  = true;
                LoadGridViews();
                ReportViewer1.Width  = 1150;
                ReportViewer1.Height = 700;
                SelectedTypes.Clear();
                SelectedCrews.Clear();
                SelectedDepts.Clear();
                SelectedEmps.Clear();
                SelectedLocs.Clear();
                SelectedSections.Clear();
                SelectedShifts.Clear();
                RefreshLabels();
                LoadGridViews();
                DateTime dt = DateTime.Today.Date.AddDays(-1);
                if (GlobalVariables.DeploymentType == false)
                {
                    PathString = "/Reports/RDLC/DRDetailed.rdlc";
                }
                else
                {
                    PathString = "/WMS/Reports/RDLC/.rdlc";
                }
                List <ViewMultipleInOut> _View = new List <ViewMultipleInOut>();
                if (_loggedUser.ViewContractual == false && _loggedUser.ViewPermanentMgm == true && _loggedUser.ViewPermanentStaff == false)
                {
                    _View = context.ViewMultipleInOuts.Where(aa => aa.CompanyID == _loggedUser.CompanyID && (aa.TypeID == 7 || aa.TypeID == 27 || aa.TypeID == 28)).ToList();
                }
                else if (_loggedUser.ViewContractual == false && _loggedUser.ViewPermanentMgm == false && _loggedUser.ViewPermanentStaff == true)
                {
                    _View = context.ViewMultipleInOuts.Where(aa => aa.CompanyID == _loggedUser.CompanyID && (aa.TypeID == 2 || aa.TypeID == 3 || aa.TypeID == 9)).ToList();
                }
                else if (_loggedUser.ViewContractual == true && _loggedUser.ViewPermanentMgm == false && _loggedUser.ViewPermanentStaff == false)
                {
                    _View = context.ViewMultipleInOuts.Where(aa => aa.CatID != 2).ToList();
                }
                else
                {
                    _View = context.ViewMultipleInOuts.Where(aa => aa.CompanyID == _loggedUser.CompanyID).ToList();
                }
                LoadReport(PathString, _View);
            }
        }
        private void ListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (PART_ListBox.SelectedItem == null)
            {
                return;
            }

            if (SelectedTypes.Contains(PART_ListBox.SelectedItem))
            {
                SelectedTypes.Remove(PART_ListBox.SelectedItem as RosService.Configuration.Type);
            }
        }
        private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (PART_DataGrid.SelectedItem == null)
            {
                return;
            }

            if (!SelectedTypes.Contains(PART_DataGrid.SelectedItem))
            {
                SelectedTypes.Add(PART_DataGrid.SelectedItem as RosService.Configuration.Type);
            }
        }
예제 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CreateDatatable();
         DivGridSection.Visible = false;
         DivGridCrew.Visible    = false;
         DivGridDept.Visible    = false;
         DivGridEmp.Visible     = false;
         DivShiftGrid.Visible   = false;
         DivLocGrid.Visible     = false;
         DivTypeGrid.Visible    = false;
         ReportViewer1.Visible  = true;
         ReportViewer1.Width    = 1050;
         ReportViewer1.Height   = 700;
         SelectedTypes.Clear();
         SelectedCrews.Clear();
         SelectedDepts.Clear();
         SelectedEmps.Clear();
         SelectedLocs.Clear();
         SelectedSections.Clear();
         SelectedShifts.Clear();
         DivGridComapny.Visible = false;
         SelectedComps.Clear();
         RefreshLabels();
         LoadGridViews();
         string _period = DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString();
         if (GlobalVariables.DeploymentType == false)
         {
             PathString = "/Reports/RDLC/MLvApplication.rdlc";
         }
         else
         {
             PathString = "/WMS/Reports/RDLC/MLvApplication.rdlc";
         }
         User         LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
         QueryBuilder qb           = new QueryBuilder();
         string       query        = qb.MakeCustomizeQuery(LoggedInUser);
         //DataTable dt = qb.GetValuesfromDB("select * from EmpView " + query);
         DataTable      dt   = qb.GetValuesfromDB("select * from EmpView ");
         List <EmpView> _emp = dt.ToList <EmpView>();
         LoadReport(PathString, GetLV(_emp, DateTime.Now.Month));
     }
 }
예제 #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DivGridSection.Visible = false;
         DivGridCrew.Visible    = false;
         DivGridDept.Visible    = false;
         DivGridEmp.Visible     = false;
         DivShiftGrid.Visible   = false;
         DivLocGrid.Visible     = false;
         DivTypeGrid.Visible    = false;
         DivGridComapny.Visible = false;
         ReportViewer1.Visible  = true;
         LoadGridViews();
         ReportViewer1.Width  = 1080;
         ReportViewer1.Height = 700;
         SelectedTypes.Clear();
         SelectedCrews.Clear();
         SelectedDepts.Clear();
         SelectedEmps.Clear();
         SelectedLocs.Clear();
         SelectedComps.Clear();
         SelectedSections.Clear();
         SelectedShifts.Clear();
         RefreshLabels();
         LoadGridViews();
         DateTime date = DateTime.Today.Date.AddDays(-1);
         if (GlobalVariables.DeploymentType == false)
         {
             PathString = "/Reports/RDLC/DRDetailed.rdlc";
         }
         else
         {
             PathString = "/WMS/Reports/RDLC/DRDetailed.rdlc";
         }
         //List<ViewAttData> _View = new List<ViewAttData>();
         User               LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
         QueryBuilder       qb           = new QueryBuilder();
         string             query        = qb.MakeCustomizeQuery(LoggedInUser);
         DataTable          dt           = qb.GetValuesfromDB("select * from ViewAttData " + query + " and AttDate = '" + date.Date.Year.ToString() + "-" + date.Date.Month.ToString() + "-" + date.Date.Day.ToString() + "'");
         List <ViewAttData> _View        = dt.ToList <ViewAttData>();
         LoadReport(PathString, _View);
     }
 }
예제 #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DivGridSection.Visible = false;
         DivGridCrew.Visible    = false;
         DivGridDept.Visible    = false;
         DivGridEmp.Visible     = false;
         DivShiftGrid.Visible   = false;
         DivLocGrid.Visible     = false;
         DivTypeGrid.Visible    = false;
         ReportViewer1.Visible  = true;
         ReportViewer1.Width    = 1050;
         ReportViewer1.Height   = 700;
         SelectedTypes.Clear();
         SelectedCrews.Clear();
         SelectedDepts.Clear();
         SelectedEmps.Clear();
         SelectedLocs.Clear();
         SelectedSections.Clear();
         SelectedShifts.Clear();
         DivGridComapny.Visible = false;
         SelectedComps.Clear();
         RefreshLabels();
         LoadGridViews();
         string _period = DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString();
         if (GlobalVariables.DeploymentType == false)
         {
             PathString = "/Reports/RDLC/MRDetailExcelP.rdlc";
         }
         else
         {
             PathString = "/WMS/Reports/RDLC/MRDetailExcelP.rdlc";
         }
         List <ViewMonthlyDataPer> _ViewList = new List <ViewMonthlyDataPer>();
         User         LoggedInUser           = HttpContext.Current.Session["LoggedUser"] as User;
         QueryBuilder qb    = new QueryBuilder();
         string       query = qb.MakeCustomizeQuery(LoggedInUser);
         DataTable    dt    = qb.GetValuesfromDB("select * from ViewMonthlyDataPer " + query + " and Period='" + _period + "'");
         _ViewList = dt.ToList <ViewMonthlyDataPer>();
         LoadReport(PathString, _ViewList);
     }
 }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                DivGridSection.Visible = false;
                DivGridCrew.Visible    = false;
                DivGridDept.Visible    = false;
                DivGridEmp.Visible     = false;
                DivShiftGrid.Visible   = false;
                DivLocGrid.Visible     = false;
                DivTypeGrid.Visible    = false;
                ReportViewer1.Visible  = true;
                DivGridComapny.Visible = false;
                SelectedComps.Clear();
                ReportViewer1.Width  = 1050;
                ReportViewer1.Height = 700;
                SelectedTypes.Clear();
                SelectedCrews.Clear();
                SelectedDepts.Clear();
                SelectedEmps.Clear();
                SelectedLocs.Clear();
                SelectedSections.Clear();
                SelectedShifts.Clear();
                RefreshLabels();
                LoadGridViews();
                DateTime dateTo   = DateTime.Today.Date.AddDays(-1);
                DateTime dateFrom = DateTime.Today.Date.AddDays(-20);
                if (GlobalVariables.DeploymentType == false)
                {
                    PathString = "/Reports/RDLC/EmpAttSummary.rdlc";
                }
                else
                {
                    PathString = "/WMS/Reports/RDLC/EmpAttSummary.rdlc";
                }


                LoadReport(PathString, context.ViewPresentEmps.Where(aa => aa.AttDate >= dateFrom && aa.AttDate <= dateTo && aa.EmpID == 1).ToList());
            }
        }
예제 #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DivGridSection.Visible = false;
         DivGridCrew.Visible    = false;
         DivGridDept.Visible    = false;
         DivGridEmp.Visible     = false;
         DivShiftGrid.Visible   = false;
         DivLocGrid.Visible     = false;
         DivTypeGrid.Visible    = false;
         ReportViewer1.Visible  = true;
         ReportViewer1.Width    = 1050;
         ReportViewer1.Height   = 700;
         SelectedTypes.Clear();
         SelectedCrews.Clear();
         SelectedDepts.Clear();
         SelectedEmps.Clear();
         SelectedLocs.Clear();
         SelectedSections.Clear();
         SelectedShifts.Clear();
         RefreshLabels();
         LoadGridViews();
         if (GlobalVariables.DeploymentType == false)
         {
             PathString = "/Reports/RDLC/YLvConsumed.rdlc";
         }
         else
         {
             PathString = "/WMS/Reports/RDLC/YLvConsumed.rdlc";
         }
         User                  LoggedInUser = HttpContext.Current.Session["LoggedUser"] as User;
         QueryBuilder          qb           = new QueryBuilder();
         string                query        = qb.MakeCustomizeQuery(LoggedInUser);
         DataTable             dt           = qb.GetValuesfromDB("select * from ViewLvConsumed " + query);
         List <ViewLvConsumed> _ViewList    = dt.ToList <ViewLvConsumed>();
         LoadReport(PathString, _ViewList);
     }
 }
예제 #11
0
        void colMethod_Clicked(object sender, MouseEventArgs e)
        {
            SelectedType = SelectedTypes.Function;
            ColumnItem     col = (ColumnItem)sender;
            CustomFunction cm  = EntitySet.CustomFunctions.First(n => n.Name == col.Text);

            if (e.Button == MouseButtons.Left)
            {
                FormCodeInput.FillData(cm);

                if (FormCodeInput.ShowDialog(this) == DialogResult.OK)
                {
                    PopulateEntitiesGrid();
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                Point pt = this.PointToScreen(e.Location);
                SelectedFunction = col.Text;
                contextMenuStrip1.Show(pt);
            }
        }
예제 #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DivGridSection.Visible = false;
         DivGridCrew.Visible    = false;
         DivGridDept.Visible    = false;
         DivGridEmp.Visible     = false;
         DivShiftGrid.Visible   = false;
         DivLocGrid.Visible     = false;
         DivTypeGrid.Visible    = false;
         ReportViewer1.Visible  = true;
         ReportViewer1.Width    = 1050;
         ReportViewer1.Height   = 700;
         SelectedTypes.Clear();
         SelectedCrews.Clear();
         SelectedDepts.Clear();
         SelectedEmps.Clear();
         SelectedLocs.Clear();
         SelectedSections.Clear();
         SelectedShifts.Clear();
         DivGridComapny.Visible = false;
         SelectedComps.Clear();
         LoadGridViews();
         RefreshLabels();
         string _period = DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString();
         if (GlobalVariables.DeploymentType == false)
         {
             PathString = "/Reports/RDLC/MRSheetC.rdlc";
         }
         else
         {
             PathString = "/WMS/Reports/RDLC/MRSheetC.rdlc";
         }
         LoadReport(PathString, context.ViewMonthlyDatas.Where(aa => aa.Period == _period).ToList());
     }
 }
예제 #13
0
        void colProperty_Clicked(object sender, MouseEventArgs e)
        {
            SelectedType = SelectedTypes.Property;
            ColumnItem col = (ColumnItem)sender;
            CustomProperty cp = EntitySet.CustomProperties.First(n => n.Name == col.Text);

            if (e.Button == MouseButtons.Left)
            {
                FormCodeInput.FillData(cp);

                if (FormCodeInput.ShowDialog(this) == DialogResult.OK)
                    PopulateEntitiesGrid();
            }
            else if (e.Button == MouseButtons.Right)
            {
                Point pt = this.PointToScreen(e.Location);
                SelectedProperty = col.Text;
                contextMenuStrip1.Show(pt);
            }
        }
        private void Window_Complite(object sender, EventArgs e)
        {
            var domains = null as IEnumerable <string>;

            //if (IsВсеДомены.IsChecked.Value)
            //    domains = СписокДоменов.Where(p => p != RosService.Client.Domain);
            //else
            //domains = new string[] { RosService.Client.Domain };
            domains = КопироватьВыбранные.ToArray();


            //var _Тип = ""; //Тип.SelectedValue as string;
            var _Домен = Домен.Text;

            if (string.IsNullOrEmpty(_Домен))
            {
                MessageBox.Show("Не указана база данных");
                return;
            }

            //var _IsКопироватьВ = IsКопироватьВ.IsChecked.Value ? Convert.ToString(КопироватьВТип.SelectedValue) : null;
            var _УсловиеКопирования = УсловияКопирования.НеОпределено;

            if (IsАтрибуты.IsChecked.Value)
            {
                _УсловиеКопирования |= УсловияКопирования.Атрибуты;
            }
            if (IsШаблон.IsChecked.Value)
            {
                _УсловиеКопирования |= УсловияКопирования.Шаблон;
            }
            if (IsИсходныйКод.IsChecked.Value)
            {
                _УсловиеКопирования |= УсловияКопирования.ИсходныйКод;
            }
            if (IsЗначенияПоУмолчанию.IsChecked.Value)
            {
                _УсловиеКопирования |= УсловияКопирования.ЗначенияПоУмолчанию;
            }
            if (IsИконка.IsChecked.Value)
            {
                _УсловиеКопирования |= УсловияКопирования.Иконка;
            }
            if (IsВсеДомены.IsChecked.Value)
            {
                _УсловиеКопирования |= УсловияКопирования.ВсеДомены;
            }

            var log = new List <string>();

            this.Window.IsEnabledComplite = false;
            //ThreadPool.QueueUserWorkItem((WaitCallback)delegate
            var types = SelectedTypes.Select(p => p.Name).ToArray();

            System.Threading.Tasks.Task.Factory.StartNew(() =>
            {
                try
                {
                    using (RosService.Client client = new RosService.Client(TimeSpan.FromMinutes(1)))
                    {
                        foreach (var item in domains)
                        {
                            try
                            {
                                foreach (var type in types)
                                {
                                    var s = DateTime.Now;
                                    try
                                    {
                                        log.Insert(0, string.Format("{0} - start", item));

                                        client.Конфигуратор.КопироватьТипДанных(
                                            type,
                                            _Домен,
                                            type, //_IsКопироватьВ,
                                            item,
                                            _УсловиеКопирования,
                                            client.Пользователь,
                                            item);

                                        log.Insert(0, string.Format("{0} - end - {1}", item, DateTime.Now - s));
                                    }
                                    catch
                                    {
                                        log.Insert(0, string.Format("{0} - error - {1}", item, DateTime.Now - s));
                                    }
                                    finally
                                    {
                                        this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
                                        {
                                            ItemsSource = null;
                                            ItemsSource = log;
                                        });
                                    }
                                }
                            }
                            finally
                            {
                                this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
                                {
                                    КопироватьВыбранные.Remove(item);
                                });
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) delegate
                    {
                        foreach (var item in SelectedTypes)
                        {
                            RosControl.UI.Application.Clear(item.Name);
                        }

                        this.Window.IsEnabledComplite = true;
                        DialogResult = true;
                    });
                }
            });
        }
예제 #15
0
        void colAttribute_Clicked(object sender, MouseEventArgs e)
        {
            SelectedType = SelectedTypes.Attribute;
            ColumnItem col = (ColumnItem)sender;
            CustomAttribute ca = EntitySet.CustomAttributes.First(a => a.RawName == col.Text);

            if (e.Button == MouseButtons.Left)
            {
                FormAttributeEditor form = new FormAttributeEditor(ca.RawName, ca.RawArgumentString, ca.AutoAddToEntities);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    if (col.Text != ca.RawName)
                    {
                        ca.RawName = form.RawName;
                        ca.RawArgumentString = form.RawArgumentString;
                        ca.AutoAddToEntities = form.AutoAddToEntities;
                        PopulateEntitiesGrid();
                    }
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                Point pt = this.PointToScreen(e.Location);
                SelectedAttribute = col.Text;
                contextMenuStrip1.Show(pt);
            }
        }
예제 #16
0
        private FrameworkElement CreateControl()
        {
            if (grid != null)
            {
                return(grid);
            }

            grid = new Grid {
                VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(Left, Top, 0, 0)
            };

            grid.ColumnDefinitions.Add(new ColumnDefinition       {
                Width = new GridLength()
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition       {
                Width = new GridLength()
            });
            grid.RowDefinitions.Add(new RowDefinition          {
                Height = new GridLength()
            });

            Brush background  = Application.Current.FindResource("BackgroundMainWindow")      as Brush ?? Brushes.White;
            Brush borderBrush = Application.Current.FindResource("BorderThinBrush")           as Brush ?? Brushes.Black;

            Grid g = new Grid();

            g.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(2, GridUnitType.Star)
            });
            g.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            g.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(2, GridUnitType.Star)
            });

            for (int r = 0; r < g.RowDefinitions.Count; r++)
            {
                System.Windows.Shapes.Ellipse e = new System.Windows.Shapes.Ellipse
                {
                    Width  = 3,
                    Height = 3,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Fill = borderBrush
                };
                Grid.SetRow(e, r);
                g.Children.Add(e);
            }

            b = new Border
            {
                VerticalAlignment = VerticalAlignment.Top,
                BorderThickness   = new Thickness(0, 1, 1, 1),
                BorderBrush       = borderBrush,
                Background        = background,
                Width             = 12,
                Height            = 24,
                Cursor            = System.Windows.Input.Cursors.Hand,
                Child             = g
            };

            b.MouseDown += (o, e) =>
            {
                startPoint = e.GetPosition(ChartPanel);
                margin     = grid.Margin;
                if (e.ClickCount > 1)
                {
                    b.ReleaseMouseCapture();
                    ChartControl.OnIndicatorsHotKey(this, null);
                }
                else
                {
                    b.CaptureMouse();
                }
            };

            b.MouseUp += (o, e) => { b.ReleaseMouseCapture(); };

            b.MouseMove += (o, e) =>
            {
                if (!b.IsMouseCaptured || grid == null || ChartPanel == null)
                {
                    return;
                }

                Point newPoint = e.GetPosition(ChartPanel);
                grid.Margin = new Thickness {
                    Left = Math.Max(0, Math.Min(margin.Left + (newPoint.X - startPoint.X), ChartPanel.ActualWidth - grid.ActualWidth)),
                    Top  = Math.Max(0, Math.Min(margin.Top + (newPoint.Y - startPoint.Y), ChartPanel.ActualHeight - grid.ActualHeight))
                };

                Left = grid.Margin.Left;
                Top  = grid.Margin.Top;
            };

            Grid.SetColumn(b, 1);

            grid.Children.Add(b);

            Grid            contentGrid = new Grid();
            List <XElement> elements    = SortElements(XElement.Parse(SelectedTypes.ToString()));
            int             column      = 0;
            int             count       = 0;
            FontFamily      fontFamily  = Application.Current.Resources["IconsFamily"] as FontFamily;
            Style           style       = Application.Current.Resources["LinkButtonStyle"] as Style;

            //ToolBar tb = new ToolBar();

            while (count < elements.Count)
            {
                if (contentGrid.ColumnDefinitions.Count <= column)
                {
                    contentGrid.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    });
                }
                for (int j = 0; j < NumberOfRows && count < elements.Count; j++)
                {
                    if (contentGrid.RowDefinitions.Count <= j)
                    {
                        contentGrid.RowDefinitions.Add(new RowDefinition {
                            Height = new GridLength(1, GridUnitType.Auto)
                        });
                    }
                    XElement element = elements[count];
                    try
                    {
                        DrawingTools.DrawingTool dt = Core.Globals.AssemblyRegistry[element.Attribute("Assembly").Value].CreateInstance(element.Name.ToString()) as DrawingTools.DrawingTool;
                        if (dt != null && dt.DisplayOnChartsMenus)
                        {
                            Button bb = new Button
                            {
                                Content    = dt.Icon ?? Gui.Tools.Icons.DrawPencil,
                                ToolTip    = dt.DisplayName,
                                Style      = style,
                                FontFamily = fontFamily,
                                FontSize   = 16,
                                FontStyle  = FontStyles.Normal,
                                Margin     = new Thickness(3),
                                Padding    = new Thickness(3)
                            };

                            Grid.SetRow(bb, j);
                            Grid.SetColumn(bb, column);

                            bb.Click += (sender, args) =>
                            {
                                if (ChartControl != null)
                                {
                                    ChartControl.TryStartDrawing(dt.GetType().FullName);
                                }
                            };

                            contentGrid.Children.Add(bb);
                            //tb.Items.Add(bb);
                            count++;
                        }
                        else
                        {
                            elements.RemoveAt(j);
                            j--;
                        }
                    }
                    catch (Exception e)
                    {
                        elements.RemoveAt(j);
                        j--;
                        Cbi.Log.Process(typeof(Custom.Resource), "NinjaScriptTileError", new object[] { element.Name.ToString(), e }, LogLevel.Error, LogCategories.NinjaScript);
                    }
                }
                column++;
            }

            Border tileHolder = new Border
            {
                Cursor          = System.Windows.Input.Cursors.Arrow,
                Background      = Application.Current.FindResource("BackgroundMainWindow") as Brush,
                BorderThickness = new Thickness((double)(Application.Current.FindResource("BorderThinThickness") ?? 1)),
                BorderBrush     = Application.Current.FindResource("BorderThinBrush") as Brush,
                Child           = contentGrid
            };

            grid.Children.Add(tileHolder);

            if (IsVisibleOnlyFocused)
            {
                Binding binding = new Binding("IsActive")
                {
                    Source = ChartControl.OwnerChart, Converter = Application.Current.FindResource("BoolToVisConverter") as IValueConverter
                };
                grid.SetBinding(UIElement.VisibilityProperty, binding);
            }

            return(grid);
        }
예제 #17
0
        public async Task <List <LookupModel> > GetAgencyPurchaseMethodsModels(string agencyCode)
        {
            string     agencyPurchaseMethods = _context.GovAgencies.Where(a => a.AgencyCode == agencyCode).Select(a => a.PurchaseMethods).FirstOrDefault();
            List <int> SelectedTypes;

            if (!string.IsNullOrEmpty(agencyPurchaseMethods))
            {
                SelectedTypes = agencyPurchaseMethods.Split(',').Where(a => int.Parse(a) != (int)Enums.TenderType.SecondStageTender && int.Parse(a) != (int)Enums.TenderType.PreQualification && int.Parse(a) != (int)Enums.TenderType.PostQualification).AsEnumerable().Select(r => int.Parse(r)).ToList();
            }
            else
            {
                SelectedTypes = new List <int>()
                {
                    (int)Enums.TenderType.CurrentTender, (int)Enums.TenderType.CurrentDirectPurchase, (int)Enums.TenderType.NationalTransformationProjects
                };
            }
            List <LookupModel> SelectedTenderTypes = await _context.TenderTypes.Where(t => SelectedTypes.Contains(t.TenderTypeId))
                                                     .Select(d => new LookupModel
            {
                Id   = d.TenderTypeId,
                Name = d.NameAr
            }).ToListAsync();

            return(SelectedTenderTypes);
        }
예제 #18
0
        void colNamespace_Clicked(object sender, MouseEventArgs e)
        {
            SelectedType = SelectedTypes.Namespace;
            ColumnItem col = (ColumnItem)sender;
            CustomNamespace ns = EntitySet.CustomNamespaces.First(n => n.Value == col.Text);

            if (e.Button == MouseButtons.Left)
            {
                Input.Text = ns.Value;
                Input.AutoAddToEntities = ns.AutoAddToEntities;
                Input.DisplayName = "Namespace:";

                if (Input.ShowDialog(this) == DialogResult.OK)
                {
                    if (col.Text != Input.Text)
                    {
                        ns.Value = Input.Text;
                        ns.AutoAddToEntities = Input.AutoAddToEntities;
                        PopulateEntitiesGrid();
                    }
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                Point pt = this.PointToScreen(e.Location);
                SelectedNamespace = col.Text;
                contextMenuStrip1.Show(pt);
            }
        }