Пример #1
0
        public ActionResult add2Test(int?id)
        {
            count     += 1;
            ViewBag.ID = id;
            Assays            assays  = db.Assays.Find(id);
            Work_Order_Assays theTest = new Work_Order_Assays();

            theTest.Work_Order_ID = workOrderId;
            theTest.Assay_ID      = assays.Assay_ID;
            theTest.Assay_Cost    = assays.Base_Price + assays.Employee_Cost * assays.Assay_Duration;
            db.Work_Order_Assays.Add(theTest);
            db.SaveChanges();
            SortingworkOrders sortDB = new SortingworkOrders();

            sortDB.Assay_Cost    = theTest.Assay_Cost;
            sortDB.Assay_ID      = theTest.Assay_ID;
            sortDB.Work_Order_ID = workOrderId;

            sortDB.Date_Due            = Convert.ToDateTime("01/01/1901"); // get from query from thingy
            sortDB.order               = count;
            sortDB.Work_Order_Assay_ID = theTest.Work_Order_Assay_ID;
            db.SortingWorkOrders.Add(sortDB);
            db.SaveChanges();


            return(RedirectToAction("Index", new { id = workOrderId }));
        }
Пример #2
0
        public ActionResult NewQuote(int?QuoteID, [Bind(Include = "QuoteID,AssayID")] QuoteItem quoteItem)
        {
            QuoteEstimate MyQuote = new QuoteEstimate();

            if (QuoteID == null || QuoteID == 0)
            {
                MyQuote.ClientID     = GetClientID();
                MyQuote.CreatedBy    = "Client " + GetClientID();
                MyQuote.CreatedDate  = DateTime.Now;
                MyQuote.ModifiedBy   = "Client " + GetClientID();
                MyQuote.ModifiedDate = DateTime.Now;
                MyQuote.QuoteDate    = DateTime.Now;
                db.QuoteEstimates.Add(MyQuote);
                db.SaveChanges();
            }
            else
            {
                MyQuote.QuoteID = (int)QuoteID;
            }
            QuoteItem MyItem = new QuoteItem();

            MyItem.QuoteID      = MyQuote.QuoteID;
            MyItem.AssayID      = quoteItem.AssayID;
            MyItem.CreatedBy    = "Client " + GetClientID();
            MyItem.CreatedDate  = DateTime.Now;
            MyItem.ModifiedBy   = "Client " + GetClientID();
            MyItem.ModifiedDate = DateTime.Now;
            MyItem.Cost         = 0;
            IEnumerable <Test> testList = db.Tests.ToList();

            foreach (Test test in testList)
            {
                if (test.AssayID == MyItem.AssayID)
                {
                    MyItem.Cost += (test.BasePrice + (test.Hours * 40));
                }
            }
            db.QuoteItems.Add(MyItem);
            db.SaveChanges();
            IEnumerable <QuoteItem> items = db.QuoteItems.ToList();

            MyQuote.QuoteItems = new List <QuoteItem>();
            foreach (QuoteItem item in items)
            {
                if (item.QuoteID == MyQuote.QuoteID)
                {
                    item.ProtocolNotebook = db.ProtocolNotebooks.Find(item.AssayID);
                    MyQuote.QuoteItems.Add(item);
                }
            }

            ViewBag.AssayID = new SelectList(db.ProtocolNotebooks, "AssayID", "AssayName", quoteItem.AssayID);

            QuoteEstimateWithItemTemplate myModel = new QuoteEstimateWithItemTemplate();

            myModel.Quote = MyQuote;

            return(View(myModel));
        }
Пример #3
0
 public ActionResult CreateCompound([Bind(Include = "LTNumber, CompoundName,Quantity,DateArrived,EmployeeID,DateDue,Appearance, Weight, MolecularMass, MTD")] Compound compound)
 {
     if (ModelState.IsValid)
     {
         db.Compounds.Add(compound);
         db.SaveChanges();
         return(RedirectToAction("WorkList"));
     }
     return(View(compound));
 }
Пример #4
0
        // GET: Work_Orders
        public ActionResult Index()
        {
            Customers cust = db.Customers.FirstOrDefault(p => p.Email == User.Identity.Name);

            if (cust != null)
            {
                ViewBag.Statuses = "";
                lstWork_Orders   = db.Work_Orders
                                   .Where(o => o.Customer_ID == cust.Customer_ID)
                                   .ToList();



                foreach (Work_Orders order in lstWork_Orders)
                {
                    IEnumerable <Work_Order_Assays> assays =
                        db.Database.SqlQuery <Work_Order_Assays>("select Work_Order_Assay_ID, Work_Order_Assays.Work_Order_ID,Work_Order_Assays.Assay_Cost,Work_Order_Assays.Assay_ID,Work_Order_Assays.Assay_Results " +
                                                                 "from Work_Order_Assays " +
                                                                 "Where Work_order_Assays.Work_Order_ID = " + order.Work_Order_ID);
                    List <Work_Order_Assays> myList = assays.ToList();
                    double totalPrice = 0;
                    foreach (Work_Order_Assays thing in myList)
                    {
                        totalPrice += thing.Assay_Cost;
                    }
                    if (order.Rush)
                    {
                        totalPrice = totalPrice * 1.15;
                    }
                    if (order.Discount)
                    {
                        totalPrice = totalPrice - totalPrice * .15;
                    }
                    order.Price_Quote = totalPrice;
                    if (order.Conditional_Tests)
                    {
                        totalPrice = totalPrice + totalPrice * .5;
                    }
                    order.Total_Cost = totalPrice;
                    Status myStatus = db.Statuses.FirstOrDefault(o => o.Status_ID == order.Status_ID);
                    string sStatus  = myStatus.Status_Desc;
                    ViewBag.Statuses = ViewBag.Statuses + sStatus + ",";

                    db.Work_Orders.Find(order.Work_Order_ID).Total_Cost  = totalPrice;
                    db.Work_Orders.Find(order.Work_Order_ID).Price_Quote = order.Price_Quote;
                    db.SaveChanges();
                }

                return(View(lstWork_Orders));
            }
            else
            {
                return(View());
            }
        }
Пример #5
0
        public ActionResult Create([Bind(Include = "Customer_ID,Customer_Last_Name,Customer_First_Name,Customer_Address_1,Customer_Address_2,Customer_City,Customer_State,Customer_Zipcode,Customer_Home_Phone,Customer_Cell_Phone,Customer_Email,Customer_Password,Customer_Payment_Info,Customer_Discount,Customer_Balance")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customer.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
Пример #6
0
        public ActionResult Create([Bind(Include = "Test_Tube_ID,Concentration,Assay_ID,LT_Number")] Test_Tube test_Tube)
        {
            if (ModelState.IsValid)
            {
                db.Test_Tube.Add(test_Tube);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(test_Tube));
        }
        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));
        }
Пример #8
0
        public ActionResult Create([Bind(Include = "EmployeeWageInfoID,EmployeeID,LastIncreaseDate,LastIncreaseAmount,CurrentWage,WageType,DirectDeposit,ModifiedBy,ModifiedDate,CreatedBy,CreatedDate")] EmployeeWageInfo employeeWageInfo)
        {
            if (ModelState.IsValid)
            {
                db.EmployeeWageInfoes.Add(employeeWageInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employeeWageInfo));
        }
Пример #9
0
        public ActionResult Create([Bind(Include = "Assay_ID,Assay_Abbreviation,Assay_Desc,Assay_Duration,Employee_Cost,Base_Price,Assay_Results")] Assays assays)
        {
            if (ModelState.IsValid)
            {
                db.Assays.Add(assays);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(assays));
        }
Пример #10
0
        public ActionResult Create([Bind(Include = "Customer_Payment_ID,Card_Type,Card_Num,Card_Expiration,Card_CVV")] Customer_Payment customer_Payment)
        {
            if (ModelState.IsValid)
            {
                db.Customer_Payments.Add(customer_Payment);
                db.SaveChanges();
                return(RedirectToAction("Home", "Customers", new { area = "" }));
            }

            return(View(customer_Payment));
        }
        public ActionResult Create([Bind(Include = "KnowledgeBaseId,Title,Author,Date,Contents")] KnowledgeBase knowledgeBase)
        {
            if (ModelState.IsValid)
            {
                db.knowledgeBases.Add(knowledgeBase);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(knowledgeBase));
        }
Пример #12
0
        public ActionResult Create([Bind(Include = "PaymentInfoID,CardNum,SecCode,NameOnCard,ExpMonth,ExpYear")] PaymentInfo paymentInfo)
        {
            if (ModelState.IsValid)
            {
                db.PaymentInfo.Add(paymentInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(paymentInfo));
        }
Пример #13
0
        public ActionResult Create([Bind(Include = "TestId,TestName,Protocol,TestDurationDays,ConditionalTest,BasePrice,MaterialsCost,WageEstimate,QtyInStock")] Test test)
        {
            if (ModelState.IsValid)
            {
                db.Tests.Add(test);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(test));
        }
Пример #14
0
        public ActionResult Create([Bind(Include = "Database_Number,order,Work_Order_Assay_ID,Work_Order_ID,Assay_Cost,Assay_ID,Date_Due")] SortingworkOrders sortingworkOrders)
        {
            if (ModelState.IsValid)
            {
                db.SortingWorkOrders.Add(sortingworkOrders);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sortingworkOrders));
        }
Пример #15
0
        public ActionResult Create([Bind(Include = "Work_Order_ID,Status_ID,Customer_ID,Instructions,Rush,Conditional_Tests,Price_Quote,Discount,Total_Cost")] Work_Orders work_Orders)
        {
            if (ModelState.IsValid)
            {
                db.Work_Orders.Add(work_Orders);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(work_Orders));
        }
Пример #16
0
        public ActionResult Create([Bind(Include = "CompoundID,LTNumber,SequenceCode,CompoundName,Quantity,DateArrived,ReceivedBy,DateDue,Appearance,Weight,MolecularMass,ConfirmationDate,MaxTotalDose,ActualWeight,ModifiedBy,ModifiedDate,CreatedBy,CreatedDate")] Compound compound)
        {
            if (ModelState.IsValid)
            {
                db.Compounds.Add(compound);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(compound));
        }
Пример #17
0
        public ActionResult Create([Bind(Include = "Customer_ID,First_Name,Last_Name,Street_Address,City,State,Phone,Email,Qualify_Discount,Password,User_Role_ID")] Customers customers)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customers);
                db.SaveChanges();
                return(RedirectToAction("Index", "Customers"));
            }

            return(View(customers));
        }
Пример #18
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));
        }
Пример #19
0
        public ActionResult Create([Bind(Include = "Employee_ID,Location_ID,Access_Level,Employee_First_Name,Employee_Last_Name,Employee_Email,Employee_Password,Employee_Position")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employee.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
Пример #20
0
        public ActionResult Create([Bind(Include = "Invoice_ID,Customer_ID,Payment_Due,Early_Payment,Early_Discount,Total_Cost")] Invoice invoice)
        {
            if (ModelState.IsValid)
            {
                db.Invoice.Add(invoice);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(invoice));
        }
        public ActionResult Create([Bind(Include = "LTNumber,OrderID,CompName,Volume,VolumeUnitID,DateArrived,ReceivedBy,DateDue,ClientWeight,MolecularMass,ConfID,ActualWeight,ActualWeightID,DoseID")] Compound compound)
        {
            if (ModelState.IsValid)
            {
                db.Compounds.Add(compound);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(compound));
        }
Пример #22
0
        public ActionResult Create([Bind(Include = "OrderID,CustomerID,LTNumber,Status,dateArrived,dateDue,custWeight,actualWeight,Quantity")] Work_Order work_Order)
        {
            if (ModelState.IsValid)
            {
                db.Work_Order.Add(work_Order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(work_Order));
        }
Пример #23
0
        public ActionResult Create([Bind(Include = "ClientID,CompanyName,ContactFirstName,ContactLastName,Address1,Address2,City,State,Country,Zip,Phone,Email,Username,PasswordHash,ModifiedBy,ModifiedDate,CreatedBy,CreatedDate")] Client client)
        {
            if (ModelState.IsValid)
            {
                db.Clients.Add(client);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(client));
        }
Пример #24
0
        public ActionResult Create([Bind(Include = "TestID,testName,estimatedDays,baseCost")] Test test)
        {
            if (ModelState.IsValid)
            {
                db.Tests.Add(test);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(test));
        }
Пример #25
0
        public ActionResult Create([Bind(Include = "EmployeeID,Name,Address,Phone,Position,Location,StartDate,UserName,Password,ModifiedBy,ModifiedDate,CreatedBy,CreatedDate")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
Пример #26
0
        public ActionResult Create([Bind(Include = "Material_ID,Material_Name,Material_Quantity,Quantity_Unit,Material_Cost,Min_On_Hand")] Material material)
        {
            if (ModelState.IsValid)
            {
                db.Material.Add(material);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(material));
        }
Пример #27
0
        public ActionResult Create([Bind(Include = "Order_ID,Customer_ID,Order_Date,Date_Received,Due_Date,Order_Rerun_Date,Order_Complete_Date,Order_Comments,Summary_Report,Data_Report")] Order order)
        {
            if (ModelState.IsValid)
            {
                db.Order.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(order));
        }
Пример #28
0
 public ActionResult Edit([Bind(Include = "Id,CompoundId,StatusId,StatusDate")] CompoundStatus compoundStatus)
 {
     if (ModelState.IsValid)
     {
         db.Entry(compoundStatus).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.StatusId = new SelectList(db.Statuses, "StatusId", "StatusName", compoundStatus.StatusId);
     return(View(compoundStatus));
 }
Пример #29
0
        public ActionResult Create([Bind(Include = "Work_Order_Assay_ID,Work_Order_ID,Assay_Cost,Assay_ID,Assay_results")] Work_Order_Assays work_Order_Assays)
        {
            if (ModelState.IsValid)
            {
                db.Work_Order_Assays.Add(work_Order_Assays);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(work_Order_Assays));
        }
Пример #30
0
        public ActionResult Create([Bind(Include = "CustID,CustFirstName,CustLastName,CustAddress1,CustAddress2,CustCity,StateID,CustZip,CountryID,CustPhone,CustEmail,PaymentInfo,CustUserName,Comments,Balance")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }