Beispiel #1
0
        private bool ShowRules(long id)
        {
            if (currentNomenclatureId != 0)
            {
                WriteMarks();
            }

            bool isExistResult = false;

            table.DT.Rows.Clear();
            using (SqlCeConnection dBConnection = new SqlCeConnection(DBEngine.LocalConnectionString))
            {
                dBConnection.Open();
                using (SqlCeCommand SQLCommand = dBConnection.CreateCommand())
                {
                    SQLCommand.CommandText = "SELECT rules.CriterionsId As Id, criteria.Descr As Descr, Marks.Mark FROM NomenclatureCriterions As rules JOIN Criterions As criteria ON rules.CriterionsId = criteria.Id LEFT JOIN Marks ON rules.CriterionsId = Marks.CriterionsId and rules.NomenclatureId = Marks.NomenclatureId WHERE rules.NomenclatureId = @Id Order By rules.Number";
                    SQLCommand.Parameters.AddWithValue("@Id", id);
                    using (SqlCeDataReader result = SQLCommand.ExecuteReader())
                    {
                        while (result.Read())
                        {
                            object obj = result["Mark"];
                            if (obj == DBNull.Value)
                            {
                                obj = 0;
                            }
                            table.AddRow((result["Descr"] as string).Trim(), result["Id"], obj);
                            isExistResult = true;
                        }
                    }
                }
            }

            return(isExistResult);
        }
Beispiel #2
0
        private void createEnumControls(Type vType)
        {
            DataTable sourceTable = new DataTable();

            sourceTable.Columns.AddRange(new[]
            {
                new DataColumn("Number", typeof(int)),
                new DataColumn("Description", typeof(string))
            });

            MobileTable visualTable = MainProcess.CreateTable("Enum", 200, 65);

            visualTable.OnChangeSelectedRow += visualTable_OnChangeSelectedRow;
            visualTable.DT = sourceTable;
            visualTable.AddColumn("№", "Number", 34);
            visualTable.AddColumn("Назва", "Description", 180);

            Dictionary <int, string> list = EnumWorker.GetList(vType);

            foreach (KeyValuePair <int, string> element in list)
            {
                visualTable.AddRow(element.Key, element.Value);
            }

            visualTable.Focus();
            controls.Add(visualTable);
        }
Beispiel #3
0
        public override sealed void DrawControls()
        {
            if (IsLoad)
            {
                visualTable    = MainProcess.CreateTable("Maps", 259, onRowSelected);
                visualTable.DT = sourceTable;
                visualTable.AddColumn("Карта", "Description", 214);

                using (SqlCeCommand query =
                           dbWorker.NewQuery("SELECT Id,Description FROM Maps WHERE ParentId=@Id ORDER BY Description")
                       )
                {
                    query.AddParameter("Id", CurrentMapId);

                    using (SqlCeDataReader reader = query.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            visualTable.AddRow(reader["Description"], reader["Id"]);
                        }
                    }
                }
                visualTable.Focus();
            }
        }
Beispiel #4
0
        public override sealed void DrawControls()
        {
            if (IsLoad)
                {
                visualTable = MainProcess.CreateTable("Maps", 259, onRowSelected);
                visualTable.DT = sourceTable;
                visualTable.AddColumn("Карта", "Description", 214);

                using (SqlCeCommand query =
                        dbWorker.NewQuery("SELECT Id,Description FROM Maps WHERE ParentId=@Id ORDER BY Description")
                    )
                    {
                    query.AddParameter("Id", CurrentMapId);

                    using (SqlCeDataReader reader = query.ExecuteReader())
                        {
                        while (reader.Read())
                            {
                            visualTable.AddRow(reader["Description"], reader["Id"]);
                            }
                        }

                    }
                visualTable.Focus();
                }
        }
Beispiel #5
0
        public override void DrawControls()
        {
            MainProcess.ToDoCommand = "Выберите операцию";

            #region Создание меню операций

            var dataTable = new DataTable();
            dataTable.Columns.AddRange(new[] {
                new DataColumn("OperationName", typeof(string)),
                new DataColumn("type", typeof(short))
            });

            table    = MainProcess.CreateTable("operations", 259, onRowSelected);
            table.DT = dataTable;
            table.AddColumn("Операция", "OperationName", 214);
            table.AddRow("Прием расх. материалов", 1);
            table.AddRow("Регистрация качества", 2);
            table.AddRow("Регистрация качества несорт.", 3);

            table.Focus();

            #endregion
        }
Beispiel #6
0
        public override void DrawControls()
        {
            MainProcess.ToDoCommand = "Выберите операцию";

            #region Создание меню операций

            var dataTable = new DataTable();
            dataTable.Columns.AddRange(new[] {
                new DataColumn("OperationName", typeof(string)),
                new DataColumn("type", typeof(short))
            });

            table = MainProcess.CreateTable("operations", 259, onRowSelected);
            table.DT = dataTable;
            table.AddColumn("Операция", "OperationName", 214);
            table.AddRow("Прием расх. материалов", 1);
            table.AddRow("Регистрация качества", 2);
            table.AddRow("Регистрация качества несорт.", 3);

            table.Focus();

            #endregion
        }
Beispiel #7
0
        private void createLongControls()
        {
            dbFieldAtt attribute = Attribute.GetCustomAttribute(
                accessory.GetType().GetProperty(propertyName),
                typeof(dbFieldAtt)) as dbFieldAtt;

            if (attribute != null && attribute.dbObjectType != null)
            {
                DataTable sourceTable = new DataTable();
                sourceTable.Columns.AddRange(new[]
                {
                    new DataColumn("Number", typeof(int)),
                    new DataColumn("Description", typeof(string))
                });

                MobileTable visualTable = MainProcess.CreateTable("Table", 200, 65);
                visualTable.OnChangeSelectedRow += visualTable_OnChangeSelectedRow;
                visualTable.DT = sourceTable;
                visualTable.AddColumn("№", "Number", 34);
                visualTable.AddColumn("Назва", "Description", 180);

                string command = string.Format("SELECT Id,Description FROM {0} WHERE MarkForDeleting=0",
                                               attribute.dbObjectType.Name);
                DataTable table = null;
                using (SqlCeCommand query = dbWorker.NewQuery(command))
                {
                    table = query.SelectToTable();
                }

                foreach (DataRow row in table.Rows)
                {
                    visualTable.AddRow(row["Id"], row["Description"]);
                }

                visualTable.Focus();
                controls.Add(visualTable);
            }
            else
            {
                MainProcess.CreateLabel("Справочник/Документ пуст!", 5, 150, 230,
                                        MobileFontSize.Normal, MobileFontPosition.Center, MobileFontColors.Warning,
                                        FontStyle.Bold);
                controls.Add(MainProcess.CreateTable("Table", 200, 65));
            }
        }
Beispiel #8
0
        public override sealed void DrawControls()
        {
            if (IsLoad)
            {
                DataTable sourceTable = new DataTable();
                sourceTable.Columns.AddRange(new[] { new DataColumn("Position", typeof(string)) });
                MobileTable visualTable = MainProcess.CreateTable("Positions", 259, onRowSelected);
                visualTable.DT = sourceTable;
                visualTable.AddColumn("№Позиции", "Position", 214);

                List <object> list      = getFilledPosition();
                int           maxNumber = Maps.GetMaxPositionNumber(MapInfo.Id);

                for (int i = 1; i <= maxNumber; i++)
                {
                    if (!list.Contains(i))
                    {
                        visualTable.AddRow(i);
                    }
                }

                visualTable.Focus();
            }
        }
Beispiel #9
0
        private bool ShowRules(BarcodeValue barcodeVal)
        {
            if (currentBarcodeValue.Value != "")
            {
                WriteMarks();
            }

            ParentCriterions = new Dictionary <long, ParentCriterionData>();

            bool isExistResult = false;

            table.DT.Rows.Clear();
            using (SqlCeConnection dBConnection = new SqlCeConnection(DBEngine.LocalConnectionString))
            {
                dBConnection.Open();
                using (SqlCeCommand SQLCommand = dBConnection.CreateCommand())
                {
                    SQLCommand.CommandText = "select \r\n" +
                                             "c.Id,\r\n" +
                                             "c.Descr,\r\n" +
                                             "c.HaveSubCriterion,\r\n" +
                                             "c.ParentCriterionId,\r\n" +
                                             "c.LineNumber,\r\n" +
                                             "m.Mark\r\n" +
                                             "from Criterions c\r\n" +
                                             "join NomenclatureCriterions r\r\n" +
                                             "on c.Id = r.CriterionsId \r\n" +
                                             "or c.ParentCriterionId = r.CriterionsId\r\n" +
                                             "left join Marks m\r\n" +
                                             "on c.Id = m.CriterionsId\r\n" +
                                             "and r.NomenclatureId = m.NomenclatureId\r\n" +
                                             "and c.ParentCriterionId = m.ParentCriterionId\r\n" +
                                             "and m.DepartmentId = @DepartmentId\r\n" +
                                             "where r.NomenclatureId = @NomenclatureId\r\n" +
                                             "order by r.Number, c.LineNumber";
                    SQLCommand.Parameters.AddWithValue("@NomenclatureId", barcodeVal.NomenclatureID);
                    SQLCommand.Parameters.AddWithValue("@DepartmentId", barcodeVal.DepartmentID);
                    using (SqlCeDataReader result = SQLCommand.ExecuteReader())
                    {
                        while (result.Read())
                        {
                            object obj = result["Mark"];
                            if (obj == DBNull.Value)
                            {
                                obj = 0;
                            }

                            long criterionsId      = (long)result["Id"];
                            bool haveSubCriterion  = (bool)result["HaveSubCriterion"];
                            long parentCriterionId = (long)result["ParentCriterionId"];

                            DataRow row = table.AddRow(((int)result["LineNumber"] > 0 ? (" " + result["LineNumber"].ToString() + ". ") : "") + ((string)result["Descr"]).Trim(),
                                                       criterionsId, obj, haveSubCriterion, parentCriterionId);
                            isExistResult = true;

                            if (haveSubCriterion)
                            {
                                if (!ParentCriterions.ContainsKey(criterionsId))
                                {
                                    ParentCriterions.Add(criterionsId, new ParentCriterionData(row));
                                }
                                else
                                {
                                    ParentCriterions[criterionsId].SetRow(row);
                                }
                            }

                            if (parentCriterionId > 0)
                            {
                                if (!ParentCriterions.ContainsKey(parentCriterionId))
                                {
                                    ParentCriterions.Add(parentCriterionId, new ParentCriterionData());
                                    ParentCriterions[parentCriterionId].SubCriterionsId.Add(criterionsId, (int)obj);
                                }
                                else
                                {
                                    ParentCriterions[parentCriterionId].SubCriterionsId.Add(criterionsId, (int)obj);
                                }
                            }
                        }
                    }
                }
            }

            foreach (ParentCriterionData pcd in ParentCriterions.Values)
            {
                long sum = 0;
                foreach (long val in pcd.SubCriterionsId.Values)
                {
                    sum = sum + val;
                }
                pcd.Row["Mark"] = 100 - sum;
            }

            return(isExistResult);
        }