protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HumanResourcesDepartment.Menu menu = new HumanResourcesDepartment.Menu(); this.company = menu.LoadObject("Google", Server.MapPath(@"~\App_Data")); ArrayList positions = new ArrayList(); positions.Add("Product owner"); positions.Add("Developer"); positions.Add("QA"); positions.Add("Project manager"); positions.Add("Business analyst"); Position.DataSource = positions; Position.DataBind(); Employeer.DataSource = this.ReturnEmployerList(this.company); Employeer.DataValueField = "Key"; Employeer.DataTextField = "Value"; Employeer.DataBind(); Subdivision.DataSource = this.ReturnSubdivisions(this.company); Subdivision.DataBind(); if (!string.IsNullOrEmpty(Request.QueryString["id"])) { this.id = int.Parse(Request.QueryString["id"]); this.SetDataOnForm(id); this.ChangeButtons(); } } else { HumanResourcesDepartment.Menu menu = new HumanResourcesDepartment.Menu(); this.company = menu.LoadObject("Google", Server.MapPath(@"~\App_Data")); } }
/// <summary> /// This method loads all data from file. /// </summary> /// <param name="sender">EventArgs</param> /// <param name="e">object</param> protected void Page_Load(object sender, EventArgs e) { HumanResourcesDepartment.Menu menu = new HumanResourcesDepartment.Menu(); this.company = menu.LoadObject("Google", Server.MapPath(@"~\App_Data")); if (!IsPostBack) { SubdivisionDropList.DataSource = this.ReturnSubdivisions(this.company); SubdivisionDropList.DataBind(); } }
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"); }