Example #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            AppUser AppUser = new AppUser();

            if (AppUser.LoadByPrimaryKey(txtUserId.Text.Trim()))
            {
                if (AppUser.Password == AEScipher.Encrypt(txtUserId.Text, txtPassword.Text))
                {
                    HttpContext.Current.Session["UserId"]   = AppUser.UserID;
                    HttpContext.Current.Session["UserName"] = AppUser.UserName;

                    AuditTrail AuditTrail = new AuditTrail();
                    string     itemAction = "Login per Tanggal : " + DateTime.Now.ToShortDateString() + " , untuk UserID : " + AppUser.UserID;
                    if (itemAction.Length > 200)
                    {
                        itemAction = itemAction.Substring(0, 200);
                    }
                    AuditTrail.ItemAction = itemAction;
                    AuditTrail.Aksi       = "LOGIN";
                    AuditTrail.DateAction = DateTime.Now;
                    AuditTrail.Save();
                    Response.Redirect("~/Default.aspx");
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }
        }
Example #2
0
        protected override void OnDeleted()
        {
            base.OnDeleted();

            int recordID = System.Convert.ToInt32(GetPropertyValue("Oid"));

            AuditTrail audit = new AuditTrail(Session)
            {
                ChangeDate = DateTime.Now, RecordType = ClassInfo.ClassType.Name, UserID = Environment.UserName, RecordID = recordID, RecordChanges = recordID.ToString() + " was deleted"
            };

            audit.Save();
        }
Example #3
0
        private void UpdateAudit(int recordID)
        {
            if (changes.Count > 0)
            {
                AuditTrail audit = new AuditTrail(Session)
                {
                    ChangeDate = DateTime.Now, RecordType = ClassInfo.ClassType.Name, UserID = Environment.UserName, RecordID = recordID
                };

                foreach (Change change in changes)
                {
                    audit.RecordChanges += string.Format("{0}:{1}({2});", change.PropertyName, change.PrevValue, change.Value);
                }
                audit.Save();
            }
        }