示例#1
0
        public ActionResult ConfirmScheduledAssay([Bind(Include = "StartDate")] Assay placeholderAssay, FormCollection form)
        {
            int AssayID     = Int32.Parse(form["AssayID"]);
            int NoOfSamples = Int32.Parse(form["Samples"]);

            if (ModelState.IsValid)
            {
                Assay assay = db.Assays.Find(AssayID);
                assay.StartDate = placeholderAssay.StartDate;
                assay.StatusID  = 3;

                ViewBag.AssayID   = assay.AssayID;
                ViewBag.StartDate = assay.StartDate;

                // create a SampleTest row in SampleTest table for each sample
                for (int i = 1; i <= NoOfSamples; i++)
                {
                    SampleTest sampleTest = new SampleTest();
                    sampleTest.LTNumber        = assay.LTNumber;
                    sampleTest.AssayID         = assay.AssayID;
                    sampleTest.CompoundSeqCode = i;
                    db.SampleTests.Add(sampleTest);
                    db.SaveChanges();
                }

                db.Entry(assay).State = EntityState.Modified;
                db.SaveChanges();
                return(View());
            }
            return(View());
        }
示例#2
0
        public void TestCorrectIntialReadyOperationsParallelDFG()
        {
            TestBlock operation1 = new TestBlock(new List <FluidBlock> {
            }, null, new TestModule());
            TestBlock operation2 = new TestBlock(new List <FluidBlock> {
            }, null, new TestModule());
            TestBlock operation3 = new TestBlock(new List <FluidBlock> {
            }, null, new TestModule());
            TestBlock operation4 = new TestBlock(new List <FluidBlock> {
            }, null, new TestModule());

            DFG <Block> dfg = new DFG <Block>();

            dfg.AddNode(operation1);
            dfg.AddNode(operation2);
            dfg.AddNode(operation3);
            dfg.AddNode(operation4);
            dfg.FinishDFG();

            Assay assay = new Assay(dfg);

            Assert.AreEqual(assay.GetReadyOperations().Count, dfg.Nodes.Count);
            foreach (var node in dfg.Nodes)
            {
                //Even the pointers should be the same.
                Assert.IsTrue(assay.GetReadyOperations().Contains(node.value));
            }
        }
示例#3
0
文件: AssayService.cs 项目: wpmyj/LC
        public void DelAssayWithUnitOfWork(Assay assay)
        {
            DelAssayBillWithUnitOfWork(assay);

            _unitOfWork.AddAction(assay, DataActions.Delete);
            _unitOfWork.Save();
        }
示例#4
0
        public ActionResult EditAssay(int id)
        {
            ViewBag.compounds = db.Compounds.ToList();
            Assay assay = db.Assays.Find(id);

            return(View(assay));
        }
示例#5
0
文件: AssayService.cs 项目: wpmyj/LC
        public AssayBill AddAssayBillWithSave(Assay oldAssay, int user_id, string billIndex, Contract cont,
                                              IList <GrainQualityIndex> GrainQualityIndexList, List <string> resultList)
        {
            //新增一个SampleDetail
            SampleDetail newSampleDetail = new SampleDetail();

            newSampleDetail.sample_number        = oldAssay.sample_number;
            newSampleDetail.sample_detail_number = oldAssay.sample_number + billIndex;
            newSampleDetail.saved = oldAssay.Sample.sample_saved;
            _unitOfWork.AddAction(newSampleDetail, DataActions.Add);

            //AssayBill新增
            AssayBill newAssayBill = new AssayBill();

            newAssayBill.assay_bill_number = oldAssay.assay_number + billIndex;
            newAssayBill.assay_number      = oldAssay.assay_number;
            newAssayBill.assay_time        = oldAssay.create_time.Value;
            newAssayBill.assay_user        = user_id;
            newAssayBill.sample_detail     = newSampleDetail.sample_detail_number;
            _unitOfWork.AddAction(newAssayBill, DataActions.Add);

            AddAssayResultWithUnitOfWork(newAssayBill, cont, GrainQualityIndexList, resultList);

            _unitOfWork.Save();
            return(newAssayBill);
        }
 public async Task SendPrintAsync(string who, Assay assay, string actionName)
 {
     foreach (var connectionId in PrintHub.connections.GetConnections(who))
     {
         await _hub.Clients.Client(connectionId).SendAsync(actionName, assay);
     }
 }
        /// <summary>
        /// 化验单
        /// </summary>
        /// <param name="a"></param>
        private void PrintAssay(Assay a)
        {
            Log.Logs += $"正在打印化验单:{a.Name}\r";

            Word.Application thisApplication = new Word.ApplicationClass();
            wApp = thisApplication;
            string tmpDocFile   = AppDomain.CurrentDomain.BaseDirectory + folder + Properties.Settings.Default.PrintAssayDocx;
            object templatefile = tmpDocFile;

            wDoc = wApp.Documents.Add(ref templatefile, ref missing, ref missing, ref missing); //在现有进程内打开文档
            wDoc.Activate();                                                                    //当前文档置前

            //填充数据
            WordReplace(wApp, "#Name#", a.Name);
            if (a.Purchase != null)
            {
                WordReplace(wApp, "#CarnoOrStorename#", "车号:" + a.Purchase.CarNo);
            }
            if (a.Store != null)
            {
                WordReplace(wApp, "#CarnoOrStorename#", "油仓:" + a.Store.Name);
            }
            WordReplace(wApp, "#视密#", a.视密.ToString("0.000"));
            WordReplace(wApp, "#标密#", a.标密.ToString("0.000"));
            WordReplace(wApp, "#闭口闪点#", a.闭口闪点);
            WordReplace(wApp, "#Temperature#", a.Temperature.ToString("0.00"));
            WordReplace(wApp, "#OilTempTime#", a.OilTempTime.ToLongTimeString());
            WordReplace(wApp, "#SmellType#", strSmellType(a.SmellType));
            WordReplace(wApp, "#混水反应#", a.混水反应);
            WordReplace(wApp, "#十六烷值#", a.十六烷值);
            WordReplace(wApp, "#十六烷指数#", a.十六烷指数);
            WordReplace(wApp, "#初硫#", a.初硫.ToString("0.00"));
            WordReplace(wApp, "#Percentage10#", a.Percentage10.ToString("0.00"));
            WordReplace(wApp, "#Percentage50#", a.Percentage50.ToString("0.00"));
            WordReplace(wApp, "#Percentage90#", a.Percentage90.ToString("0.00"));
            WordReplace(wApp, "#回流#", a.回流.ToString("0.00"));
            WordReplace(wApp, "#干点#", a.干点.ToString("0.00"));
            WordReplace(wApp, "#蚀点#", a.蚀点.ToString("0.00"));
            WordReplace(wApp, "#凝点#", a.凝点.ToString("0.00"));
            WordReplace(wApp, "#含硫#", a.含硫.ToString("0.00"));
            WordReplace(wApp, "#CreatedBy#", a.CreatedBy);
            WordReplace(wApp, "#CreatedAt#", a.CreatedAt.ToString("yyyy-MM-dd HH:mm"));
            PrintTime(wApp);

            object background = false; //这个很重要,否则关闭的时候会提示请等待Word打印完毕后再退出,加上这个后可以使Word所有
            object filename   = AppDomain.CurrentDomain.BaseDirectory + createdfolder + a.Name + ".docx";

            wDoc.SaveAs(ref filename, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref
                        missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
            wDoc.PrintOut(ref background, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref
                          missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
                          ref missing);
            object saveOption = Word.WdSaveOptions.wdSaveChanges;

            wDoc.Close(ref saveOption, ref missing, ref missing); //关闭当前文档,如果有多个模版文件进行操作,则执行完这一步后接着执行打开Word文档的方法即可
                        saveOption = Word.WdSaveOptions.wdDoNotSaveChanges;

            wApp.Quit(ref saveOption, ref missing, ref missing); //关闭Word进程
        }
示例#8
0
文件: AssayService.cs 项目: wpmyj/LC
 public void DelAssayBillWithUnitOfWork(Assay delAssay)
 {
     foreach (AssayBill ab in delAssay.AssayBills)
     {
         DelAssayResultWithUnitOfWork(ab);
         _unitOfWork.AddAction(ab, DataActions.Delete);
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Assay assay = db.assay.Find(id);

            db.assay.Remove(assay);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#10
0
        public AssayDTO AddAssay(AssayDTO assayDto)
        {
            var assay = new Assay();

            //var project = _projectRepository.FindSingle(d => d.Accession
            //    .Equals(assayDto.ProjectAcc));

            assay.Name                 = assayDto.Name;
            assay.ProjectId            = assayDto.ProjectId;
            assay.TechnologyPlatformId = assayDto.Platform;
            assay.TechnologyTypeId     = assayDto.Technology;
            //assay.DesignType = getCVterm(assayDto.AssayDesignType);
            assay.MeasurementTypeId = assayDto.Type;

            if (assayDto.SamplesDataset != null)
            {
                assayDto.SamplesDataset.ProjectId = assayDto.ProjectId;
            }
            if (assayDto.FeaturesDataset != null)
            {
                assayDto.FeaturesDataset.ProjectId = assayDto.ProjectId;
            }
            if (assayDto.ObservationsDataset != null)
            {
                assayDto.ObservationsDataset.ProjectId = assayDto.ProjectId;
            }

            var BSdataset = _datasetService.CreateDataset(assayDto.SamplesDataset);

            if (BSdataset != null)
            {
                assay.Datasets.Add(BSdataset);
            }

            var FEdataset = _datasetService.CreateDataset(assayDto.FeaturesDataset);

            if (FEdataset != null)
            {
                assay.Datasets.Add(FEdataset);
            }

            var OBdataset = _datasetService.CreateDataset(assayDto.ObservationsDataset);

            if (OBdataset != null)
            {
                assay.Datasets.Add(OBdataset);
            }

            assay = _assayRepository.Insert(assay);


            if (_dataContext.Save().Equals("CREATED"))
            {
                assayDto.Id = assay.Id;
                return(assayDto);
            }
            return(null);
        }
示例#11
0
        public void TestUpdateReadyOperationsMultiDependecy()
        {
            TestBlock operation1 = new TestBlock(new List <FluidBlock> {
            }, "op1", new TestModule());
            TestBlock operation3 = new TestBlock(new List <FluidBlock> {
            }, "op3", new TestModule());
            TestBlock operation2 = new TestBlock(new List <FluidBlock> {
                operation1, operation3
            }, "op2", new TestModule());
            TestBlock operation4 = new TestBlock(new List <FluidBlock> {
            }, "op4", new TestModule());

            DFG <Block> dfg = new DFG <Block>();

            dfg.AddNode(operation1);
            dfg.AddNode(operation3);
            dfg.AddNode(operation2);
            dfg.AddNode(operation4);
            dfg.FinishDFG();

            //Now the operations associated with node 1,
            //should wait for the operation assocaited with node 0 and 2.

            Assay assay = new Assay(dfg);

            //Remove first dependecy

            assay.UpdateReadyOperations(dfg.Nodes[2].value);

            Assert.AreEqual(assay.GetReadyOperations().Count, dfg.Nodes.Count - 2);

            Assert.IsTrue(assay.GetReadyOperations().Contains(dfg.Nodes[0].value));
            Assert.IsTrue(assay.GetReadyOperations().Contains(dfg.Nodes[3].value));
            Assert.IsFalse(assay.GetReadyOperations().Contains(dfg.Nodes[1].value));
            Assert.IsFalse(assay.GetReadyOperations().Contains(dfg.Nodes[2].value));

            Assert.IsFalse(dfg.Nodes[0].value.IsDone);
            Assert.IsFalse(dfg.Nodes[1].value.IsDone);
            Assert.IsTrue(dfg.Nodes[2].value.IsDone);
            Assert.IsFalse(dfg.Nodes[3].value.IsDone);

            //remove last dependecy
            assay.UpdateReadyOperations(dfg.Nodes[0].value);

            Assert.AreEqual(assay.GetReadyOperations().Count, dfg.Nodes.Count - 2);

            Assert.IsTrue(assay.GetReadyOperations().Contains(dfg.Nodes[1].value));
            Assert.IsTrue(assay.GetReadyOperations().Contains(dfg.Nodes[3].value));
            Assert.IsFalse(assay.GetReadyOperations().Contains(dfg.Nodes[0].value));
            Assert.IsFalse(assay.GetReadyOperations().Contains(dfg.Nodes[2].value));

            Assert.IsTrue(dfg.Nodes[0].value.IsDone);
            Assert.IsFalse(dfg.Nodes[1].value.IsDone);
            Assert.IsTrue(dfg.Nodes[2].value.IsDone);
            Assert.IsFalse(dfg.Nodes[3].value.IsDone);
        }
 public ActionResult Edit([Bind(Include = "AssayID,TypeCode,SummaryInfo,DetailedInfo,Procedure,LiteratureReferences,EstimateDaysToComplete")] Assay assay)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assay).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(assay));
 }
示例#13
0
 public ActionResult Edit([Bind(Include = "AssayID,assayDescription")] Assay assay)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assay).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(assay));
 }
示例#14
0
 public ActionResult Edit([Bind(Include = "AssayID,ShortDesc,Cost,BasePrice,DetailedDesc")] Assay assay)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assay).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(assay));
 }
示例#15
0
 public ActionResult Edit_Assay([Bind(Include = "Assay_ID,Assay_Name,Base_Cost,Assay_Description")] Assay assay)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assay).State = EntityState.Modified;
         db.SaveChanges();
         return(View("Assay_Edited"));
     }
     return(View(assay));
 }
示例#16
0
 public ActionResult Edit([Bind(Include = "AssayID,Desc,Summary,DaysToComplete,MTD_mg")] Assay assay)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assay).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(assay));
 }
 public ActionResult Edit([Bind(Include = "AssayID,AssayName,EstimatedDaysToComplete,DetailedDescription,StartDate,NoOfTests,AbbreviationCode")] Assay assay)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assay).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(assay));
 }
 public ActionResult Edit([Bind(Include = "AssayID,Desc,Protocol,CompletionEstimate,DateTimeScheduled,DateTimeCompleted,BasePrice,ExtraTestNotes,ResultsLink")] Assay assay)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assay).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(assay));
 }
示例#19
0
 public ActionResult Edit([Bind(Include = "AssayID,AssayNameID,WorkOrderID,Protocol,EstDuration,StatusID,QuantResults,QualResults,WorkHoursReq,StartDate,LTNumber,IsRequired,Cost")] Assay assay)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assay).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(assay));
 }
示例#20
0
文件: AssayService.cs 项目: wpmyj/LC
        public Assay UpdAssayConfirmWithUnitofWork(Assay oldAssay)
        {
            Assay reAssay = null;

            oldAssay.confirm_time = _sPGetSysDateTimeService.GetSysDateTime();

            _unitOfWork.AddAction(oldAssay, DataActions.Update);
            reAssay = oldAssay;
            return(reAssay);
        }
示例#21
0
 public ActionResult Edit([Bind(Include = "Id,Name,IsQualitative,MinResultValue,MaxResultValue,LastUpdate,IsMultiplex")] Assay assay)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assay).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(assay));
 }
示例#22
0
        public ActionResult Create([Bind(Include = "AssayID,Desc,Summary,DaysToComplete,MTD_mg")] Assay assay)
        {
            if (ModelState.IsValid)
            {
                db.Assays.Add(assay);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(assay));
        }
示例#23
0
        public ActionResult Create_Assay([Bind(Include = "Assay_ID,Assay_Name,Base_Cost,Assay_Description")] Assay assay)
        {
            if (ModelState.IsValid)
            {
                db.Assay.Add(assay);
                db.SaveChanges();
                return(View("Assay_Created"));
            }

            return(View(assay));
        }
示例#24
0
        //remove an assay from an order
        public ActionResult RemoveOrder(int id)
        {
            Assay assay = new Assay();
            IEnumerable <Assay> eAssay;

            assay = db.Assays.Find(id);

            eAssay = HelperController.RemoveOrderAssayList(assay);

            return(RedirectToAction("Order"));
        }
示例#25
0
        public ActionResult Create([Bind(Include = "AssayID,ShortDesc,Cost,BasePrice,DetailedDesc")] Assay assay)
        {
            if (ModelState.IsValid)
            {
                db.Assays.Add(assay);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(assay));
        }
示例#26
0
        public ActionResult Create([Bind(Include = "AssayID,assayDescription")] Assay assay)
        {
            if (ModelState.IsValid)
            {
                db.Assays.Add(assay);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(assay));
        }
示例#27
0
 public ActionResult Edit([Bind(Include = "ASSAYID,RESULT,COMMENTS,TESTID")] Assay assay)
 {
     if (ModelState.IsValid)
     {
         db.Entry(assay).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.TESTID = new SelectList(db.Test, "TESTID", "TESTDESCRIPTION", assay.TESTID);
     return(View(assay));
 }
示例#28
0
文件: AssayService.cs 项目: wpmyj/LC
 public void DelAssay(Assay delAssay)
 {
     try
     {
         _assayDal.Delete(delAssay);
     }
     catch (RepositoryException ex)
     {
         throw ex;
     }
 }
示例#29
0
        public ActionResult Create([Bind(Include = "Id,Name,IsQualitative,MinResultValue,MaxResultValue,LastUpdate,IsMultiplex")] Assay assay)
        {
            if (ModelState.IsValid)
            {
                db.Assay.Add(assay);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(assay));
        }
        public ActionResult Create([Bind(Include = "AssayID,TypeCode,SummaryInfo,DetailedInfo,Procedure,LiteratureReferences,EstimateDaysToComplete")] Assay assay)
        {
            ViewBag.TypeCode = db.AssayTypes.ToList();
            if (ModelState.IsValid)
            {
                db.Assays.Add(assay);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(assay));
        }
示例#31
0
        private void RunProtocol(int ProtocolID, string PlateName)
        {
            counter = 0;
            //int ProtocolID = 2000103;//This is my OD Protocol
            //returns true if successful, false otherwise
            try
            {
                //First have to make sure the machine is working
                UpdateStatus();
                if (CurrentStatus != InstrumentState.Ready)
                {//if the instrument isn't ready, try for 10 seconds to make it ready, then abort
                    for (int i = 0; i < 20; i++)
                    {
                        UpdateStatus();
                        if (CurrentStatus == InstrumentState.Ready)
                        {
                            break;
                        }
                        Thread.Sleep(500);
                    }
                    //if this fails, return false
                    if (CurrentStatus != InstrumentState.Ready)
                    {
                        LastCommandResult = new CommandResult("Instrument Status Was Never Ready");
                        PulseObject();
                        return;
                    }
                }
                //Onwards with the protocol
                MlrServ.AssayRunDefinitionClass AssayRunDef = new AssayRunDefinitionClass();
                AssayRunDef.ProtocolID = ProtocolID;
                AssayRunDef.LoadFirstPlate = true;
                AssayRunDef.Notes = NextPlateName;

                //Create new m_Assay (and run if in demo mode)
                m_Assay = InstrumentServ.NewAssay(AssayRunDef as AssayRunDefinition) as Assay;
                 //Check that the object was created
                if (m_Assay == null)
                {
                    txtErrors.Text += "\nUnable to start new m_Assay (" + InstrumentServ.GetLastErrorText() + ")";
                    LastCommandResult = new CommandResult("Was unable to start assay");
                    PulseObject();
                    return;
                }
            }
            catch
            {
                txtErrors.Text += "\nUnexplained Error During Reading"+DateTime.Now.ToString()+"\n";
                LastCommandResult = new CommandResult("Unexplained Error");
                PulseObject();
                CurrentStatus = InstrumentState.Busted;
                return;
            }
            return;
        }
示例#32
0
        protected void InternalDispose(bool disposing)
        {
            // If you need thread safety, use a lock around these
            // operations, as well as in your methods that use the resource.
            if (!_disposed)
            {
                if (disposing)
                {
                    if (Victor != null)
                    {
                        try
                        {
                            Victor.StopServer();
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(InstrumentServ);
                            Thread.Sleep(1000);//give it time to close
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(Victor);
                        }
                        catch { }
                    }
                    if (ProtocolTree != null)
                    {
                        try
                        {
                            Marshal.ReleaseComObject(ProtocolTree);
                        }
                        catch { }

                    }
                    if (m_Assay != null)
                    {
                        try
                        {
                            Marshal.ReleaseComObject(m_Assay);
                        }
                        catch { }
                    }
                    Victor = null;
                    ProtocolTree = null;
                    m_Assay = null;
                    InstrumentServ = null;
                    GC.Collect();//call disposers
                    GC.Collect();//finalize
                    _disposed = true;
                }

            }
        }