//by Ben
    protected bool loadObject()
    {
        obj = new ERosterCode();
        bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest);

        if (!db.select(dbConn, obj))
        {
            return(false);
        }

        if (obj.RosterCodeHasLunch)
        {
            RosterCodeLunchPanel.Visible = true;
        }
        else
        {
            RosterCodeLunchPanel.Visible = false;
        }

        if (obj.RosterCodeHasOT)
        {
            RosterCodeOTPanel.Visible = true;
        }
        else
        {
            RosterCodeOTPanel.Visible = false;
        }

        if (obj.RosterCodeCountWorkHourOnly)
        {
            RosterCodeNormalWorkInOut.Visible                = false;
            RosterCodeNormalWorkInOutOT.Visible              = false;
            RosterCodeCountWorkHourOnlyOT.Visible            = true;
            RosterCodeCountWorkHourOnlyLunchPanel.Visible    = true;
            RosterCodeCountWorkHourOnlyHalfUnitPanel.Visible = true;
        }
        else
        {
            RosterCodeNormalWorkInOut.Visible                = true;
            RosterCodeNormalWorkInOutOT.Visible              = true;
            RosterCodeCountWorkHourOnlyOT.Visible            = false;
            RosterCodeCountWorkHourOnlyLunchPanel.Visible    = false;
            RosterCodeCountWorkHourOnlyHalfUnitPanel.Visible = false;
        }

        if (obj.RosterCodeIsOverrideHourlyPayment)
        {
            OverrideHourlyPaymentPanel.Visible = true;
        }
        else
        {
            OverrideHourlyPaymentPanel.Visible = false;
        }

        if (obj.RosterCodeType.Equals("L"))
        {
            LeaveCodeSettingPanel.Visible = true;
        }
        else
        {
            LeaveCodeSettingPanel.Visible = false;
        }

        Hashtable values = new Hashtable();

        db.populate(obj, values);
        binding.toControl(values);


        return(true);
    }
Beispiel #2
0
    protected bool loadObject()
    {
        DBFilter filterStatus = new DBFilter();

        filterStatus.add(new Match("EmpRequestRecordID", CurRequestID));
        filterStatus.add(new Match("EmpRequestType", EEmpRequest.TYPE_EELATEWAIVE));
        ArrayList empRequestList = EEmpRequest.db.select(dbConn, filterStatus);

        if (empRequestList.Count > 0)
        {
            EEmpRequest empRequest = (EEmpRequest)empRequestList[0];
            if (empRequest.EmpID == UserID)
            {
                string submitStatus = empRequest.EmpRequestStatus;
                if ((submitStatus.Equals(EEmpRequest.STATUS_SUBMITTED) || submitStatus.Equals(EEmpRequest.STATUS_ACCEPTED)) && !submitStatus.Equals(EEmpRequest.STATUS_APPROVED))
                {
                    btnCancel.Visible       = true;
                    RejectReasonRow.Visible = false;
                }
                else
                {
                    btnCancel.Visible = false;
                    if (!string.IsNullOrEmpty(empRequest.EmpRequestRejectReason))
                    {
                        RejectReasonRow.Visible = true;
                        lblRejectReason.Text    = empRequest.EmpRequestRejectReason;
                    }
                    else
                    {
                        RejectReasonRow.Visible = false;
                    }
                }
            }
            else
            {
                btnCancel.Visible       = false;
                RejectReasonRow.Visible = false;
            }
            obj = new ERequestLateWaive();
            obj.RequestLateWaiveID = CurRequestID;
            if (!db.select(dbConn, obj))
            {
                return(false);
            }

            EAttendanceRecord aObj = new EAttendanceRecord();
            aObj.AttendanceRecordID = obj.AttendanceRecordID;
            if (sdb.select(dbConn, aObj))
            {
                // Start 0000112, Miranda, 2015-01-17
                AttendanceRecordDate.Text = aObj.AttendanceRecordDate.ToString("yyyy-MM-dd");
                ERosterCode rcObj = new ERosterCode();
                rcObj.RosterCodeID = aObj.RosterCodeID;
                if (ERosterCode.db.select(dbConn, rcObj))
                {
                    RosterCode.Text        = rcObj.RosterCode;
                    RosterCodeDesc.Text    = rcObj.RosterCodeDesc;
                    RosterCodeInTime.Text  = rcObj.RosterCodeInTime.ToString("HH:mm");
                    RosterCodeOutTime.Text = rcObj.RosterCodeOutTime.ToString("HH:mm");
                }
                AttendanceRecordWorkStart.Text = aObj.AttendanceRecordWorkStart.ToString("HH:mm");
                AttendanceRecordWorkEnd.Text   = aObj.AttendanceRecordWorkEnd.ToString("HH:mm");
                // End 0000112, Miranda, 2015-01-17
                AttendanceRecordActualLateMins.Text = aObj.AttendanceRecordActualLateMins.ToString();
            }

            Hashtable values = new Hashtable();
            db.populate(obj, values);
            binding.toControl(values);

            LateWaiveDateToPlaceHolder.Visible = true;

            string LateWaiveAuthorizedMessage = CONFIRM_MESSAGE;

            Authorize.Attributes.Add("onclick", "return confirm(\"" + HROne.Common.WebUtility.GetLocalizedString(LateWaiveAuthorizedMessage) + "\");");
            Reject.Attributes.Add("onclick", "return confirm(\"" + HROne.Common.WebUtility.GetLocalizedString(CONFIRM_MESSAGE) + "\");");


            return(true);
        }
        else
        {
            return(false);
        }
    }