예제 #1
0
        public ActionResult NewVersion(int?Id, int rfqId)
        {
            if (Id != null)
            {
                var      sql      = "SELECT Count(*) FROM axisdb.rversions where RfqId =" + rfqId;
                var      total    = db.Database.SqlQuery <int>(sql).First();
                Rversion rversion = db.Rversions.Find(Id);
                rversion.Date          = DateTime.Now;
                rversion.NumberVersion = total + 1;
                db.Rversions.Add(rversion);
                db.SaveChanges();

                var listquote = db.Quotes.Where(r => r.RversionId == Id).ToList();
                foreach (var item in listquote)
                {
                    item.RversionId = rversion.RversionId;
                    db.Quotes.Add(item);
                    db.SaveChanges();
                }


                return(RedirectToAction("PartialVersionEdit", "Quotes", new { rversionId = rversion.RversionId, rfqId = rfqId }));
            }
            else
            {
                return(new JsonResult()
                {
                    Data = null
                });
            }
        }
예제 #2
0
        // GET: Quotes/Create
        public ActionResult Create(int rversionid)
        {
            Rversion rversion = db.Rversions.Find(rversionid);
            Rfq      rfq      = db.Rfqs.Find(rversion.RfqId);


            ViewBag.RfqId              = rfq.RfqId;
            ViewBag.VersionDate        = rversion.Date;
            ViewBag.NumberVersion      = rversion.NumberVersion;
            ViewBag.SiteFarm           = rfq.Farm.FarmName;
            ViewBag.FullName           = rfq.Farm.Client.FullName;
            ViewBag.Street             = rfq.Farm.StreetAddress;
            ViewBag.City               = rfq.Farm.City;
            ViewBag.State              = rfq.Farm.State;
            ViewBag.Country            = rfq.Farm.Country;
            ViewBag.ProjectDescription = rversion.ProjectDescription;
            ViewBag.ProjectName        = rfq.ProjectName;
            ViewBag.RversionId         = rversion.RversionId;

            ViewBag.TypeWork  = rversion.TypeWork;
            ViewBag.ScopeWork = rversion.ScopeWork.Work;

            ViewBag.Notes       = rversion.NotesAndInstructions;
            ViewBag.Description = "";

            //ViewBag.Description = new SelectList(db.QuotesLists, "Description", "Description");

            return(View());
        }
예제 #3
0
        public ActionResult Delete(int id)
        {
            Rversion rversion = db.Rversions.Find(id);

            db.Rversions.Remove(rversion);
            db.SaveChanges();
            return(new JsonResult()
            {
                Data = "Deleted successfully"
            });
        }
예제 #4
0
        public ActionResult PrintRfqViewer(int?RversionId, int?RfqId, string typefarm)
        {
            if ((RversionId == null) & (RfqId == null))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Rfq rfq = db.Rfqs.Find(RfqId);

            if (rfq == null)
            {
                return(HttpNotFound());
            }
            Rversion rversion = db.Rversions.Find(RversionId);

            if (rfq == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Typefarm       = typefarm;
            ViewBag.RversionId     = rversion.RversionId;
            ViewBag.VersionDate    = rversion.Date;
            ViewBag.NumberVersion  = rversion.NumberVersion;
            ViewBag.TypeWork       = rversion.TypeWork;
            ViewBag.Status         = rversion.Status;
            ViewBag.ScopeWork      = rversion.ScopeWork.Work;
            ViewBag.MIPricePerTech = rversion.MIPricePerTech;
            ViewBag.MITechnicians  = rversion.MITechnicians;
            ViewBag.MITotal        = rversion.MITotal;
            ViewBag.MOPricePerTech = rversion.MOPricePerTech;
            ViewBag.MOTechnicians  = rversion.MOTechnicians;
            ViewBag.MOTotal        = rversion.MOTotal;

            ViewBag.Notes = rversion.NotesAndInstructions;
            ViewBag.ProjectDescription = rversion.ProjectDescription;
            ViewBag.ProjectName        = rfq.ProjectName;
            ViewBag.SiteFarm           = rfq.Farm.FarmName;
            ViewBag.FullName           = rfq.Farm.Client.FullName;
            ViewBag.Street             = rfq.Farm.StreetAddress;
            ViewBag.City               = rfq.Farm.City;
            ViewBag.State              = rfq.Farm.State;
            ViewBag.Country            = rfq.Farm.Country;
            ViewBag.TermsandConditions = rversion.TermsandConditions;

            var quotes1 = db.Quotes.Where(q => q.RversionId == rversion.RversionId).Where(r => r.TypeR == 1).ToList();
            var quotes2 = db.Quotes.Where(q => q.RversionId == rversion.RversionId).Where(r => r.TypeR == 2).ToList();

            ViewBag.Quotes1 = quotes1;
            ViewBag.Quotes2 = quotes2;
            return(new Rotativa.ViewAsPdf("RfqViewer", rfq)
            {
                FileName = "RFQ " + RfqId + " Ver " + ViewBag.NumberVersion + ".pdf"
            });
        }
예제 #5
0
 public ActionResult Edit([Bind(Include = "RversionId,NumberVersion,Date,TypeWork,ProjectDescription,TotalCost,Status,NotesAndInstructions,RfqId,ScopeWorkId,TermsandConditions")] Rversion rversion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rversion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.RfqId       = new SelectList(db.Rfqs, "RfqId", "Status", rversion.RfqId);
     ViewBag.ScopeWorkId = new SelectList(db.ScopeWorks, "ScopeWorkId", "Work", rversion.ScopeWorkId);
     return(View(rversion));
 }
예제 #6
0
        // GET: Quotes/Edit/5
        public ActionResult PartialVersionEdit(int?rversionId, int rfqId)
        {
            if (rversionId == null)
            {
                return(RedirectToAction("Details", "Rfqs", new { id = rfqId }));
            }
            Rversion rversion = db.Rversions.Find(rversionId);
            Rfq      rfq      = db.Rfqs.Find(rfqId);


            ViewBag.VersionDate   = rversion.Date;
            ViewBag.NumberVersion = rversion.NumberVersion;
            ViewBag.RfqId         = rfqId;

            ViewBag.SiteFarm           = rfq.Farm.FarmName;
            ViewBag.FullName           = rfq.Farm.Client.FullName;
            ViewBag.Street             = rfq.Farm.StreetAddress;
            ViewBag.City               = rfq.Farm.City;
            ViewBag.State              = rfq.Farm.State;
            ViewBag.Country            = rfq.Farm.Country;
            ViewBag.ProjectDescription = rversion.ProjectDescription;
            ViewBag.ProjectName        = rfq.ProjectName;
            ViewBag.RversionId         = rversion.RversionId;

            ViewBag.TypeWork    = rversion.TypeWork;
            ViewBag.Notes       = rversion.NotesAndInstructions;
            ViewBag.ScopeWork   = rversion.ScopeWork.Work;
            ViewBag.Typefarm    = rfq.Farm.TypeFarm;
            ViewBag.Description = "";

            ViewBag.MIPricePerTech = rversion.MIPricePerTech;
            ViewBag.MITechnicians  = rversion.MITechnicians;
            ViewBag.MITotal        = rversion.MITotal;

            ViewBag.MOPricePerTech = rversion.MOPricePerTech;
            ViewBag.MOTechnicians  = rversion.MOTechnicians;
            ViewBag.MOTotal        = rversion.MOTotal;


            var quotes1 = db.Quotes.Where(q => q.RversionId == rversion.RversionId).Where(r => r.TypeR == 1).ToList();
            var quotes2 = db.Quotes.Where(q => q.RversionId == rversion.RversionId).Where(r => r.TypeR == 2).ToList();

            ViewBag.Quotes1 = quotes1;
            ViewBag.Quotes2 = quotes2;


            //ViewBag.Description = new SelectList(db.QuotesLists, "Description", "Description");


            ViewBag.Quotes = db.Quotes.Where(r => r.RversionId == rversionId).ToList();
            return(PartialView());
        }
예제 #7
0
        public ActionResult Create([Bind(Include = "RversionId,NumberVersion,Date,TypeWork,ProjectDescription,TotalCost,Status,NotesAndInstructions,RfqId,ScopeWorkId,TermsandConditions")] Rversion rversion)
        {
            if (ModelState.IsValid)
            {
                rversion.Date = DateTime.Now;
                db.Rversions.Add(rversion);
                db.SaveChanges();
                return(RedirectToAction("Create", "Quotes", new { rversionid = rversion.RversionId }));
            }

            ViewBag.RfqId       = new SelectList(db.Rfqs, "RfqId", "ProjectName", rversion.RfqId);
            ViewBag.ScopeWorkId = new SelectList(db.ScopeWorks, "ScopeWorkId", "Work", rversion.ScopeWorkId);
            return(View(rversion));
        }
예제 #8
0
        // GET: Rversions/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Rversion rversion = db.Rversions.Find(id);

            if (rversion == null)
            {
                return(HttpNotFound());
            }
            return(View(rversion));
        }
예제 #9
0
        // GET: Rversions/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Rversion rversion = db.Rversions.Find(id);

            if (rversion == null)
            {
                return(HttpNotFound());
            }
            ViewBag.RfqId       = new SelectList(db.Rfqs, "RfqId", "Status", rversion.RfqId);
            ViewBag.ScopeWorkId = new SelectList(db.ScopeWorks, "ScopeWorkId", "Work", rversion.ScopeWorkId);
            return(View(rversion));
        }
예제 #10
0
        public void TestReadWriteRversion()
        {
            var stream  = new MemoryStream();
            var message = new Rversion(16384, "9P2000")
            {
                Tag = 0
            };

            var p = new Protocol.Protocol(stream);

            p.Write(message);
            stream.Position = 0;

            var data   = new byte[message.Length];
            var length = stream.Read(data, 0, (int)message.Length);

            Assert.That(length, Is.EqualTo(message.Length));

            stream.Position = 0;
            var message2 = (Rversion)p.Read();

            Assert.That(message2, Is.EqualTo(message));
        }
예제 #11
0
        // GET: Rversions/Create
        public ActionResult Create(int rfqid, string projectname)
        {
            var model = new Rversion
            {
                RfqId         = rfqid,
                NumberVersion = 1,
                Status        = "Open",
                Date          = DateTime.Now
            };
            Rfq rfq = db.Rfqs.Find(rfqid);

            ViewBag.ProjectName = projectname;
            ViewBag.RfqId       = rfqid;
            ViewBag.FullName    = rfq.Farm.Client.FullName;
            ViewBag.Street      = rfq.Farm.StreetAddress;
            ViewBag.City        = rfq.Farm.City;
            ViewBag.State       = rfq.Farm.State;
            ViewBag.Country     = rfq.Farm.Country;
            ViewBag.SiteFarm    = rfq.Farm.FarmName;


            ViewBag.ScopeWorkId = new SelectList(db.ScopeWorks, "ScopeWorkId", "Work");
            return(View(model));
        }
예제 #12
0
        public Message Read()
        {
            Message message;
            var     bytes  = ReadMessage();
            var     offset = Constants.Bit32Sz;
            var     type   = bytes[offset];

            switch (type)
            {
            case (byte)MessageType.Tversion:
                message = new Tversion(bytes);
                break;

            case (byte)MessageType.Rversion:
                message = new Rversion(bytes);
                break;

            case (byte)MessageType.Tauth:
                message = new Tauth(bytes);
                break;

            case (byte)MessageType.Rauth:
                message = new Rauth(bytes);
                break;

            case (byte)MessageType.Tattach:
                message = new Tattach(bytes);
                break;

            case (byte)MessageType.Rattach:
                message = new Rattach(bytes);
                break;

            case (byte)MessageType.Rerror:
                message = new Rerror(bytes);
                break;

            case (byte)MessageType.Tflush:
                message = new Tflush(bytes);
                break;

            case (byte)MessageType.Rflush:
                message = new Rflush(bytes);
                break;

            case (byte)MessageType.Twalk:
                message = new Twalk(bytes);
                break;

            case (byte)MessageType.Rwalk:
                message = new Rwalk(bytes);
                break;

            case (byte)MessageType.Topen:
                message = new Topen(bytes);
                break;

            case (byte)MessageType.Ropen:
                message = new Ropen(bytes);
                break;

            case (byte)MessageType.Tcreate:
                message = new Tcreate(bytes);
                break;

            case (byte)MessageType.Rcreate:
                message = new Rcreate(bytes);
                break;

            case (byte)MessageType.Tread:
                message = new Tread(bytes);
                break;

            case (byte)MessageType.Rread:
                message = new Rread(bytes);
                break;

            case (byte)MessageType.Twrite:
                message = new Twrite(bytes);
                break;

            case (byte)MessageType.Rwrite:
                message = new Rwrite(bytes);
                break;

            case (byte)MessageType.Tclunk:
                message = new Tclunk(bytes);
                break;

            case (byte)MessageType.Rclunk:
                message = new Rclunk(bytes);
                break;

            case (byte)MessageType.Tremove:
                message = new Tremove(bytes);
                break;

            case (byte)MessageType.Rremove:
                message = new Rremove(bytes);
                break;

            case (byte)MessageType.Tstat:
                message = new Tstat(bytes);
                break;

            case (byte)MessageType.Rstat:
                message = new Rstat(bytes);
                break;

            case (byte)MessageType.Twstat:
                message = new Twstat(bytes);
                break;

            case (byte)MessageType.Rwstat:
                message = new Rwstat(bytes);
                break;

            default:
                throw new Exception("Unsupported Message Type");
            }
            return(message);
        }