Exemple #1
0
 public int AddROandClinicalTest(ROandClinicalTest obj)
 {
     obj.DateAdd = DateTime.Now;
     obj.DateUpdate = DateTime.Now;
     obj.Suser = System.Web.Security.Membership.GetUser().ToString();
     db.ROandClinicalTests.AddObject(obj);
     db.SaveChanges();
     return obj.ROClinicalTestID;
 }
Exemple #2
0
 public dbActionResult EditROandClinicalTest(ROandClinicalTest obj)
 {
     try
     {
         obj.DateUpdate = DateTime.Now;
         obj.Suser = System.Web.Security.Membership.GetUser().ToString();
         db.ROandClinicalTests.Attach(obj);
         db.ObjectStateManager.ChangeObjectState(obj, EntityState.Modified);
         db.SaveChanges();
         dbActionResult returnObj = new dbActionResult();
         returnObj.intResult = obj.ROClinicalTestID;
         returnObj.exConcur = null;
         returnObj.exData = null;
         return (returnObj);
     }
     catch (OptimisticConcurrencyException ex)
     {
         dbActionResult returnObj = new dbActionResult();
         returnObj.intResult = -1;
         returnObj.exConcur = ex;
         returnObj.exData = null;
         return (returnObj);
     }
     catch (DataException ex)
     {
         dbActionResult returnObj = new dbActionResult();
         returnObj.intResult = -2;
         returnObj.exConcur = null;
         returnObj.exData = ex;
         return (returnObj);
     }
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the ROandClinicalTests EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToROandClinicalTests(ROandClinicalTest rOandClinicalTest)
 {
     base.AddObject("ROandClinicalTests", rOandClinicalTest);
 }
 /// <summary>
 /// Create a new ROandClinicalTest object.
 /// </summary>
 /// <param name="rOClinicalTestID">Initial value of the ROClinicalTestID property.</param>
 public static ROandClinicalTest CreateROandClinicalTest(global::System.Int32 rOClinicalTestID)
 {
     ROandClinicalTest rOandClinicalTest = new ROandClinicalTest();
     rOandClinicalTest.ROClinicalTestID = rOClinicalTestID;
     return rOandClinicalTest;
 }
        public ActionResult PartialClinicalTestEdit(ROandClinicalTest obj)
        {
            try
            {
            if (ModelState.IsValid)
            {
                if ((obj.ROClinicalTestID != -1) && (obj.ROID != -1))
                {
                    // редактирование для анализа
                    db.EditROandClinicalTest(obj);
                    ModelState.Clear();
                    var tmp = dbm.ROes.SingleOrDefault(o => o.ROID == obj.ROID);
                    return RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = tmp.MBAnalysisID, sampleId = tmp.SampleID , showRO = 1 });
                }
                // if ((roId != -1) && (sampleId == -1) && (mbAnalysisId == -1))
                if ((obj.ROClinicalTestID == -1) && (obj.ROID != -1))
                {
                    // сохранение из анализа
                    db.AddROandClinicalTest(obj);
                    ModelState.Clear();
                    var tmp = dbm.ROes.SingleOrDefault(o => o.ROID == obj.ROID);

                    return RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = tmp.MBAnalysisID, sampleId = tmp.SampleID, showRO = 1 });
                }

            }

            return RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = obj.RO.MBAnalysisID, showRO = 1 });
            }
              catch (DataException ex)
              {
                  var tmp = dbm.ROes.SingleOrDefault(o => o.ROID == obj.ROID);
                  string strMessage = "Ошибка! Показатели бактериоскопии сохранить не удалось. Возможно введены повторяющиеся значения";
                  return RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = tmp.MBAnalysisID, sampleId = tmp.SampleID, showRO = 1, message = strMessage  });
              }
        }
        public ActionResult PartialClinicalTestEdit(int mbAnalysisId = -1,int roId = -1, int clinicalTestId = -1, string text = "")
        {
            ROandClinicalTest obj = new ROandClinicalTest();
            //редактирование
            if ((mbAnalysisId != -1) && (clinicalTestId != -1) && (roId != -1))
            {
                obj = dbm.ROandClinicalTests.Include(o => o.RO).SingleOrDefault(o => o.ROClinicalTestID == clinicalTestId);

                ViewData["titleText"] = "Редактирование чувствительности для " + text ;
                ViewData["buttonText"] = "Сохранить";
            }
            //добавление
            if ((mbAnalysisId != -1) && (clinicalTestId == -1) && (roId != -1))
            {
                obj.ROClinicalTestID = -1;
                obj.ROID = roId;
                obj.RO = dbm.ROes.SingleOrDefault(o => o.ROID == roId);
                ViewData["titleText"] = "Добавление чувствительности для " + text;
                ViewData["buttonText"] = "Добавить";
            }

            var itemsAbType = db.GetAntibioticTypeList().ToList();
            List<SelectListItem> listAbType = new List<SelectListItem>();
            foreach (var item in itemsAbType)
            {
                listAbType.Add(new SelectListItem { Text = item.DescriptionEng, Value = item.AntibioticTypeID.ToString() });
            }
            var selectAbType = new SelectList(listAbType, "Value", "Text");
            ViewData["selectAbType"] = selectAbType;

            List<SelectListItem> listSIR = new List<SelectListItem>();
            //S;I;R;N;D
            listSIR.Add(new SelectListItem { Text = "S", Value = "S" });
            listSIR.Add(new SelectListItem { Text = "I", Value = "I" });
            listSIR.Add(new SelectListItem { Text = "R", Value = "R" });
            listSIR.Add(new SelectListItem { Text = "N", Value = "N" });
            listSIR.Add(new SelectListItem { Text = "D", Value = "D" });
            var selectSIR = new SelectList(listSIR, "Value", "Text");
            ViewData["selectSIR"] = selectSIR;

            var itemsMethod = db.GetMethodList();
            List<SelectListItem> listMethod = new List<SelectListItem>();
            foreach(var item in itemsMethod)
            {
                listMethod.Add(new SelectListItem { Text = item.DescriptionRus, Value = item.MethodID.ToString() });
            }
            var selectMethod = new SelectList(listMethod , "Value", "Text");
            ViewData["selectMethod"] = selectMethod;

            return PartialView("PartialClinicalTestEdit", obj);
        }