Beispiel #1
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5LR_GLRFT_1643_Array Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5LR_GLRFT_1643_Array functionReturn = new FR_L5LR_GLRFT_1643_Array();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    Connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw new Exception("Exception occured in method cls_Get_LeaveRequests_For_Tenant", ex);
            }
            return(functionReturn);
        }
Beispiel #2
0
        protected static FR_L5LR_GLRFT_1643_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5LR_GLRFT_1643_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_VacationPlanner_LeaveRequest.Atomic.Retrieval.SQL.cls_Get_LeaveRequests_For_Tenant.sql";

            command.CommandText = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(commandLocation)).ReadToEnd();
            CSV2Core_MySQL.Support.DBSQLSupport.SetParameter(command, "ticket", securityTicket);
            command.CommandTimeout = QueryTimeout;

            List <L5LR_GLRFT_1643_raw> results = new List <L5LR_GLRFT_1643_raw>();
            var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(Connection, Transaction);
            var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());

            try
            {
                reader.SetOrdinals(new string[] { "ShortName", "Name_DictID", "Description_DictID", "ColorCode", "Parent_RefID", "IsAuthorizationRequired", "IsIncludedInCapacityCalculation", "AbsenceReason_Type_RefID", "IsAllowedAbsence", "IsDeactivated", "IsCarryOverEnabled", "IsCaryOverLimited", "IfCarryOverLimited_MaximumAmount_Hrs", "CMN_BPT_EMP_Employee_LeaveRequestID", "CMN_CAL_Event_RefID", "CMN_CAL_Event_Approval_RefID", "CMN_BPT_STA_AbsenceReason_RefID", "Comment", "StartTime", "EndTime", "R_EventDuration_sec", "CalendarInstance_RefID", "IsApprovalProcessDenied", "ForEmployeeID", "ForEmployee_BusinessParticipant_RefID", "ForEmployee_Staff_Number", "ForEmployee_StandardFunction", "IsApproved", "IsApprovalProcessOpened", "IsApprovalProcessCanceledByUser", "StandardFunction", "BusinessParticipant_RefID", "CMN_BPT_EMP_EmployeeID", "SequenceNumber", "CMN_BPT_EMP_Employee_LeaveRequest_EmployeeCoverID", "ActionTriggeredBy_Account_RefID", "CMN_CAL_Event_Approval_ActionID", "IsApproval", "IsRevocation", "IsDenial", "Approval_Action_Commnet" });
                while (reader.Read())
                {
                    L5LR_GLRFT_1643_raw resultItem = new L5LR_GLRFT_1643_raw();
                    //0:Parameter ShortName of type string
                    resultItem.ShortName = reader.GetString(0);
                    //1:Parameter ReasonName of type Dict
                    resultItem.ReasonName             = reader.GetDictionary(1);
                    resultItem.ReasonName.SourceTable = "cmn_bpt_sta_absencereasons";
                    loader.Append(resultItem.ReasonName);
                    //2:Parameter ReasonDesc of type Dict
                    resultItem.ReasonDesc             = reader.GetDictionary(2);
                    resultItem.ReasonDesc.SourceTable = "cmn_bpt_sta_absencereasons";
                    loader.Append(resultItem.ReasonDesc);
                    //3:Parameter ColorCode of type string
                    resultItem.ColorCode = reader.GetString(3);
                    //4:Parameter Parent_RefID of type Guid
                    resultItem.Parent_RefID = reader.GetGuid(4);
                    //5:Parameter IsAuthorizationRequired of type bool
                    resultItem.IsAuthorizationRequired = reader.GetBoolean(5);
                    //6:Parameter IsIncludedInCapacityCalculation of type bool
                    resultItem.IsIncludedInCapacityCalculation = reader.GetBoolean(6);
                    //7:Parameter AbsenceReason_Type_RefID of type Guid
                    resultItem.AbsenceReason_Type_RefID = reader.GetGuid(7);
                    //8:Parameter IsAllowedAbsence of type bool
                    resultItem.IsAllowedAbsence = reader.GetBoolean(8);
                    //9:Parameter IsDeactivated of type bool
                    resultItem.IsDeactivated = reader.GetBoolean(9);
                    //10:Parameter IsCarryOverEnabled of type bool
                    resultItem.IsCarryOverEnabled = reader.GetBoolean(10);
                    //11:Parameter IsCaryOverLimited of type bool
                    resultItem.IsCaryOverLimited = reader.GetBoolean(11);
                    //12:Parameter IfCarryOverLimited_MaximumAmount_Hrs of type double
                    resultItem.IfCarryOverLimited_MaximumAmount_Hrs = reader.GetDouble(12);
                    //13:Parameter CMN_BPT_EMP_Employee_LeaveRequestID of type Guid
                    resultItem.CMN_BPT_EMP_Employee_LeaveRequestID = reader.GetGuid(13);
                    //14:Parameter CMN_CAL_Event_RefID of type Guid
                    resultItem.CMN_CAL_Event_RefID = reader.GetGuid(14);
                    //15:Parameter CMN_CAL_Event_Approval_RefID of type Guid
                    resultItem.CMN_CAL_Event_Approval_RefID = reader.GetGuid(15);
                    //16:Parameter CMN_BPT_STA_AbsenceReason_RefID of type Guid
                    resultItem.CMN_BPT_STA_AbsenceReason_RefID = reader.GetGuid(16);
                    //17:Parameter Comment of type string
                    resultItem.Comment = reader.GetString(17);
                    //18:Parameter StartTime of type DateTime
                    resultItem.StartTime = reader.GetDate(18);
                    //19:Parameter EndTime of type DateTime
                    resultItem.EndTime = reader.GetDate(19);
                    //20:Parameter R_EventDuration_sec of type long
                    resultItem.R_EventDuration_sec = reader.GetLong(20);
                    //21:Parameter CalendarInstance_RefID of type Guid
                    resultItem.CalendarInstance_RefID = reader.GetGuid(21);
                    //22:Parameter IsApprovalProcessDenied of type bool
                    resultItem.IsApprovalProcessDenied = reader.GetBoolean(22);
                    //23:Parameter ForEmployeeID of type Guid
                    resultItem.ForEmployeeID = reader.GetGuid(23);
                    //24:Parameter ForEmployee_BusinessParticipant_RefID of type Guid
                    resultItem.ForEmployee_BusinessParticipant_RefID = reader.GetGuid(24);
                    //25:Parameter ForEmployee_Staff_Number of type string
                    resultItem.ForEmployee_Staff_Number = reader.GetString(25);
                    //26:Parameter ForEmployee_StandardFunction of type string
                    resultItem.ForEmployee_StandardFunction = reader.GetString(26);
                    //27:Parameter IsApproved of type bool
                    resultItem.IsApproved = reader.GetBoolean(27);
                    //28:Parameter IsApprovalProcessOpened of type bool
                    resultItem.IsApprovalProcessOpened = reader.GetBoolean(28);
                    //29:Parameter IsApprovalProcessCanceledByUser of type bool
                    resultItem.IsApprovalProcessCanceledByUser = reader.GetBoolean(29);
                    //30:Parameter StandardFunction of type string
                    resultItem.StandardFunction = reader.GetString(30);
                    //31:Parameter BusinessParticipant_RefID of type Guid
                    resultItem.BusinessParticipant_RefID = reader.GetGuid(31);
                    //32:Parameter CMN_BPT_EMP_EmployeeID of type Guid
                    resultItem.CMN_BPT_EMP_EmployeeID = reader.GetGuid(32);
                    //33:Parameter SequenceNumber of type string
                    resultItem.SequenceNumber = reader.GetString(33);
                    //34:Parameter CMN_BPT_EMP_Employee_LeaveRequest_EmployeeCoverID of type Guid
                    resultItem.CMN_BPT_EMP_Employee_LeaveRequest_EmployeeCoverID = reader.GetGuid(34);
                    //35:Parameter ActionTriggeredBy_Account_RefID of type Guid
                    resultItem.ActionTriggeredBy_Account_RefID = reader.GetGuid(35);
                    //36:Parameter CMN_CAL_Event_Approval_ActionID of type Guid
                    resultItem.CMN_CAL_Event_Approval_ActionID = reader.GetGuid(36);
                    //37:Parameter IsApproval of type bool
                    resultItem.IsApproval = reader.GetBoolean(37);
                    //38:Parameter IsRevocation of type bool
                    resultItem.IsRevocation = reader.GetBoolean(38);
                    //39:Parameter IsDenial of type bool
                    resultItem.IsDenial = reader.GetBoolean(39);
                    //40:Parameter Approval_Action_Commnet of type string
                    resultItem.Approval_Action_Commnet = reader.GetString(40);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw new Exception("Exception occured durng data retrieval in method cls_Get_LeaveRequests_For_Tenant", ex);
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

            returnStatus.Result = L5LR_GLRFT_1643_raw.Convert(results).ToArray();
            return(returnStatus);
        }