// Resume/Suspend Now /// <summary> /// Method for Resume/Suspend system immediately /// </summary> /// <param name="UpdateType"></param> /// <returns></returns> public ActionResult CMS040_UpdateSystemStatus(string UpdateType) { bool bResult = false; try { ICommonHandler handler = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; if (UpdateType == "SUSPEND") { bResult = handler.UpdateSystemStatus(true, true, CommonUtil.dsTransData.dtUserData.EmpNo); } else if (UpdateType == "RESUME") { bResult = handler.UpdateSystemStatus(false, true, CommonUtil.dsTransData.dtUserData.EmpNo); } List <doSystemStatus> l = new List <doSystemStatus>(); doSystemStatus item = new doSystemStatus(); var list = handler.GetSystemStatus(); if (list.Count > 0) { string strOnline = CommonUtil.GetLabelFromResource("Common", "CMS040", "lblOnline");; string strOffline = CommonUtil.GetLabelFromResource("Common", "CMS040", "lblOffline"); item.CompleteFlag = bResult; item.UpdateType = UpdateType; item.SystemStatus = (list[0].SuspendFlag == true) ? "Offline" : "Online"; item.SystemStatusDisplayName = (list[0].SuspendFlag == true) ? strOffline : strOnline; item.NextResumeServiceDateTime = ((DateTime)list[0].ResumeServiceDateTime).ToString("dd-MMM-yyyy HH:mm:ss"); item.NextSuspendServiceDateTime = ((DateTime)list[0].SuspendServiceDateTime).ToString("dd-MMM-yyyy HH:mm:ss"); l.Add(item); } return(Json(l)); } catch (Exception ex) { ObjectResultData res = new ObjectResultData(); res.AddErrorMessage(ex); return(Json(res)); } }
///<summary> ///Purpose: /// Check input manual flag /// ///Parameters: /// bManualFlag: 0 /// bSuspendFlag: 0 /// Current date: 8-Aug-2011 /// ///Expected: /// Do nothing ///</summary> public string Case2() { ICommonHandler target = ServiceContainer.GetService <ICommonHandler>() as ICommonHandler; bool bManualFlag = false; bool bSuspendFlag = false; //Current date = 8-Aug-2011 string expected = null; string actual = null; try { target.UpdateSystemStatus(bSuspendFlag, bManualFlag, ""); } catch (ApplicationErrorException ex) { actual = ex.ErrorResult.Message.Code; } catch (Exception ex) { actual = ex.StackTrace; } return(string.Format(RESULT_FORMAT, 2, expected, actual, CompareResult_String(expected, actual))); }