Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Model.Warehouse warehouse  = new Model.Warehouse();
            List <Item>     warehouses = new List <Item>();
            Item            item       = new Item()
            {
                Name        = "Шампунь",
                Description = "Шампунь Head'n'Shoulders не шипит глаза",
                Price       = 3000,
                WhenAdded   = DateTime.Now
            };
            ConsoleReporter consoleReporter = new ConsoleReporter();
            Serializer      serializer      = new Serializer();
            ConsoleKeyInfo  key;

            while (true)
            {
                key = System.Console.ReadKey(true);
                if (key.Key == ConsoleKey.Enter)
                {
                    warehouse.AddToWarehouse(warehouses, item);
                    serializer.Serialize(warehouses);
                }
                consoleReporter.Report();
            }
        }
Exemplo n.º 2
0
        public int WaerhouseUpt(Model.Warehouse Model)
        {
            string sql = $"update Warehouse set Mcid={Model.Mcid},Mname='{Model.Mname}',Mplace='{Model.Mplace}',Mcoordinate='{Model.Mcoordinate}',Mnum='{Model.Mnum}'";
            int    i   = DapperHelper.Execute(sql);

            return(i);
        }
        // 修改
        public int UptWarehouse(Model.Warehouse a)
        {
            string sql = $"Update Warehouse Set  WarehouseName='{a.WarehouseName}' , WarehouseSite='{a.WarehouseSite}', WarehouseCoordinate='{a.WarehouseCoordinate}'," +
                         $"WarehouseNum='{a.WarehouseNum}', WarehouseState='{a.WarehouseState}' where WarehouseId='{a.WarehouseId}' ";

            return(DapperHelper.Execute(sql));
        }
        // 新增
        public int AddWarehouse(Model.Warehouse a)
        {
            string sql = $"insert into Warehouse values (null,'{a.WarehouseName}', '{a.WarehouseSite}'," +
                         $" '{a.WarehouseCoordinate}', '{a.WarehouseNum}', '{a.WarehouseState}')";

            return(DapperHelper.Execute(sql));
        }
Exemplo n.º 5
0
        public int Update(Model.Warehouse warehouse)
        {
            string sql = $"UPDATE Warehouse SET WarehouseName='{warehouse.WarehouseName}',WarehouseSite='{warehouse.WarehouseSite}',WarehouseCoordinate='{warehouse.WarehouseCoordinate}',WarehouseNum={warehouse.WarehouseNum},WarehouseState='{warehouse.WarehouseState}' WHERE WarehouseId={warehouse.WarehouseId}";

            return(DapperHelper.Execute(sql));
        }
Exemplo n.º 6
0
        public int Insert(Model.Warehouse Model)
        {
            string sql = $"INSERT INTO Warehouse VALUES(NULL,'{Model.WarehouseName}','{Model.WarehouseSite}','{Model.WarehouseCoordinate}',{Model.WarehouseNum},'{Model.WarehouseState}')";

            return(DapperHelper.Execute(sql));
        }
Exemplo n.º 7
0
        public int WaerhouseAdd(Model.Warehouse Model)
        {
            string sql = $"insert into Warehouse values({Model.Mcid},'{Model.Mname}','{Model.Mplace}','{Model.Mcoordinate}','{Model.Mnum}',{Model.Mstatus})";

            return(DapperHelper.Add(sql));
        }
Exemplo n.º 8
0
        public List <Model.Field> BuildMaze()
        {
            string _filePath = Path.GetDirectoryName(System.AppDomain.CurrentDomain.BaseDirectory);

            _filePath  = Directory.GetParent(_filePath).FullName;
            _filePath  = Directory.GetParent(Directory.GetParent(_filePath).FullName).FullName;
            _filePath += @"\Goudkoorts\Map\Map1.txt";
            TextReader tr = new StreamReader(_filePath);

            string line;

            List <string> list = new List <string>();


            while ((line = tr.ReadLine()) != null)
            {
                list.Add(line);
            }

            char[] characters = list[0].ToArray();
            Route = new Model.Route();
            Model.Field[,] fields = new Model.Field[list.Count, characters.Length];
            for (int i = 0; i < list.Count; i++)
            {
                characters = list[i].ToArray();
                for (int j = 0; j < characters.Length; j++)
                {
                    switch (characters[j])
                    {
                    case '░':
                        Model.WaterField waterfield = new Model.WaterField('░');
                        fields[i, j] = waterfield;
                        Route.Waterfields.Add(waterfield);
                        break;

                    case 'K':
                        fields[i, j] = new Model.QuayField('K');
                        break;

                    case ' ':
                        fields[i, j] = new Model.EmptyField(' ');
                        break;

                    case '←':
                        fields[i, j] = new Model.RegularField('═');
                        break;

                    case '→':
                        fields[i, j] = new Model.RegularField('═');
                        break;

                    case '↑':
                        fields[i, j] = new Model.RegularField('║');
                        break;

                    case '↓':
                        fields[i, j] = new Model.RegularField('║');
                        break;

                    case '█':
                        Model.Warehouse warehouse = new Model.Warehouse('█');
                        fields[i, j] = warehouse;
                        Route.Warehouses.Add(warehouse);
                        break;

                    case '◄':
                        fields[i, j] = new Model.RegularField('~');
                        break;

                    case '╠':
                        //fields[i, j] = new Model.SwitchField('╠');
                        break;

                    case '╣':
                        //fields[i, j] = new Model.SwitchField('╣');
                        break;

                    case 'x':
                        fields[i, j] = new Model.EndField(' ');
                        break;
                    }
                }
            }

            for (int i = 0; i < list.Count; i++)
            {
                characters = list[i].ToArray();
                for (int j = 0; j < characters.Length; j++)
                {
                    switch (characters[j])
                    {
                    case '╠':
                        Model.SwitchField switchField = new Model.SwitchField('╠');
                        switchField.FirstNext      = fields[i, j + 1];
                        switchField.SecondNext     = fields[i, j + 1];
                        switchField.FirstPrevious  = fields[i - 1, j];
                        switchField.SecondPrevious = fields[i + 1, j];
                        fields[i, j] = switchField;
                        Route.Switches.Add(switchField);
                        break;

                    case '╣':
                        Model.SwitchField switchField2 = new Model.SwitchField('╣');
                        switchField2.FirstNext      = fields[i - 1, j];
                        switchField2.SecondNext     = fields[i + 1, j];
                        switchField2.FirstPrevious  = fields[i, j - 1];
                        switchField2.SecondPrevious = fields[i, j - 1];
                        fields[i, j] = switchField2;
                        Route.Switches.Add(switchField2);
                        break;

                    default:
                        break;
                    }
                }
            }

            for (int i = 0; i < list.Count; i++)
            {
                characters = list[i].ToArray();
                for (int j = 0; j < characters.Length; j++)
                {
                    switch (characters[j])
                    {
                    case '←':
                        if (j - 1 > -1)
                        {
                            fields[i, j].Next = fields[i, j - 1];
                        }
                        break;

                    case '→':
                        if (j + 1 < characters.Length)
                        {
                            fields[i, j].Next = fields[i, j + 1];
                        }
                        break;

                    case '░':
                        if (j + 1 < characters.Length)
                        {
                            fields[i, j].Next = fields[i, j + 1];
                        }
                        break;

                    case '█':
                        if (j + 1 < characters.Length)
                        {
                            fields[i, j].Next = fields[i, j + 1];
                        }
                        break;

                    case '↑':
                        if (i - 1 > -1)
                        {
                            fields[i, j].Next = fields[i - 1, j];
                        }
                        break;

                    case '↓':
                        if (i + 1 < list.Count)
                        {
                            fields[i, j].Next = fields[i + 1, j];
                        }
                        break;

                    case 'K':
                        if (j - 1 > -1)
                        {
                            fields[i, j].Next = fields[i, j - 1];
                            //Model.WaterField waterField= new Model.WaterField('░');
                            //waterField.Quay = true;
                            //waterField.Next = fields[i - 1, j].Next;
                            //fields[i - 1, j] = waterField;
                            //fields[i - 1, j - 1].Next = fields[i - 1, j];
                        }
                        break;

                    case '◄':
                        if (j - 1 > -1)
                        {
                            fields[i, j].Next = fields[i, j - 1];
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            List <Model.Field> print = new List <Model.Field>();

            for (int i = 0; i < list.Count; i++)
            {
                characters = list[i].ToArray();
                for (int j = 0; j < characters.Length; j++)
                {
                    print.Add(fields[i, j]);
                }
            }
            return(print);
        }