Exemplo n.º 1
0
 public SeatSide GetSeatSideById(int id)
 {
     DispositionDataContext dispositionDb = new DispositionDataContext();
     return (from s in dispositionDb.SeatSides
             where s.SideID == id
             select s).Single();
 }
Exemplo n.º 2
0
 public void DeleteSeatSideById(int id)
 {
     DispositionDataContext dispositionDb = new DispositionDataContext();
     var seatSide = (from s in dispositionDb.SeatSides
                     where s.SideID == id
                     select s).Single();
     dispositionDb.SeatSides.DeleteOnSubmit(seatSide);
     dispositionDb.SubmitChanges();
 }
Exemplo n.º 3
0
 public void UpdateSeatType(SeatType seatType)
 {
     DispositionDataContext dispositionDb = new DispositionDataContext();
     var updateSeatType = (from s in dispositionDb.SeatTypes
                     where s.TypeID == seatType.TypeID
                     select s).Single();
     updateSeatType.Code = seatType.Code;
     updateSeatType.Description = seatType.Description;
     updateSeatType.Obsolete = seatType.Obsolete;
     dispositionDb.SubmitChanges();
 }
Exemplo n.º 4
0
        public IEnumerable<Defect> GetDefectsByCommodityId(int id)
        {
            DispositionDataContext dbDisposition = new DispositionDataContext();
            var defectList = (from d in DispositionCacheManager.Defect2Commodities
                              where d.CommodityID == id
                              orderby d.Defect.Description
                              select new Defect
                              {
                                  DefectID = d.Defect.DefectID,
                                  Description = d.Defect.Description.Trim(),
                                  Obsolete = d.Defect.Obsolete,
                                  Code = d.Defect.Code
                              }).ToList().OrderBy(c => c.Description);

            return defectList;
        }
Exemplo n.º 5
0
        public IEnumerable<DefectDetail> GetDefectDetailsByCommodityAndDefect(int commodityID, int defectID)
        {
            DispositionDataContext dbDisposition = new DispositionDataContext();

            var defectDetailList = (from d in DispositionCacheManager.DefectDetail2CommoditiyAndDefect
                                    where d.CommodityID == commodityID && d.DefectID == defectID
                                    orderby d.DefectDetail.Description
                                    select new DefectDetail
                                    {
                                        DefectDetailID = d.DefectDetail.DefectDetailID,
                                        Code = d.DefectDetail.Code,
                                        Description = d.DefectDetail.Description.Trim(),
                                        Obsolete = d.DefectDetail.Obsolete
                                    }).ToList().OrderBy(c => c.Description);
            return defectDetailList;
        }
Exemplo n.º 6
0
 public Printer GetPrinter(int id)
 {
     DispositionDataContext dbDisposition = new DispositionDataContext();
     var printer = (from p in dbDisposition.Printers where p.Id == id select p).Single();
     return printer;
 }
Exemplo n.º 7
0
 public IEnumerable<Printer> GetPrinters()
 {
     DispositionDataContext dbDisposition = new DispositionDataContext();
     var printers = (from p in dbDisposition.Printers select p).ToList();
     return printers;
 }
Exemplo n.º 8
0
 public void DeleteDefectXrefCommodity(int defectId, int commodityId)
 {
     DispositionDataContext dispositionDb = new DispositionDataContext();
     var xref = (from s in dispositionDb.Xref_Defects_Commodities
                 where s.CommodityID == commodityId && s.DefectID == defectId 
                 select s).Single();
     dispositionDb.Xref_Defects_Commodities.DeleteOnSubmit(xref);
     DispositionCacheManager.RefreshDefect2Commodities();
 }
Exemplo n.º 9
0
 public IEnumerable<Commodity> GetCommoditiesByDefectId(int id)
 {
     DispositionDataContext dbDisposition = new DispositionDataContext();
     var commodities = (from x in DispositionCacheManager.Defect2Commodities
                        join c in dbDisposition.Commodities on x.CommodityID equals c.CommodityID
                        where x.DefectID == id
                        select new Commodity
                        {
                            Code = c.Code,
                            CommodityID = c.CommodityID,
                            Description = c.Description,
                            Obsolete = c.Obsolete
                        }).ToList();
     return commodities;
 }
Exemplo n.º 10
0
        public void InsertScrapDispositionDefectHistory(IEnumerable<DispositionTag> tags)
        {
            DispositionDataContext dbDisposition = new DispositionDataContext();

            foreach (var tag in tags)
            {
                var side = GetValidSeatSide(tag.Part.side.Trim());
                ScrapDispositionDefectHistory history = new ScrapDispositionDefectHistory
                {
                    DispositionType = tag.Disposition.Transaction.Trim(),
                    Employee = tag.EmployeeInfo.Name.Trim(),
                    PartNumber = tag.Part.partno.Trim(),
                    Qty = tag.Disposition.Qty,
                    TypeID = tag.Disposition.SeatType.TypeID,
                    SeatPortionID = tag.Disposition.SeatPortion.SeatPortionID,
                    SideID = side.SideID,
                    CommodityID = tag.Disposition.SeatCommodity.CommodityID,
                    DefectID = tag.Disposition.SeatDefect.DefectID,
                    DefectDetailID = tag.Disposition.SeatDefectDetail.DefectDetailID,
                    CompletedOn = DateTime.Now,
                };

                dbDisposition.ScrapDispositionDefectHistories.InsertOnSubmit(history);
            }
            dbDisposition.SubmitChanges();
        }
Exemplo n.º 11
0
        //public List<FinalQuestionResult> GetFinalQuestionsResult(string groupType)
        //{
        //    DispositionDataContext dbDisposition = new DispositionDataContext();
        //    var questions = (from q in dbDisposition.FinalQuestions.Where(s=>s.Group == groupType)
        //                     orderby q.Priority descending
        //                     select new FinalQuestionResult
        //                     {
        //                         FinalQuestion = q,
        //                         Result = -1,
        //                     }).ToList();
        //    return questions;
        //}

        //public FinalQuestion GetFinalMoreQuestions(int id, int result)
        //{
        //    DispositionDataContext dbDisposition = new DispositionDataContext();
        //    FinalQuestion newQuestion = null;
        //    var more = (from q in dbDisposition.FinalMoreQuestions
        //                where q.FinalQuestionId == id && q.Result == result
        //                select q).FirstOrDefault();

        //    if (more != null) {
        //        newQuestion = dbDisposition.FinalQuestions.Where(q => q.Id == more.FinalLinkQuestionId).FirstOrDefault();
        //    }
        //    return newQuestion;
        //}

        private SeatSide GetValidSeatSide(string side) {
            DispositionDataContext dbDisposition = new DispositionDataContext();
            string filter = side;
            if (filter.Equals("RHD")) {
                filter = "RH";
            } else if (filter.Equals("LHD")) {
                filter = "LH";
            }

            var sides = (from s in dbDisposition.SeatSides where s.Description.Trim().Equals(filter) select s).ToList();
            if (sides.Count() > 0)
                return sides.Single();
            else
            {
                return (from s in dbDisposition.SeatSides where s.Description.Trim().Equals("N/A") select s).Single();
            }
        }
Exemplo n.º 12
0
        public void DeleteFinalQuestionById(int id)
        {
            DispositionDataContext dbDisposition = new DispositionDataContext();
            var item = dbDisposition.FinalQuestions.Where(q => q.Id == id).FirstOrDefault();
            if (item != null)
            {
                dbDisposition.FinalQuestions.DeleteOnSubmit(item);
                dbDisposition.SubmitChanges();
            }

        }
Exemplo n.º 13
0
        public void UpdateDefectDetail(DefectDetail defectDetail)
        {
            DispositionDataContext dispositionDb = new DispositionDataContext();
            var updateDefectDetail = (from s in dispositionDb.DefectDetails
                                      where s.DefectDetailID == defectDetail.DefectDetailID
                                      select s).Single();

            updateDefectDetail.Code = defectDetail.Code;
            updateDefectDetail.Description = defectDetail.Description;
            updateDefectDetail.Obsolete = defectDetail.Obsolete;
            dispositionDb.SubmitChanges();
        }
Exemplo n.º 14
0
 public void CreateDefectDetail(DefectDetail defectDetail)
 {
     DispositionDataContext dispositionDb = new DispositionDataContext();
     dispositionDb.DefectDetails.InsertOnSubmit(defectDetail);
     dispositionDb.SubmitChanges();
     DispositionCacheManager.RefreshDefectDetails();
 }
Exemplo n.º 15
0
 public void DeleteDefectDetailById(int id)
 {
     DispositionDataContext dispositionDb = new DispositionDataContext();
     var defectDetail = (from s in dispositionDb.DefectDetails
                      where s.DefectDetailID == id
                      select s).Single();
     dispositionDb.DefectDetails.DeleteOnSubmit(defectDetail);
     dispositionDb.SubmitChanges();
     DispositionCacheManager.RefreshDefectDetails();
 }
Exemplo n.º 16
0
        public DefectDetail GetDefectDetailById(int id)
        {
            DispositionDataContext dispositionDb = new DispositionDataContext();
            var defectDetail = (from s in dispositionDb.DefectDetails
                    where s.DefectDetailID == id
                    select s).Single();

            var result = new DefectDetail
            {
                Code = defectDetail.Code,
                DefectDetailID = defectDetail.DefectDetailID,
                Description = defectDetail.Description,
                Obsolete = defectDetail.Obsolete
            };
            return result;
        }
Exemplo n.º 17
0
        public IEnumerable<DefectDetail> GetDefectDetails()
        {
            DispositionDataContext dispositionDb = new DispositionDataContext();
            var defectDetailList = (from d in dispositionDb.DefectDetails
                                    select d).ToList();

            var results = (from d in defectDetailList
                            select new DefectDetail
                            {
                                DefectDetailID = d.DefectDetailID,
                                Code = d.Code,
                                Description = d.Description.Trim(),
                                Obsolete = d.Obsolete
                            }).ToList().OrderBy(c=>c.Description).ToList();
            return results;
        }
Exemplo n.º 18
0
 public void DeleteDefectXrefCommodity(Xref_Defects_Commodity reference)
 {
     DispositionDataContext dispositionDb = new DispositionDataContext();
     var result = (from d in dispositionDb.Xref_Defects_Commodities
                   where d.CommodityID == reference.CommodityID && d.DefectID == reference.DefectID 
                   select d).Single();
     dispositionDb.Xref_Defects_Commodities.DeleteOnSubmit(result);
     dispositionDb.SubmitChanges();
     DispositionCacheManager.RefreshDefect2Commodities();
 }
Exemplo n.º 19
0
        public void CreateDefectXrefCommodity(Xref_Defects_Commodity reference)
        {
            DispositionDataContext dispositionDb = new DispositionDataContext();
            dispositionDb.Xref_Defects_Commodities.InsertOnSubmit(reference);
            try
            {
                dispositionDb.SubmitChanges();
                DispositionCacheManager.RefreshDefect2Commodities();
            }
            catch (Exception ex)
            {

            }
        }
Exemplo n.º 20
0
 public void CreateFinalQuestion(FinalQuestion question)
 {
     DispositionDataContext dbDisposition = new DispositionDataContext();
     dbDisposition.FinalQuestions.InsertOnSubmit(question);
     dbDisposition.SubmitChanges();
 }
Exemplo n.º 21
0
 public void UpdateFinalQuestion(FinalQuestion question)
 {
     DispositionDataContext dbDisposition = new DispositionDataContext();
     var item = dbDisposition.FinalQuestions.Where(q => q.Id == question.Id).FirstOrDefault();
     if (item != null)
     {
         item.Parent = question.Parent;
         item.Priority = question.Priority;
         item.Question = question.Question.Trim();
         item.Group = question.Group;
         dbDisposition.SubmitChanges();
     }
     
 }
Exemplo n.º 22
0
        public void CreateDefectDetailRefCommodityDefect(int commodityId, int defectId, int defectDetailId) 
        {
            DispositionDataContext dbDisposition = new DispositionDataContext();
            Xref_DefectDetail_Commodity_Defect reference = new Xref_DefectDetail_Commodity_Defect
            {
                CommodityID = commodityId,
                DefectID = defectId,
                DefectDetailID = defectDetailId
            };

            dbDisposition.Xref_DefectDetail_Commodity_Defects.InsertOnSubmit(reference);
            dbDisposition.SubmitChanges();
            DispositionCacheManager.RefreshDefectDetail2CommoditiyAndDefect();
        }
Exemplo n.º 23
0
 public List<FinalQuestion> GetFinalQuestions()
 {
     DispositionDataContext dbDisposition = new DispositionDataContext();
     var questions = (from q in dbDisposition.FinalQuestions
                      orderby q.Priority descending
                      select q).ToList();
     return questions;
 }
Exemplo n.º 24
0
        public void DeleteDefectDetailRefCommodityDefect(int commodityId, int defectId, int defectDetailId)
        {
            DispositionDataContext dbDisposition = new DispositionDataContext();
            var reference = (from r in dbDisposition.Xref_DefectDetail_Commodity_Defects
                             where r.CommodityID == commodityId && r.DefectID == defectId && r.DefectDetailID == defectDetailId
                             select r).Single();

            dbDisposition.Xref_DefectDetail_Commodity_Defects.DeleteOnSubmit(reference);
            dbDisposition.SubmitChanges();
            DispositionCacheManager.RefreshDefectDetail2CommoditiyAndDefect();
        }
Exemplo n.º 25
0
 public IEnumerable<SeatSide> GetSeatSides()
 {
     DispositionDataContext dispositionDb = new DispositionDataContext();
     return (from s in dispositionDb.SeatSides
             select s).ToList().OrderBy(c => c.Description).ToList();
 }
Exemplo n.º 26
0
 public IEnumerable<Xref_DefectDetail_Commodity_Defect> GetDefectDetail2CommoditiyAndDefect()
 {
     DispositionDataContext dbDisposition = new DispositionDataContext();
     var defect2commoditiesanddefect = (from d in dbDisposition.Xref_DefectDetail_Commodity_Defects select d).ToList();
     return defect2commoditiesanddefect;
 }
Exemplo n.º 27
0
 public void DeleteDefectById(int id)
 {
     DispositionDataContext dispositionDb = new DispositionDataContext();
     var defect = (from s in dispositionDb.Defects
                      where s.DefectID == id
                      select s).Single();
     dispositionDb.Defects.DeleteOnSubmit(defect);
     dispositionDb.SubmitChanges();
 }
Exemplo n.º 28
0
 public IEnumerable<Xref_Defects_Commodity> GetDefect2Commodities()
 {
     DispositionDataContext dbDisposition = new DispositionDataContext();
     var defect2commodities = (from d in dbDisposition.Xref_Defects_Commodities select d).ToList();
     return defect2commodities;
 }
Exemplo n.º 29
0
 public void CreateSeatSide(SeatSide seatSide)
 {
     DispositionDataContext dispositionDb = new DispositionDataContext();
     dispositionDb.SeatSides.InsertOnSubmit(seatSide);
     dispositionDb.SubmitChanges();
 }
Exemplo n.º 30
0
 public void CreateDefect(Defect defect)
 {
     DispositionDataContext dispositionDb = new DispositionDataContext();
     dispositionDb.Defects.InsertOnSubmit(defect);
     dispositionDb.SubmitChanges();
 }