コード例 #1
0
ファイル: Context.cs プロジェクト: Dergash/TMES
 public void Exec(String Command, params object[] Params)
 {
     using(var Instance = new NSIEntities())
     {
         Instance.Database.ExecuteSqlCommand(Command, Params);
     }
 }
コード例 #2
0
ファイル: OrderRepository.cs プロジェクト: Dergash/TMES
        public Order SelectByCode(String Code)
        {
            Order Result = null;
            using (var Context = new NSIEntities())
            {
                var SearchResult = Context.Zakaz.FirstOrDefault(x => x.zakaz == Code);
                if (SearchResult != null)
                {
                    Result = new Order();
                    Result.Code = Code;
                    Result.Name = SearchResult.NaimZak;                
                }

                // PTP = "00" - planned, "02" - unplanned
                IEnumerable<ZakazVPR> Content = Context.ZakazVPR.
                                                Where(x => x.Z == Code
                                                 && x.PTP == "00").ToList();
                foreach(var Record in Content)
                {
           
                    var Element = new Element()
                    {
             
                        Type = ElementType.Block,
                        Index = Record.IND_CH,
                        Denotation = Record.OBOZN_CH,
                        Amount = Record.KSP ?? 1
                    };
                    Result.Content.Add(Element);
                }

            }

            return Result;
        }
コード例 #3
0
 public void Exec(String Command, params object[] Params)
 {
     using (var Instance = new NSIEntities())
     {
         Instance.Database.ExecuteSqlCommand(Command, Params);
     }
 }
コード例 #4
0
ファイル: OrderRepository.cs プロジェクト: lin0244/TMES
        public Order SelectByCode(String Code)
        {
            Order Result = null;

            using (var Context = new NSIEntities())
            {
                var SearchResult = Context.Zakaz.FirstOrDefault(x => x.zakaz == Code);
                if (SearchResult != null)
                {
                    Result      = new Order();
                    Result.Code = Code;
                    Result.Name = SearchResult.NaimZak;
                }

                // PTP = "00" - planned, "02" - unplanned
                IEnumerable <ZakazVPR> Content = Context.ZakazVPR.
                                                 Where(x => x.Z == Code &&
                                                       x.PTP == "00").ToList();
                foreach (var Record in Content)
                {
                    var Element = new Element()
                    {
                        Type       = ElementType.Block,
                        Index      = Record.IND_CH,
                        Denotation = Record.OBOZN_CH,
                        Amount     = Record.KSP ?? 1
                    };
                    Result.Content.Add(Element);
                }
            }

            return(Result);
        }
コード例 #5
0
        public Department SelectById(Int32 Id)
        {
            Department Result = null;

            using (var Context = new NSIEntities())
            {
                var SearchResult = Context.PDivision.FirstOrDefault(x => x.ID == Id);
                if (SearchResult != null)
                {
                    Result           = new Department();
                    Result.Id        = SearchResult.ID;
                    Result.ShortName = SearchResult.Name;
                    //Result.ColorCode = ColorHelper.Random().ToInt();
                }
            }
            return(Result);
        }
コード例 #6
0
ファイル: DepartmentRepository.cs プロジェクト: Dergash/TMES
        public Department SelectById(Int32 Id)
        {
            Department Result = null;
            using(var Context = new NSIEntities())
            {

                var SearchResult = Context.PDivision.FirstOrDefault(x => x.ID == Id);
                if(SearchResult != null)
                {
                    Result = new Department();
                    Result.Id = SearchResult.ID;
                    Result.ShortName = SearchResult.Name;
                    //Result.ColorCode = ColorHelper.Random().ToInt();
                    
                }
            }
            return Result;
        }