コード例 #1
0
ファイル: SeamList.cs プロジェクト: rAum/SeamCarving
 public SeamList(int length, SeamType seamType)
 {
     seams = new List<int>[length];
     len = length;
     seamsCount = 0;
     type = seamType;
 }
コード例 #2
0
        public IList <Pipe> GetPipesToExport()
        {
            try
            {
                // PipeTestResult result = null;
                // Inspector inspector = null;
                // Certificate certificate = null;
                // var q = session.QueryOver<Pipe>()
                //     .Where(n => ((n.ToExport == true)))
                //     .JoinAlias(r => r.PipeTestResult, () => result, JoinType.LeftOuterJoin)
                //     .JoinAlias(() => result.Inspectors, () => inspector, JoinType.LeftOuterJoin)
                //     .JoinAlias(() => inspector.Certificates, () => certificate, JoinType.LeftOuterJoin)
                //     .TransformUsing(Transformers.DistinctRootEntity)
                //     .List<Pipe>();
                //return q;

                Plate             plate       = null;
                Heat              heat        = null;
                PlateManufacturer plateMan    = null;
                PipeMillSizeType  type        = null;
                PipeTest          tests       = null;
                PipeTestResult    result      = null;
                Inspector         inspector   = null;
                Certificate       certificate = null;
                Project           proj        = null;
                SeamType          seam        = null;
                Spool             spool       = null;
                File              attach      = null;

                var q = session.QueryOver <Pipe>()
                        .Where(n => ((n.ToExport == true)))

                        .JoinAlias(r => r.PipeTestResult, () => result, JoinType.LeftOuterJoin)
                        .JoinAlias(() => result.Inspectors, () => inspector, JoinType.LeftOuterJoin)
                        .JoinAlias(() => inspector.Certificates, () => certificate, JoinType.LeftOuterJoin)

                        .JoinAlias(p => p.Plate, () => plate, JoinType.LeftOuterJoin)
                        .JoinAlias(() => plate.Heat, () => heat, JoinType.LeftOuterJoin)
                        .JoinAlias(() => heat.PlateManufacturer, () => plateMan, JoinType.LeftOuterJoin)

                        .JoinAlias(t => t.Type, () => type, JoinType.LeftOuterJoin)
                        .JoinAlias(() => type.SeamType, () => seam, JoinType.LeftOuterJoin)
                        .JoinAlias(() => type.PipeTests, () => tests, JoinType.LeftOuterJoin)

                        .JoinAlias(t => t.Spools, () => spool, JoinType.LeftOuterJoin)
                        .JoinAlias(t => t.Attachments, () => attach, JoinType.LeftOuterJoin)
                        .JoinAlias(t => t.Project, () => proj, JoinType.LeftOuterJoin)

                        .Fetch(o => o.PurchaseOrder).Eager
                        .Fetch(r => r.Railcar).Eager

                        .TransformUsing(Transformers.DistinctRootEntity)
                        .List <Pipe>();
                return(q);
            }
            catch (GenericADOException ex)
            {
                throw new RepositoryException("GetPipesToExport", ex);
            }
        }
コード例 #3
0
        //
        // GET: /SeamType/Details/5

        public ActionResult Details(int id = 0)
        {
            SeamType seamtype = db.SeamTypes.Find(id);

            if (seamtype == null)
            {
                return(HttpNotFound());
            }
            return(View(seamtype));
        }
コード例 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            SeamType seamtype = db.SeamTypes.Find(id);

            db.SeamTypes.Remove(seamtype);
            db.SaveChanges();
            if (Insert_CodeLookUp_Audit("Seam Weld Type", "Delete", seamtype.SeamTypeItem, ""))
            {
                //nothing to do at this point.
            }
            return(RedirectToAction("Index"));
        }
コード例 #5
0
 public ActionResult Edit(SeamType seamtype)
 {
     if (ModelState.IsValid)
     {
         db.Entry(seamtype).State = EntityState.Modified;
         db.SaveChanges();
         if (Insert_CodeLookUp_Audit("Seam Weld Type", "Edit", Session["CodeLookUpAduit_Oldvalue"].ToString(), seamtype.SeamTypeItem))
         {
             //nothing to do at this point.
         }
         return(RedirectToAction("Index"));
     }
     return(View(seamtype));
 }
コード例 #6
0
        public SeamTypeObject(SeamType seamType)
        {
            this.Id       = seamType.Id;
            this.IsActive = seamType.IsActive;
            this.Name     = seamType.Name;

            if (seamType.SeamTypes != null)
            {
                this.SeamTypes = new List <SeamTypeObject>();
                foreach (var st in seamType.SeamTypes)
                {
                    this.SeamTypes.Add(new SeamTypeObject(st));
                }
            }
        }
コード例 #7
0
        public ActionResult Create(SeamType seamtype)
        {
            if (ModelState.IsValid)
            {
                db.SeamTypes.Add(seamtype);
                db.SaveChanges();
                if (Insert_CodeLookUp_Audit("Seam Weld Type", "Create", "", seamtype.SeamTypeItem))
                {
                    //nothing to do at this point.
                }
                return(RedirectToAction("Index"));
            }

            return(View(seamtype));
        }
コード例 #8
0
ファイル: DataImporter.cs プロジェクト: AleksMorozova/prizm
        private SeamType ImportSeamType(SeamTypeObject seamTypeObj)
        {
            if (seamTypeObj == null)
            {
                return(null);
            }

            bool     isNew    = false;
            SeamType seamType = importRepo.SeamTypeRepo.Get(seamTypeObj.Id);

            if (seamType == null)
            {
                seamType = new SeamType();
                isNew    = true;
            }

            seamType.Id       = seamTypeObj.Id;
            seamType.IsActive = seamTypeObj.IsActive;
            seamType.Name     = seamTypeObj.Name;
            seamType.IsNative = false;
            seamType.Project  = ImportProject(seamTypeObj.Project);

            if (seamTypeObj.SeamTypes != null)
            {
                foreach (var st in seamTypeObj.SeamTypes)
                {
                    seamType.SeamTypes.Add(ImportSeamType(st));
                }
            }

            if (isNew)
            {
                importRepo.SeamTypeRepo.Save(seamType);
            }
            else
            {
                importRepo.SeamTypeRepo.SaveOrUpdate(seamType);
            }

            return(seamType);
        }
コード例 #9
0
        //
        // GET: /SeamType/Delete/5

        public ActionResult Delete(int id = 0)
        {
            SeamType seamtype     = db.SeamTypes.Find(id);
            var      seamfeatures = (from vf in db.ValveSectionFeatures
                                     where vf.SeamWeldTypeID == seamtype.SeamTypeID
                                     select new
            {
                vf
            }).ToList();


            if (seamfeatures.Count > 0)
            {
                ModelState.AddModelError("SeamTypeItem", "This Seam Weld Type is assigned to Circuit feature(s) and cannot be deleted.");
                ViewBag.HasError = "True";
            }
            if (seamtype == null)
            {
                return(HttpNotFound());
            }
            return(View(seamtype));
        }
コード例 #10
0
        //
        // GET: /SeamType/Edit/5

        public ActionResult Edit(int id = 0)
        {
            SeamType seamtype     = db.SeamTypes.Find(id);
            var      seamfeatures = (from vf in db.ValveSectionFeatures
                                     where vf.SeamWeldTypeID == seamtype.SeamTypeID
                                     select new
            {
                vf
            }).ToList();


            if (seamfeatures.Count > 0)
            {
                ModelState.AddModelError("SeamTypeItem", "Warning! This Seam Weld Type is assigned to Circuit feature(s).");
                ViewBag.HasError = "True";
            }
            if (seamtype == null)
            {
                return(HttpNotFound());
            }
            Session["CodeLookUpAduit_Oldvalue"] = seamtype.SeamTypeItem;
            return(View(seamtype));
        }