示例#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
        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
        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
        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;
        }