Exemple #1
0
 public int AddMBAnalysisBacterioscopy(MBAnalysisBacterioscopy obj)
 {
     obj.DateAdd = DateTime.Now;
     obj.DateUpdate = DateTime.Now;
     obj.Suser = System.Web.Security.Membership.GetUser().ToString();
     db.MBAnalysisBacterioscopies.AddObject(obj);
     db.SaveChanges();
     return obj.MBAnalysisBacterioscopyID;
 }
Exemple #2
0
 public dbActionResult EditMBAnalysisBacterioscopy(MBAnalysisBacterioscopy obj)
 {
     try
     {
         obj.DateUpdate = DateTime.Now;
         obj.Suser = System.Web.Security.Membership.GetUser().ToString();
         db.MBAnalysisBacterioscopies.Attach(obj);
         db.ObjectStateManager.ChangeObjectState(obj, EntityState.Modified);
         db.SaveChanges();
         dbActionResult returnObj = new dbActionResult();
         returnObj.intResult = obj.MBAnalysisBacterioscopyID;
         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>
 /// Create a new MBAnalysisBacterioscopy object.
 /// </summary>
 /// <param name="mBAnalysisBacterioscopyID">Initial value of the MBAnalysisBacterioscopyID property.</param>
 public static MBAnalysisBacterioscopy CreateMBAnalysisBacterioscopy(global::System.Int32 mBAnalysisBacterioscopyID)
 {
     MBAnalysisBacterioscopy mBAnalysisBacterioscopy = new MBAnalysisBacterioscopy();
     mBAnalysisBacterioscopy.MBAnalysisBacterioscopyID = mBAnalysisBacterioscopyID;
     return mBAnalysisBacterioscopy;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the MBAnalysisBacterioscopies EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMBAnalysisBacterioscopies(MBAnalysisBacterioscopy mBAnalysisBacterioscopy)
 {
     base.AddObject("MBAnalysisBacterioscopies", mBAnalysisBacterioscopy);
 }
        public ActionResult PartialBacEdit(MBAnalysisBacterioscopy obj)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var tmp = dbm.MBAnalysis.SingleOrDefault(o => o.MBAnalysisID == obj.MBAnalysisID);
                    if ((obj.MBAnalysisBacterioscopyID != -1) && (obj.MBAnalysisID != -1))
                    {
                        // редактирование для анализа
                        db.EditMBAnalysisBacterioscopy(obj);
                        ModelState.Clear();
                        tmp = dbm.MBAnalysis.SingleOrDefault(o => o.MBAnalysisID == obj.MBAnalysisID);
                        string strMessage = "Показатели бактериоскопии успешно сохранены";
                        return RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = obj.MBAnalysisID, showBac = 1, sampleId = tmp.SampleID, message = strMessage });
                    }
                    // if ((roId != -1) && (sampleId == -1) && (mbAnalysisId == -1))
                    if ((obj.MBAnalysisBacterioscopyID == -1) && (obj.MBAnalysisID != -1))
                    {
                        // сохранение из анализа
                        db.AddMBAnalysisBacterioscopy(obj);
                        ModelState.Clear();
                        tmp = dbm.MBAnalysis.SingleOrDefault(o => o.MBAnalysisID == obj.MBAnalysisID);
                        string strMessage = "Показатели бактериоскопии успешно сохранены";
                        return RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = obj.MBAnalysisID, showBac = 1, sampleId = tmp.SampleID, message = strMessage });
                    }

                    return RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = obj.MBAnalysisID, showBac = 1, sampleId = tmp.SampleID, message = "Показатели бактериоскопии успешно сохранены" });
                }
                else
                {
                    string strMessage = "Ошибка! Показатели бактериоскопии сохранить не удалось. Возможно введены повторяющиеся значения";
                    return RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = obj.MBAnalysisID, showBac = 1, message = strMessage });

                }

            }
            catch (DataException ex)
            {
                string strMessage = "Ошибка! Показатели бактериоскопии сохранить не удалось. Возможно введены повторяющиеся значения";
                return RedirectToAction("MBAnalysisEdit", new { mbAnalysisId = obj.MBAnalysisID, showBac = 1, message = strMessage  });
            }
        }
        public ActionResult PartialBacEdit(int mbAnalysisBacId = -1, int mbAnalysisId = -1 , int sampleId = -1)
        {
            MBAnalysisBacterioscopy obj = new MBAnalysisBacterioscopy();
            if ((mbAnalysisBacId != -1) && (mbAnalysisId != -1))
            {
                //редактирование показателей бактериоскопии
                obj = dbm.MBAnalysisBacterioscopies.Include(o => o.MBAnalysi).SingleOrDefault(o => o.MBAnalysisBacterioscopyID == mbAnalysisBacId);
                ViewData["titleText"] = "Редактирование показателей бактериоскопии";
                ViewData["buttonText"] = "Сохранить";
            }
            if ((mbAnalysisBacId == -1) && (mbAnalysisId != -1))
            {
                // добавление показателя бактериоскопии
                obj.MBAnalysisID = mbAnalysisId;
                obj.MBAnalysisBacterioscopyID = -1;
                obj.MBAnalysi = dbm.MBAnalysis.SingleOrDefault(o => o.MBAnalysisID == mbAnalysisId );
                ViewData["titleText"] = "Добавление показателей бактериоскопии";
                ViewData["buttonText"] = "Сохранить";
            }

            var itemsBacOrg = dbm.MBBacterioscopyOrganismTypes.ToList();
            List<SelectListItem> listBacOrg = new List<SelectListItem>();
            foreach (var item in itemsBacOrg)
            {
                listBacOrg.Add(new SelectListItem { Text = item.DescriptionRus, Value = item.MBBacterioscopyOrganismTypeID.ToString() });
            }
            var selectBacOrg = new SelectList(listBacOrg, "Value", "Text");
            ViewData["selectBacOrg"] = selectBacOrg;

            //100;x100;1000;x1000
            List<SelectListItem> listViewField = new List<SelectListItem>();
            listViewField.Add(new SelectListItem { Text = "100", Value = "100" });
            listViewField.Add(new SelectListItem { Text = "x100", Value = "x100" });
            listViewField.Add(new SelectListItem { Text = "x1000", Value = "x1000" });
            listViewField.Add(new SelectListItem { Text = "1000", Value = "1000" });
            listViewField.Add(new SelectListItem { Text = "", Value = "" });
            var selectViewField = new SelectList(listViewField, "Value", "Text", "");
            ViewData["selectViewField"] = selectViewField;

            //0-10;10-15;15-20;25-30;35-40;45-50;55-100
            List<SelectListItem> listValue = new List<SelectListItem>();
            listValue.Add(new SelectListItem { Text = "0-10", Value = "0-10" });
            listValue.Add(new SelectListItem { Text = "10-15", Value = "10-15" });
            listValue.Add(new SelectListItem { Text = "15-20", Value = "15-20" });
            listValue.Add(new SelectListItem { Text = "25-30", Value = "25-30" });
            listValue.Add(new SelectListItem { Text = "35-40", Value = "35-40" });
            listValue.Add(new SelectListItem { Text = "45-50", Value = "45-50" });
            listValue.Add(new SelectListItem { Text = "55-100", Value = "55-100" });
            listValue.Add(new SelectListItem { Text = "", Value = "" });
            var selectValue = new SelectList( listValue , "Value", "Text", "");
            ViewData["selectValue"] = selectValue;

            return PartialView("PartialBacEdit", obj);
        }