/// <summary> /// Save the error Log to the Database.with null UserID /// </summary> /// <param name="ErrorLocation">String Form Name+Fuction Name </param> /// <param name="ErrorDesc">String error string</param> /// <param name="ErrorTime">DateTime of Error</param> /// <param name="NullUserID">it takes null User ID true or false any Condition</param> /// <returns>Boolean true if log saved else false</returns> public static Boolean save(string ErrorLocation, string ErrorDesc, DateTime ErrorTime, Boolean NullUserID) { Boolean _return = false; try { List <cstErrorLog> _lsErrorCustom = new List <cstErrorLog>(); cstErrorLog _error = new cstErrorLog(); _error.ErrorLogID = Guid.Empty; _error.ErrorLocation = ErrorLocation; _error.ErrorDesc = ErrorDesc; _error.ErrorTime = ErrorTime; _lsErrorCustom.Add(_error); _return = Global.controller.SaveErrorlog(_lsErrorCustom); } catch (Exception) { } return(_return); }
/// <summary> /// Save error log with Global UserID and Current Datetime value /// </summary> /// <param name="ErrorLocation">String Form Name+Fuction Name </param> /// <param name="ErrorDesc">String error string</param> /// <returns>Boolean true if log saved else false</returns> public static Boolean save(string ErrorLocation, string ErrorDesc) { Boolean _return = false; try { List <cstErrorLog> _lsErrorCustom = new List <cstErrorLog>(); cstErrorLog _error = new cstErrorLog(); _error.ErrorLogID = Guid.Empty; _error.ErrorLocation = "PackingCustom." + ErrorLocation; _error.ErrorDesc = ErrorDesc; _error.ErrorTime = DateTime.UtcNow; _error.UserID = Guid.Empty; _lsErrorCustom.Add(_error); cmdErrorLog _Error = new cmdErrorLog(); _return = _Error.SaveLog(_lsErrorCustom); } catch (Exception) { } return(_return); }
protected void txtSearchLog_TextChanged(object sender, EventArgs e) { txtSearchLog.Focus(); try { String SearchText = txtSearchLog.Text; String[] Part = SearchText.Split(new char[] { '|' }); if (Part[0].ToString() != "" || Part[0].ToString() != null) { Guid Rowid; Guid.TryParse(Part[0].ToString(), out Rowid); List <cstErrorLog> lsErrorLog = Obj.call.GetErrorLog(); cstErrorLog _Err = lsErrorLog.SingleOrDefault(i => i.ErrorLogID == Rowid); cstDspErrorLog _error = new cstDspErrorLog(); _error.ErrorDescription = _Err.ErrorDesc; _error.ErrorLocation = _Err.ErrorLocation; _error.ErrorDate = _Err.ErrorTime; _error.ErrorID = _Err.ErrorLogID; _error.UserName = "******"; if (_Err.UserID != Guid.Empty) { try { _error.UserName = Obj.call.GetSelcetedUserMaster(_Err.UserID).SingleOrDefault(o => o.UserID == _Err.UserID).UserFullName; } catch (Exception) { } } List <cstDspErrorLog> lsDataSource = new List <cstDspErrorLog>(); lsDataSource.Add(_error); gvErrorInformation.DataSource = lsDataSource; gvErrorInformation.DataBind(); txtSearchLog.Text = ""; } } catch (Exception) { } }
/// <summary> /// Get All error Log Table information. /// </summary> /// <returns>list og cstErrorLog Table.</returns> public List <cstErrorLog> GetErrorLogAll() { List <cstErrorLog> lsError = new List <cstErrorLog>(); try { var v = from _error in entX3v6.ErrorLogs select _error; foreach (var Vitem in v) { cstErrorLog _error = new cstErrorLog(); _error.ErrorLogID = Vitem.ErrorLogID; _error.ErrorDesc = Vitem.ErrorDesc; _error.ErrorLocation = Vitem.ErrorLocation; _error.ErrorTime = Convert.ToDateTime(Vitem.ErrorTime); Guid Userid = (Guid)Vitem.UserID; _error.UserID = Userid; lsError.Add(_error); } } catch (Exception) { } return(lsError); }