protected static FR_L5DWS_GDWSFW_1148 Execute(DbConnection Connection, DbTransaction Transaction, P_L5DWS_GDWSFW_1148 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5DWS_GDWSFW_1148();
            //Put your code here
            returnValue.Result = new L5DWS_GDWSFW_1148();

            List <L5DWS_GDWSFT_1154> resultSchedules = new List <L5DWS_GDWSFT_1154>();

            DateTime scheduleDate = Parameter.WeekStartDate.Date;

            for (var i = 0; i < 7; i++)
            {
                ORM_CMN_STR_PPS_DailyWorkSchedule.Query scheduleQuery = new ORM_CMN_STR_PPS_DailyWorkSchedule.Query();
                scheduleQuery.WorkSheduleDate = scheduleDate;
                scheduleQuery.Tenant_RefID    = securityTicket.TenantID;
                scheduleQuery.IsDeleted       = false;

                var schedules = ORM_CMN_STR_PPS_DailyWorkSchedule.Query.Search(Connection, Transaction, scheduleQuery);

                foreach (var schedule in schedules)
                {
                    L5DWS_GDWSFT_1154 resultSchedule = new L5DWS_GDWSFT_1154();
                    resultSchedule.BreakDurationTime_in_sec        = schedule.BreakDurationTime_in_sec;
                    resultSchedule.CMN_STR_PPS_DailyWorkScheduleID = schedule.CMN_STR_PPS_DailyWorkScheduleID;
                    resultSchedule.ContractWorkerText = schedule.ContractWorkerText;
                    resultSchedule.Employee_RefID     = schedule.Employee_RefID;
                    resultSchedule.InstantiatedWithShiftTemplate_RefID    = schedule.InstantiatedWithShiftTemplate_RefID;
                    resultSchedule.IsBreakTimeManualySpecified            = schedule.IsBreakTimeManualySpecified;
                    resultSchedule.IsWorkShedule_Confirmed                = schedule.IsWorkShedule_Confirmed;
                    resultSchedule.R_ContractSpecified_WorkingTime_in_sec = schedule.R_ContractSpecified_WorkingTime_in_sec;
                    resultSchedule.R_WorkDay_Duration_in_sec              = schedule.R_WorkDay_Duration_in_sec;
                    resultSchedule.R_WorkDay_Start_in_sec                = schedule.R_WorkDay_Start_in_sec;
                    resultSchedule.SheduleBreakTemplate_RefID            = schedule.SheduleBreakTemplate_RefID;
                    resultSchedule.WorkingSheduleComment                 = schedule.WorkingSheduleComment;
                    resultSchedule.WorkShedule_ConfirmedBy_Account_RefID = schedule.WorkShedule_ConfirmedBy_Account_RefID;
                    resultSchedule.WorkSheduleDate      = schedule.WorkSheduleDate;
                    resultSchedule.R_WorkDay_End_in_sec = schedule.R_WorkDay_End_in_sec;


                    resultSchedules.Add(resultSchedule);
                }
                scheduleDate = scheduleDate.AddDays(1);
            }


            returnValue.Result.DailyWorkSchedules = resultSchedules.ToArray();

            return(returnValue);

            #endregion UserCode
        }
Exemplo n.º 2
0
        protected static FR_L5DWS_GDWSFT_1154_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            var returnStatus = new FR_L5DWS_GDWSFT_1154_Array();

            DbCommand command = Connection.CreateCommand();

            command.Connection  = Connection;
            command.Transaction = Transaction;
            var commandLocation = "CL5_Plannico_DailyWorkSchedules.Atomic.Retrieval.SQL.cls_Get_DailyWorkSchedules_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 <L5DWS_GDWSFT_1154> results = new List <L5DWS_GDWSFT_1154>();
            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[] { "CMN_STR_PPS_DailyWorkScheduleID", "Employee_RefID", "WorkSheduleDate", "InstantiatedWithShiftTemplate_RefID", "SheduleBreakTemplate_RefID", "IsBreakTimeManualySpecified", "WorkingSheduleComment", "ContractWorkerText", "R_WorkDay_Start_in_sec", "R_WorkDay_End_in_sec", "R_WorkDay_Duration_in_sec", "BreakDurationTime_in_sec", "R_ContractSpecified_WorkingTime_in_sec", "IsWorkShedule_Confirmed", "WorkShedule_ConfirmedBy_Account_RefID" });
                while (reader.Read())
                {
                    L5DWS_GDWSFT_1154 resultItem = new L5DWS_GDWSFT_1154();
                    //0:Parameter CMN_STR_PPS_DailyWorkScheduleID of type Guid
                    resultItem.CMN_STR_PPS_DailyWorkScheduleID = reader.GetGuid(0);
                    //1:Parameter Employee_RefID of type Guid
                    resultItem.Employee_RefID = reader.GetGuid(1);
                    //2:Parameter WorkSheduleDate of type DateTime
                    resultItem.WorkSheduleDate = reader.GetDate(2);
                    //3:Parameter InstantiatedWithShiftTemplate_RefID of type Guid
                    resultItem.InstantiatedWithShiftTemplate_RefID = reader.GetGuid(3);
                    //4:Parameter SheduleBreakTemplate_RefID of type Guid
                    resultItem.SheduleBreakTemplate_RefID = reader.GetGuid(4);
                    //5:Parameter IsBreakTimeManualySpecified of type bool
                    resultItem.IsBreakTimeManualySpecified = reader.GetBoolean(5);
                    //6:Parameter WorkingSheduleComment of type String
                    resultItem.WorkingSheduleComment = reader.GetString(6);
                    //7:Parameter ContractWorkerText of type String
                    resultItem.ContractWorkerText = reader.GetString(7);
                    //8:Parameter R_WorkDay_Start_in_sec of type int
                    resultItem.R_WorkDay_Start_in_sec = reader.GetInteger(8);
                    //9:Parameter R_WorkDay_End_in_sec of type int
                    resultItem.R_WorkDay_End_in_sec = reader.GetInteger(9);
                    //10:Parameter R_WorkDay_Duration_in_sec of type int
                    resultItem.R_WorkDay_Duration_in_sec = reader.GetInteger(10);
                    //11:Parameter BreakDurationTime_in_sec of type int
                    resultItem.BreakDurationTime_in_sec = reader.GetInteger(11);
                    //12:Parameter R_ContractSpecified_WorkingTime_in_sec of type int
                    resultItem.R_ContractSpecified_WorkingTime_in_sec = reader.GetInteger(12);
                    //13:Parameter IsWorkShedule_Confirmed of type bool
                    resultItem.IsWorkShedule_Confirmed = reader.GetBoolean(13);
                    //14:Parameter WorkShedule_ConfirmedBy_Account_RefID of type Guid
                    resultItem.WorkShedule_ConfirmedBy_Account_RefID = reader.GetGuid(14);

                    results.Add(resultItem);
                }
            }
            catch (Exception ex)
            {
                reader.Close();
                throw ex;
            }
            reader.Close();
            //Load all the dictionaries from the datatables
            loader.Load();

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