コード例 #1
0
        // ////////////////////////////////////////////////////////////////////////
        // INITIAL EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_RESOURCES_EMPLOYEES_ADD"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if ((string)Request.QueryString["source_page"] == null)
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in employees_add.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Convert.ToInt32(Session["companyID"]).ToString();

                // If coming from
                // ... employee_navigator.aspx
                if (Request.QueryString["source_page"] == "lm")
                {
                    // ... Initialize tables
                    employeesAddTDS = new EmployeesAddTDS();

                    EmployeeAddGateway employeeAddGateway = new EmployeeAddGateway();
                    employeeAddGateway.LoadAll();

                    // ... Store tables
                    Session["employeesAddTDS"] = employeesAddTDS;
                }

                int companyId = Int32.Parse(hdfCompanyId.Value);
                ProjectTimeJobClassTypeList projectTimeJobClassTypeList = new ProjectTimeJobClassTypeList();
                projectTimeJobClassTypeList.LoadAndAddItem(1, companyId, "");
                ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table;
                ddlJobClassType.DataValueField = "JobClassType";
                ddlJobClassType.DataTextField = "JobClassType";
                ddlJobClassType.DataBind();
                ddlJobClassType.SelectedIndex = 0;

                // StepSection1In
                wzTeamMember.ActiveStepIndex = 0;
                lblUserErrorMessage.Visible = false;
                StepBeginIn();
            }
            else
            {
                // Restore tables
                employeesAddTDS = (EmployeesAddTDS)Session["employeesAddTDS"];
            }
        }
コード例 #2
0
        /// <summary>
        /// Save
        /// </summary>
        /// <returns>employeeId</returns>
        public int Save()
        {
            EmployeesAddTDS employeeAddChanges = (EmployeesAddTDS)Data.GetChanges();
            int employeeId = 0;

            if (employeeAddChanges != null)
            {
                if (employeeAddChanges.EmployeeAdd.Rows.Count > 0)
                {
                    EmployeeAddGateway employeeNavigatorGateway = new EmployeeAddGateway(employeeAddChanges);

                    // Update employees
                    foreach (EmployeesAddTDS.EmployeeAddRow row in (EmployeesAddTDS.EmployeeAddDataTable)employeeAddChanges.EmployeeAdd)
                    {
                        // Insert new employees
                        if ((!row.Deleted) && (!row.InDatabase))
                        {
                            Employee employee = new Employee(null);
                            int? loginId = null; if (!row.IsLoginIDNull()) loginId = row.LoginID;
                            int? contactsId = null; if (!row.IsContactsIDNull()) contactsId = row.ContactsID;
                            string middleInitial = ""; if (!row.IsMiddleInitialNull()) middleInitial = row.MiddleInitial;
                            string email = ""; if (!row.IseMailNull()) email = row.eMail;
                            bool assignableSrs = row.AssignableSRS;
                            string jobClass = ""; if (!row.IsJobClassTypeNull()) jobClass = row.JobClassType;
                            string personalAgencyName = ""; if (!row.IsPersonalAgencyNameNull()) personalAgencyName = row.PersonalAgencyName;
                            bool isVacationsManager = row.IsVacationsManager;
                            bool approveTimesheets = row.ApproveTimesheets;
                            decimal? bourdenFactor = null; if (!row.IsBourdenFactorNull()) bourdenFactor = (decimal)row.BourdenFactor;
                            decimal? usHealthBenefitFactor = null; if (!row.IsUSHealthBenefitFactorNull()) usHealthBenefitFactor = (decimal)row.USHealthBenefitFactor;
                            decimal? benefitFactorCad = null; if (!row.IsBenefitFactorCadNull()) benefitFactorCad = (decimal)row.BenefitFactorCad;
                            decimal? benefitFactorUsd = null; if (!row.IsBenefitFactorUsdNull()) benefitFactorUsd = (decimal)row.BenefitFactorUsd;
                            string crew = ""; //TODO CREW

                            employeeId = employee.InsertDirect(loginId, contactsId, row.FullName, row.FirstName, middleInitial, row.LastName, row.Type, row.State, row.IsSalesman, row.RequestProjectTime, row.Deleted, row.Salaried, email, assignableSrs, jobClass, row.Category, personalAgencyName, isVacationsManager, approveTimesheets, bourdenFactor, usHealthBenefitFactor, benefitFactorCad, benefitFactorUsd, crew);

                            // Employee Categories Approve Timesheets
                            EmployeeCategoryApproveTimesheets employeeCategoryApproveTimesheets = new EmployeeCategoryApproveTimesheets(null);
                            employeeCategoryApproveTimesheets.InsertDirect(employeeId, "Field", false, false);
                            employeeCategoryApproveTimesheets.InsertDirect(employeeId, "Field 44", false, false);
                            employeeCategoryApproveTimesheets.InsertDirect(employeeId, "Mechanic/Manufactoring", false, false);
                            employeeCategoryApproveTimesheets.InsertDirect(employeeId, "Office/Admin", false, false);
                            employeeCategoryApproveTimesheets.InsertDirect(employeeId, "Special Forces", false, false);
                        }
                    }
                }
            }

            return employeeId;
        }
コード例 #3
0
        private bool StepBeginNext()
        {
            int selectedLoginId = Int32.Parse(ddlUsers.SelectedValue);
            EmployeeAddGateway employeeAddGateway = new EmployeeAddGateway();

            if (employeeAddGateway.IsInLfs(selectedLoginId))
            {
                lblUserErrorMessage.Visible = true;
                return false;
            }
            else
            {
                lblUserErrorMessage.Visible = false;
                return true;
            }
        }