Esempio n. 1
0
        public Boolean LogAudit(Dictionary <string, string> LogData, Dictionary <string, string> userInfo, DateTime Date_Created, out string ErrorMessage)
        {
            Boolean bRet = false;

            ErrorMessage = "";

            DataBase.Connections.DBConnection DB = null;
            try
            {
                DB = new DataBase.Connections.DBConnection();
                DB.BeginTransaction();

                DBRecord mRec = new DBRecord();
                mRec.CreateRow("user_audit", "ADD", "AUDIT_ID", userInfo["AUDIT_ID"].ToString());
                mRec.InsertString("AUDIT_USER_ID", GetString(userInfo["USR_PKID"].ToString(), 40));
                mRec.InsertString("AUDIT_USER_CODE", GetString(userInfo["USR_CODE"].ToString(), 15));
                mRec.InsertString("AUDIT_SCREEN", GetString(LogData["AUDIT_SCREEN"].ToString(), 60));
                mRec.InsertString("AUDIT_ACTION", GetString(LogData["AUDIT_ACTION"].ToString(), 60));
                mRec.InsertString("AUDIT_REMARKS", GetString(LogData["AUDIT_REMARKS"].ToString(), 250));
                mRec.InsertString("AUDIT_KEY", GetString(LogData["AUDIT_KEY"].ToString(), 40));
                mRec.InsertString("AUDIT_REFNO", GetString(LogData["AUDIT_REFNO"].ToString(), 60));
                mRec.InsertString("AUDIT_COMPANY_CODE", GetString(userInfo["REC_COMPANY_CODE"].ToString(), 4));
                mRec.InsertString("AUDIT_BRANCH_CODE", GetString(userInfo["REC_BRANCH_CODE"].ToString(), 4));
                mRec.InsertString("AUDIT_FYCODE", GetString(userInfo["YEAR_CODE"].ToString(), 4));
                mRec.InsertDateAndTime("AUDIT_CLIENT_DATE", Date_Created);

                string Sql = mRec.UpdateRow();
                DB.ExecuteNonQuery(Sql);

                if (LogData["AUDIT_ACTION"].ToString() == "LOGOUT")
                {
                    Sql = " update user_userm set usr_logged = 'N' where usr_pkid = '" + userInfo["USR_PKID"].ToString() + "'";
                    DB.ExecuteNonQuery(Sql);
                }

                DB.CommitTransaction();
                bRet = true;
            }
            catch (Exception Ex)
            {
                bRet = false;
                DB.RollbackTransaction();
                ErrorMessage = Ex.Message.ToString();
            }
            return(bRet);
        }
Esempio n. 2
0
        public Boolean UserLogBook(string Log_id, string Log_Source, string Log_Type, Object Log_Doc_Date, string Log_HBL_Id, string Log_CUST_Id, string Log_User_Code, DateTime Date_Created, string Log_From_Amt, string Log_To_Amt, string Log_Description, out string ErrorMessage)
        {
            Boolean bRet = false;

            ErrorMessage = "";
            DataBase.Connections.DBConnection DB = null;
            try
            {
                DB = new DataBase.Connections.DBConnection();
                DB.BeginTransaction();

                DBRecord mRec = new DBRecord();
                mRec.CreateRow("user_logbook", "ADD", "LOG_ID", Log_id);
                mRec.InsertString("LOG_SOURCE", GetString(Log_Source, 30));
                mRec.InsertString("LOG_TYPE", GetString(Log_Type, 10));
                mRec.InsertString("LOG_HBL_ID", Log_HBL_Id);
                mRec.InsertString("LOG_CUST_ID", Log_CUST_Id);
                mRec.InsertNumeric("LOG_FROM_AMT", Lib.Conv2Decimal(Log_From_Amt).ToString());
                mRec.InsertNumeric("LOG_TO_AMT", Lib.Conv2Decimal(Log_To_Amt).ToString());
                mRec.InsertString("LOG_USER_CODE", GetString(Log_User_Code, 15));
                mRec.InsertDate("LOG_DOC_DATE", Log_Doc_Date);
                mRec.InsertDateAndTime("LOG_DATE", Date_Created);

                string Sql = mRec.UpdateRow();
                DB.ExecuteNonQuery(Sql);

                DB.CommitTransaction();
                bRet = true;
            }
            catch (Exception Ex)
            {
                bRet = false;
                DB.RollbackTransaction();
                ErrorMessage = Ex.Message.ToString();
            }
            return(bRet);
        }