コード例 #1
0
ファイル: DataManager.cs プロジェクト: rymbln/Spec_Soft
 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
ファイル: DataManager.cs プロジェクト: rymbln/Spec_Soft
 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 });
            }
        }