예제 #1
0
 public int AddMBAnalysisToSample(int sampleId, int mbAnalysisTypeId)
 {
     MBAnalysi obj = new MBAnalysi();
     obj.MBAnalysisTypeID = mbAnalysisTypeId;
     obj.SampleID = sampleId;
     // добавление дефолта результата
     obj.MBAnalysisResultID = 14;
     // добавление дефолта статуса
     obj.MBStatusID = 2;
     obj.DateAdd = DateTime.Now;
     obj.DateUpdate = DateTime.Now;
     obj.Suser = System.Web.Security.Membership.GetUser().ToString();
     db.MBAnalysis.AddObject(obj);
     db.SaveChanges();
     return obj.MBAnalysisID;
 }
예제 #2
0
 public dbActionResult EditMBAnalysis(MBAnalysi obj)
 {
     try
     {
         obj.DateUpdate = DateTime.Now;
         obj.Suser = System.Web.Security.Membership.GetUser().ToString();
         db.MBAnalysis.Attach(obj);
         db.ObjectStateManager.ChangeObjectState(obj, EntityState.Modified);
         db.SaveChanges();
         dbActionResult returnObj = new dbActionResult();
         returnObj.intResult = obj.MBAnalysisID;
         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);
     }
 }
예제 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the MBAnalysis EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMBAnalysis(MBAnalysi mBAnalysi)
 {
     base.AddObject("MBAnalysis", mBAnalysi);
 }
예제 #4
0
 /// <summary>
 /// Create a new MBAnalysi object.
 /// </summary>
 /// <param name="mBAnalysisID">Initial value of the MBAnalysisID property.</param>
 /// <param name="sampleID">Initial value of the SampleID property.</param>
 /// <param name="mBAnalysisTypeID">Initial value of the MBAnalysisTypeID property.</param>
 public static MBAnalysi CreateMBAnalysi(global::System.Int32 mBAnalysisID, global::System.Int32 sampleID, global::System.Int32 mBAnalysisTypeID)
 {
     MBAnalysi mBAnalysi = new MBAnalysi();
     mBAnalysi.MBAnalysisID = mBAnalysisID;
     mBAnalysi.SampleID = sampleID;
     mBAnalysi.MBAnalysisTypeID = mBAnalysisTypeID;
     return mBAnalysi;
 }
예제 #5
0
        public ActionResult MBAnalysisEdit(vwMBAnaysisEdit model)
        {
            try
            {

                MBAnalysi obj = new MBAnalysi();

                obj = model.MBAnalysisObj;
                db.EditMBAnalysis(obj);
                var tmp = dbm.Samples.SingleOrDefault(o => o.SampleID == model.MBAnalysisObj.SampleID);
                string strMessage = "Результаты анализа " + model.MBAnalysisObj.MBAnalysisType.DescriptionRus + " для образца " + model.SampleObj.SampleID + " сохранены успешно ";
                return RedirectToAction("MBAnalysisList", new { message = strMessage, queue = 1 });
            }
            catch (DataException ex)
            {
                string strMessage = "Ошибка" + ex.Message + ". Результаты анализа " + model.MBAnalysisObj.MBAnalysisType.DescriptionRus + " для образца " + model.SampleObj.SampleID + " не удалось сохранить ";
                return RedirectToAction("MBAnalysisList", new { message = strMessage, queue = 1 });
            }
        }