public ActionResult DeleteConfirmed(int id)
        {
            Compound_Sample compound_Sample = db.Compound_Sample.Find(id);

            db.Compound_Sample.Remove(compound_Sample);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Input_Results([Bind(Include = "Compound_Sample_ID,LT_Number,Compound_Sequence_Code,Compound_Name,Employee_ID,Appearance,Weight,Weight_Unit,Molecular_Mass,MTD,MTD_Units,Test_Date_Time,Pass_Fail,Quantitative_Data,Qualitative_Data")] Compound_Sample compound_Sample)
 {
     if (ModelState.IsValid)
     {
         db.Entry(compound_Sample).State = EntityState.Modified;
         db.SaveChanges();
         return(View("Results_Inputted"));
     }
     return(View(compound_Sample));
 }
        public ActionResult Create([Bind(Include = "Compound_Sample_ID,LT_Number,Compound_Sequence_Code,Compound_Name,Employee_ID,Appearance,Weight,Weight_Unit,Molecular_Mass,MTD,MTD_Units,Test_Date_Time,Pass_Fail,Quantitative_Data,Qualitative_Data")] Compound_Sample compound_Sample)
        {
            if (ModelState.IsValid)
            {
                db.Compound_Sample.Add(compound_Sample);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(compound_Sample));
        }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "compoundSampleId,compoundSequenceCode,quantity,dateArrived,receivedBy,dateDue,appearance,weightIndicatedByCustomer,weightActual,molecularMass,maxToleratedDose,LTNumber")] Compound_Sample compound_Sample)
        {
            if (ModelState.IsValid)
            {
                db.Compund_Sample.Add(compound_Sample);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.LTNumber = new SelectList(db.Compound, "LTNumber", "compoundName", compound_Sample.LTNumber);
            return(View(compound_Sample));
        }
Exemplo n.º 5
0
        public ActionResult Add_Compound_Details([Bind(Include = "Compound_Sequence_Code,Compound_Name,Appearance,Weight,Weight_Unit,Molecular_Mass,MTD,MTD_Units")] Compound_Sample compound_Sample)
        {
            if (ModelState.IsValid)
            {
                compound_Sample.LT_Number   = New_LT_Number;
                compound_Sample.Employee_ID = EmployeesController.Current_Employee_ID;
                db.Compound_Sample.Add(compound_Sample);
                db.SaveChanges();
                return(View("Created_Compound"));
            }

            return(View(compound_Sample));
        }
Exemplo n.º 6
0
        public ActionResult Edit([Bind(Include = "compoundSampleId,compoundSequenceCode,quantity,dateArrived,receivedBy,dateDue,appearance,weightIndicatedByCustomer,weightActual,molecularMass,maxToleratedDose,LTNumber")] Compound_Sample compound_Sample)
        {
            int oid1 = Convert.ToInt32(TempData["oid"]);

            if (ModelState.IsValid)
            {
                db.Entry(compound_Sample).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("ReceiveOrderFrom", "Lab", new { id = oid1 }));
            }
            ViewBag.LTNumber = new SelectList(db.Compound, "LTNumber", "compoundName", compound_Sample.LTNumber);
            return(View(compound_Sample));
        }
Exemplo n.º 7
0
        // GET: Compound_Sample/Edit/5
        public ActionResult Input_Results(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Compound_Sample compound_Sample = db.Compound_Sample.Find(id);

            if (compound_Sample == null)
            {
                return(HttpNotFound());
            }
            return(View(compound_Sample));
        }
Exemplo n.º 8
0
        public ActionResult DeleteConfirmed(int id)
        {
            int             oid1            = Convert.ToInt32(TempData["oid"]);
            int             id1             = Convert.ToInt32(TempData["id"]);
            Compound_Sample compound_Sample = db.Compund_Sample.Find(id);

            db.Database.ExecuteSqlCommand("UPDATE Assay_Test SET compoundSampleId = NULL WHERE compoundSampleId = " + id1);


            //Assay_Test assay_Test = db.Database.SqlQuery<Assay_Test>("sdfasf");
            db.Compund_Sample.Remove(compound_Sample);
            db.SaveChanges();
            return(RedirectToAction("ReceiveOrderFrom", "Lab", new { id = oid1 }));
        }
Exemplo n.º 9
0
        // GET: Compound_Sample/Edit/5
        public ActionResult Edit(int?id, int oid)
        {
            TempData["oid"] = oid;
            ViewBag.oid     = oid;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Compound_Sample compound_Sample = db.Compund_Sample.Find(id);

            if (compound_Sample == null)
            {
                return(HttpNotFound());
            }
            ViewBag.LTNumber = new SelectList(db.Compound, "LTNumber", "LTNumber", compound_Sample.LTNumber);
            return(View(compound_Sample));
        }
Exemplo n.º 10
0
        // GET: Compound_Sample/Delete/5
        public ActionResult Delete(int?id, int oid)
        {
            TempData["oid"] = oid;
            TempData["id"]  = id;
            ViewBag.oid     = oid;
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Compound_Sample compound_Sample = db.Compund_Sample.Find(id);

            if (compound_Sample == null)
            {
                return(HttpNotFound());
            }
            return(View(compound_Sample));
        }
Exemplo n.º 11
0
        public ActionResult CreateOrder(FormCollection form)
        {
            //create and save order
            Order order = new Order();

            order.orderDate     = DateTime.Now;
            order.orderStatusId = 1;
            order.Order_Status  = db.Order_Status.Find(order.orderStatusId);
            if (form["runConditionals"] != null)
            {
                order.runConditionals = "Y";
            }
            else
            {
                order.runConditionals = "N";
            }
            order.customerComments = form["comments"];
            order.customerId       = 2; //change to active user id
            order.Customer         = db.Customer.Find(order.customerId);
            db.Order.Add(order);
            db.SaveChanges();

            //create and save compound
            Compound compound = new Compound();

            compound.compoundName        = form["compoundName"];
            compound.compoundDescription = form["compoundDescription"];
            db.Compound.Add(compound);
            db.SaveChanges();

            int numberOfSamples = Convert.ToInt32(form["numberOfSamples"]);

            //create and save compound samples
            for (int i = 0; i < numberOfSamples; i++)
            {
                Compound_Sample compound_Sample = new Compound_Sample();
                compound_Sample.compoundSequenceCode      = i;
                compound_Sample.LTNumber                  = compound.LTNumber;
                compound_Sample.weightIndicatedByCustomer = Convert.ToDecimal(form["weight"]);
                compound_Sample.quantity                  = Convert.ToDecimal(form["quantity"]);
                //string mtd = form["mtd"];
                //if(mtd != "")
                //{
                //    compound_Sample.maxToleratedDose = Convert.ToDouble(mtd);
                //}
                db.Compund_Sample.Add(compound_Sample);
                db.SaveChanges();
            }
            int assayTypeCount = db.Assay_Type.Count();

            for (int i = 1; i <= assayTypeCount; i++)
            {
                var test = form["assay-" + i.ToString()];
                if (test != null)
                {
                    Assay_Type assay_type = db.Assay_Type.Find(i);
                    if (assay_type != null)
                    {
                        Assay assay = new Assay();
                        assay.LTNumber    = compound.LTNumber;
                        assay.assayTypeId = assay_type.assayTypeId;
                        db.Assay.Add(assay);
                        db.SaveChanges();

                        Assay_Order assay_order = new Assay_Order();
                        assay_order.assayId = assay.assayId;
                        assay_order.orderId = order.orderId;
                        db.Assay_Order.Add(assay_order);
                        db.SaveChanges();
                    }
                }
            }


            return(View("OrderConfirmation", order));
        }