Example #1
0
 private Arthur.PurchaseEntryDL.TransactionResult DeleteLoginUser(Microsoft.Practices.EnterpriseLibrary.Data.Database db, System.Data.Common.DbTransaction transaction)
 {
     Arthur.PurchaseEntryDL.TransactionResult transactionResult;
     int i = 0;
     System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand("spDeleteLoginUser");
     db.AddInParameter(dbCommand, "LoginID", System.Data.DbType.Int32, this._loginId);
     db.AddParameter(dbCommand, "Return Value", System.Data.DbType.Int32, System.Data.ParameterDirection.ReturnValue, "Return Value", System.Data.DataRowVersion.Default, i);
     db.ExecuteNonQuery(dbCommand, transaction);
     i = (int)db.GetParameterValue(dbCommand, "Return Value");
     transactionResult = i == -1 ? new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Failure, "Failure Deleted") : new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Success, "Successfully Deleted");
     return transactionResult;
 }
        /// <summary>
        /// Executes the WriteLog stored procedure
        /// </summary>
        /// <param name="eventId">The event id for this MsgEntry.</param>
        /// <param name="priority">The priority for this MsgEntry.</param>
        /// <param name="severity">The severity for this MsgEntry.</param>
        /// <param name="title">The title for this MsgEntry.</param>
        /// <param name="timeStamp">The timestamp for this MsgEntry.</param>
        /// <param name="machineName">The machine name for this MsgEntry.</param>
        /// <param name="appDomainName">The appDomainName for this MsgEntry.</param>
        /// <param name="processId">The process id for this MsgEntry.</param>
        /// <param name="processName">The processName for this MsgEntry.</param>
        /// <param name="managedThreadName">The managedthreadName for this MsgEntry.</param>
        /// <param name="win32ThreadId">The win32threadID for this MsgEntry.</param>
        /// <param name="message">The message for this MsgEntry.</param>
        /// <param name="db">An instance of the database class to use for storing the MsgEntry</param>
        /// <returns>An integer for the MsgEntry Id</returns>
        private int ExecuteWriteLogStoredProcedure(int eventId, int priority, TraceEventType severity, string title, DateTime timeStamp,
                                                    string machineName, string appDomainName, string processId, string processName,
                                                    string managedThreadName, string win32ThreadId, string message, Microsoft.Practices.EnterpriseLibrary.Data.Database db)
        {
            DbCommand cmd = db.GetStoredProcCommand(writeLogStoredProcName);

            db.AddInParameter(cmd, "eventID", DbType.Int32, eventId);
            db.AddInParameter(cmd, "priority", DbType.Int32, priority);
            db.AddParameter(cmd, "severity", DbType.String, 32, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, severity.ToString());
            db.AddParameter(cmd, "title", DbType.String, 256, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, title);
            db.AddInParameter(cmd, "timestamp", DbType.DateTime, timeStamp);
            db.AddParameter(cmd, "machineName", DbType.String, 32, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, machineName);
            db.AddParameter(cmd, "AppDomainName", DbType.String, 512, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, appDomainName);
            db.AddParameter(cmd, "ProcessID", DbType.String, 256, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, processId);
            db.AddParameter(cmd, "ProcessName", DbType.String, 512, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, processName);
            db.AddParameter(cmd, "ThreadName", DbType.String, 512, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, managedThreadName);
            db.AddParameter(cmd, "Win32ThreadId", DbType.String, 128, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, win32ThreadId);
            db.AddParameter(cmd, "message", DbType.String, 1500, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, message);
            db.AddInParameter(cmd, "formattedmessage", DbType.String, message);

            db.AddOutParameter(cmd, "LogId", DbType.Int32, 4);

            db.ExecuteNonQuery(cmd);
            int logId = Convert.ToInt32(cmd.Parameters[cmd.Parameters.Count - 1].Value, CultureInfo.InvariantCulture);
            return logId;
        }
Example #3
0
 private Arthur.PurchaseEntryDL.TransactionResult AddEditLoginUser(Microsoft.Practices.EnterpriseLibrary.Data.Database db, System.Data.Common.DbTransaction transaction)
 {
     int i;
     Arthur.PurchaseEntryDL.TransactionResult transactionResult;
     bool bl;
     i = 0;
     System.Data.Common.DbCommand dbCommand = db.GetStoredProcCommand("spAddEditLoginUser");
     db.AddInParameter(dbCommand, "LoginID", System.Data.DbType.Int32, this._loginId);
     db.AddInParameter(dbCommand, "CompanyID", System.Data.DbType.Int32, this._companyId);
     db.AddInParameter(dbCommand, "UserName", System.Data.DbType.String, this._userName);
     db.AddInParameter(dbCommand, "Password", System.Data.DbType.String, this._password);
     db.AddInParameter(dbCommand, "RoleID", System.Data.DbType.String, this._roleId);
     db.AddInParameter(dbCommand, "LoginAccess", System.Data.DbType.Boolean, this._loginAccess);
     db.AddInParameter(dbCommand, "AddEditOption", System.Data.DbType.Int16, this._addEditOption);
     db.AddParameter(dbCommand, "Return Value", System.Data.DbType.Int32, System.Data.ParameterDirection.ReturnValue, "Return Value", System.Data.DataRowVersion.Default, i);
     db.ExecuteNonQuery(dbCommand, transaction);
     this._loginId = (int)db.GetParameterValue(dbCommand, "Return Value");
     bl = i != 0;
     if (!bl)
     {
         transactionResult = new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Failure, "User Name Already Exists. Please Change Some Other Name");
     }
     else
     {
         bl = i != -1;
         if (!bl)
         {
             bl = this._addEditOption != 1;
             if (!bl)
             {
                 return new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Failure, "Failure Updated");
             }
             transactionResult = new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Failure, "Failure Adding");
         }
         else
         {
             bl = this._addEditOption != 1;
             transactionResult = !bl ? new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Success, "Successfully Updated") : new Arthur.PurchaseEntryDL.TransactionResult(Arthur.PurchaseEntryDL.TransactionStatus.Success, "Successfully Added");
         }
     }
     return transactionResult;
 }