/// <summary>
 /// This method adds new subdivision.
 /// </summary>
 /// <param name="sender">object</param>
 /// <param name="e">EventArgs</param>
 protected void AddSubdivision(object sender, EventArgs e)
 {
     company.AddSubdivision(NameOfSubdivision.Text);
     HumanResourcesDepartment.Menu menu = new HumanResourcesDepartment.Menu();
     menu.SaveObject(this.company, Server.MapPath(@"~\App_Data"));
     Response.Redirect(Request.RawUrl);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            HumanResourcesDepartment.Menu menu = new HumanResourcesDepartment.Menu();
            this.company = menu.LoadObject("Google", Server.MapPath(@"~\App_Data"));
            menu.SaveObject(this.company, Server.MapPath(@"~\App_Data"));

            try
            {
                int      int_id = int.Parse(Request.QueryString["id"]);
                Employee emp    = this.company.FindById(int_id);
                this.company.RemoveEmloyee(emp);

                menu.SaveObject(this.company, Server.MapPath(@"~\App_Data"));
            }
            catch (NullReferenceException)
            {
            }
            catch (ArgumentNullException)
            {
            }
            Response.Redirect("Default");
        }
        /// <summary>
        /// This method delete subdivision.
        /// </summary>
        /// <param name="sender">object</param>
        /// <param name="e">EventArgs</param>
        protected void DeleteSubdivision(object sender, EventArgs e)
        {
            string nameOfSubdivision = SubdivisionDropList.SelectedValue;

            if (nameOfSubdivision != "All")
            {
                this.company.RemoveSubdivision(nameOfSubdivision);
            }
            else
            {
                subdivision = company.FindSubdivisionByName(nameOfSubdivision);
            }
            HumanResourcesDepartment.Menu menu = new HumanResourcesDepartment.Menu();
            menu.SaveObject(this.company, Server.MapPath(@"~\App_Data"));
            Response.Redirect(Request.RawUrl);
        }
コード例 #4
0
        /// <summary>
        /// This method adds employee.
        /// </summary>
        /// <param name="sender">object</param>
        /// <param name="e">EventArgs</param>
        protected void AddEmployee(object sender, EventArgs e)
        {
            this.SelectedPosition    = Position.SelectedValue;
            this.SelectedSubdivision = Subdivision.SelectedValue;
            if (Employeer.SelectedValue == "None")
            {
                this.company.AddEmployee(FirstName.Text, LastName.Text, ContactDetails.Text, this.SelectedPosition, this.SelectedSubdivision);
            }
            else
            {
                this.SelectedEmployerId = int.Parse(Employeer.SelectedValue);
                this.company.AddEmployee(FirstName.Text, LastName.Text, ContactDetails.Text, this.SelectedPosition, this.SelectedSubdivision, this.SelectedEmployerId);
            }

            HumanResourcesDepartment.Menu menu = new HumanResourcesDepartment.Menu();
            menu.SaveObject(this.company, Server.MapPath(@"~\App_Data"));
            Response.Redirect("Default");
        }
コード例 #5
0
        /// <summary>
        /// This method change employee's information.
        /// </summary>
        /// <param name="sender">object</param>
        /// <param name="e">EventArgs</param>
        protected void ChangeEmployee(object sender, EventArgs e)
        {
            this.SelectedPosition    = Position.SelectedValue;
            this.SelectedSubdivision = Subdivision.SelectedValue;
            Employee emp = this.company.FindById(int.Parse(Emp_id.Text));

            if (Employeer.SelectedValue == "None")
            {
                emp.ChangeAllData(FirstName.Text, LastName.Text, ContactDetails.Text, this.SelectedPosition, this.company.FindSubdivisionByName(this.SelectedSubdivision), null);
            }
            else
            {
                this.SelectedEmployerId = int.Parse(Employeer.SelectedValue);
                emp.ChangeAllData(FirstName.Text, LastName.Text, ContactDetails.Text, this.SelectedPosition, this.company.FindSubdivisionByName(this.SelectedSubdivision), this.company.FindById(SelectedEmployerId));
            }

            HumanResourcesDepartment.Menu menu = new HumanResourcesDepartment.Menu();
            menu.SaveObject(this.company, Server.MapPath(@"~\App_Data"));
            Response.Redirect("Default");
        }
 /// <summary>
 /// This method saves object and redirect on AddEmployeeForm.
 /// </summary>
 /// <param name="sender">EventArgs</param>
 /// <param name="e">object</param>
 protected void AddEmployee(object sender, EventArgs e)
 {
     HumanResourcesDepartment.Menu menu = new HumanResourcesDepartment.Menu();
     menu.SaveObject(this.company, Server.MapPath(@"~\App_Data"));
     Response.Redirect("AddEmployeeForm");
 }