Beispiel #1
0
        public void Create(Entities.SostavIzdeliaTo newSostavIzdelia)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            SostavIzdelia _sostavIzdelia;

            /*создание объекта добавляемой строки*/
            _sostavIzdelia= new SostavIzdelia
            {
                Count = newSostavIzdelia.count,
                IdCurrent = newSostavIzdelia.idCurrent,
                IdIzdelia = newSostavIzdelia.idIzdelia,
                IdLast = newSostavIzdelia.idLast
            };

            // Вставка данных
            db.SostavIzdelia.InsertOnSubmit(_sostavIzdelia);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #2
0
        public void CreateDirectory(Entities.DirectoryTo newDirectory)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            DirectoryTable _directory;

            /*создание объекта добавляемой строки*/
            _directory = new DirectoryTable
            {
                MaterialCode = newDirectory.MaterialCode,
                NormMaterial = newDirectory.NormMaterial,
                NormWaste = newDirectory.NormWaste,
                ProductionCode = newDirectory.ProductionCode
            };
            // Вставка данных
            db.DirectoryTable.InsertOnSubmit(_directory);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #3
0
        public List<Entities.ProductionEntity> GetAllProductions()
        {
            try
            {
                var db = new DBElectricDataContext();
                IEnumerable<Entities.ProductionEntity> productions =
                                        from production in db.ProductionTable
                                        select new Entities.ProductionEntity(
                                            production.ProductionCode,
                                            production.NameProduction,
                                            production.DesignationProduction,
                                            //production.UnitTable.ShortNameUnit,
                                            //production.UnitCode,
                                            //production.CountProduction,
                                            production.TypeTable.NameType,
                                            production.TypeCode,
                                            production.SortTable.NameSort,
                                            production.SortCode,
                                            production.SignTable.NameSign,
                                            production.SignCode);

                return productions.ToList();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #4
0
        public void CreateProduction(Entities.ProductionTo newProduction)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            ProductionTable _production;

            /*создание объекта добавляемой строки*/
            _production = new ProductionTable
            {
                SignCode = newProduction.SignCode,
                SortCode = newProduction.SortCode,
                TypeCode = newProduction.TypeCode,
                ProductionCode = newProduction.ProductionCode,
                NameProduction = newProduction.NameProduction,
                DesignationProduction = newProduction.DesignationProduction,
                //CountProduction = newProduction.CountProduction,
                //UnitCode = newProduction.UnitCode
            };
            // Вставка данных
            db.ProductionTable.InsertOnSubmit(_production);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #5
0
        public List<Entities.TypeEntity> GetAllTypes()
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.TypeEntity> types =
                                        from type in db.TypeTable
                                        select new Entities.TypeEntity(
                                            type.TypeCode,
                                            type.NameType);

                return types.ToList();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #6
0
        public List<Entities.SortEntity> GetAllSorts()
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.SortEntity> sorts =
                                        from sort in db.SortTable
                                        select new Entities.SortEntity(
                                            sort.SortCode,
                                            sort.NameSort);

                return sorts.ToList();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #7
0
        public List<Entities.SignEntity> GetAllSigns()
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.SignEntity> signs =
                                        from sign in db.SignTable
                                        select new Entities.SignEntity(
                                            sign.SignCode,
                                            sign.NameSign);

                return signs.ToList();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #8
0
        public Entities.SortEntity GetSort(int idSort)
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.SortEntity> sorts =
                                        from sort in db.SortTable
                                        where sort.SortCode == idSort
                                        select new Entities.SortEntity(
                                            sort.SortCode,
                                            sort.NameSort);

                return sorts.First();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #9
0
        public List<Entities.UnitEntity> GetAllUnits()
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.UnitEntity> units =
                                        from unit in db.UnitTable
                                        select new Entities.UnitEntity(
                                            unit.UnitCode,
                                            unit.NameUnit,
                                            unit.ShortNameUnit);

                return units.ToList();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #10
0
        public Entities.TypeEntity GetType(int idType)
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.TypeEntity> types =
                                        from type in db.TypeTable
                                        where type.TypeCode == idType
                                        select new Entities.TypeEntity(
                                            type.TypeCode,
                                            type.NameType);

                return types.First();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #11
0
        public List<Entities.MaterialEntity> GetAllMaterials()
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.MaterialEntity> materials =
                                        from material in db.MaterialTable
                                        select new Entities.MaterialEntity(
                                            material.MaterialCode,
                                            material.NameMaterial,
                                            material.UnitTable.NameUnit);

                return materials.ToList();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #12
0
        public Entities.SignEntity GetSign(int idSign)
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.SignEntity> signs =
                                        from sign in db.SignTable
                                        where sign.SignCode == idSign
                                        select new Entities.SignEntity(
                                            sign.SignCode,
                                            sign.NameSign);

                return signs.First();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #13
0
        public Entities.UnitEntity GetUnit(int idUnit)
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.UnitEntity> units =
                                        from unit in db.UnitTable
                                        where unit.UnitCode == idUnit
                                        select new Entities.UnitEntity(
                                            unit.UnitCode,
                                            unit.NameUnit,
                                            unit.ShortNameUnit);

                return units.First();
            }
            catch (Exception ex) { throw ex; }
        }
        public List<Entities.PolnayaPrimenyaemostEntity> getAll()
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.PolnayaPrimenyaemostEntity> polnayaPrimenyaemosts =
                                        from polnayaPrimenyaemost in db.PolnayaPrimenyaemost
                                        select new Entities.PolnayaPrimenyaemostEntity(
                                            polnayaPrimenyaemost.Id,
                                            polnayaPrimenyaemost.detalCode,
                                            db.ProductionTable.Where(x => x.ProductionCode == polnayaPrimenyaemost.detalCode).First().NameProduction,
                                            polnayaPrimenyaemost.Count);

                return polnayaPrimenyaemosts.ToList();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #15
0
        public List<Entities.DirectoryEntity> GetAllDirectorys()
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.DirectoryEntity> directorys =
                                        from directory in db.DirectoryTable
                                        select new Entities.DirectoryEntity(
                                            directory.ProductionCode,
                                            directory.ProductionTable.NameProduction,
                                            directory.MaterialCode,
                                            directory.MaterialTable.NameMaterial,
                                            directory.NormMaterial,
                                            directory.NormWaste);

                return directorys.ToList();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #16
0
        public List<Entities.SostavIzdeliaEntity> getAll()
        {
            try
            {
                var db = new DBElectricDataContext();

                IEnumerable<Entities.SostavIzdeliaEntity> sostavIzdelias =
                                        from sostavIzdelia in db.SostavIzdelia
                                        select new Entities.SostavIzdeliaEntity(sostavIzdelia.Id,
                                            sostavIzdelia.IdIzdelia,
                                            db.ProductionTable.Where(x => x.ProductionCode == sostavIzdelia.IdIzdelia).First().NameProduction,
                                            sostavIzdelia.IdLast,
                                            db.ProductionTable.Where(x => x.ProductionCode == sostavIzdelia.IdLast).First().NameProduction,
                                            sostavIzdelia.IdCurrent,
                                            db.ProductionTable.Where(x => x.ProductionCode == sostavIzdelia.IdCurrent).First().NameProduction,
                                            sostavIzdelia.Count);

                return sostavIzdelias.ToList();
            }
            catch { throw; }
        }
Beispiel #17
0
        public void DeleteDirectory(long idDirectory)
        {
            var db = new DBElectricDataContext();

            var deleteOrderDirectory =
                from directorys in db.DirectoryTable
                where directorys.ProductionCode == idDirectory
                select directorys;

            foreach (var directory in deleteOrderDirectory)
            {
                db.DirectoryTable.DeleteOnSubmit(directory);
            }
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void clearAll()
        {
            var db = new DBElectricDataContext();

            /*var deleteOrderMaterial =
                from materials in db.MaterialTable
                where materials.MaterialCode == idMaterial
                select materials;*/

            foreach (var polnayaPrimenyaemost in db.PolnayaPrimenyaemost)
            {
                db.PolnayaPrimenyaemost.DeleteOnSubmit(polnayaPrimenyaemost);
            }
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #19
0
        public void DeleteSign(int idSign)
        {
            var db = new DBElectricDataContext();

            var deleteOrderSign =
                from signs in db.SignTable
                where signs.SignCode == idSign
                select signs;

            foreach (var sign in deleteOrderSign)
            {
                db.SignTable.DeleteOnSubmit(sign);
            }
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #20
0
        public void DeleteType(int idType)
        {
            var db = new DBElectricDataContext();

            var deleteOrderType =
                from types in db.TypeTable
                where types.TypeCode == idType
                select types;

            foreach (var type in deleteOrderType)
            {
                db.TypeTable.DeleteOnSubmit(type);
            }
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #21
0
        public void CreateType(Entities.TypeTo newType)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            TypeTable _type;

            /*создание объекта добавляемой строки*/
            _type = new TypeTable
            {
                NameType = newType.NameType
            };
            // Вставка данных
            db.TypeTable.InsertOnSubmit(_type);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #22
0
        public void DeleteProduction(long idProduction)
        {
            var db = new DBElectricDataContext();

            var deleteOrderProduction =
                from productions in db.ProductionTable
                where productions.ProductionCode == idProduction
                select productions;

            foreach (var production in deleteOrderProduction)
            {
                db.ProductionTable.DeleteOnSubmit(production);
            }
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #23
0
        public void DeleteUnit(int idUnit)
        {
            var db = new DBElectricDataContext();

            var deleteOrderUnit =
                from units in db.UnitTable
                where units.UnitCode == idUnit
                select units;

            foreach (var unit in deleteOrderUnit)
            {
                db.UnitTable.DeleteOnSubmit(unit);
            }
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #24
0
        public void CreateSign(Entities.SignTo newSign)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            SignTable _sign;

            /*создание объекта добавляемой строки*/
            _sign = new SignTable
            {
                NameSign = newSign.NameSign
            };
            // Вставка данных
            db.SignTable.InsertOnSubmit(_sign);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #25
0
        public void Delete(long IdDeliting)
        {
            var db = new DBElectricDataContext();

            var deleteOrderSostavIzdelia =
                from sostavIzdelia in db.SostavIzdelia
                where sostavIzdelia.Id== IdDeliting
                select sostavIzdelia;

            foreach (var sostavIzdelia in deleteOrderSostavIzdelia)
            {
                db.SostavIzdelia.DeleteOnSubmit(sostavIzdelia);
            }
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #26
0
        public void DeleteSort(int idSort)
        {
            var db = new DBElectricDataContext();

            var deleteOrderSort =
                from sorts in db.SortTable
                where sorts.SortCode == idSort
                select sorts;

            foreach (var sort in deleteOrderSort)
            {
                db.SortTable.DeleteOnSubmit(sort);
            }
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #27
0
        public void DeleteMaterial(long idMaterial)
        {
            var db = new DBElectricDataContext();

            var deleteOrderMaterial =
                from materials in db.MaterialTable
                where materials.MaterialCode == idMaterial
                select materials;

            foreach (var material in deleteOrderMaterial)
            {
                db.MaterialTable.DeleteOnSubmit(material);
            }
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void Create(Entities.PolnayaPrimenyaemostTo newPolnayaPrimenyaemost)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            PolnayaPrimenyaemost _polnayaPrimenyaemost;

            /*создание объекта добавляемой строки*/
            _polnayaPrimenyaemost = new PolnayaPrimenyaemost
            {
                Count = newPolnayaPrimenyaemost.count,
                detalCode = newPolnayaPrimenyaemost.idDetali
            };
            // Вставка данных
            db.PolnayaPrimenyaemost.InsertOnSubmit(_polnayaPrimenyaemost);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #29
0
        public void CreateUnit(Entities.UnitTo newUnit)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            UnitTable _unit;

            /*создание объекта добавляемой строки*/
            _unit = new UnitTable
            {
                NameUnit = newUnit.NameUnit,
                ShortNameUnit = newUnit.ShortNameUnit
            };
            // Вставка данных
            db.UnitTable.InsertOnSubmit(_unit);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #30
0
        public void CreateMaterial(Entities.MaterialTo newMaterial)
        {
            /*добавить запрись в базу данных*/
            /*создание объекта БД*/
            var db = new DBElectricDataContext();

            MaterialTable _material;

            /*создание объекта добавляемой строки*/
            _material = new MaterialTable
            {
                MaterialCode = newMaterial.MaterialCode,
                NameMaterial = newMaterial.NameMaterial,
                UnitCode = newMaterial.UnitCode
            };
            // Вставка данных
            db.MaterialTable.InsertOnSubmit(_material);
            // Отправка изменений в базу данных
            try
            {
                db.SubmitChanges();
            }
            catch (Exception ex) { throw ex; }
        }