private void Search() { try { BizLog bizLog = new BizLog(); BmLogPagingRq bmLogRq = new BmLogPagingRq(); bmLogRq.Paging.CurPage = ucPaging.CurPage; bmLogRq.Paging.PageSize = ucPaging.PageSize; if (!string.IsNullOrEmpty(tbxStartDate.Text) && !string.IsNullOrEmpty(tbxEndDate.Text)) { bmLogRq.StartDate = Convert.ToDateTime(tbxStartDate.Text + " 00:00:00"); bmLogRq.EndDate = Convert.ToDateTime(tbxEndDate.Text + " 23:59:59"); } if (ddlResult.SelectedValue != "-1") bmLogRq.Log.Result = ddlResult.SelectedValue; if (ddlCallerMethod.SelectedValue != "-1") bmLogRq.Log.CallerMethod = ddlCallerMethod.SelectedValue; if (ddlCalleeMethod.SelectedValue != "-1") bmLogRq.Log.CalleeMethod = ddlCalleeMethod.SelectedValue; var result = bizLog.GetLogPagingList(bmLogRq); ucPaging.TotalRowCount = result.TotalCount; rptLogList.DataSource = result.List; rptLogList.DataBind(); } catch (Exception ex) { cLib.WriteLog("Exception", ex.Message); } }
private void Search() { try { BizLog bizLog = new BizLog(); BmConnectLogPagingRq bmLogRq = new BmConnectLogPagingRq(); bmLogRq.Paging.CurPage = ucPaging.CurPage; bmLogRq.Paging.PageSize = ucPaging.PageSize; if (!string.IsNullOrEmpty(tbxStartDate.Text) && !string.IsNullOrEmpty(tbxEndDate.Text)) { bmLogRq.SearchDateType = ddlDateType.SelectedValue; bmLogRq.StartDate = Convert.ToDateTime(tbxStartDate.Text + " 00:00:00"); bmLogRq.EndDate = Convert.ToDateTime(tbxEndDate.Text + " 23:59:59"); } if (string.IsNullOrEmpty(tbxSearch.Text) == false) { switch (ddlSearchType.SelectedValue) { case "IP": bmLogRq.ConnectLog.Ip = tbxSearch.Text; break; case "LINK": bmLogRq.ConnectLog.LinkUrl = tbxSearch.Text; break; case "ID": bmLogRq.ConnectLog.Id = tbxSearch.Text; break; } } var result = bizLog.GetConnectLogPagingList(bmLogRq); ucPaging.TotalRowCount = result.TotalCount; rptConnectLogList.DataSource = result.List; rptConnectLogList.DataBind(); } catch (Exception ex) { cLib.WriteLog("Exception", ex.Message); } }
private void Search() { try { BizLog bizLog = new BizLog(); BmUpdateHistoryPagingRq bmUpdateHistroyRq = new BmUpdateHistoryPagingRq(); bmUpdateHistroyRq.Paging.CurPage = ucPaging.CurPage; bmUpdateHistroyRq.Paging.PageSize = ucPaging.PageSize; if (!string.IsNullOrEmpty(tbxStartDate.Text) && !string.IsNullOrEmpty(tbxEndDate.Text)) { bmUpdateHistroyRq.StartDate = Convert.ToDateTime(tbxStartDate.Text + " 00:00:00"); bmUpdateHistroyRq.EndDate = Convert.ToDateTime(tbxEndDate.Text + " 23:59:59"); } if (ddlCmdType.SelectedValue != "-1") bmUpdateHistroyRq.UpdateHistory.CmdCode = Convert.ToInt32(ddlCmdType.SelectedValue); if (ddlObjectType.SelectedValue != "-1") bmUpdateHistroyRq.UpdateHistory.ObjectType = ddlObjectType.SelectedValue; if (!string.IsNullOrEmpty(tbxSearch.Text)) { if (ddlSearchType.SelectedValue == "1") bmUpdateHistroyRq.UpdateHistory.ObjectSeq = Convert.ToInt32(tbxSearch.Text); else if (ddlSearchType.SelectedValue == "2") bmUpdateHistroyRq.UpdateHistory.ObjectData = tbxSearch.Text; else bmUpdateHistroyRq.UpdateHistory.Registrant = tbxSearch.Text; } var result = bizLog.GetUpdateHistoryPagingList(bmUpdateHistroyRq); ucPaging.TotalRowCount = result.TotalCount; rptUpdateHistoryList.DataSource = result.List; rptUpdateHistoryList.DataBind(); } catch (Exception ex) { cLib.WriteLog("Exception", ex.Message); } }
/// <summary>로그 작성</summary> public void WriteLog(string pResult, string pMsg) { try { BmLog bmLog = new BmLog(); StackTrace st = new StackTrace(); bmLog.CallerMethod = st.GetFrame(2).GetMethod().Name != null ? st.GetFrame(2).GetMethod().Name : ""; bmLog.CalleeMethod = st.GetFrame(1).GetMethod().Name != null ? st.GetFrame(1).GetMethod().Name : ""; bmLog.PageUrl = HttpContext.Current != null ? HttpContext.Current.Request.Url.AbsoluteUri : ""; bmLog.Result = pResult; bmLog.Msg = pMsg; BizLog bizLog = new BizLog(); bizLog.WriteLog(bmLog); } catch (Exception ex) { if (pResult != "WriteLog") WriteLog("WriteLog", ex.Message); } }
/// <summary>변경이력 작성</summary> public void WriteHistory(object pObj, HistoryCommandType pCmdCode) { try { BmUpdateHistory bmUpdateHistory = new BmUpdateHistory(); StackTrace st = new StackTrace(); Type t = pObj.GetType(); bmUpdateHistory.CmdCode = Convert.ToInt32(pCmdCode); bmUpdateHistory.PageMethod = st.GetFrame(3).GetMethod().Name; bmUpdateHistory.PageUrl = HttpContext.Current.Request.Url.AbsoluteUri; bmUpdateHistory.ObjectType = t.Name; bmUpdateHistory.ObjectSeq = (int)t.GetProperties().FirstOrDefault(o => o.Name.Equals("Seq")).GetValue(pObj); if (pCmdCode == HistoryCommandType.INSERT) { bmUpdateHistory.Registrant = (string)t.GetProperties().FirstOrDefault(o => o.Name.Equals("Registrant")).GetValue(pObj); } else { bmUpdateHistory.Registrant = (string)t.GetProperties().FirstOrDefault(o => o.Name.Equals("Modifyer")).GetValue(pObj); } foreach (System.Reflection.PropertyInfo prop in t.GetProperties()) { var hs = prop.GetCustomAttributesData().FirstOrDefault(o => o.AttributeType.Name.Equals("HistoryAttribute")); if (hs != null) { var Record = hs.NamedArguments.FirstOrDefault(o => o.MemberName.Equals("Record")); if (Record != null && (bool)Record.TypedValue.Value == true) { var DpName = hs.NamedArguments.FirstOrDefault(o => o.MemberName.Equals("Name")); bmUpdateHistory.ObjectData += string.Format("[{0} = {1}]", DpName.TypedValue.Value, prop.GetValue(pObj)); } } } BizLog bizLog = new BizLog(); bizLog.WriteUpdateHistory(bmUpdateHistory); } catch (Exception ex) { throw; } }
/// <summary>로그인</summary> /// <returns> /// 0 = 성공 /// , -1 = 비밀번호 오류 /// , -2 = 아이디 오류 /// , -3 = 세션 갱신 실패 /// , -4 = Exception /// , -5 = 접속로그 오류 /// </returns> public static int Login(string Id, string Pw) { try { HttpContext context = HttpContext.Current; BizMember bizMember = new BizMember(); BmAdminMember bmAdminMember = new BmAdminMember(); bmAdminMember.Id = Id; bmAdminMember.State = 1; var AccountList = bizMember.GetAdminMemberList(bmAdminMember); if (AccountList.Count == 1) { BmAdminMember Account = AccountList[0]; if (Pw == Account.Pw) { Account.SessionId = context.Session.SessionID; SessionId = context.Session.SessionID; if (bizMember.UpdateAdminMemberSession(Account)) { BizLog bizLog = new BizLog(); BmConnectLog bmConnectLog = new BmConnectLog(); //접속세션이 없을시 접속세션 등록 if (context.Session["ConnectSeq"] == null) { bmConnectLog.ReconnectYn = "Y"; bmConnectLog.SessionId = context.Session.SessionID; bmConnectLog.Ip = context.Request.ServerVariables["REMOTE_ADDR"] != null ? context.Request.ServerVariables["REMOTE_ADDR"] : ""; bmConnectLog.LinkUrl = context.Request.ServerVariables["HTTP_REFERER"] != null ? context.Request.ServerVariables["HTTP_REFERER"] : ""; context.Session["ConnectSeq"] = bizLog.InsertConnectLogScalar(bmConnectLog); } bmConnectLog.Seq = (int)context.Session["ConnectSeq"]; bmConnectLog.Id = bmAdminMember.Id; //접속로그 로그인Id, 시간 업데이트 if (bizLog.UpdateLoginLog(bmConnectLog)) { //로그인 성공 세션 등록 foreach (string colName in strLoginColumnArray) { Type t = Account.GetType(); context.Session.Add("Login" + colName, t.GetProperties().FirstOrDefault(o => o.Name.Equals(colName)).GetValue(Account).ToString()); } return 0; } //접속 로그 오류 else return -5; } else { //세션 갱신 실패 return -3; } } else { //비밀번호가 다를 경우 return -1; } } else { //아이디가 1개가 아닐경우 return -2; } } catch (Exception ex) { _cLib.WriteLog("Exception", ex.Message); return -4; } }