public void AttachSystemsAffectedToChangeRequestTest() { ChangeRequestInterface api = new CRSubSystemAPI(); SystemAffected systemAffected = new SystemAffected(); systemAffected.SystemName = "Test"; systemAffected.SystemType = "Test"; systemAffected.TypeOfChange = "Update"; systemAffected.Details = "Test"; ApiResult result = api.AttachSystemsAffectedToChangeRequest(systemAffected); Assert.AreEqual(Globals.SUCCESS_STATUS_TEXT, result.StatusDesc); }
internal ApiResult AttachSystemAffectedToChangeRequest(SystemAffected sys) { ApiResult apiResult = new ApiResult(); try { if (!sys.IsValid()) { apiResult.SetFailuresAsStatusInResponseFields(sys.StatusDesc); return(apiResult); } sys.Save(); apiResult.SetSuccessAsStatusInResponseFields(); } catch (Exception ex) { HandleError(nameof(AttachSystemAffectedToChangeRequest), "EXCEPTION", ex.Message); apiResult.SetFailuresAsStatusInResponseFields(ex.Message); } return(apiResult); }
protected void btnSubmit_Click(object sender, EventArgs e) { try { SystemAffected systemAffected = new SystemAffected(); systemAffected.ChangeRequestId = ViewState["ChangeRequestId"] as string; systemAffected.CreatedBy = (Session["User"] as SystemUser)?.Username; systemAffected.CreatedOn = DateTime.Now; systemAffected.Details = ddTypeOfSystem.SelectedValue; systemAffected.ModifiedBy = (Session["User"] as SystemUser)?.Username; systemAffected.ModifiedOn = DateTime.Now; systemAffected.SystemName = ddTypeOfSystem.SelectedValue; systemAffected.SystemType = ddTypeOfSystem.SelectedValue; systemAffected.TypeOfChange = ddTypeOfChange.SelectedValue; ApiResult apiResult = BussinessLogic.cRSystemAPIClient.AttachSystemsAffectedToChangeRequest(systemAffected); if (apiResult.StatusCode != Globals.SUCCESS_STATUS_CODE) { //Show Error Message string msg = "ERROR:" + apiResult.StatusDesc; Master.ErrorMessage = msg; return; } DataTable dt = BussinessLogic.cRSystemAPIClient.ExecuteDataSet("GetSystemsAffectedByChangeRequestId", new object[] { systemAffected.ChangeRequestId }).Tables[0]; dataGridResults.DataSource = dt; dataGridResults.DataBind(); } catch (Exception ex) { //Show Error Message string msg = "ERROR:" + ex.Message; Master.ErrorMessage = msg; return; } }
public ApiResult AttachSystemsAffectedToChangeRequest(SystemAffected systemAffected) => cRSubSystemAPI.AttachSystemsAffectedToChangeRequest(systemAffected);