public ResponseItem VoidTest(RequestItem Item)
        {
            ResponseItem re = new ResponseItem(Item);

            re.RequestItem.RequestLog = re.RequestItem.RequestLog + "srv_start: " + DateTime.Now.ToString() + ",";
            ServiceConfig srvcont = new ServiceConfig(_serviceconfigparameters);
            decimal? TR_SubmitMinHours = null;
            Queries.GetQueries getQ = new Queries.GetQueries(_serviceconfigparameters);

            RuntimeProperties _RuntimeProperties = new RuntimeProperties(_serviceconfigparameters);
            _RuntimeProperties.GetPersonalProperties(Item.reqp_userid);

            try
            {

                TR_SubmitMinHours = getQ.tbl_hrWorkingHourTemplate_MinHoursDaily(Item.reqp_userid, Item.reqp_date, _RuntimeProperties.CalendarName.GetValue());
                // TRS_PrivateGetDailyHourLimitByUser(Item.reqp_date, Item.reqp_userid);

                TR_SubmitMinHours = TR_SubmitMinHours == null ? Convert.ToDecimal(8.25) : TR_SubmitMinHours;

                HelperClasses.Serializer srl = new HelperClasses.Serializer();

                string hour = srl.NTSoftJsonSerialize(TR_SubmitMinHours.ToString());
                re.ResponseBody = hour.Replace(",", ".");
                re.RequestCompleted = true;

            }

            catch (Exception ex)
            {
                HelperClasses.ExceptionHandler.LogException(ex, srvcont, Item);
                //re.ResponseBody = ex.ToString();
                re.RequestCompleted = false;
            }

            re.RequestItem.RequestLog = re.RequestItem.RequestLog + "srv_finish: " + DateTime.Now.ToString() + ",";
            return re;
        }
 public void SetRuleValue(string Rule, string RuntimePropertyName)
 {
     var Property = this.GetType().GetProperty(RuntimePropertyName).GetValue(this,null) as RuntimeProperty;
     Property.PropertyValue = null;
     Queries.GetQueries getQ = new Queries.GetQueries(_ServiceConfigParameters);
     var rules = getQ.tbl_genRuleDescription_ByRule(Rule);
     RuleReader ruleReader = new RuleReader(this, rules);
     var rule = ruleReader.Read();
     if (rules.Count != 0 && rule != null && rule.RuleValue.ToLower() !="x")
     {
         Property.PropertyValue = rule.RuleValue;
     }
 }
 public void GetPropertiesForTRUpdate(int ID_hrStaff, DateTime RequestedDate, List<Entities.EntityViews.tblTimeReport_Transaction_Input> list)
 {
     if (!_ArePropReadyTRUpdate.Ready || _ArePropReadyTRUpdate.ID_hrStaff != ID_hrStaff || _ArePropReadyTRUpdate.RequestedDate != RequestedDate)
     {
         this._SelectedDate.PropertyValue = RequestedDate.Date;
         Queries.GetQueries getQ = new Queries.GetQueries(_ServiceConfigParameters);
         var trHeader = getQ.tbl_trTransactionHeader_Current(ID_hrStaff, RequestedDate);
         this._SelectedDateTransactionStatus.PropertyValue = trHeader == null ? Constants.TRANSACTION_STATUS.OPEN : trHeader.tbl_trTransactionStatus.TransactionStatus;
         this._MinHoursDaily.PropertyValue = (decimal)getQ.tbl_hrWorkingHourTemplate_MinHoursDaily(ID_hrStaff, RequestedDate,this._CalendarName.GetValue());
         this._TRInputListClient.PropertyValue = list;
         this.SetRuleValue("DayIsEditableValidation", this._CalendarName.PropertyName);
         var date = getQ.tbl_trDate_Current(RequestedDate, _CalendarName.GetValue());
         if (date != null)
         {
             this._SelectedDateType.PropertyValue = date.DateType;
             this._SelectedDateisOptional.PropertyValue = date.IsOptional;
         }
         this.SetRuleValue("AllowHalfDayAbsance", this._PercentPerDay.PropertyName);
         this.LastOpenDay.PropertyValue = getQ.tbl_trTransactionHeader_LastOpenDay(ID_hrStaff);
         _ArePropReadyTRUpdate.Ready = true;
         _ArePropReadyTRUpdate.ID_hrStaff = ID_hrStaff;
         _ArePropReadyTRUpdate.RequestedDate = RequestedDate;
     }
 }
 public void GetPropertiesForTRSubmit(int ID_hrStaff, DateTime RequestedDate)
 {
     if (!_ArePropReadyTRSubmit.Ready || _ArePropReadyTRSubmit.ID_hrStaff != ID_hrStaff || _ArePropReadyTRSubmit.RequestedDate != RequestedDate)
     {
         Queries.GetQueries getQ = new Queries.GetQueries(_ServiceConfigParameters);
         this._TRInputList.PropertyValue = getQ.tbl_trTransaction_ByUser_Date(ID_hrStaff, RequestedDate);
         this._SumOfHours.PropertyValue = this.TRInputList.GetValue<List<Entities.EntityViews.tblTimeReport_Transaction_Input>>().Sum(s => s.Hour);
         this._FirstSubmitableDay.PropertyValue = getQ.tbl_trTransactionHeader_FirstSubmitableDay(ID_hrStaff, RequestedDate, _DateOfTRStart.GetValue(), _CalendarName.GetValue());
         this._WorkingHoursWeekly.PropertyValue = (decimal)getQ.tbl_hrWorkingHourTemplate_WorkingHoursWeekly(ID_hrStaff, RequestedDate);
         this._MinHoursDaily.PropertyValue = (decimal)getQ.tbl_hrWorkingHourTemplate_MinHoursDaily(ID_hrStaff, RequestedDate,this._CalendarName.GetValue());
         this.SetRuleValue("DayIsEditableValidation", this._CalendarName.PropertyName);
         _ArePropReadyTRSubmit.Ready = true;
         _ArePropReadyTRSubmit.ID_hrStaff = ID_hrStaff;
         _ArePropReadyTRSubmit.RequestedDate = RequestedDate;
     }
 }
        public void GetPropertiesForReports(int ID_hrStaff, DateTime PeriodStarting, DateTime PeriodEnd, string ReportName)
        {
            if (!_ArePropReadyReports.Ready || _ArePropReadyReports.ID_hrStaff != ID_hrStaff || _ArePropReadyReports.RequestedDate != PeriodStarting || _ArePropReadyReports.ReportName != ReportName)
            {
                Queries.GetQueries getQ = new Queries.GetQueries(_ServiceConfigParameters);
                this._PeriodStarting.PropertyValue = PeriodStarting;
                this._PeriodEnd.PropertyValue = PeriodEnd;
                this._SelectedReportType.PropertyValue = ReportName;
                this._ContractTypeForReports.PropertyValue = getQ.GetContractType_ByDate(ID_hrStaff, PeriodEnd) != null ? getQ.GetContractType_ByDate(ID_hrStaff, PeriodEnd).Value : null;
                SetRuleValue("GetReportTemplate", this.SelectedReportTemplate.PropertyName);

                _ArePropReadyReports.Ready = true;
                _ArePropReadyReports.ID_hrStaff = ID_hrStaff;
                _ArePropReadyReports.RequestedDate = PeriodStarting;

            }
        }
        public void GetPersonalProperties(int ID_hrStaff)
        {
            if (!_ArePropReadyPersonal.Ready || _ArePropReadyPersonal.ID_hrStaff != ID_hrStaff)
            {

                ServiceConfig srvcont = new ServiceConfig(_ServiceConfigParameters);
                Queries.GetQueries getQ = new Queries.GetQueries(_ServiceConfigParameters);
                var posHistory = getQ.tbl_hrPositionHistory_byID(ID_hrStaff);
                var person = getQ.tbl_hrStaff_ByID(ID_hrStaff);
                this._Staff_ID.PropertyValue = ID_hrStaff;
                this._Full_Name.PropertyValue = person.FullName;
                this._ContractType.PropertyValue = posHistory.Contract_Type;
                this._Country.PropertyValue = person.tbl_genCountry.Country;
                this._PMSA.PropertyValue = posHistory.PMSA;
                this._PMSAItem.PropertyValue = posHistory.PMSAItem;
                this._Position.PropertyValue = posHistory.Position;
                this._DateOfTRStart.PropertyValue = person.Date_of_TR_start == null ? new DateTime(1901, 1, 1).Date :
                    ((DateTime)person.Date_of_TR_start).Date;
                this._DateOfTREnd.PropertyValue = person.Date_of_TR_end == null ? new DateTime(2999, 12, 31).Date :
                    ((DateTime)person.Date_of_TR_end).Date;
                this._DateOfEntrance.PropertyValue = person.Date_of_entrance == null ? new DateTime(1901, 1, 1).Date :
                    ((DateTime)person.Date_of_entrance).Date;
                this._Gender.PropertyValue = person.Gender;
                this._PhoneDirOnly.PropertyValue = person.PhoneDirOnly;
                this._OfficialLS.PropertyValue = string.IsNullOrEmpty(person.Official_LoanStaff) ? "false" : person.Official_LoanStaff;
                this.SetRuleValue("GetCalendarInfo", this._CalendarName.PropertyName);
                this.SetRuleValue("GetBusinessUnitInfo", this._BusinessUnitInfo.PropertyName);
                this.SetRuleValue("InputTemplateFilter", this._TemplateFilter.PropertyName);
                this.SetRuleValue("GetActivityCodeInfo", this._ActivityCodeInfo.PropertyName);
                this.SetRuleValue("ReasonCodeFilter",this._ReasonCodeFilter.PropertyName);
                _ArePropReadyPersonal.Ready = true;
                _ArePropReadyPersonal.ID_hrStaff = ID_hrStaff;

            }
        }