protected void btnCloseStatus_Click(object sender, EventArgs e) { const string METHOD_NAME = "btnCloseStatus_Click"; try { GridViewRow row = grdResult.SelectedRow; string path = row.Cells[Convert.ToInt32(ErrorResultColumn.errColPath)].Text; if (Common.CodeLib.IsNumeric(path)) { int appErrorInfoID = Convert.ToInt32(path); string appName = Common.UILib.GetDropDownText(ddlEditApplication); string severity = Common.UILib.GetDropDownText(ddlEditSeverity); DateTime errorDate = Convert.ToDateTime(row.Cells[Convert.ToInt32(ErrorResultColumn.errColDate)].Text); string errorStatus = "Closed"; string errorAction = txtEditAction.Text; string errorCode = txtEditErrorCode.Text; string errorText = txtErrorText.Text; string loginServer = txtEditServer.Text; string loginClient = txtEditClient.Text; string loginUser = txtEditUser.Text; string userName = Common.AppHelper.GetIdentityName(); AppError.AppErrorFileSave(appErrorInfoID, appName, severity, errorDate, errorStatus, errorAction, loginServer, loginClient, loginUser, errorCode, userName, errorText); } else { Common.CWarning warn = new Common.CWarning("You cannot set the status of a file based error. You need to first Import this error."); throw (warn); } ClearEditValues(); FillResultsGrid(); } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); } }
protected void btnImportErrorFile_Click(object sender, EventArgs e) { const string METHOD_NAME = "btnImportErrorFile_Click"; try { GridViewRow row = grdResult.SelectedRow; string path = row.Cells[Convert.ToInt32(ErrorResultColumn.errColPath)].Text; int appErrorInfoID = 0; string appName = ""; string severity = ""; DateTime errorDate; string errorStatus = ""; string errorAction = ""; string errorCode = ""; string errorText = ""; string loginServer = ""; string loginClient = ""; string loginUser = ""; string errorBreakText = txtEditBreakText.Text; string userName = Common.AppHelper.GetIdentityName(); if (Common.CodeLib.IsNumeric(path)) { appErrorInfoID = Convert.ToInt32(path); } appName = Common.UILib.GetDropDownText(ddlEditApplication); severity = Common.UILib.GetDropDownText(ddlEditSeverity); errorDate = Convert.ToDateTime(row.Cells[Convert.ToInt32(ErrorResultColumn.errColDate)].Text); errorStatus = Common.UILib.GetDropDownText(ddlEditStatus); errorAction = txtEditAction.Text; errorDate = Convert.ToDateTime(row.Cells[Convert.ToInt32(ErrorResultColumn.errColDate)].Text); errorCode = txtEditErrorCode.Text; errorText = txtErrorText.Text; loginServer = txtEditServer.Text; loginClient = txtEditClient.Text; loginUser = txtEditUser.Text; string[] errorBlocks = txtErrorText.Text.Split(new string[] { errorBreakText }, System.StringSplitOptions.RemoveEmptyEntries); foreach (string eBlock in errorBlocks) { AppError.AppErrorFileSave(appErrorInfoID, appName, severity, errorDate, errorStatus, errorAction, loginServer, loginClient, loginUser, errorCode, userName, eBlock); // Perhaps this was an update, but if we're splitting the error text into multiple errors, // the subsequent updates must really become inserts of new errors. That's why we reset // the appErrorInfoID. if (appErrorInfoID > 0) { appErrorInfoID = 0; } } // after a successful import, delete the file, the repop the grid if (!Common.CodeLib.IsNumeric(path)) { File.Delete(path); } ClearEditValues(); FillResultsGrid(); } catch (System.Exception ex) { Common.CException wex = new Common.CException(MOD_NAME + METHOD_NAME, ex); ((PrimaryTemplate)Page.Master).ShowWarning(ex); } }