Example #1
0
 private static void SetModelData(EmployeeModel model)
 {
     model.DeptList     = DeptDAO.QueryAll();
     model.EmployeeList = EmployeeDAO.QueryAll();
     model.EmpDeptList  = EmployeeDAO.QueryAllInfo();
     model.Datas        = EmployeeDAO.QueryAllDicInfo();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            User currentUser = (User)Session["currentUser"];

            if (currentUser != null)
            {
                Boolean superuser = false;
                foreach (string s in currentUser.getRoles())
                {
                    if (s.Equals("superuser"))
                    {
                        superuser = true;
                    }
                }
                if (superuser)
                {
                    if (!IsPostBack)
                    {
                        DeptDAO           depdao = new DeptDAO();
                        List <Department> deps   = depdao.getAllDepartment();
                        foreach (Department d in deps)
                        {
                            if (d.getDeptName().ToLower().Equals("hr"))
                            {
                                lblDept.Items.Add(new ListItem("Human Resource", d.getDeptName()));
                            }
                            else
                            {
                                lblDept.Items.Add(new ListItem(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(d.getDeptName().ToLower()), d.getDeptName()));
                            }
                        }
                        UserDAO udao = new UserDAO();

                        ArrayList sups = udao.get_supervisors();
                        foreach (User supervisor in sups)
                        {
                            ddlSup.Items.Add(supervisor.getName());
                        }
                    }
                    else
                    {
                        txtPassword.Attributes["value"]  = txtPassword.Text;
                        txtPassword2.Attributes["value"] = txtPassword2.Text;
                    }
                }
                else
                {
                    Response.Redirect("errorPage.aspx");
                }
            }
            else
            {
                Response.Redirect("login.aspx");
            }
        }
Example #3
0
 public ActionResult Modify(DeptModel model)
 {
     try
     {
         DeptDAO.Modify(model.Dept);
         model.Message = "修改部门信息成功";
     }
     catch (Exception ex)
     {
         model.Message = ex.Message;
     }
     return(View("ToModify", model));
 }
Example #4
0
 public ActionResult Modify(EmployeeModel model)
 {
     try
     {
         EmployeeDAO.Modify(model.Employee);
         model.Message = "修改员工信息成功.";
     }
     catch (Exception ex)
     {
         model.Message = ex.Message;
     }
     model.DeptList = DeptDAO.QueryAll();
     return(View("ToModify", model));
 }
Example #5
0
        public ActionResult Index()
        {
            DeptModel model = new DeptModel();

            try
            {
                model.DeptList = DeptDAO.QueryAll();
            }
            catch (Exception ex)
            {
                model.DeptList = new List <TblDept>();
                model.Message  = ex.Message;
            }
            return(View(model));
        }
Example #6
0
        public ActionResult Delete(DeptModel model)
        {
            try
            {
                DeptDAO.Delete(model.Dept.DeptId);
                model.Message = "删除部门信息成功";
            }
            catch (Exception ex)
            {
                model.Message = ex.Message;
            }

            model.DeptList = DeptDAO.QueryAll();
            return(View("Index", model));
        }
Example #7
0
        public ActionResult Add(DeptModel model)
        {
            try
            {
                DeptDAO.Add(model.Dept);
                model.Message = "保存部门信息成功";
            }
            catch (Exception ex)
            {
                model.Message = ex.Message;
            }

            model.DeptList = DeptDAO.QueryAll();
            return(View("Index", model));
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User currentUser = (User)Session["currentUser"];

            if (currentUser == null)
            {
                Response.Redirect("login.aspx");
            }
            Boolean super = false;
            Boolean cc    = false;

            foreach (string role in currentUser.getRoles())
            {
                if (role.Equals("superuser"))
                {
                    super = true;
                }
                if (role.Equals("content creator"))
                {
                    cc = true;
                }
            }
            if (!cc)
            {
                if (!super)
                {
                    Response.Redirect("errorPage.aspx");
                }
            }

            if (!IsPostBack)
            {
                DeptDAO           depdao = new DeptDAO();
                List <Department> deps   = depdao.getAllDepartment();
                foreach (Department d in deps)
                {
                    if (d.getDeptName().ToLower().Equals("hr"))
                    {
                        ddlDept.Items.Add(new ListItem("Human Resource", d.getDeptName()));
                    }
                    else
                    {
                        ddlDept.Items.Add(new ListItem(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(d.getDeptName().ToLower()), d.getDeptName()));
                    }
                    //ddlDept.Items.Add(new ListItem(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(d.getDeptName().ToLower()), d.getDeptName()));
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["currentUser"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     else
     {
         User    currentUser  = (User)Session["currentUser"];
         Boolean authenticate = authenticateAccess(currentUser);
         if (!authenticate)
         {
             Response.Redirect("errorPage.aspx");
         }
         else
         {
             if (!IsPostBack)
             {
                 DeptDAO           depdao = new DeptDAO();
                 List <Department> deps   = depdao.getAllDepartment();
                 foreach (Department d in deps)
                 {
                     if (d.getDeptName().ToLower().Equals("hr"))
                     {
                         lblDept.Items.Add(new ListItem("Human Resource", d.getDeptName()));
                     }
                     else
                     {
                         lblDept.Items.Add(new ListItem(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(d.getDeptName().ToLower()), d.getDeptName()));
                     }
                     //lblDept.Items.Add(new ListItem(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(d.getDeptName().ToLower()), d.getDeptName()));
                 }
                 string     id     = Request.QueryString["id"];
                 int        id_num = Convert.ToInt32(id);
                 ContactDAO adao   = new ContactDAO();
                 a                     = adao.getContactById(id_num);
                 txtName.Text          = a.name;
                 lblDept.SelectedValue = a.department;
                 txtEmail.Text         = a.email;
                 txtRemarks.Text       = a.remarks;
             }
         }
     }
 }
Example #10
0
 public ActionResult ToModify(DeptModel model)
 {
     try
     {
         model.Dept = DeptDAO.QueryByKey(model.Dept);
         if (model.Dept == null)
         {
             model.Message  = "修改的数据不存在。";
             model.DeptList = DeptDAO.QueryAll();
             return(View("Index", model));
         }
         return(View(model));
     }
     catch (Exception ex)
     {
         model.Message  = ex.Message;
         model.DeptList = DeptDAO.QueryAll();
         return(View("Index", model));
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DeptDAO           depdao = new DeptDAO();
                List <Department> deps   = depdao.getAllDepartment();
                foreach (Department d in deps)
                {
                    lblDept.Items.Add(new ListItem(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(d.getDeptName().ToLower()), d.getDeptName()));
                }
                UserDAO udao = new UserDAO();

                ArrayList sups = udao.get_supervisors();
                foreach (User supervisor in sups)
                {
                    ddlSup.Items.Add(supervisor.getName());
                }
            }
            else
            {
                txtPassword.Attributes["value"]  = txtPassword.Text;
                txtPassword2.Attributes["value"] = txtPassword2.Text;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["currentUser"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    User currentUser = (User)Session["currentUser"];

                    TNFDAO          tnfDAO          = new TNFDAO();
                    UserDAO         userDAO         = new UserDAO();
                    NotificationDAO notificationDAO = new NotificationDAO();

                    int notificationID = Convert.ToInt32(Request.QueryString["n"]);

                    Notification currentNotification = notificationDAO.getNotificationByID(notificationID);

                    if (currentNotification == null || !currentNotification.getUserIDTo().Equals(currentUser.getUserID()))
                    {
                        Response.Redirect("errorPage.aspx");
                    }

                    TNF  currentTNF = tnfDAO.getIndividualTNFByID(currentNotification.getUserIDFrom(), currentNotification.getTNFID());
                    User applicant  = userDAO.getUserByID(currentNotification.getUserIDFrom());

                    Course   courseApplied   = tnfDAO.getCourseFromTNF(currentNotification.getTNFID());
                    Lesson   lessonApplied   = tnfDAO.getLessonFromTNF(currentNotification.getTNFID());
                    TNFData  tnfData         = tnfDAO.getIndividualTNFDataByID(currentNotification.getTNFID());
                    Workflow currentWorkflow = currentTNF.getWorkflow();
                    int      probationPeriod = currentWorkflow.getProbationPeriod();
                    TimeSpan ts = currentTNF.getApplicationDate().Subtract(applicant.getStartDate());

                    //show warning if overseas, probation, > 10000
                    if (courseApplied.getPrice() > 10000)
                    {
                        warningPanelPrice.Visible = true;
                        lblWarningPrice.Visible   = true;
                        lblWarningPrice.Text      = "This course is over $10,000";
                    }
                    if (courseApplied.getOverseas().ToLower().Equals("y"))
                    {
                        warningPanelOverseas.Visible = true;
                        lblWarningOverseas.Visible   = true;
                        lblWarningOverseas.Text      = "This course is an overseas course";
                    }
                    if (ts.TotalDays < probationPeriod)
                    {
                        warningPanelProbation.Visible = true;
                        lblWarningProbation.Visible   = true;
                        probationDate.Enabled         = true;
                        lblWarningProbation.Text      = "Applicant is under probation";
                    }

                    //setting user information
                    nameOfStaffOutput.Text    = applicant.getName();
                    employeeNumberOutput.Text = applicant.getUserID();
                    emailOutput.Text          = applicant.getEmail();
                    designationOutput.Text    = applicant.getJobTitle();
                    departmentOutput.Text     = applicant.getDepartment();

                    //setting course and lesson information
                    courseOutput.Text     = courseApplied.getCourseName();
                    startDate.Text        = lessonApplied.getStartDate().ToString("d MMM yyyy");
                    endDate.Text          = lessonApplied.getEndDate().ToString("d MMM yyyy");
                    startTime.Text        = lessonApplied.getStartTime().ToString();
                    endTime.Text          = lessonApplied.getEndTime().ToString();
                    venueOutput.Text      = lessonApplied.getVenue();
                    instructorOutput.Text = lessonApplied.getInstructor();

                    string internalOrExternal = courseApplied.getInternalOrExternal();
                    if (internalOrExternal.ToLower().Equals("internal"))
                    {
                        inhouse.Checked     = true;
                        external.Checked    = false;
                        lblExternal.Visible = false;
                        externalCourseProviderOutput.Visible = false;
                    }
                    else
                    {
                        inhouse.Checked     = false;
                        external.Checked    = true;
                        lblExternal.Visible = true;
                        externalCourseProviderOutput.Visible = true;
                        externalCourseProviderOutput.Text    = courseApplied.getCourseProvider();
                    }
                    courseFeeOutput.Text = "$" + courseApplied.getPrice();

                    //setting tnf data information
                    string prepareForNewJobRole = tnfData.getPrepareForNewJobRole();
                    if (prepareForNewJobRole.Equals("y"))
                    {
                        objectiveInput1.Checked  = true;
                        objectiveElaborate1.Text = tnfData.getPrepareForNewJobRoleText();
                        completeDateOutput1.Text = tnfData.getPrepareForNewJobRoleCompletionDate().Value.ToString("MM-dd-yyyy");
                    }
                    else
                    {
                        objectiveInput1.Checked  = false;
                        objectiveElaborate1.Text = "-";
                        completeDateOutput1.Text = "-";
                    }

                    string shareKnowledge = tnfData.getShareKnowledge();
                    if (shareKnowledge.Equals("y"))
                    {
                        objectiveInput2.Checked  = true;
                        objectiveElaborate2.Text = tnfData.getShareKnowledgeText();
                        completeDateOutput2.Text = tnfData.getShareKnowledgeCompletionDate().Value.ToString("MM-dd-yyyy");
                    }
                    else
                    {
                        objectiveInput2.Checked  = false;
                        objectiveElaborate2.Text = "-";
                        completeDateOutput2.Text = "-";
                    }

                    string otherObjectives = tnfData.getOtherObjectives();
                    if (otherObjectives.Equals("y"))
                    {
                        objectiveInput3.Checked    = true;
                        objectiveElaborate3.Text   = tnfData.getOtherObjectivesText();
                        completionDateOutput3.Text = tnfData.getOtherObjectivesCompletionDate().Value.ToString("MM-dd-yyyy");
                    }
                    else
                    {
                        objectiveInput3.Checked    = false;
                        objectiveElaborate3.Text   = "-";
                        completionDateOutput3.Text = "-";
                    }

                    //all HR will view HR approval section
                    if (currentUser.getJobCategory().Equals("hr"))
                    {
                        hrApprovalView.Visible = true;
                        BondDAO    bondDAO     = new BondDAO();
                        DeptDAO    deptDAO     = new DeptDAO();
                        Bonds      checkBond   = bondDAO.getBondByTNFIDandUserID(currentTNF.getTNFID(), applicant.getUserID());
                        Department currentDept = deptDAO.getDeptByName(applicant.getDepartment());
                        lbl_HR.Text = "Is HR";
                        rfv_trainingCost.Enabled    = true;
                        rfv_mspBondDuration.Enabled = true;

                        if (checkBond != null)
                        {
                            rbtnBond.Checked        = true;
                            rbtnMSP.Enabled         = false;
                            rbtnNA.Enabled          = false;
                            mspBondDuration.Text    = string.Empty;
                            mspBondDuration.Enabled = true;
                        }
                        else
                        {
                            rbtnBond.Checked = false;
                            rbtnBond.Enabled = false;
                        }

                        costcentre.Text = currentDept.getCostCentre().ToString();
                        double balance = currentDept.getActualBudget() - courseApplied.getPrice();
                        trainingBudgetBal.Text  = balance.ToString();
                        trainingBudgetDate.Text = DateTime.Now.ToString("MM/dd/yyyy");
                    }
                    else
                    {
                        lbl_HR.Text = "Is not HR";
                        rfv_trainingCost.Enabled    = false;
                        rfv_mspBondDuration.Enabled = false;
                    }
                }
            }
        }
Example #13
0
        public long SaveDepartment(DeptDTO ObjDeptDTO)
        {
            IDeptDAO _IDeptDAO = new DeptDAO();

            return(_IDeptDAO.SaveDepartment(ObjDeptDTO));
        }
Example #14
0
        public List <DeptDTO> GetDepartment(int DeptId)
        {
            IDeptDAO _IDeptDAO = new DeptDAO();

            return(_IDeptDAO.GetDepartment(DeptId));
        }
Example #15
0
        public List <DeptDTO> GetDeptList()
        {
            IDeptDAO _IDeptDAO = new DeptDAO();

            return(_IDeptDAO.GetDeptList());
        }
Example #16
0
 public ActionResult ToModify(EmployeeModel model)
 {
     model.Employee = EmployeeDAO.QueryByKey(model.Employee);
     model.DeptList = DeptDAO.QueryAll();
     return(View(model));
 }
Example #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //hp = new Dictionary<string, string>();

            if (Session["currentUser"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                User    currentUser = (User)Session["currentUser"];
                Boolean superuser   = false;
                foreach (string s in currentUser.getRoles())
                {
                    if (s.Equals("superuser"))
                    {
                        superuser = true;
                    }
                }

                if (!superuser)
                {
                    Response.Redirect("errorPage.aspx");
                }

                if (!IsPostBack)
                {
                    UserDAO udao   = new UserDAO();
                    string  userID = Request.QueryString["userID"];
                    if (userID == null || userID.Equals(""))
                    {
                        Response.Redirect("errorPage.aspx");
                    }
                    User      toChange = udao.getUserByID(userID);
                    ArrayList roles    = udao.getRolesByID(userID);
                    txtUsername.Text  = toChange.getUserID();
                    txtName.Text      = toChange.getName();
                    txtAddress.Text   = toChange.getAddress();
                    txtContactNo.Text = toChange.getContact();
                    //txtDept.Text = toChange.getDepartment();

                    DeptDAO           depdao = new DeptDAO();
                    List <Department> deps   = depdao.getAllDepartment();
                    foreach (Department d in deps)
                    {
                        if (d.getDeptName().ToLower().Equals("hr"))
                        {
                            lblDept.Items.Add(new ListItem("Human Resource", d.getDeptName()));
                        }
                        else
                        {
                            lblDept.Items.Add(new ListItem(System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(d.getDeptName().ToLower()), d.getDeptName()));
                        }
                    }
                    lblDept.SelectedValue = toChange.getDepartment();

                    // find supervisor
                    List <User> allSupervisorForDept = udao.getAllUsersByDept(toChange.getDepartment());
                    ddlSup.Items.Add(new ListItem("--select--", "none"));
                    foreach (User u in allSupervisorForDept)
                    {
                        ddlSup.Items.Add(new ListItem(u.getName(), u.getName()));
                    }
                    foreach (ListItem li in ddlSup.Items)
                    {
                        string supid = toChange.getSupervisor();
                        User   u     = udao.getUserByID(supid);
                        if (u == null)
                        {
                            u = udao.getUserByID("admin");
                        }
                        if (li.Text.Equals(u.getName()))
                        {
                            ddlSup.SelectedValue = li.Text;
                        }
                    }
                    txtJobTitle.Text = toChange.getJobTitle();
                    txtEmail.Text    = toChange.getEmail();
                    foreach (ListItem item in cblRoles.Items)
                    {
                        foreach (string s in roles)
                        {
                            if (item.Value.Equals(s))
                            {
                                item.Selected = true;
                            }
                        }
                    }
                }
            }
        }