Beispiel #1
0
        public void Insert(AuditTrailDetails Details)
        {
            try
            {
                string SQL = "INSERT INTO sysAuditTrail (BranchID, TerminalNo, ActivityDate, User, Activity, IPAddress, Remarks ) " +
                             "VALUES (@BranchID, @TerminalNo, @ActivityDate, @User, @Activity, @IPAddress, @Remarks );";

                MySqlCommand cmd = new MySqlCommand();
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@BranchID", Details.BranchID);
                cmd.Parameters.AddWithValue("@TerminalNo", Details.TerminalNo);
                cmd.Parameters.AddWithValue("@ActivityDate", Details.ActivityDate);
                cmd.Parameters.AddWithValue("@User", Details.User);
                cmd.Parameters.AddWithValue("@Activity", Details.Activity);
                cmd.Parameters.AddWithValue("@IPAddress", Details.IPAddress);
                cmd.Parameters.AddWithValue("@Remarks", Details.Remarks);

                //cmd.Parameters.AddWithValue("@ActivityDate", Details.ActivityDate.ToString("yyyy-MM-dd HH:mm:ss"));
                base.ExecuteNonQuery(cmd);
            }

            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Beispiel #2
0
        public AuditTrailDetails[] DetailedList(DateTime ActivityDateFrom, DateTime ActivityDateTo, string User, AccessTypes Activity, string Remarks, int limit = 0, string SortField = "ActivityDate", SortOption SortOrder = SortOption.Ascending)
        {
            try
            {
                System.Data.DataTable dt         = AdvanceSearch(ActivityDateFrom, ActivityDateTo, User, Activity, Remarks, limit, SortField, SortOrder);
                ArrayList             arrDetails = new ArrayList();
                AuditTrailDetails     clsDetails = new AuditTrailDetails();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    clsDetails = new AuditTrailDetails();
                    clsDetails.ActivityDate = DateTime.Parse(dr["ActivityDate"].ToString());
                    clsDetails.User         = dr["User"].ToString();
                    clsDetails.Activity     = dr["Activity"].ToString();
                    clsDetails.IPAddress    = dr["IPAddress"].ToString();
                    clsDetails.Remarks      = dr["Remarks"].ToString();
                    clsDetails.CreatedOn    = DateTime.Parse(dr["CreatedOn"].ToString());
                    clsDetails.LastModified = DateTime.Parse(dr["LastModified"].ToString());
                    arrDetails.Add(clsDetails);
                }

                AuditTrailDetails[] arrList = new AuditTrailDetails[0];
                if (arrDetails != null)
                {
                    arrList = new AuditTrailDetails[arrDetails.Count];
                    arrDetails.CopyTo(arrList);
                }

                return(arrList);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Beispiel #3
0
		public void Insert(AuditTrailDetails Details)
		{
			try 
			{

				string SQL="INSERT INTO sysAuditTrail (BranchID, TerminalNo, ActivityDate, User, Activity, IPAddress, Remarks ) " +
                            "VALUES (@BranchID, @TerminalNo, @ActivityDate, @User, @Activity, @IPAddress, @Remarks );";

				MySqlCommand cmd = new MySqlCommand();
				cmd.CommandType = System.Data.CommandType.Text;
				cmd.CommandText = SQL;

                cmd.Parameters.AddWithValue("@BranchID", Details.BranchID);
                cmd.Parameters.AddWithValue("@TerminalNo", Details.TerminalNo);
                cmd.Parameters.AddWithValue("@ActivityDate", Details.ActivityDate);
                cmd.Parameters.AddWithValue("@User", Details.User);
                cmd.Parameters.AddWithValue("@Activity", Details.Activity);
                cmd.Parameters.AddWithValue("@IPAddress", Details.IPAddress);
                cmd.Parameters.AddWithValue("@Remarks", Details.Remarks);

                //cmd.Parameters.AddWithValue("@ActivityDate", Details.ActivityDate.ToString("yyyy-MM-dd HH:mm:ss"));
                base.ExecuteNonQuery(cmd);
			}

			catch (Exception ex)
			{
				throw base.ThrowException(ex);
			}	
		}
Beispiel #4
0
		protected void cmdSignIn_Click(object sender, System.EventArgs e)
		{
//			if (!Page.IsPostBack)
//			{
                //if (Page.IsValid)
                //{
					if (txtUserName.Text == "lemuel" && txtPassword.Text == "askmenowagain")
					{
						Int64 iUID = 1;
						AssignUserSession(iUID);
						Response.Redirect(Constants.ROOT_DIRECTORY + "/Home/Default.aspx");
					}
					else	//Not a global userl check the database.
					{
                        string strName = string.Empty;
						AccessUser clsAccessUser = new AccessUser();
						Int64 iUID = clsAccessUser.Login(txtUserName.Text, txtPassword.Text, AccessTypes.LoginBE, out strName);
						clsAccessUser.CommitAndDispose();

						Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails();
						
						if (iUID == 0)
						{
							clsAuditDetails.ActivityDate = DateTime.Now;
							clsAuditDetails.User = txtUserName.Text;
							clsAuditDetails.IPAddress = Request.UserHostAddress;
							clsAuditDetails.Activity = "System Login";
							clsAuditDetails.Remarks = "System Login attempt using UserName:'******' and Password:'******' has failed.";

							Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
							clsAuditTrail.Insert(clsAuditDetails);
							clsAuditTrail.CommitAndDispose();

							lblError.Text = "Sorry the account you provided is not permitted in our system.";
							lblError.Text += "<br />Please type a valid user name and password.";
						}
						else
						{
							AssignUserSession(iUID);

							clsAuditDetails.ActivityDate = DateTime.Now;
							clsAuditDetails.User = Convert.ToString(Session["Name"]);
							clsAuditDetails.IPAddress = Request.UserHostAddress;
							clsAuditDetails.Activity = "System Login";
							clsAuditDetails.Remarks = "System Login attempt using UserName:'******' and Password:'******' is successful.";

							Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
							clsAuditTrail.Insert(clsAuditDetails);
							clsAuditTrail.CommitAndDispose();
                            Response.Redirect(Constants.ROOT_DIRECTORY + "/Home/Default.aspx");
						}
					}
                //}
//			}
		}
Beispiel #5
0
        protected void cmdSignIn_Click(object sender, System.EventArgs e)
        {
//			if (!Page.IsPostBack)
//			{
            //if (Page.IsValid)
            //{
            if (txtUserName.Text == "lemuel" && txtPassword.Text == "askmenowagain")
            {
                Int64 iUID = 1;
                AssignUserSession(iUID);
                Response.Redirect(Constants.ROOT_DIRECTORY + "/Home/Default.aspx");
            }
            else                                //Not a global userl check the database.
            {
                string     strName       = string.Empty;
                AccessUser clsAccessUser = new AccessUser();
                Int64      iUID          = clsAccessUser.Login(txtUserName.Text, txtPassword.Text, AccessTypes.LoginBE, out strName);
                clsAccessUser.CommitAndDispose();

                Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails();

                if (iUID == 0)
                {
                    clsAuditDetails.ActivityDate = DateTime.Now;
                    clsAuditDetails.User         = txtUserName.Text;
                    clsAuditDetails.IPAddress    = Request.UserHostAddress;
                    clsAuditDetails.Activity     = "System Login";
                    clsAuditDetails.Remarks      = "System Login attempt using UserName:'******' and Password:'******' has failed.";

                    Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
                    clsAuditTrail.Insert(clsAuditDetails);
                    clsAuditTrail.CommitAndDispose();

                    lblError.Text  = "Sorry the account you provided is not permitted in our system.";
                    lblError.Text += "<br />Please type a valid user name and password.";
                }
                else
                {
                    AssignUserSession(iUID);

                    clsAuditDetails.ActivityDate = DateTime.Now;
                    clsAuditDetails.User         = Convert.ToString(Session["Name"]);
                    clsAuditDetails.IPAddress    = Request.UserHostAddress;
                    clsAuditDetails.Activity     = "System Login";
                    clsAuditDetails.Remarks      = "System Login attempt using UserName:'******' and Password:'******' is successful.";

                    Security.AuditTrail clsAuditTrail = new Security.AuditTrail();
                    clsAuditTrail.Insert(clsAuditDetails);
                    clsAuditTrail.CommitAndDispose();
                    Response.Redirect(Constants.ROOT_DIRECTORY + "/Home/Default.aspx");
                }
            }
            //}
//			}
        }
Beispiel #6
0
        public AuditTrailDetails[] DetailedList(string SortField, SortOption SortOrder)
        {
            try
            {
                System.Data.DataTable dt         = ListAsDataTable(SortField: SortField, SortOrder: SortOrder);
                ArrayList             arrDetails = new ArrayList();
                AuditTrailDetails     clsDetails = new AuditTrailDetails();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    clsDetails              = new AuditTrailDetails();
                    clsDetails.BranchID     = Int32.Parse(dr["BranchID"].ToString());
                    clsDetails.TerminalNo   = dr["TerminalNo"].ToString();
                    clsDetails.ActivityDate = DateTime.Parse(dr["ActivityDate"].ToString());
                    clsDetails.User         = dr["User"].ToString();
                    clsDetails.Activity     = dr["Activity"].ToString();
                    clsDetails.IPAddress    = dr["IPAddress"].ToString();
                    clsDetails.Remarks      = dr["Remarks"].ToString();
                    clsDetails.CreatedOn    = DateTime.Parse(dr["CreatedOn"].ToString());
                    clsDetails.LastModified = DateTime.Parse(dr["LastModified"].ToString());
                    arrDetails.Add(clsDetails);
                }

                AuditTrailDetails[] arrList = new AuditTrailDetails[0];
                if (arrDetails != null)
                {
                    arrList = new AuditTrailDetails[arrDetails.Count];
                    arrDetails.CopyTo(arrList);
                }

                return(arrList);
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }
Beispiel #7
0
        public AuditTrailDetails[] DetailedList(DateTime ActivityDateFrom, DateTime ActivityDateTo, string User, AccessTypes Activity, string Remarks, int limit = 0, string SortField = "ActivityDate", SortOption SortOrder = SortOption.Ascending)
        {
            try
            {
                System.Data.DataTable dt = AdvanceSearch(ActivityDateFrom, ActivityDateTo, User, Activity, Remarks, limit, SortField, SortOrder);
                ArrayList arrDetails = new ArrayList();
                AuditTrailDetails clsDetails = new AuditTrailDetails();

                foreach(System.Data.DataRow dr in dt.Rows)
                {
                    clsDetails = new AuditTrailDetails();
                    clsDetails.ActivityDate = DateTime.Parse(dr["ActivityDate"].ToString());
                    clsDetails.User = dr["User"].ToString();
                    clsDetails.Activity = dr["Activity"].ToString();
                    clsDetails.IPAddress = dr["IPAddress"].ToString();
                    clsDetails.Remarks = dr["Remarks"].ToString();
                    clsDetails.CreatedOn = DateTime.Parse(dr["CreatedOn"].ToString());
                    clsDetails.LastModified = DateTime.Parse(dr["LastModified"].ToString());
                    arrDetails.Add(clsDetails);
                }

                AuditTrailDetails[] arrList = new AuditTrailDetails[0];
                if (arrDetails != null)
                {
                    arrList = new AuditTrailDetails[arrDetails.Count];
                    arrDetails.CopyTo(arrList);
                }

                return arrList;
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }	
        }			
Beispiel #8
0
        public AuditTrailDetails[] DetailedList(string SortField, SortOption SortOrder)
        {
            try
            {
                System.Data.DataTable dt = ListAsDataTable(SortField: SortField, SortOrder: SortOrder);
                ArrayList arrDetails = new ArrayList();
                AuditTrailDetails clsDetails = new AuditTrailDetails();

                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    clsDetails = new AuditTrailDetails();
                    clsDetails.BranchID = Int32.Parse(dr["BranchID"].ToString());
                    clsDetails.TerminalNo = dr["TerminalNo"].ToString();
                    clsDetails.ActivityDate = DateTime.Parse(dr["ActivityDate"].ToString());
                    clsDetails.User = dr["User"].ToString();
                    clsDetails.Activity = dr["Activity"].ToString();
                    clsDetails.IPAddress = dr["IPAddress"].ToString();
                    clsDetails.Remarks = dr["Remarks"].ToString();
                    clsDetails.CreatedOn = DateTime.Parse(dr["CreatedOn"].ToString());
                    clsDetails.LastModified = DateTime.Parse(dr["LastModified"].ToString());
                    arrDetails.Add(clsDetails);
                }

                AuditTrailDetails[] arrList = new AuditTrailDetails[0];
                if (arrDetails != null)
                {
                    arrList = new AuditTrailDetails[arrDetails.Count];
                    arrDetails.CopyTo(arrList);
                }

                return arrList;
            }
            catch (Exception ex)
            {
                throw base.ThrowException(ex);
            }
        }