Esempio n. 1
0
        //note that if the interval id passed through is null, it returns the whole shift.
        public static Cycle[] SelectByInterval(
            string operation,
            DateTime dateOp,
            string shift,
            string tabKey,
            ProductionEntryInterval entryInterval,
            ColumnFilter[] filters,
            SortBy[] sortBy)
        {
            if (entryInterval == null)
            {
                return(Select(operation, dateOp, shift, tabKey, filters, sortBy));
            }

            using (var connection = Utility.GetConnection <Cycle> ()) {
                var list = new SelectAll <Cycle> ()
                           .WherePropertyEquals("Operation", operation)
                           .WherePropertyEquals("DateOp", dateOp)
                           .WherePropertyEquals("Shift", shift)
                           .WherePropertyBetween("DateTimeStart", entryInterval.IntervalStartUtc, entryInterval.IntervalEndUtc)
                           .WherePropertyEquals("DataEntryTab", tabKey)
                           .WherePropertyEquals("Datasource", DatasourceValidator.ManualEntry);

                ColumnFilter[] unknownFilters;
                GridHelpers.ApplyFiltersToSelectAll(list, new [] { new UnitHierarchyImplementation(new [] { operation }) }, filters, out unknownFilters);
                GridHelpers.ApplySortByToSelectAll(list, sortBy, "DateTimeModified");

                return(list.Execute(connection));
            }
        }
Esempio n. 2
0
        public void Visit(SelectAll all)
        {
            all.Parent.Parent.Children.Remove(all.Parent);

            var tableMatches = Scope.Current.FindAll();

            if (tableMatches.Length == 0) //only has a dynamic object and we can't tell the property names till runtime. Compile error.
            {
                Errors.Add(new SelectNoColumnsFound(new Semantic.LineInfo(all.Line.Line, all.Line.CharacterPosition)));
            }

            foreach (var match in tableMatches)
            {
                var tableReferance = new TableMemberReference {
                    Member       = match.TableVariable.Variable,
                    RowReference = new TableVariableRowReference {
                        Id = match.TableAlias
                    },
                    Line = all.Line
                };

                var arg = new SelectArg();
                arg.Children.Add(tableReferance);
                all.Parent.Parent.Children.Add(arg);
            }
        }
Esempio n. 3
0
        public static Cycle[] SelectByIntervalShift(
            string operation,
            ShiftInterval shiftInterval,
            string tabKey,
            ColumnFilter[] filters,
            SortBy[] sortBy)
        {
            using (var connection = Utility.GetConnection <Cycle> ()) {
                var list = new SelectAll <Cycle> ()
                           .WherePropertyEquals("Operation", operation)
                           .WherePropertyEquals("DateOp", shiftInterval.DateOp)
                           .WherePropertyEquals("Shift", shiftInterval.Shift)
                           .WherePropertyBetween("DateTimeStart", shiftInterval.GetIntervalStartTimeUtc(operation), shiftInterval.GetIntervalEndTimeUtc(operation))
                           .WherePropertyEquals("DataEntryTab", tabKey)
                           .WherePropertyEquals("Datasource", DatasourceValidator.ManualEntry);

                GridHelpers.ApplyFiltersToSelectAll(
                    list,
                    new [] {
                    new UnitHierarchyImplementation(new [] { operation })
                },
                    filters,
                    out ColumnFilter[] unknownFilters);

                GridHelpers.ApplySortByToSelectAll(list, sortBy, "DateTimeModified");

                return(list.Execute(connection));
            }
        }
        public void CanWriteSelectAllToJsonUsingNewtonsoftJsonConverter()
        {
            // Arrange
            SelectAll <Customer> selectAll = new SelectAll <Customer>();

            selectAll.Container = null;
            selectAll.Model     = _edmModel;
            selectAll.UseInstanceForProperties = true;
            selectAll.Instance = new Customer
            {
                Id       = 2,
                Name     = "abc",
                Location = new Address
                {
                    Street = "37TH PL",
                    City   = "Reond"
                }
            };

            JSelectExpandWrapperConverter converter = new JSelectExpandWrapperConverter();

            // Act
            string json = SerializeUtils.WriteJson(converter, selectAll);

            // Assert
            Assert.Equal("{\"Id\":2,\"Name\":\"abc\",\"Location\":{\"Street\":\"37TH PL\",\"City\":\"Reond\"}}", json);
        }
Esempio n. 5
0
        /// <summary>
        /// 构造一个 SelectAll 节点。
        /// </summary>
        /// <param name="table">如果本属性为空,表示选择所有数据源的所有属性;否则表示选择指定数据源的所有属性。</param>
        /// <returns></returns>
        public ISelectAll SelectAll(ITableSource table = null)
        {
            ISelectAll res = new SelectAll();

            res.Source = table;
            return(res);
        }
Esempio n. 6
0
        public void TestReturnObjectJson()
        {
            var logica = new EfDatabaseAutomation.Automation.SelectParametrSheme.LogicsSelectAutomation();

            logica.SelectUser = "******";
            var select = new SelectAll();
            //   var t = select.SqlModelAutomation<>(logica);
        }
Esempio n. 7
0
 private void NotifyCanExecuteChanged()
 {
     PlaySelected.NotifyCanExecuteChanged();
     SelectAll.NotifyCanExecuteChanged();
     StopSelected.NotifyCanExecuteChanged();
     DeleteSelected.NotifyCanExecuteChanged();
     ClearSelection.NotifyCanExecuteChanged();
     RemoveFinished.NotifyCanExecuteChanged();
 }
 private void m_contextMenuSelectAll_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(GetTileFilter()))
     {
         SelectAllWithFilter selCmd = new SelectAllWithFilter();
         selCmd.Filter = GetTileFilter();
         CommandExecuter.Instance.Execute(selCmd);
     }
     else
     {
         SelectAll selCmd = new SelectAll();
         CommandExecuter.Instance.Execute(selCmd);
     }
 }
        public void CanWriteSelectAllAndExpandToJsonUsingNewtonsoftJsonConverter()
        {
            // Arrange
            SelectAll <Order> expandOrder = new SelectAll <Order>();

            expandOrder.Model = _edmModel;
            expandOrder.UseInstanceForProperties = true;
            expandOrder.Instance = new Order
            {
                Id    = 21,
                Title = "new Order21"
            };

            SelectAllAndExpand <Customer> selectExpand = new SelectAllAndExpand <Customer>();
            MockPropertyContainer         container    = new MockPropertyContainer();

            container.Properties["Orders"]        = expandOrder; // expanded
            selectExpand.Container                = container;
            selectExpand.Model                    = _edmModel;
            selectExpand.UseInstanceForProperties = true;
            selectExpand.Instance                 = new Customer
            {
                Id       = 2,
                Name     = "abc",
                Location = new Address
                {
                    Street = "37TH PL",
                    City   = "Reond"
                }
            };

            JSelectExpandWrapperConverter converter = new JSelectExpandWrapperConverter();

            // Act
            string json = SerializeUtils.WriteJson(converter, selectExpand, true);

            // Assert
            Assert.Equal(@"{
  ""Orders"": {
    ""Id"": 21,
    ""Title"": ""new Order21""
  },
  ""Id"": 2,
  ""Name"": ""abc"",
  ""Location"": {
    ""Street"": ""37TH PL"",
    ""City"": ""Reond""
  }
}", json);
        }
Esempio n. 10
0
        public void Enumerate(Action <dynamic> yield)
        {
            WithConnection(
                c =>
            {
                var cmd = new SelectAll().Command(c);

                using (var reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        yield(new DynamicDataReader(reader));
                    }
                }
            }
                );
        }
Esempio n. 11
0
        public static Cycle[] SelectByPrimaryKey(DateTime dateTimestart, string operation, string loader, string hauler, string loaderOperatorId, string haulerOperatorId, string origin, string destination, string material, DateTime dateop)
        {
            using (var connection = Utility.GetConnection <Cycle> ()) {
                var list = new SelectAll <Cycle> ()
                           .WherePropertyEquals("Operation", operation)
                           .WherePropertyEquals("Loader", loader)
                           .WherePropertyEquals("Hauler", hauler)
                           .WherePropertyEquals("LoaderOperatorId", loaderOperatorId)
                           .WherePropertyEquals("HaulerOperatorId", haulerOperatorId)
                           .WherePropertyEquals("Origin", origin)
                           .WherePropertyEquals("Destination", destination)
                           .WherePropertyEquals("Material", material)
                           .WherePropertyEquals("DateOp", dateop);

                return(list.Execute(connection));
            }
        }
Esempio n. 12
0
        public void Enumerate(Action<dynamic> yield)
        {
            WithConnection(
                  c =>
                  {
                      var cmd = new SelectAll().Command(c);

                      using (var reader = cmd.ExecuteReader())
                      {
                          while (reader.Read())
                          {
                              yield(new DynamicDataReader(reader));
                          }
                      }
                  }
             );
        }
Esempio n. 13
0
        /// <summary>
        /// Выгрузка сводной таблицы по покупкам из таблицы ReportXlsx
        /// </summary>
        /// <param name="pathSaveReport">Путь сохранения</param>
        /// <param name="inn">ИНН</param>
        /// <returns></returns>
        public Stream GenerateSummarySales(string pathSaveReport, string inn)
        {
            DataSet dataReport            = new DataSet();
            var     selectProcedureReport = new SelectAll();
            var     reportModel           = selectProcedureReport.ReturnReportModelXlsx(1);
            var     fullPath = Path.Combine(pathSaveReport, reportModel.NameFile);

            dataReport.Tables.Add(selectProcedureReport.ReturnModelReport(reportModel, inn));
            selectProcedureReport.Dispose();
            if (dataReport.Tables[0] != null)
            {
                var xlsx = new ReportExcel();
                xlsx.ReportSaveFullDataSet(fullPath, dataReport);
                xlsx.Dispose();
                return(xlsx.DownloadFile(fullPath));
            }
            return(null);
        }
Esempio n. 14
0
        protected void SelectAll_CheckedChanged(object sender, EventArgs e)
        {
            List <int> a = GetSelectedTitles();

            if (!(sender is CheckBox))
            {
                return;
            }
            CheckBox Select = (CheckBox)sender;
            Control  sc     = Select.Parent;

            for (int i = 1; i <= 24; i++)
            {
                CheckBox cb = (CheckBox)sc.FindControl("Checkbox" + i);
                cb.Checked = Select.Checked;
            }
            SelectAll.Focus();
        }
Esempio n. 15
0
        /// <summary>
        ///  Функция анализа подстановки
        /// </summary>
        /// <param name="libraryAutomation">Библиотека автоматизации</param>
        /// <param name="modelKbk">Модель КБК</param>
        /// <param name="isTp">Проверка ТП</param>
        /// <returns>Bool есть ли такой КБК в БД для проверки группы</returns>
        private bool Status(LibraryAutomations libraryAutomation, ModelKbkOnKbk modelKbk, bool isTp)
        {
            string    status  = "01";
            SelectAll select  = new SelectAll();
            var       payment = select.SelectKbkGroup(modelKbk.KbkIfns);

            if (payment != null)
            {
                switch (payment.IdQbe)
                {
                case 1:
                    status = "13";
                    SendsStatus(IsSberbank(status, modelKbk), libraryAutomation);
                    break;

                case 2:
                    SendsTp(isTp, libraryAutomation, modelKbk);
                    break;

                case 3:
                    if (modelKbk.InnPayer.Length != 12)
                    {
                        SendsStatus(IsSberbank(status, modelKbk), libraryAutomation);
                        SendsTp(isTp, libraryAutomation, modelKbk);
                    }
                    else
                    {
                        status = "09";
                        SendsStatus(IsSberbank(status, modelKbk), libraryAutomation);
                        SendsTp(isTp, libraryAutomation, modelKbk);
                    }
                    break;

                case 4:
                    status = "02";
                    SendsStatus(IsSberbank(status, modelKbk), libraryAutomation);
                    SendsTp(isTp, libraryAutomation, modelKbk);
                    break;
                }
                modelKbk.StatusPayerUtcAfter = status;
                return(true);
            }
            return(false);
        }
Esempio n. 16
0
        public void CreateMainMenu(Gtk.Menu menu)
        {
            menu.Append(Undo.CreateAcceleratedMenuItem(Gdk.Key.Z, Gdk.ModifierType.ControlMask));

            ImageMenuItem redo = Redo.CreateAcceleratedMenuItem(Gdk.Key.Z, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask);

            redo.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.Y, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append(redo);

            menu.AppendSeparator();
            menu.Append(Cut.CreateAcceleratedMenuItem(Gdk.Key.X, Gdk.ModifierType.ControlMask));
            menu.Append(Copy.CreateAcceleratedMenuItem(Gdk.Key.C, Gdk.ModifierType.ControlMask));
            menu.Append(CopyMerged.CreateAcceleratedMenuItem(Gdk.Key.C, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
            menu.Append(Paste.CreateAcceleratedMenuItem(Gdk.Key.V, Gdk.ModifierType.ControlMask));
            menu.Append(PasteIntoNewLayer.CreateAcceleratedMenuItem(Gdk.Key.V, Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask));
            menu.Append(PasteIntoNewImage.CreateAcceleratedMenuItem(Gdk.Key.V, Gdk.ModifierType.Mod1Mask | Gdk.ModifierType.ControlMask));

            menu.AppendSeparator();
            menu.Append(SelectAll.CreateAcceleratedMenuItem(Gdk.Key.A, Gdk.ModifierType.ControlMask));

            ImageMenuItem deslect = Deselect.CreateAcceleratedMenuItem(Gdk.Key.A, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask);

            deslect.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.D, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append(deslect);

            menu.AppendSeparator();
            menu.Append(EraseSelection.CreateAcceleratedMenuItem(Gdk.Key.Delete, Gdk.ModifierType.None));
            menu.Append(FillSelection.CreateAcceleratedMenuItem(Gdk.Key.BackSpace, Gdk.ModifierType.None));
            menu.Append(InvertSelection.CreateAcceleratedMenuItem(Gdk.Key.I, Gdk.ModifierType.ControlMask));

            menu.AppendSeparator();
            Gtk.Action menu_action  = new Gtk.Action("Palette", Mono.Unix.Catalog.GetString("Palette"), null, null);
            Menu       palette_menu = (Menu)menu.AppendItem(menu_action.CreateSubMenuItem()).Submenu;

            palette_menu.Append(LoadPalette.CreateMenuItem());
            palette_menu.Append(SavePalette.CreateMenuItem());
            palette_menu.Append(ResetPalette.CreateMenuItem());
            palette_menu.Append(ResizePalette.CreateMenuItem());

            menu.AppendSeparator();
            menu.Append(AddinManager.CreateMenuItem());
        }
Esempio n. 17
0
        public void Visit(SelectAll all)
        {
            all.Parent.Parent.Children.Remove(all.Parent);

            var tableMatches = Scope.Current.FindAll();

            foreach (var match in tableMatches)
            {
                var tableReferance = new TableMemberReference {
                    Member       = match.TableVariable.Variable,
                    RowReference = new TableVariableRowReference {
                        Id = match.TableAlias
                    }
                };

                var arg = new SelectArg();
                arg.Children.Add(tableReferance);
                all.Parent.Parent.Children.Add(arg);
            }
        }
Esempio n. 18
0
        internal void Notifications()
        {
            //Click on Notification tab
            GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='account-profile-section']/div/div[1]/div[2]/div/div", 10000);
            ClickNotification.Click();

            //Click on See all
            GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "LinkText", "See All...", 10000);
            ClickSeeAll.Click();

            //Click on select all
            // Wait
            GlobalDefinitions.WaitForElementClickable(GlobalDefinitions.driver, "XPath", "//*[@id='notification-section']//" +
                                                      "div[last()-1]/div/div/div[3]/input", 1000);
            // GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//div[@data-tooltip='Select all']", 10000);
            SelectAll.Click();
            Thread.Sleep(1000);
            Base.test.Log(LogStatus.Info, "Successfully selected all notifications");

            //UnSelect All
            GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='notification-section']/div[2]/div/div/div[3]/div[1]/div[2]", 10000);
            UnSelectAll.Click();
            Base.test.Log(LogStatus.Info, "Successfully Unselected all notifications");

            //Select one
            GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='notification-section']/div[2]/div/div/div[3]/div[2]/span/span/div/div[1]/div/div/div[3]/input", 10000);
            SelectOne.Click();

            //Mark Selction as read
            GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='notification-section']/div[2]/div/div/div[3]/div[1]/div[4]", 10000);
            MarkSelection.Click();

            //Delete Notification
            GlobalDefinitions.WaitForElementVisibility(GlobalDefinitions.driver, "XPath", "//*[@id='notification-section']/div[2]/div/div/div[3]/div[1]/div[3]/i", 10000);
            Delete.Click();
            Thread.Sleep(2000);
            Base.test.Log(LogStatus.Info, "Delete notification successfull");
        }
Esempio n. 19
0
        public LayoutCheckWindowViewModel()
        {
            LoadedCommand.Subscribe(() => {
                using (var context = new NorthwindDbContext())
                {
                    Categories = new ObservableCollection <Category>(context.Categories.AsNoTracking().ToList());
                    CategoryPanelVisibility.Value = Visibility.Visible;
                    ProductListVisibility.Value   = Visibility.Collapsed;

                    RaisePropertyChanged(null);
                }
            });
            NavigateNext.Subscribe(() => {
                using (var context = new NorthwindDbContext())
                {
                    Products = new ObservableCollection <Product>(context.Products.Include(x => x.Category).Include(x => x.Supplier).Where(x => x.CategoryId == SelectedCategoryId.Value).AsNoTracking().ToList());
                    CategoryPanelVisibility.Value = Visibility.Collapsed;
                    ProductListVisibility.Value   = Visibility.Visible;

                    RaisePropertyChanged(null);
                }
            });
            SelectAll.Subscribe(() => {
                using (var context = new NorthwindDbContext())
                {
                    Products = new ObservableCollection <Product>(context.Products.Include(x => x.Category).Include(x => x.Supplier).AsNoTracking().ToList());
                    CategoryPanelVisibility.Value = Visibility.Collapsed;
                    ProductListVisibility.Value   = Visibility.Visible;

                    RaisePropertyChanged(null);
                }
            });
            ExitView2Command.Subscribe(() => {
                CategoryPanelVisibility.Value = Visibility.Visible;
                ProductListVisibility.Value   = Visibility.Collapsed;
            });
        }
Esempio n. 20
0
 public override void Write(Utf8JsonWriter writer, SelectAll <TEntity> value, JsonSerializerOptions options)
 {
     JsonSerializer.Serialize(writer, value.ToDictionary(SelectExpandWrapperConverter.MapperProvider), options);
 }
Esempio n. 21
0
        void SelectAllToolStripMenuItemClick(object sender, EventArgs e)
        {
            SelectAll selectAll = new SelectAll();

            selectAll.Run();
        }
Esempio n. 22
0
        public async Task <Stream> LoadFileTax121(int numberElement)
        {
            var selectAll = new SelectAll();

            return(await Task.Factory.StartNew(() => selectAll.LoadFile121(numberElement)));
        }
Esempio n. 23
0
 private void NotifyCanExecuteChanged()
 {
     SelectAll.NotifyCanExecuteChanged();
     RemoveSelected.NotifyCanExecuteChanged();
     ClearSelection.NotifyCanExecuteChanged();
 }
Esempio n. 24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrWhiteSpace(Label))
        {
            labelTD.Visible = false;
        }

        if (string.IsNullOrWhiteSpace(ItemLabelColumnName) || string.IsNullOrWhiteSpace(ItemValueColumnName) || Items == null)
        {
            return;
        }

        int idx = 0;

        if (string.IsNullOrWhiteSpace(SelectAll))
        {
            SelectAll = "false";
        }
        if (string.IsNullOrWhiteSpace(IgnoreDefaultItems))
        {
            IgnoreDefaultItems = "false";
        }

        Dictionary <string, int> counts = new Dictionary <string, int>();

        if (ShowChildCount && OptionGroupValueColumnName != null)
        {
            foreach (DataRow row in Items.Rows)
            {
                string groupValue = row[OptionGroupValueColumnName].ToString();

                if (!counts.ContainsKey(groupValue))
                {
                    counts[groupValue] = 0;
                }

                string itemValue = row[ItemValueColumnName].ToString();

                if (!string.IsNullOrWhiteSpace(itemValue))
                {
                    if (IgnoreDefaultItems.ToUpper() == "TRUE" && (itemValue == "0" || itemValue == "-1"))
                    {
                        continue;
                    }

                    counts[groupValue]++;
                }
            }
        }

        string[]      customAttributes = !string.IsNullOrWhiteSpace(CustomAttributes) ? CustomAttributes.Split(',') : null;
        List <string> selList          = new List <string>("t,true,y,yes,1".Split(','));

        ddlItems.Items.Clear();

        foreach (DataRow row in Items.Rows)
        {
            string itemLabel    = row[ItemLabelColumnName] != DBNull.Value ? row[ItemLabelColumnName].ToString() : "";
            string itemValue    = row[ItemValueColumnName] != DBNull.Value ? row[ItemValueColumnName].ToString() : "";
            string itemSelected = !string.IsNullOrWhiteSpace(ItemSelectedColumnName) ? (row[ItemSelectedColumnName] != DBNull.Value ? row[ItemSelectedColumnName].ToString() : null) : null;

            if (itemValue == "")
            {
                itemValue = "MISSING";
            }

            if (IgnoreDefaultItems.ToUpper() == "TRUE")
            {
                if (string.IsNullOrWhiteSpace(itemValue) || itemValue == "0" || itemValue == "-1")
                {
                    continue;
                }
            }

            itemValue = (!string.IsNullOrWhiteSpace(OptionGroupValueColumnName) ? row[OptionGroupValueColumnName].ToString() + "___" :  "") + itemValue;

            if (itemSelected == null)
            {
                itemSelected = "";
            }
            bool selected = false;

            if (SelectAll.ToString().ToUpper() == "TRUE")
            {
                selected = true;
            }
            else if (!string.IsNullOrWhiteSpace(SelectedItems))
            {
                selected = ("," + SelectedItems.ToLower() + ",").IndexOf("," + itemValue.ToLower() + ",") != -1;
            }
            else
            {
                selected = selList.Contains(itemSelected.ToLower());
            }

            ListItem li = new ListItem(itemLabel, itemValue);
            li.Selected = selected;
            li.Attributes.Add("RowIdx", idx.ToString());

            if (customAttributes != null && customAttributes.Length > 0)
            {
                for (int x = 0; x < customAttributes.Length; x++)
                {
                    li.Attributes.Add(customAttributes[x].Trim(), row[customAttributes[x].Trim()].ToString());
                }
            }

            if (OptionGroupLabelColumnName != null && OptionGroupValueColumnName != null)
            {
                string groupValue = row[OptionGroupValueColumnName].ToString();
                string groupLabel = row[OptionGroupLabelColumnName].ToString() + (ShowChildCount ? " (" + counts[groupValue] + ")" : "");

                if (!Groups.Contains(groupLabel))
                {
                    Groups.Add(groupLabel.Replace(";", "<semicolon>").Replace("'", ""));
                }

                li.Attributes.Add("OptionGroup", groupLabel);
                li.Attributes.Add("OptionGroupValue", groupValue);
            }

            ddlItems.Items.Add(li);

            idx++;
        }

        base.Visible = IsVisible;
    }
Esempio n. 25
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAccelAction(Undo, "<Primary>Z");
            menu.AppendItem(Undo.CreateMenuItem());

            app.AddAccelAction(Redo, new[] { "<Primary><Shift>Z", "<Ctrl>Y" });
            menu.AppendItem(Redo.CreateMenuItem());

            var paste_section = new GLib.Menu();

            menu.AppendSection(null, paste_section);

            app.AddAccelAction(Cut, "<Primary>X");
            paste_section.AppendItem(Cut.CreateMenuItem());

            app.AddAccelAction(Copy, "<Primary>C");
            paste_section.AppendItem(Copy.CreateMenuItem());

            app.AddAccelAction(CopyMerged, "<Primary><Shift>C");
            paste_section.AppendItem(CopyMerged.CreateMenuItem());

            app.AddAccelAction(Paste, "<Primary>V");
            paste_section.AppendItem(Paste.CreateMenuItem());

            app.AddAccelAction(PasteIntoNewLayer, "<Primary><Shift>V");
            paste_section.AppendItem(PasteIntoNewLayer.CreateMenuItem());

            app.AddAccelAction(PasteIntoNewImage, "<Primary><Alt>V");
            paste_section.AppendItem(PasteIntoNewImage.CreateMenuItem());

            var sel_section = new GLib.Menu();

            menu.AppendSection(null, sel_section);

            app.AddAccelAction(SelectAll, "<Primary>A");
            sel_section.AppendItem(SelectAll.CreateMenuItem());

            app.AddAccelAction(Deselect, new[] { "<Primary><Shift>A", "<Ctrl>D" });
            sel_section.AppendItem(Deselect.CreateMenuItem());

            var edit_sel_section = new GLib.Menu();

            menu.AppendSection(null, edit_sel_section);

            app.AddAccelAction(EraseSelection, "Delete");
            edit_sel_section.AppendItem(EraseSelection.CreateMenuItem());

            app.AddAccelAction(FillSelection, "BackSpace");
            edit_sel_section.AppendItem(FillSelection.CreateMenuItem());

            app.AddAccelAction(InvertSelection, "<Primary>I");
            edit_sel_section.AppendItem(InvertSelection.CreateMenuItem());

            var palette_section = new GLib.Menu();

            menu.AppendSection(null, palette_section);

            var palette_menu = new GLib.Menu();

            menu.AppendSubmenu(Translations.GetString("Palette"), palette_menu);

            app.AddAction(LoadPalette);
            palette_menu.AppendItem(LoadPalette.CreateMenuItem());

            app.AddAction(SavePalette);
            palette_menu.AppendItem(SavePalette.CreateMenuItem());

            app.AddAction(ResetPalette);
            palette_menu.AppendItem(ResetPalette.CreateMenuItem());

            app.AddAction(ResizePalette);
            palette_menu.AppendItem(ResizePalette.CreateMenuItem());
        }
Esempio n. 26
0
        public ClientsTable(string DataSource = @"G:\Clients.sqlite")
        {
            #region WithConnection
            Action<Action<SQLiteConnection>> WithConnection = y =>
            {
                var csb = new SQLiteConnectionStringBuilder
                {
                    DataSource = DataSource,

                    // is there any other version?
                    Version = 3
                };


                using (var c = new SQLiteConnection(csb.ConnectionString))
                {
                    c.Open();

                    try
                    {
                        y(c);
                    }
                    catch (Exception ex)
                    {
                        // ex.Message = "SQL logic error or missing database\r\nno such function: concat"
                        // ex = {"Could not load file or assembly 'System.Data.SQLite, Version=1.0.86.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT:...
                        Console.WriteLine(new { ex.Message, ex.StackTrace });
                        Debugger.Break();
                    }
                }
            };
            #endregion

            WithConnection(
                c =>
                {
                    new Create { }.ExecuteNonQuery(c);
                }
            );

            #region Insert
            this.Insert = value =>
            {
                var x = default(long);

                WithConnection(
                    c =>
                    {
                        value.ExecuteNonQuery(c);
                        x = c.LastInsertRowId;
                    }
                );

                return x;
            };
            #endregion

              #region Select
            this.Select = delegate
            {
                var t = default(DataTable);

                WithConnection(
                  c =>
                  {
                      t = new SelectAll { }.GetDataTable(c);
                  }
                );

                return t;
            };
            #endregion
        }
Esempio n. 27
0
        public static MySqlDataAdapter all()
        {
            MySqlCommand dataFromBase = SelectAll.Data(DataBaseConnect.getInstance());

            return(DataBaseToWinForm.Transform(dataFromBase));
        }
Esempio n. 28
0
        public IHttpActionResult Post(string operation, string tabKey, string intervalString, [FromBody] CycleDtc record)
        {
            var operationInfo = GetOperationInfo(operation);

            var tabInfo = VwRfProductionDataEntryTab.Find(operationInfo.Operation, tabKey);

            if (tabInfo == null)
            {
                throw new ArgumentException();
            }

            // Only shift interval supported at the moment.
            if (!tabInfo.IntervalType.Equals("Shift", StringComparison.InvariantCultureIgnoreCase))
            {
                throw new ArgumentException();
            }

            // Maximum # of loads exceeded
            if (record.Loads > MAX_LOADS)
            {
                throw new Exception("$Too many loads entered.Maximum { maxLoads } loads per record.");
            }

            var intervalType  = tabInfo.IntervalType.ToUpper();
            var shiftInterval = (ShiftInterval)_entryIntervalProvider.GetInterval(intervalType, intervalString);

            var productionEntryIntervalFactory = new ProductionEntryIntervalFactory(_operationInfoProvider, _timezoneInfoProvider, _productionEntryUtility);

            var productionEntryIntervalType = (ProductionEntryIntervalType)Enum.Parse(typeof(ProductionEntryIntervalType), tabInfo.IntervalType);
            var entryIntervalProvider       = productionEntryIntervalFactory.GetProvider(productionEntryIntervalType);

            //var intervals = entryIntervalProvider.GetIntervals(operationInfo.Operation, shiftInterval.DateOp, shiftInterval.Shift);

            //if (!bool.TryParse(showAll, out bool finalShowAll)) finalShowAll = false;

            //ViewData["ShowAllIntervals"] = finalShowAll;

            //Process the interval
            //int finalIntervalId;
            //if (string.IsNullOrEmpty(intervalId) || !int.TryParse(intervalId, out finalIntervalId))
            //    finalIntervalId = 0;

            ////if the show all box is checked, then we ignore the passed interval id
            //if (finalShowAll) finalIntervalId = -1;

            //get the related interval
            var productionEntryInterval = entryIntervalProvider.GetInterval(
                operationInfo.Operation,
                shiftInterval.DateOp,
                shiftInterval.Shift,
                0);

            //if (!finalShowAll)
            //{
            //try
            //{
            //    productionEntryInterval = entryIntervalProvider.GetInterval(
            //        operationInfo.Operation,
            //        shiftInstance.DateOp,
            //        shiftInstance.Shift,
            //        record.IntervalId);
            //}
            //catch (Exception)
            //{
            //    //if a bad interval id is passed in, then default to the first interval for the shift.
            //    productionEntryInterval = entryIntervalProvider.GetInterval(
            //        operationInfo.Operation,
            //        shiftInstance.DateOp,
            //        shiftInstance.Shift, 0);
            //}

            //ViewData["IntervalId"] = finalIntervalId;

            //}

            //ViewData["IntervalSelect"] = new SelectList(intervals, "IntervalId", "Label", finalIntervalId);

            //Data for shift selector view
            //ViewData["Operation"] = operationInfo.Operation;
            //if (operationsContext.Length > 1) ViewData["OperationSelect"] = new SelectList(operationsContext, "Operation", "Description", operationInfo.Description);
            //ViewData["ShiftSelect"] = new SelectList(shiftInfos, "Shift", "Label", finalShift.Shift);

            //ViewData["Shift"] = finalShift.Shift;
            //ViewData["DateOp"] = finalDateOp.ToShortDateString();

            //var includedFleetTypes = new[]
            //{
            //    FleetTypeValidator.HaulerFleetType, FleetTypeValidator.LoaderFleetType,
            //    FleetTypeValidator.ExcavatorFleetType, FleetTypeValidator.ShovelFleetType
            //};

            //var fleetTypes = Request.QueryString.GetValues("FleetType");
            ////Validate fleettypes, prepare select list
            //var fleetTypeRecords = Array.FindAll(RfFleetType.SelectAll(),
            //                                     f =>
            //                                     Array.Find(includedFleetTypes, i => Utility.CompareSqlStrings(i, f.FleetType)) != null);

            //var selectedFleetTypeRecords = fleetTypes != null && fleetTypes.Length != 0
            //                                   ? Array.FindAll(fleetTypeRecords, ur => Array.Find(fleetTypes, u => Utility.CompareSqlStrings(u, ur.FleetType)) != null) : fleetTypeRecords;

            //var fleetTypeSelect = new BetterCheckBoxList<RfFleetType>(fleetTypeRecords, "FleetType", "Description", selectedFleetTypeRecords);

            //ViewData["FleetTypeSelect"] = fleetTypeSelect;
            //ViewData["SelectedFleetTypes"] = Array.ConvertAll(selectedFleetTypeRecords, u => u.FleetType);

            //var fleetTypeUrl = "&FleetType=" + String.Join("&FleetType=", Array.ConvertAll(selectedFleetTypeRecords, u => u.FleetType));

            ////Next and previous shift links
            //if (Request.Url != null)
            //{
            //    var url = Request.Url.AbsolutePath;
            //    var nextShift = operationInfo.GetNextShift(shiftInstance);
            //    var prevShift = operationInfo.GetPrevShift(shiftInstance);

            //    ViewData["Url"] = url;

            //    var urlTail = string.Format("{0}&ShowAllIntervals={1}&tabKey={2}", fleetTypeUrl, finalShowAll, tabKey);

            //    if (intervalType == ProductionEntryIntervalType.Hourly && !finalShowAll && entryInterval != null)
            //    {
            //        var nextInterval = entryIntervalProvider.GetNextInterval(shiftInstance.Operation, shiftInstance.DateOp, shiftInstance.Shift, finalIntervalId);
            //        var prevInterval = entryIntervalProvider.GetPrevInterval(shiftInstance.Operation, shiftInstance.DateOp, shiftInstance.Shift, finalIntervalId);

            //        ViewData["NextIntervalUrl"] =
            //            string.Format("{0}?operation={1}&dateOp={2}&shift={3}&intervalId={4}{5}", url,
            //                          operationInfo.Operation, nextInterval.IntervalShift.DateOp.ToShortDateString(),
            //                          nextInterval.IntervalShift.Shift, nextInterval.IntervalId, urlTail);
            //        ViewData["PrevIntervalUrl"] =
            //            string.Format("{0}?operation={1}&dateOp={2}&shift={3}&intervalId={4}{5}", url,
            //                          operationInfo.Operation, prevInterval.IntervalShift.DateOp.ToShortDateString(),
            //                          prevInterval.IntervalShift.Shift, prevInterval.IntervalId, urlTail);
            //    }

            //    var defaultIntervalId = finalShowAll ? -1 : 0;

            //    ViewData["NextShiftUrl"] = string.Format("{0}?operation={1}&dateOp={2}&shift={3}&intervalId={4}{5}", url,
            //                                             operationInfo.Operation, nextShift.DateOp.ToShortDateString(),
            //                                             nextShift.Shift, defaultIntervalId, urlTail);
            //    ViewData["PrevShiftUrl"] = string.Format("{0}?operation={1}&dateOp={2}&shift={3}&intervalId={4}{5}", url,
            //                                             operationInfo.Operation, prevShift.DateOp.ToShortDateString(),
            //                                             prevShift.Shift, defaultIntervalId, urlTail);

            //    ViewData["NextDayUrl"] = string.Format("{0}?operation={1}&dateOp={2}&shift={3}&intervalId={4}{5}", url,
            //                             operationInfo.Operation, shiftInstance.DateOp.AddDays(1).ToShortDateString(),
            //                             shiftInstance.Shift, defaultIntervalId, urlTail);
            //    ViewData["PrevDayUrl"] = string.Format("{0}?operation={1}&dateOp={2}&shift={3}&intervalId={4}{5}", url,
            //                                             operationInfo.Operation, shiftInstance.DateOp.AddDays(-1).ToShortDateString(),
            //                                             shiftInstance.Shift, defaultIntervalId, urlTail);
            //}

            //const int maxLoads = 1000;

            //IOperationInfo operationInfo;
            //ShiftInstance shiftInstance;
            //IProductionEntryIntervalProvider entryIntervalProvider;
            //ProductionEntryInterval entryInterval;
            //ValidateArguments(out operationInfo, out shiftInstance, out entryIntervalProvider, out entryInterval);

            var gradeItems = RfProductionDataEntryGrade.SelectAll(operation, tabKey).Select(g => g.GradeItem).ToArray();

            //var newValues = ObjectBinder.BindDictionary<FlexibleRowObject, int>(Request.Form, "NewValues");
            //var oldValues = ObjectBinder.BindDictionary<FlexibleRowObject, int>(Request.Form, "OldValues");

            using (var connection = Utility.GetConnection <Cycle> ()) {
                using (var transaction = connection.BeginTransaction()) {
                    // Get movement rows
                    var rows = entryIntervalProvider.ConvertToMovementRows(shiftInterval, productionEntryInterval, tabKey, newValues, oldValues);

                    var row = rows.Where(r => r.Id == rowIndex).FirstOrDefault();

                    result.AddValidationErrors(rowIndex, entryIntervalProvider.ValidateMovementRow(connection, transaction, row));

                    if (!result.IsErrorFree() || result.RowResults.Exists(row => row.ValidationErrors.Count > 0))
                    {
                        return(result);
                    }

                    foreach (var row in rows)
                    {
                        try {
                            var deleteRow = row.OldValue != null ? row.OldValue : row;

                            var deleteGrades = new DeleteAll <CycleGrade> ()
                                               .WherePropertyEquals("Operation", deleteRow.Operation)
                                               .WherePropertyEquals("Loader", deleteRow.Loader)
                                               .WherePropertyEquals("Hauler", deleteRow.Hauler)
                                               .WherePropertyEquals("LoaderOperatorId", deleteRow.LoaderOperatorId)
                                               .WherePropertyEquals("HaulerOperatorId", deleteRow.HaulerOperatorId)
                                               .WherePropertyEquals("Origin", deleteRow.Origin)
                                               .WherePropertyEquals("Destination", deleteRow.Destination)
                                               .WherePropertyEquals("Material", deleteRow.Material)
                                               .WherePropertyEquals("DateOp", deleteRow.DateOp)
                                               .WherePropertyEquals("Shift", deleteRow.Shift)
                                               .WherePropertyEquals("Datasource", deleteRow.Datasource)
                                               .WherePropertyIn("GradeItem", gradeItems);

                            if (deleteRow.DateTimeStart.HasValue)
                            {
                                deleteGrades.WherePropertyEquals("DateTimeStart", deleteRow.DateTimeStart.Value);
                            }

                            deleteGrades.Execute(connection, transaction);

                            var deleteCycles = new DeleteAll <Cycle> ()
                                               .WherePropertyEquals("Operation", deleteRow.Operation)
                                               .WherePropertyEquals("Loader", deleteRow.Loader)
                                               .WherePropertyEquals("Hauler", deleteRow.Hauler)
                                               .WherePropertyEquals("LoaderOperatorId", deleteRow.LoaderOperatorId)
                                               .WherePropertyEquals("HaulerOperatorId", deleteRow.HaulerOperatorId)
                                               .WherePropertyEquals("Origin", deleteRow.Origin)
                                               .WherePropertyEquals("Destination", deleteRow.Destination)
                                               .WherePropertyEquals("Material", deleteRow.Material)
                                               .WherePropertyEquals("DateOp", deleteRow.DateOp)
                                               .WherePropertyEquals("Shift", deleteRow.Shift)
                                               .WherePropertyEquals("Datasource", deleteRow.Datasource);

                            if (deleteRow.DateTimeStart.HasValue)
                            {
                                deleteCycles.WherePropertyEquals("DateTimeStart", deleteRow.DateTimeStart.Value);
                            }

                            deleteCycles.Execute(connection, transaction);

                            int cycleCount = 0;

                            foreach (var cycle in row.Cycles)
                            {
                                cycleCount++;
                                Utility.SaveSafe(connection, transaction, cycle);

                                foreach (var gradeItem in cycle.GradeValues)
                                {
                                    Utility.SaveSafe(connection, transaction, CreateCycleGrade(cycle, gradeItem.Key, gradeItem.Value));
                                    if (cycleCount.Equals(row.Cycles.Count()) && !string.IsNullOrEmpty(tab.SourceGradeType))
                                    {
                                        var grade = new SelectAll <VwProductionDataEntryGrade> ()
                                                    .WherePropertyEquals("Operation", cycle.Operation)
                                                    .WherePropertyEquals("DateOp", cycle.DateOp)
                                                    .WherePropertyEquals("Origin", cycle.Origin)
                                                    .WherePropertyEquals("Material", cycle.Material)
                                                    .WherePropertyEquals("GradeItem", gradeItem.Key)
                                                    .First(connection, transaction);

                                        Utility.SaveSafe(connection, transaction, CreateGrade(cycle, tab.SourceGradeType, grade));
                                    }
                                }
                            }

                            result.AddRowSaved(row.Id);
                            result.AddRowUpdated(row.Id, new FlexibleRowObject(row));

                            ManualDataEntryLog.Log(transaction,
                                                   row.IsNew ? ManualDataEntryLog.AdditionLogType : ManualDataEntryLog.UpdateLogType, shiftInstance.Operation,
                                                   LoadAndHaulManualEntryLog.LogArea, LoadAndHaulManualEntryLog.LogGroup, "Production Entry", shiftInstance.DateOp, shiftInstance.Shift, null, "Data edited.");
                        } catch (Exception ex) {
                            result.AddRowError(row.Id, GridRowError.Make(ex));
                        }
                    }

                    if (!result.IsErrorFree() || result.RowResults.Exists(row => row.ValidationErrors.Count > 0))
                    {
                        return(result);
                    }

                    // Add record to ManualDataEntryProcesQueue to recalculate the grades
                    Utility.SaveSafe(connection, transaction, new ManualDataEntryProcessQueue()
                    {
                        Operation = shiftInstance.Operation, DateOp = shiftInstance.DateOp, DateTimeAdded = DateTime.UtcNow
                    });

                    transaction.Commit();
                }
            }

            return(result);
        }
Esempio n. 29
0
 public void Visit(SelectAll all, CommonTree tree)
 {
     Parent(tree).Children.Add(all);
     SetLine(all, tree);
 }
Esempio n. 30
0
 public List <Company> GetAllCompanies()
 {
     return(SelectAll.ToList());
 }