コード例 #1
0
 public override DbCommand GetSelectCommand(Microsoft.Practices.EnterpriseLibrary.Data.Database db, string keyValue)
 {
     string proc = "WCS.GetEquipmentDetail";
     DbCommand cmd = db.GetStoredProcCommand(proc);
     db.AddInParameter(cmd, "pKeyValue", DbType.Int32, Fn.ToInt(keyValue));
     return cmd;
 }
コード例 #2
0
        //protected override void InitNewRow()
        //{
            
        //    this["assignto_function"] = "wfl.f_GetAssignTo_StateOwner";
        //    base.InitNewRow();
            
        //}
        public override DbCommand GetSelectCommand(Microsoft.Practices.EnterpriseLibrary.Data.Database db, string keyValue)
        {
            if (keyValue == "") keyValue = "0";

            string proc = "security.GetWflStateHeadDetail";
            DbCommand cmd = db.GetStoredProcCommand(proc);
            db.AddInParameter(cmd, "pDjId", DbType.String, keyValue);
            return cmd;
        }
コード例 #3
0
        public override bool Insert(string newKeyValue, System.Collections.Hashtable dataControlCollection, Microsoft.Practices.EnterpriseLibrary.Data.Database db, System.Data.Common.DbTransaction transaction)
        {
            if (base.Insert(newKeyValue, dataControlCollection, db, transaction))
            {
                DbCommand cmd = db.GetStoredProcCommand("wcs.AddCellDirection");
                db.AddInParameter(cmd, "pWhId", DbType.Int32, KeyValue);
                db.ExecuteNonQuery(cmd, transaction);
                return true;
            }

            return true;
        }
コード例 #4
0
        /// <summary>
        /// Executes the WriteLog stored procedure
        /// </summary>
        /// <param name="msgEntry">The MsgEntry to store in the database.</param>
        /// <param name="db">An instance of the database class to use for storing the MsgEntry</param>
        /// <param name="transaction">The transaction that wraps around the execution calls for storing the MsgEntry</param>
        /// <returns>An integer for the MsgEntry Id</returns>
        private int ExecuteWriteLogStoredProcedure(MsgEntry msgEntry, Microsoft.Practices.EnterpriseLibrary.Data.Database db, DbTransaction transaction)
        {
            DbCommand cmd = db.GetStoredProcCommand(writeLogStoredProcName);

            //db.AddInParameter(cmd, "eventID", DbType.Int32, msgEntry.EventId);
            //db.AddInParameter(cmd, "priority", DbType.Int32, msgEntry.Priority);
            //db.AddParameter(cmd, "severity", DbType.String, 32, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.Severity.ToString());
            //db.AddParameter(cmd, "title", DbType.String, 256, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.Title);
            //db.AddInParameter(cmd, "timestamp", DbType.DateTime, msgEntry.TimeStamp);
            //db.AddParameter(cmd, "machineName", DbType.String, 32, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.MachineName);
            //db.AddParameter(cmd, "AppDomainName", DbType.String, 512, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.AppDomainName);
            //db.AddParameter(cmd, "ProcessID", DbType.String, 256, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.ProcessId);
            //db.AddParameter(cmd, "ProcessName", DbType.String, 512, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.ProcessName);
            //db.AddParameter(cmd, "ThreadName", DbType.String, 512, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.ManagedThreadName);
            //db.AddParameter(cmd, "Win32ThreadId", DbType.String, 128, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.Win32ThreadId);
            //db.AddParameter(cmd, "message", DbType.String, 1500, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, msgEntry.Message);

            //if (Formatter != null)
            //    db.AddInParameter(cmd, "formattedmessage", DbType.String, Formatter.Format(msgEntry));
            //else
            //    db.AddInParameter(cmd, "formattedmessage", DbType.String, msgEntry.Message);

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

            db.ExecuteNonQuery(cmd, transaction);
            int logId = Convert.ToInt32(cmd.Parameters[cmd.Parameters.Count - 1].Value, CultureInfo.InvariantCulture);
            return logId;
        }
コード例 #5
0
        /// <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;
        }
コード例 #6
0
 /// <summary>
 /// Executes the AddCategory stored procedure
 /// </summary>
 /// <param name="msgEntry">The MsgEntry to store in the database.</param>
 /// <param name="logID">The unique identifer for the MsgEntry as obtained from the WriteLog Stored procedure.</param>
 /// <param name="db">An instance of the database class to use for storing the MsgEntry</param>
 /// <param name="transaction">The transaction that wraps around the execution calls for storing the MsgEntry</param>
 private void ExecuteAddCategoryStoredProcedure(MsgEntry msgEntry, int logID, Microsoft.Practices.EnterpriseLibrary.Data.Database db, DbTransaction transaction)
 {
     foreach (string category in msgEntry.Categories)
     {
         DbCommand cmd = db.GetStoredProcCommand(addCategoryStoredProcName);
         db.AddInParameter(cmd, "categoryName", DbType.String, category);
         db.AddInParameter(cmd, "logID", DbType.Int32, logID);
         db.ExecuteNonQuery(cmd, transaction);
     }
 }
コード例 #7
0
ファイル: Login.cs プロジェクト: samdoss/AMSystem
 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;
 }
コード例 #8
0
ファイル: Login.cs プロジェクト: samdoss/AMSystem
 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;
 }