Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string icode = codetxt.Text;
            string idesc = desctxt.Text;

            if (!Validator.IsValidString(icode))
            {
                GUIutils.ShowMessage("Account COde Is Not Valid");
                return;
            }
            if (icode.Length != 3)
            {
                GUIutils.ShowMessage("Account Code Should be Three Characters");
                return;
            }
            if (Group.Isexist(icode))
            {
                GUIutils.ShowMessage("Account Code Already Exists");
                return;
            }

            if (!Validator.IsValidString(idesc))
            {
                GUIutils.ShowMessage("Account Name Is Not Valid");
                return;
            }


            Group.AddGroup(icode, idesc);
            codetxt.Clear();
            desctxt.Clear();
        }
Ejemplo n.º 2
0
        private void GenerateRulesAndWriteToFile(string materialName, string pmxFile)
        {
            Log.Info($"Generating rules for {materialName}");
            var dbReader = new DBReader(SapTablesConnectionString);
            var model    = dbReader.GetModelByMaterial(materialName);

            if (model.Matnr == null)
            {
                Log.Warn($"No data available for model {materialName}, skipping ");
                return;
            }

            var pm = LoadProductModel(pmxFile);

            pm.Name = materialName;

            var hierarchyMapping = dbReader.GetHierarchyMapping();

            var categoryRelation      = CreateCategoryRelation(dbReader, materialName, pm);
            var salesValidityRelation = CreateSalesValidityRelation(dbReader, model, pm);
            var modelRules            = ConvertRules(hierarchyMapping, dbReader, model, pm);
            var basketRules           = ConvertBaskets(hierarchyMapping, dbReader, model, pm);
            var importedRules         = new Group("ImportedRules", PrivateFlag.False, EnabledFlag.True);

            var ruleGroup = new Group("StandardRules", PrivateFlag.False, EnabledFlag.True);

            ruleGroup.Rules.AddRange(modelRules);
            importedRules.AddGroup(ruleGroup);

            var basketGrp = new Group("Baskets", PrivateFlag.False, EnabledFlag.True);

            basketGrp.Rules.AddRange(basketRules);
            importedRules.AddGroup(basketGrp);

            importedRules.Relations.Add(salesValidityRelation);
            importedRules.Relations.Add(categoryRelation);

            pm.ProductModelStructure.Groups.RemoveAll(g => g.Name == "ImportedRules");
            pm.ProductModelStructure.Groups.Add(importedRules);

            var newPmx = WriteProductModelToFile(materialName, pm);

            Log.Info($"Generated file {newPmx}");
        }
Ejemplo n.º 3
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            string acc_code  = AccTypeCodetxt.Text;
            string acc_name  = AccTypeNametxt.Text.ToUpper();
            string acc_class = "";
            string curbal    = CBALtxt.Text;

            if (!Validator.IsValidString(acc_code))
            {
                GUIutils.ShowMessage("Account COde Is Not Valid");
                return;
            }
            if (acc_code.Length != 2)
            {
                GUIutils.ShowMessage("Account Code Should be Two Characters");
                return;
            }
            if (Group.Isexist(acc_code))
            {
                GUIutils.ShowMessage("Account Code Already Exists");
                return;
            }

            if (!Validator.IsValidString(acc_name))
            {
                GUIutils.ShowMessage("Account Name Is Not Valid");
                return;
            }

            if (AccClassCombo.SelectedIndex == -1)
            {
                GUIutils.ShowMessage("select An Account Class");
                return;
            }

            acc_class = AccClassCombo.SelectedItem.ToString().Trim().ToUpper();

            if (!(acc_class == "ASSET" || acc_class == "LIABILITY" ||
                  acc_class == "EXPENSE" || acc_class == "INCOME"))
            {
                GUIutils.ShowMessage("Account class should be selected");
                return;
            }

            acc_class = acc_class.Substring(0, 1);

            if (!Validator.IsValidNumber(curbal))
            {
                GUIutils.ShowMessage("Current Balance should be Numeric Value");
                return;
            }

            decimal crr = Convert.ToDecimal(curbal);

            Group.AddGroup(acc_code, acc_name, acc_class, crr);
        }
Ejemplo n.º 4
0
        public ActionResult AddGroup(string name, int department)
        {
            Group.AddGroup(name, department);
            Messages messages = new Messages {
                { Messages.Message.TypeMessage.good, string.Format("Группа {0} добавленна", name) }
            };

            TempData["messages"] = messages;
            return(Redirect("/Admin"));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Добавляет всю группу студентов в систему
        /// </summary>
        /// <param name="name">Имя группы</param>
        /// <param name="department">Кафедра группы</param>
        /// <param name="fileStudent">Файл со списком студентов</param>
        /// <returns>Страница</returns>
        public ActionResult AddGroupAndStudent(string name, int department, HttpPostedFileBase fileStudent)
        {
            Messages messages = new Messages();

            if (fileStudent != null)
            {
                Group  group    = Group.AddGroup(name, department);
                string fileName = Request.PhysicalApplicationPath + "\\Files\\" + fileStudent.FileName;
                Microsoft.Office.Interop.Excel.Application excelApplication = null;
                Microsoft.Office.Interop.Excel.Workbooks   excelWorkbooks;
                Microsoft.Office.Interop.Excel.Workbook    excelFile = null;
                Microsoft.Office.Interop.Excel.Worksheet   excelWorksheet;
                try
                {
                    fileStudent.SaveAs(fileName);
                    excelApplication = new Microsoft.Office.Interop.Excel.Application();
                    excelWorkbooks   = excelApplication.Workbooks;
                    excelFile        = excelWorkbooks.Open(fileName);
                    excelWorksheet   = (Microsoft.Office.Interop.Excel.Worksheet)excelFile.Worksheets.get_Item(1);
                    for (int i = 2;; i++)
                    {
                        Microsoft.Office.Interop.Excel.Range fioStudnt   = excelWorksheet.Range["A" + i];
                        Microsoft.Office.Interop.Excel.Range emailStudnt = excelWorksheet.Range["B" + i];
                        string telephoneStudnt      = excelWorksheet.Range["C" + i].Value2 ?? "";
                        int    currentSemestrStudnt = Convert.ToInt32(excelWorksheet.Range["D" + i].Value2 ?? "1");
                        string addressStudnt        = excelWorksheet.Range["E" + i].Value2;
                        string recordBookStudnt     = group.Name + (excelWorksheet.Range["F" + i].Value2 != null ? Convert.ToInt32(excelWorksheet.Range["F" + i].Value2).ToString("D2") : i.ToString("D2"));
                        Student.TypeOfEducation typeOfEducetionStudnt = Student.ConverStringToEnum(excelWorksheet.Range["G" + i].Value2 ?? "");
                        string contactsParentsStudnt           = excelWorksheet.Range["H" + i].Value2 ?? "";
                        string employmentInTheDepartmentStudnt = excelWorksheet.Range["I" + i].Value2 ?? "";
                        if (fioStudnt.Value2 != null || emailStudnt.Value2 != null)
                        {
                            string[] fio = ((string)fioStudnt.Value2.ToString()).Split(' ');
                            Student.AddStudent(fio[0], fio[1], fio[2], emailStudnt.Value2.ToString(), telephoneStudnt, group.ID, currentSemestrStudnt, addressStudnt, recordBookStudnt, typeOfEducetionStudnt, contactsParentsStudnt, employmentInTheDepartmentStudnt, false);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                finally
                {
                    excelFile.Close();
                    excelApplication.Quit();
                    System.IO.File.Delete(fileName);
                }
                messages.Add(Messages.Message.TypeMessage.good, string.Format("Группа {0} добавленна", name));
            }
            TempData["messages"] = messages;
            return(Redirect("/Admin"));
        }
Ejemplo n.º 6
0
        public void AssignGroup(Group group, GroupMemberService groupMemberService)
        {
            AssertionConcern.AssertStateTrue(SupportsNesting, "This role does not support group nesting.");
            AssertionConcern.AssertArgumentNotNull(group, "Group must not be null.");
            AssertionConcern.AssertArgumentEquals(TenantId, group.TenantId, "Wrong tenant for this group.");

            _internalGroup.AddGroup(group, groupMemberService);

            DomainEventPublisher
            .Instance
            .Publish(new GroupAssignedToRole(
                         TenantId,
                         Name,
                         group.Name));
        }
Ejemplo n.º 7
0
        public Room(int worldWidth, int worldHeight, bool groups = true)
        {
            Transform          = new Transform();
            Transform.rotation = Quaternion.RotationAxis(Vector3.Up, (float)Math.PI);
            Groups             = new RoomGroups(this);
            AllActiveLinks     = new ObservableHashSet <Link>();
            AllInactiveLinks   = new ObservableHashSet <Link>();

            WorldWidth  = worldWidth;
            WorldHeight = worldHeight;

            Scheduler   = new Scheduler();
            BorderColor = Color.DarkGray;

            // grid System
            GridsystemAffect = new GridSystem(this, 40, new Vector2R(0, 0), worldWidth, OrbIt.ScreenHeight);
            CollisionManager = new CollisionManager(this);
            Level            = new Level(this, 40, 40, GridsystemAffect.cellWidth, GridsystemAffect.cellHeight);
            Camera           = new MeshCamera(this, 1f, Vector2R.Zero);
            DrawLinks        = true;
            Scheduler        = new Scheduler();

            Dictionary <dynamic, dynamic> userPr = new Dictionary <dynamic, dynamic>()
            {
                { nodeE.position, new Vector2R(0, 0) },
                { nodeE.texture, Textures.Blackorb },
            };

            DefaultNode = new Node(this, userPr)
            {
                name = "master"
            };
            //defaultNode.IsDefault = true;

            foreach (Component c in DefaultNode.comps.Values)
            {
                c.AfterCloning();
            }

            Node firstdefault = new Node(this, ShapeType.Circle);

            //firstdefault.addComponent(comp.itempayload, true);
            Node.cloneNode(DefaultNode, firstdefault);
            firstdefault.name = "[G0]0";
            //firstdefault.IsDefault = true;

            MasterGroup = new Group(this, DefaultNode, DefaultNode.name, false);
            if (groups)
            {
                MasterGroup.AddGroup(new Group(this, DefaultNode, "General Groups", false));
                MasterGroup.AddGroup(new Group(this, DefaultNode, "Preset Groups", false));
                MasterGroup.AddGroup(new Group(this, DefaultNode.CreateClone(this), "Player Group"));
                MasterGroup.AddGroup(new Group(this, DefaultNode, "Item Group", false));
                MasterGroup.AddGroup(new Group(this, DefaultNode, "Link Groups", false));
                MasterGroup.AddGroup(new Group(this, DefaultNode.CreateClone(this), "Bullet Group"));
                MasterGroup.AddGroup(new Group(this, DefaultNode, "Wall Group"));
                Groups.General.AddGroup(new Group(this, firstdefault, "Group1"));
            }
            Dictionary <dynamic, dynamic> userPropsTarget = new Dictionary <dynamic, dynamic>()
            {
                { typeof(ColorChanger), true },
                { nodeE.texture, Textures.Ring }
            };

            TargetNodeGraphic = new Node(this, userPropsTarget)
            {
                name = "TargetNodeGraphic"
            };
            if (DebugFlags.addRoomWalls)
            {
                MakeWalls(10);
            }

            MakePresetGroups();
            MakeItemGroups();
        }
Ejemplo n.º 8
0
        public Node CreateNode()
        {
            Vector2R pos = UserInterface.WorldMousePos;

            //new node(s)
            Dictionary <dynamic, dynamic> userP = new Dictionary <dynamic, dynamic>()
            {
                { nodeE.position, pos },
            };
            HashSet <Type> comps = new HashSet <Type>()
            {
                typeof(BasicDraw), typeof(Movement), typeof(Lifetime)
            };
            List <Type> allComps = new List <Type>();

            foreach (Type c in Component.compTypes)
            {
                allComps.Add(c);
            }

            int total = allComps.Count - comps.Count;


            Random random     = Utils.random;
            int    compsToAdd = random.Next(total);

            int a       = 21 * 21;
            int randLog = random.Next(a);
            int root    = (int)Math.Ceiling(Math.Sqrt(randLog));

            root       = 21 - root;
            compsToAdd = root;

            //System.Console.WriteLine(compsToAdd + " " + root);

            int counter = 0;

            while (compsToAdd > 0)
            {
                if (counter++ > allComps.Count)
                {
                    break;
                }
                int  compNum = random.Next(allComps.Count - 1);
                Type newcomp = allComps[compNum];

                //if (newcomp == typeof(Tree)) continue; //test

                if (comps.Contains(newcomp))
                {
                    continue;
                }
                comps.Add(newcomp);
                compsToAdd--;
            }

            foreach (Type c in comps)
            {
                userP.Add(c, true);
            }


            Node n = room.SpawnNode(userP, blank: true, lifetime: 5000);

            if (n != null)
            {
                foreach (Type t in n.comps.Keys.ToList())
                {
                    if ((n.comps[t].compType & mtypes.item) == mtypes.item)
                    {
                        n.RemoveComponent(t);
                    }
                }

                //savedDicts.Enqueue(userP);
                savedNodes.Enqueue(n);
                Group p = room.MasterGroup.childGroups["Link Groups"];
                var   g = new Group(room, n, n.name);
                p.AddGroup(g);
                //p.AddGroup(g.Name, g);
                //OrbIt.ui.sidebar.UpdateGroupComboBoxes();
                savedGroups.Enqueue(g);
            }
            return(n);
            //ListBox lst = Game1.ui.sidebar.lstMain;
            //Node newNode = (Node)lst.Items.ElementAt(lst.ItemIndex + 1);
            //System.Console.WriteLine(newNode.name);
        }
Ejemplo n.º 9
0
        public AggregatesResultProviderMock()
        {
            this.Aggregates = new Dictionary <Coordinate, AggregateValue[]>();

            Group rowRoot = new Group("Grand Total");
            Group colRoot = new Group("Grand Total");

            this.Root = new Coordinate(rowRoot, colRoot);

            var june   = new Group("Jun");
            var july   = new Group("Jul");
            var august = new Group("Aug");

            colRoot.AddGroup(june);
            colRoot.AddGroup(july);
            colRoot.AddGroup(august);

            var parent = new Group("Copy holder");

            rowRoot.AddGroup(parent);

            this.Add(parent, colRoot, 615, 17, 509, 6, 315, 6, 1439, 29);

            var child = new Group("Direct mail");

            parent.AddGroup(child);

            var oneFree = new Group("1 Free with 10");

            child.AddGroup(oneFree);

            var extraDi = new Group("Extra Discount");

            child.AddGroup(extraDi);

            this.Add(child, colRoot, 136, 3, 115, 2, 71, 2, 322, 7);
            this.Add(oneFree, colRoot, 66, 1, 55, 1, 33, 1, 154, 3);
            this.Add(extraDi, colRoot, 70, 2, 60, 1, 38, 1, 168, 4);

            child = new Group("Magazine");
            parent.AddGroup(child);

            oneFree = new Group("1 Free with 10");
            child.AddGroup(oneFree);

            extraDi = new Group("Extra Discount");
            child.AddGroup(extraDi);

            this.Add(child, colRoot, 247, 8, 174, 2, 134, 2, 555, 12);
            this.Add(oneFree, colRoot, 165, 6, 99, 1, 77, 1, 341, 8);
            this.Add(extraDi, colRoot, 82, 2, 75, 1, 57, 1, 214, 4);

            child = new Group("Newspaper");
            parent.AddGroup(child);

            oneFree = new Group("1 Free with 10");
            child.AddGroup(oneFree);

            extraDi = new Group("Extra Discount");
            child.AddGroup(extraDi);

            this.Add(child, colRoot, 232, 6, 220, 2, 110, 2, 562, 10);
            this.Add(oneFree, colRoot, 121, 1, 132, 1, 44, 1, 297, 3);
            this.Add(extraDi, colRoot, 111, 5, 88, 1, 66, 1, 265, 7);



            parent = new Group("Glare filter");
            rowRoot.AddGroup(parent);

            this.Add(parent, colRoot, 730, 19, 583, 6, 395, 6, 1708, 31);

            child = new Group("Direct mail");
            parent.AddGroup(child);

            oneFree = new Group("1 Free with 10");
            child.AddGroup(oneFree);

            extraDi = new Group("Extra Discount");
            child.AddGroup(extraDi);

            this.Add(child, colRoot, 168, 2, 142, 2, 92, 2, 402, 6);
            this.Add(oneFree, colRoot, 99, 1, 77, 1, 44, 1, 220, 3);
            this.Add(extraDi, colRoot, 69, 1, 65, 1, 48, 1, 182, 3);

            child = new Group("Magazine");
            parent.AddGroup(child);

            oneFree = new Group("1 Free with 10");
            child.AddGroup(oneFree);

            extraDi = new Group("Extra Discount");
            child.AddGroup(extraDi);

            this.Add(child, colRoot, 310, 15, 234, 2, 175, 2, 719, 19);
            this.Add(oneFree, colRoot, 154, 7, 110, 1, 88, 1, 352, 9);
            this.Add(extraDi, colRoot, 156, 8, 124, 1, 87, 1, 367, 10);

            child = new Group("Newspaper");
            parent.AddGroup(child);

            oneFree = new Group("1 Free with 10");
            child.AddGroup(oneFree);

            extraDi = new Group("Extra Discount");
            child.AddGroup(extraDi);

            this.Add(child, colRoot, 252, 2, 207, 2, 128, 2, 587, 6);
            this.Add(oneFree, colRoot, 132, 1, 77, 1, 33, 1, 242, 3);
            this.Add(extraDi, colRoot, 120, 1, 130, 1, 95, 1, 345, 3);



            parent = new Group("Mouse pad");
            rowRoot.AddGroup(parent);

            this.Add(parent, colRoot, 1354, 20, 1153, 6, 853, 6, 3360, 32);

            child = new Group("Direct mail");
            parent.AddGroup(child);

            oneFree = new Group("1 Free with 10");
            child.AddGroup(oneFree);

            extraDi = new Group("Extra Discount");
            child.AddGroup(extraDi);

            this.Add(child, colRoot, 287, 2, 262, 2, 203, 2, 752, 6);
            this.Add(oneFree, colRoot, 165, 1, 121, 1, 99, 1, 385, 3);
            this.Add(extraDi, colRoot, 122, 1, 141, 1, 104, 1, 367, 3);

            child = new Group("Magazine");
            parent.AddGroup(child);

            oneFree = new Group("1 Free with 10");
            child.AddGroup(oneFree);

            extraDi = new Group("Extra Discount");
            child.AddGroup(extraDi);

            this.Add(child, colRoot, 662, 13, 549, 2, 385, 2, 1596, 17);
            this.Add(oneFree, colRoot, 374, 8, 275, 1, 187, 1, 836, 10);
            this.Add(extraDi, colRoot, 288, 5, 274, 1, 198, 1, 760, 7);

            child = new Group("Newspaper");
            parent.AddGroup(child);

            oneFree = new Group("1 Free with 10");
            child.AddGroup(oneFree);

            extraDi = new Group("Extra Discount");
            child.AddGroup(extraDi);

            this.Add(child, colRoot, 405, 5, 342, 2, 265, 2, 1012, 9);
            this.Add(oneFree, colRoot, 187, 1, 176, 1, 121, 1, 484, 3);
            this.Add(extraDi, colRoot, 218, 4, 166, 1, 144, 1, 528, 6);



            parent = new Group("Printer stand");
            rowRoot.AddGroup(parent);

            this.Add(parent, colRoot, 560, 17, 451, 6, 333, 6, 1344, 29);

            child = new Group("Direct mail");
            parent.AddGroup(child);

            oneFree = new Group("1 Free with 10");
            child.AddGroup(oneFree);

            extraDi = new Group("Extra Discount");
            child.AddGroup(extraDi);

            this.Add(child, colRoot, 170, 5, 104, 2, 64, 2, 338, 9);
            this.Add(oneFree, colRoot, 88, 3, 44, 1, 44, 1, 176, 5);
            this.Add(extraDi, colRoot, 82, 2, 60, 1, 20, 1, 162, 4);

            child = new Group("Magazine");
            parent.AddGroup(child);

            oneFree = new Group("1 Free with 10");
            child.AddGroup(oneFree);

            extraDi = new Group("Extra Discount");
            child.AddGroup(extraDi);

            this.Add(child, colRoot, 200, 6, 190, 2, 156, 2, 546, 10);
            this.Add(oneFree, colRoot, 110, 2, 88, 1, 66, 1, 264, 4);
            this.Add(extraDi, colRoot, 90, 4, 102, 1, 90, 1, 282, 6);

            child = new Group("Newspaper");
            parent.AddGroup(child);

            oneFree = new Group("1 Free with 10");
            child.AddGroup(oneFree);

            extraDi = new Group("Extra Discount");
            child.AddGroup(extraDi);

            this.Add(child, colRoot, 190, 6, 157, 2, 113, 2, 460, 10);
            this.Add(oneFree, colRoot, 88, 5, 77, 1, 33, 1, 198, 7);
            this.Add(extraDi, colRoot, 102, 1, 80, 1, 80, 1, 262, 3);

            this.Add(rowRoot, colRoot, 3259, 73, 2696, 24, 1896, 24, 7851, 121);
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            Group group1 = new Group
            {
                Number = "101",
                Title  = "Факультет энергетического строительства",
            };

            Group group2 = new Group
            {
                Number = "201",
                Title  = "Факультет транспортных коммуникаций",
            };

            Group group3 = new Group
            {
                Number = "301",
                Title  = "Факультет информационных технологий и робототехники",
            };

            Student student1 = new Student
            {
                ID      = "10111",
                Name    = "Олег",
                SurName = "Морозов",
                Marks   = new List <int> {
                    4, 5, 4, 5
                },
                Group = group1
            };

            Student student2 = new Student
            {
                ID      = "10112",
                Name    = "Яна",
                SurName = "Пашкевич",
                Marks   = new List <int> {
                    4, 5, 5, 5
                },
                Group = group1
            };

            Student student3 = new Student
            {
                ID      = "20211",
                Name    = "Павел",
                SurName = "Климов",
                Marks   = new List <int> {
                    4, 4, 3, 3
                },
                Group = group2
            };

            Student student4 = new Student
            {
                ID      = "20212",
                Name    = "Мария",
                SurName = "Иванова",
                Marks   = new List <int> {
                    5, 5, 5, 4
                },
                Group = group2
            };

            Student student5 = new Student
            {
                ID      = "30311",
                Name    = "Кирилл",
                SurName = "Петров",
                Marks   = new List <int> {
                    5, 5, 5, 5
                },
                Group = group3
            };

            Student student6 = new Student
            {
                ID      = "30312",
                Name    = "Анжела",
                SurName = "Мухина",
                Marks   = new List <int> {
                    5, 4, 4, 4
                },
                Group = group3
            };

            List <Group> groups = new List <Group> {
                group1, group2, group3
            };

            List <Student> students = new List <Student> {
                student1, student2, student3, student4, student5, student6
            };

            while (true)
            {
                Console.WriteLine("Введите команду. \n 1 - Список студентов," +
                                  " \n 2 - Добавить студента,\n 3 - Редактировать студента, " +
                                  "\n 4 - Удалить студента, \n 5 - Список групп, \n 6 - Добавить группу, \n " +
                                  "7 - Редактировать групп, \n 8 - Удалить группу \n Q - quit");
                var command = Console.ReadLine();

                switch (command)
                {
                case "1":
                    Student.PrintStudents(students);
                    break;

                case "2":
                    Console.WriteLine("В какую группу добавить студента?");

                    for (int i = 0; i < groups.Count; i++)
                    {
                        Console.Write($"№{i} ");
                        Console.WriteLine(groups[i].Title);
                    }
                    Console.WriteLine("Введите №:");
                    var     inputGroup = int.Parse(Console.ReadLine());
                    Student newstudent = new Student();
                    newstudent = Student.AddStudent(groups[inputGroup]);
                    students.Add(newstudent);
                    break;

                case "3":
                    Student.EditStudent(students, groups);
                    break;

                case "4":
                    Student.Removestudent(students);
                    break;

                case "5":
                    Group.PrintGroups(groups);
                    break;

                case "6":
                    var newgroup = Group.AddGroup(groups);
                    groups.Add(newgroup);
                    break;

                case "7":
                    Group.EditGroup(groups);
                    break;

                case "8":
                    Group.RemoveGroup(groups);
                    break;

                case "Q":
                case "q":
                    return;
                }
            }
        }