/// <summary>
 ///BKMBInfo維護畫面建置
 /// </summary>
 /// <param name="bkmbModel"></param>
 /// <param name="insertOrUpdate"></param>
 /// <returns></returns>
 public ActionResult SingleCRUDInfo(string id, string Mode)
 {
     try
     {
         SingleCRUDInfoViewModel singleCRUDInfoModel = new SingleCRUDInfoViewModel();
         var selectList = _service.GetDtypeSelecList();
         selectList.Insert(0, new SelectListItem {
             Text = "請選擇", Value = ""
         });
         singleCRUDInfoModel.DTypeSelectList = new SelectList(selectList, "Value", "Text");
         singleCRUDInfoModel.Mode            = Mode;
         if (Mode == "Update")
         {
             if (string.IsNullOrEmpty(id))
             {
                 singleCRUDInfoModel.ErrorMessage = "需要修改資料的代碼為空值,修改動作失敗";
                 return(View(singleCRUDInfoModel));
             }
             singleCRUDInfoModel.SingleCRUDModel = _service.GetSingleCRUDData(id);
             if (singleCRUDInfoModel.SingleCRUDModel == null)
             {
                 singleCRUDInfoModel.ErrorMessage = "查無該筆修改資料,修改動作失敗";
                 return(View(singleCRUDInfoModel));
             }
             return(View(singleCRUDInfoModel));
         }
         return(View(singleCRUDInfoModel));
     }
     catch (Exception ex)
     {
         return(View(new SingleCRUDInfoViewModel()));
     }
 }
 /// <summary>
 ///BKMBInfo維護畫面建置
 /// </summary>
 /// <param name="bkmbModel"></param>
 /// <param name="insertOrUpdate"></param>
 /// <returns></returns>
 public ActionResult SingleCRUDInfo(string id, string Mode)
 {
     try
     {
         Log.LogInfoWriter(userName, LogManagement.LogType.OP, LogManagement.EventLevel.Info, LogManagement.LogAction.USER_Trace_EnterPage, LogManagement.SystemName.基本作業, "使用者進入SingleCRUD維護畫面", null, null);
         Log.LogInfoWriter(userName, LogManagement.LogType.AP, LogManagement.EventLevel.Info, LogManagement.LogAction.SYS_FunctionStart, LogManagement.SystemName.基本作業, "開始取得SingleCRUD維護畫面", new { id, Mode }, null);
         SingleCRUDInfoViewModel singleCRUDInfoModel = new SingleCRUDInfoViewModel();
         var selectList = _service.GetDtypeSelecList();
         selectList.Insert(0, new SelectListItem {
             Text = "請選擇", Value = ""
         });
         singleCRUDInfoModel.DTypeSelectList = new SelectList(selectList, "Value", "Text");
         singleCRUDInfoModel.Mode            = Mode;
         if (Mode == "Update")
         {
             if (string.IsNullOrEmpty(id))
             {
                 Log.LogInfoWriter(userName, LogManagement.LogType.AP, LogManagement.EventLevel.Error, LogManagement.LogAction.Error_NullException, LogManagement.SystemName.基本作業, "修改資料的Pkey為空值,修改失敗", new { id, Mode }, null);
                 singleCRUDInfoModel.ErrorMessage = "需要修改資料的代碼為空值,修改動作失敗";
                 return(View(singleCRUDInfoModel));
             }
             singleCRUDInfoModel.SingleCRUDModel = _service.GetSingleCRUDData(id);
             if (singleCRUDInfoModel.SingleCRUDModel == null)
             {
                 Log.LogInfoWriter(userName, LogManagement.LogType.AP, LogManagement.EventLevel.Error, LogManagement.LogAction.Error_NullException, LogManagement.SystemName.基本作業, "查無該筆修改資料,修改失敗", new { id, Mode }, null);
                 singleCRUDInfoModel.ErrorMessage = "查無該筆修改資料,修改動作失敗";
                 return(View(singleCRUDInfoModel));
             }
             Log.LogInfoWriter(userName, LogManagement.LogType.AP, LogManagement.EventLevel.Info, LogManagement.LogAction.SYS_FunctionEnd, LogManagement.SystemName.基本作業, "取得SingleCRUD維護畫面結束", singleCRUDInfoModel, null);
             return(View(singleCRUDInfoModel));
         }
         Log.LogInfoWriter(userName, LogManagement.LogType.AP, LogManagement.EventLevel.Info, LogManagement.LogAction.SYS_FunctionEnd, LogManagement.SystemName.基本作業, "取得SingleCRUD維護畫面結束", singleCRUDInfoModel, null);
         return(View(singleCRUDInfoModel));
     }
     catch (Exception ex)
     {
         Log.LogInfoWriter(userName, LogManagement.LogType.AP, LogManagement.EventLevel.Error, LogManagement.LogAction.Error_FunctionError, LogManagement.SystemName.基本作業, "取得SingleCRUD維護畫面,發生錯誤", new { id, Mode }, ex);
         return(View(new SingleCRUDInfoViewModel()));
     }
 }