コード例 #1
0
        public int saveAuditTrail(object objNew, string ModuleName, Guid UserId, string BussinessProcess)
        {
            string strVal = AuditTrailComparer.Compare(objNew);

            if (strVal == "")
            {
                return(0);
            }
            else // save.
            {
                bool isSaved = false;
                ECXSecurity.ECXSecurityAccess objAT = new WarehouseApplication.ECXSecurity.ECXSecurityAccess();
                objAT.CookieContainer = new System.Net.CookieContainer();



                isSaved = objAT.AddAuditTrail(ModuleName, UserId, strVal, "New Record Added");
                objAT.AuditTrailCommit();



                if (isSaved == true)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            }
        }
コード例 #2
0
        // To save audit trail
        // 1- saved
        // 0 - no changes made
        //-1 fail
        /// <summary>
        /// Automatically logs audit Trail identifiying changes made.Requires public properties.
        /// </summary>
        /// <param name="objOld">The Original Object Before Update </param>
        /// <param name="objNew">The Object with Modidfied Values </param>
        /// <param name="ModuleName">The name of the application module</param>
        /// <param name="UserId">User Id of the persom who make the modification</param>
        /// <param name="BussinessProcess">The Name of Bussiness proccess e.g Update Driver Information</param>
        /// <returns>1-if successfull , 0 - when no changes are made , -1 when fail</returns>
        public int saveAuditTrail(object objOld, object objNew, string ModuleName, Guid UserId, string BussinessProcess)
        {
            string strVal = AuditTrailComparer.Compare(objOld, objNew);

            if (strVal == "")
            {
                return(0);
            }
            else // save.
            {
                bool     isSaved = false;
                string   strOld  = "";
                string   strNew  = "";
                string[] str     = new string[2];
                str = strVal.Split('*');
                if (str.Count() == 2)
                {
                    strOld = BussinessProcess + str[0];
                    strNew = BussinessProcess + str[1];
                }
                ECXSecurity.ECXSecurityAccess objAT = new WarehouseApplication.ECXSecurity.ECXSecurityAccess();
                objAT.CookieContainer = new System.Net.CookieContainer();
                if (strOld == "" || strNew == "")
                {
                    return(0);
                }


                isSaved = objAT.AddAuditTrail(ModuleName, UserId, strOld, strNew);
                objAT.AuditTrailCommit();



                if (isSaved == true)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            }
        }