public List <Barcode> Search(int lotId)
        {
            using (PCBVIEntities context = DbContextFactory.Create())
            {
                var query = from x in context.LotBarCodes
                            select new
                {
                    Lot       = x.Lot,
                    Barcode   = x.Barcode,
                    LotName   = x.Lot.LotCode,
                    ItemName  = x.Barcode.Item.Name,
                    ErrorType = x.Barcode.ErrorCode.ErrorType.Name
                };

                if (lotId != 0)
                {
                    query = query.Where(x => x.Lot.LotId == lotId);
                }


                foreach (var x in query)
                {
                    x.Barcode.LotName       = x.LotName;
                    x.Barcode.ItemName      = x.ItemName;
                    x.Barcode.ErrorTypeName = x.ErrorType;
                }

                var list = query.ToList();

                return(list.ConvertAll(x => x.Barcode));
            }
        }
Exemple #2
0
 //Get ALl
 public List <T> GetAll()
 {
     using (PCBVIEntities context = DbContextFactory.Create())// DB컨텍스트
     {
         return(context.Set <T>().ToList());
     }
 }
Exemple #3
0
 //Get Count 숫자
 public int GetCount()
 {
     using (PCBVIEntities context = DbContextFactory.Create())
     {
         return(context.Set <T>().Count());
     }
 }
Exemple #4
0
 //삽입
 public void Insert(T entity)
 {
     using (PCBVIEntities context = DbContextFactory.Create())
     {
         context.Set <T>().Add(entity);
         context.SaveChanges();
     }
 }
Exemple #5
0
        //삭제
        public void Delete(T entity)
        {
            using (PCBVIEntities context = DbContextFactory.Create())
            {
                context.Entry(entity).State = EntityState.Deleted;

                context.SaveChanges();
            }
        }
Exemple #6
0
        //리스트 등록

        public void InsertALL(List <T> entiList)
        {
            using (PCBVIEntities context = DbContextFactory.Create())
            {
                entiList.ForEach(n => context.Set <T>().Add(n));
                context.SaveChanges();
                // companies.ForEach(n => context.AddToCompanies(n));
            }
        }
Exemple #7
0
        /// <summary>
        ///  //회원이 맞으면 true 아니면 false
        /// </summary>
        public Employee IsCorrectEmployee(string id, string password)
        {
            using (PCBVIEntities context = DbContextFactory.Create())
            {
                var query = from x in context.Employees
                            where x.LoginId.Equals(id) && x.Password.Equals(password)
                            select x;

                return(query.FirstOrDefault());
            }
        }
Exemple #8
0
        public Barcode Search(int code)
        {
            using (PCBVIEntities context = new PCBVIEntities())
            {
                var query = from x in context.Barcodes
                            where x.BarcodeCode == code
                            select x;

                return(query.ToList()[0]);
            }
        }
Exemple #9
0
        public bool InsertOrUpdate(Barcode barcode)
        {
            using (PCBVIEntities context = new PCBVIEntities())
            {
                context.Entry(barcode).State = barcode.BarcodeId != 0 ? EntityState.Modified : EntityState.Added;

                try
                {
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    if (e != null)
                    {
                        return(false);
                    }
                }
                return(true);
            }
        }
Exemple #10
0
        public List <ErrorCode> Search(int codeId, int typeId, int kindId)
        {
            using (PCBVIEntities context = DbContextFactory.Create())
            {
                var query = from x in context.ErrorCodes
                            //where x.Code.Equals(code) &&
                            //x.ErrorKind.Name.Equals(kind) &&
                            //x.ErrorType.Name.Equals(type)
                            select new
                {
                    ErrorCode     = x,
                    ErrorKindName = x.ErrorKind.Name,
                    ErrorTypeName = x.ErrorType.Name
                };

                if (codeId != 0)
                {
                    query = query.Where(x => x.ErrorCode.ErrorCodeId == codeId);
                }

                if (typeId != 0)
                {
                    query = query.Where(x => x.ErrorCode.ErrorTypeId == typeId);
                }

                if (kindId != 0)
                {
                    query = query.Where(x => x.ErrorCode.ErrorKindId == kindId);
                }

                foreach (var x in query)
                {
                    x.ErrorCode.ErrorKindName = x.ErrorKindName;
                    x.ErrorCode.ErrorTypeName = x.ErrorTypeName;
                }

                var list = query.ToList();

                return(list.ConvertAll(x => x.ErrorCode));
            }
        }