Exemple #1
0
        public static void AddSystemFunction(DatabaseConnection dbConn, string FunctionCode, string FunctionDescription, string FunctionCategory, bool FunctionIsHidden)
        {
            ESystemFunction function = GetObjectByCode(dbConn, FunctionCode);

            if (function != null)
            {
                if (!function.Description.Equals(FunctionDescription))
                {
                    function.Description = FunctionDescription;
                }
                if (!function.FunctionCategory.Equals(FunctionCategory))
                {
                    function.FunctionCategory = FunctionCategory;
                }
                if (!function.FunctionIsHidden.Equals(FunctionIsHidden))
                {
                    function.FunctionIsHidden = FunctionIsHidden;
                }
                ESystemFunction.db.update(dbConn, function);
            }
            else
            {
                function = new ESystemFunction();
                function.FunctionCode     = FunctionCode;
                function.FunctionCategory = FunctionCategory;
                function.Description      = FunctionDescription;
                function.FunctionIsHidden = FunctionIsHidden;
                ESystemFunction.db.insert(dbConn, function);
            }
        }
Exemple #2
0
        public string GetLogText(DatabaseConnection dbConn, string EmpNoFilter, bool ShowHeaderOnly, bool ShowKeyIDOnly, bool DoNotConvertID)
        {
            StringBuilder logTextBuilder  = new StringBuilder();
            bool          skipGenerateLog = false;

            DBFilter auditTrailDetailFilter = new DBFilter();

            auditTrailDetailFilter.add(new Match("AuditTrailID", this.AuditTrailID));
            ArrayList auditTrailDetailList = EAuditTrailDetail.db.select(dbConn, auditTrailDetailFilter);

            int empID = this.EmpID;

            if (!string.IsNullOrEmpty(EmpNoFilter.Trim()))
            {
                if (empID.Equals(0))
                {
                    foreach (EAuditTrailDetail auditTrailDetail in auditTrailDetailList)
                    {
                        string tmpRemark = auditTrailDetail.Remark.Replace(" ", "");
                        int    pos       = tmpRemark.IndexOf("\nEmpID=", StringComparison.CurrentCultureIgnoreCase);
                        if (pos >= 0)
                        {
                            string empIDString = tmpRemark.Substring(pos + 1, tmpRemark.IndexOf("\n", pos + 1) - pos);
                            empID = int.Parse(empIDString.Substring(empIDString.IndexOf("=") + 1));
                        }
                    }
                }
                EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                empInfo.EmpID = empID;
                if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                {
                    if (empInfo.EmpNo.IndexOf(EmpNoFilter.Trim(), StringComparison.CurrentCultureIgnoreCase) < 0)
                    {
                        skipGenerateLog = true;
                    }
                }
                else
                {
                    skipGenerateLog = true;
                }
            }
            if (!skipGenerateLog)
            {
                ESystemFunction function = new ESystemFunction();
                function.FunctionID = this.FunctionID;
                if (ESystemFunction.db.select(dbConn, function))
                {
                    logTextBuilder.AppendLine(string.Empty.PadLeft(78, '-'));
                    EUser user = new EUser();
                    user.UserID = this.UserID;
                    if (EUser.db.select(dbConn, user))
                    {
                        logTextBuilder.AppendLine("User     : \t" + user.LoginID + " - " + user.UserName);
                    }
                    else if (this.UserID.Equals(0))
                    {
                        logTextBuilder.AppendLine("User     : \t" + "System");
                    }
                    else
                    {
                        logTextBuilder.AppendLine("User     : \t" + this.UserID + " (Unknown)");
                    }

                    logTextBuilder.AppendLine("Function : \t" + function.FunctionCode + " - " + function.Description);
                    logTextBuilder.AppendLine("Date/Time: \t" + this.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"));

                    if (!this.EmpID.Equals(0))
                    {
                        EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                        empInfo.EmpID = this.EmpID;
                        if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                        {
                            logTextBuilder.AppendLine("Employee : \t" + empInfo.EmpNo + " - " + empInfo.EmpEngFullName);
                        }
                    }

                    logTextBuilder.AppendLine(string.Empty.PadLeft(78, '-'));

                    if (!ShowHeaderOnly)
                    {
                        foreach (EAuditTrailDetail auditTrailDetail in auditTrailDetailList)
                        {
                            if ((auditTrailDetail.Remark.Replace(" ", "").IndexOf("EmpID=" + empID, StringComparison.CurrentCultureIgnoreCase) >= 0 || this.EmpID.Equals(empID)) && !string.IsNullOrEmpty(EmpNoFilter.Trim()) || string.IsNullOrEmpty(EmpNoFilter.Trim()))
                            {
                                logTextBuilder.Append(auditTrailDetail.GetLogText(dbConn, ShowKeyIDOnly, DoNotConvertID));
                            }
                        }
                    }
                }
                //logTextBuilder.AppendLine(string.Empty);
            }
            return(logTextBuilder.ToString());
        }
Exemple #3
0
    private ArrayList GetRemoveMenuItemList(MenuItemCollection menuItemCollection)
    {
        HROne.ProductLicense productLicense         = WebUtils.productLicense(Session);
        ArrayList            removeSubMenuItemArray = new ArrayList();

        foreach (MenuItem subMenuItem in menuItemCollection)
        {
            if (WebUtils.IsEMUser(user))
            {
                if (!subMenuItem.Text.Equals("Security", StringComparison.CurrentCultureIgnoreCase))
                {
                    removeSubMenuItemArray.Add(subMenuItem);
                }
                continue;
            }
            if (productLicense != null)
            {
                if (subMenuItem.Text.Equals("Code Setup", StringComparison.CurrentCultureIgnoreCase) ||
                    subMenuItem.Text.Equals("Report", StringComparison.CurrentCultureIgnoreCase)
                    )
                {
                    if (!productLicense.IsLeaveManagement && !productLicense.IsPayroll && !productLicense.IsTaxation)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Employee", StringComparison.CurrentCultureIgnoreCase) ||
                    subMenuItem.Text.Equals("Leave", StringComparison.CurrentCultureIgnoreCase)
                    )
                {
                    if (!productLicense.IsLeaveManagement)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Payroll", StringComparison.CurrentCultureIgnoreCase) ||
                    subMenuItem.Text.Equals("MPF Setup", StringComparison.CurrentCultureIgnoreCase)
                    )
                {
                    if (!productLicense.IsPayroll)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Taxation", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsTaxation)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.IndexOf("P-Fund ", StringComparison.CurrentCultureIgnoreCase) >= 0 ||
                    subMenuItem.Text.IndexOf("ORSO ", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (!HROne.Lib.Entities.ESystemParameter.getParameter(dbConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_USE_ORSO).Equals("Y", StringComparison.CurrentCultureIgnoreCase))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }

                if (subMenuItem.Text.IndexOf("Commission Achievement Process", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (!HROne.Lib.Entities.ESystemParameter.getParameter(dbConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_MONTHLY_ACHIEVEMENT_COMMISSION).Equals("Y", StringComparison.CurrentCultureIgnoreCase))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.IndexOf("Incentive Payment Process", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (!HROne.Lib.Entities.ESystemParameter.getParameter(dbConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_INCENTIVE_PAYMENT).Equals("Y", StringComparison.CurrentCultureIgnoreCase))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.IndexOf("Double Pay Adjustment", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (!HROne.Lib.Entities.ESystemParameter.getParameter(dbConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_ENABLE_DOUBLE_PAY_ADJUSTMENT).Equals("Y", StringComparison.CurrentCultureIgnoreCase))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.IndexOf("Bonus Process", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (!HROne.Lib.Entities.ESystemParameter.getParameter(dbConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_ENABLE_BONUS_PROCESS).Equals("Y", StringComparison.CurrentCultureIgnoreCase))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.IndexOf("E-mail ", StringComparison.CurrentCultureIgnoreCase) >= 0 ||
                    subMenuItem.Text.IndexOf("Email ", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Cost Allocation", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsCostCenter)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Attendance", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsAttendance)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("ESS Authorization Group Setup", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsESS)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("ESS Authorization Workflow Setup", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsESS)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Release Pay Slip to ESS", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsESS)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Release Tax Report to ESS", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsESS)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Training", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsTraining)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("e-channel", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROneSaaS || Session["CompanyDBID"] == null)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                //if (subMenuItem.Text.Equals("Work Hour Pattern Setup", StringComparison.CurrentCultureIgnoreCase))
                //    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                //    {
                //        removeSubMenuItemArray.Add(subMenuItem);
                //        continue;
                //    }
                if (subMenuItem.Text.Equals("Annual Leave Prorata Rounding Rule Setup", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Import Leave Balance Adjustment", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("MPF Termination Code Mapping", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Statutory Minimum Wage Setup", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                //if (subMenuItem.Text.Equals("User Guide", StringComparison.CurrentCultureIgnoreCase))
                //{
                //    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.iMGR)
                //    {
                //        removeSubMenuItemArray.Add(subMenuItem);
                //        continue;
                //    }
                //}
                if (subMenuItem.Text.Equals("Import Employee Information", StringComparison.CurrentCultureIgnoreCase))
                {
                    HROne.Lib.Entities.ESystemFunction function = HROne.Lib.Entities.ESystemFunction.GetObjectByCode(dbConn, "PER999");
                    if (function != null)
                    {
                        if (function.FunctionIsHidden)
                        {
                            removeSubMenuItemArray.Add(subMenuItem);
                            continue;
                        }
                    }
                    else
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }

                if (subMenuItem.Text.Equals("Shift Duty Code", StringComparison.CurrentCultureIgnoreCase))
                {
                    ESystemFunction m_function = ESystemFunction.GetObjectByCode(dbConn, "SYS025");
                    if (m_function == null || m_function.FunctionIsHidden)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }
                if (subMenuItem.Text.Equals("Payment Calculation Formula", StringComparison.CurrentCultureIgnoreCase))
                {
                    ESystemFunction m_function = ESystemFunction.GetObjectByCode(dbConn, "SYS026");
                    if (m_function == null || m_function.FunctionIsHidden)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }
                if (subMenuItem.Text.Equals("Report Builder", StringComparison.CurrentCultureIgnoreCase))
                {
                    ESystemFunction m_function = ESystemFunction.GetObjectByCode(dbConn, "RPT004");
                    if (m_function == null || m_function.FunctionIsHidden)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }
                if (subMenuItem.Text.Equals("Customized Attendance Preparation Process", StringComparison.CurrentCultureIgnoreCase))
                {
                    ESystemFunction m_function = ESystemFunction.GetObjectByCode(dbConn, "CUSTOM003");
                    if (m_function == null || m_function.FunctionIsHidden)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }

                //{
                //    HROne.Lib.Entities.ESystemFunction function = HROne.Lib.Entities.ESystemFunction.GetObjectByCode(dbConn, "CUSTOM003");
                //    if (function != null)
                //    {
                //        if (function.FunctionIsHidden)
                //        {
                //            removeSubMenuItemArray.Add(subMenuItem);
                //            continue;
                //        }
                //    }
                //    else
                //    {
                //        removeSubMenuItemArray.Add(subMenuItem);
                //        continue;
                //    }
                //}
                removeSubMenuItemArray.AddRange(GetRemoveMenuItemList(subMenuItem.ChildItems));
            }
            else
            if (!subMenuItem.Text.Equals("Security", StringComparison.CurrentCultureIgnoreCase))
            {
                removeSubMenuItemArray.Add(subMenuItem);
            }
        }
        return(removeSubMenuItemArray);
    }