private void AddAuditType(string type) { Phytel.Services.ParameterCollection phyParams = new Phytel.Services.ParameterCollection(); phyParams.Add(new Parameter("@TypeName", type, SqlDbType.VarChar, ParameterDirection.Input, 50)); Phytel.Services.SQLDataService.Instance.ExecuteProcedure(_DBConnName, false, "spPhy_InsertAuditType", phyParams); _dbAuditTypes.Add(_type); }
public void WriteAuditLog() { CheckAuditTypeValidity(); if (_validatedAuditType == "PageView") { //Call stored procedure for AuditView Phytel.Services.ParameterCollection phyParamsAudView = new Phytel.Services.ParameterCollection(); AddEssentialParams(ref phyParamsAudView); Phytel.Services.SQLDataService.Instance.ExecuteProcedure(_DBConnName, false, "spPhy_LogAuditView", phyParamsAudView); } else if (_validatedAuditType == "ErrorMessage" || _validatedAuditType == "SystemError") { string _errorid = (_message != null ? _message.SelectSingleNode("Id").InnerText : "0"); string _errorText = (_message != null ? _message.SelectSingleNode("Text").InnerText : "Unknown"); string _source = (_message != null ? _message.SelectSingleNode("Source").InnerText : "Unknown"); string _stackT = (_message != null ? _message.SelectSingleNode("StackTrace").InnerText : "Unknown"); Phytel.Services.ParameterCollection phyParamsError = new Phytel.Services.ParameterCollection(); AddEssentialParams(ref phyParamsError); phyParamsError.Add(new Parameter("@AuditType", _type, SqlDbType.VarChar, ParameterDirection.Input, _type.Length)); phyParamsError.Add(new Parameter("@ErrorId", _errorid, SqlDbType.VarChar, ParameterDirection.Input, 20)); phyParamsError.Add(new Parameter("@ErrorText", _errorText, SqlDbType.VarChar, ParameterDirection.Input, 20)); phyParamsError.Add(new Parameter("@Source", _source, SqlDbType.VarChar, ParameterDirection.Input, _source.Length)); phyParamsError.Add(new Parameter("@StackTrace", _stackT, SqlDbType.VarChar, ParameterDirection.Input, _stackT.Length)); //Call stored procedure for AuditError Phytel.Services.SQLDataService.Instance.ExecuteProcedure(_DBConnName, false, "spPhy_LogAuditError", phyParamsError); if (_validatedAuditType == "SystemError") { base.LogError(_errorText, LogErrorCode.Error, LogErrorSeverity.High, _stackT); } } else { //Call stored procedure for AuditAction int tosVersion = 0; int notificationTotal = 0; bool isNumeric = false; string patients = string.Empty; if (_patientIDNodeList != null && _patientIDNodeList.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (XmlNode n in _patientIDNodeList) { sb.Append(n.InnerText + "|"); } patients = sb.ToString(); } else if (_patientSummaryPatientId != 0) { patients = _patientSummaryPatientId.ToString(); } if (!string.IsNullOrEmpty(_tOSVersion)) { isNumeric = int.TryParse(_tOSVersion, out tosVersion); } if (!string.IsNullOrEmpty(_notificationTotal)) { isNumeric = int.TryParse(_notificationTotal, out notificationTotal); } Phytel.Services.ParameterCollection phyParams = new Phytel.Services.ParameterCollection(); AddEssentialParams(ref phyParams); phyParams.Add(new Parameter("@AuditType", _type, SqlDbType.VarChar, ParameterDirection.Input, 50)); phyParams.Add(new Parameter("@EditedUserId", _editedUserId, SqlDbType.UniqueIdentifier, ParameterDirection.Input, 100)); phyParams.Add(new Parameter("@EnteredUserName", _enteredUserName, SqlDbType.VarChar, ParameterDirection.Input, 50)); phyParams.Add(new Parameter("@SearchText", _searchText, SqlDbType.VarChar, ParameterDirection.Input, -1)); phyParams.Add(new Parameter("@LandingPage", _landingPage, SqlDbType.VarChar, ParameterDirection.Input, 50)); phyParams.Add(new Parameter("@TOSVersion", tosVersion, SqlDbType.Int, ParameterDirection.Input, 4)); phyParams.Add(new Parameter("@NotificationTotal", notificationTotal, SqlDbType.Int, ParameterDirection.Input, 4)); phyParams.Add(new Parameter("@DownloadedReport", _downloadedReport, SqlDbType.VarChar, ParameterDirection.Input, 100)); phyParams.Add(new Parameter("@Patients", patients, SqlDbType.VarChar, ParameterDirection.Input, -1)); Phytel.Services.SQLDataService.Instance.ExecuteProcedure(_DBConnName, false, "spPhy_LogAuditAction", phyParams); } }