/// <summary> /// Handles the Click event of the btnsubmitProject control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnsubmitProject_Click(object sender, EventArgs e) { try { ProjectDetailsBAL projectDetailsBAL = new ProjectDetailsBAL(); DataTable dtProjectDetails = (DataTable)ViewState["ProjectDetails"]; projectDetailsBAL.SaveProjectDetailsBAL(dtProjectDetails); grdProjectDetails.DataSource = null; grdProjectDetails.DataBind(); ViewState["ProjectDetails"] = null; Response.Write("<script language='javascript'>alert('Project Details Inserted')</script>"); } catch (Exception) { // throw; } }
/// <summary> /// Bind Functional roles. /// </summary> private void GetRole() { try { ProjectDetailsBAL projectDetailsBAL = new ProjectDetailsBAL(); dsRoles = projectDetailsBAL.GetRole(); // Check if dataset is not null if (dsRoles != null) { ddlRole.DataSource = dsRoles; ddlRole.DataTextField = "RoleName"; ddlRole.DataValueField = "RoleId"; ddlRole.DataBind(); ddlRole.Items.Insert(0, new ListItem("--Select--", "0")); } } catch (Exception) { // throw; } }
/// <summary> /// Bind Repeater for ProjectDetails. /// </summary> private void BindRepeater() { try { DataSet dsProjectDetails = new DataSet(); ProjectDetailsBAL projectDetailsBAL = new ProjectDetailsBAL(); dsProjectDetails = projectDetailsBAL.ViewProjectDetailsBAL(candidateId); if (dsProjectDetails != null) { rptrProjectDetails.DataSource = dsProjectDetails; rptrProjectDetails.DataBind(); } } catch (Exception) { // throw; } }
protected void rptrProjectDetails_ItemDataBound(object sender, RepeaterItemEventArgs e) { DropDownList ddlRole = (DropDownList)e.Item.FindControl("ddlRole"); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { try { ProjectDetailsBAL projectDetailsBAL = new ProjectDetailsBAL(); dsRoles = projectDetailsBAL.GetRole(); // Check if dataset is not null if (dsRoles != null) { ddlRole.DataSource = dsRoles; ddlRole.DataTextField = "RoleName"; ddlRole.DataValueField = "RoleId"; ddlRole.DataBind(); ddlRole.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "RoleId")); } } catch (Exception) { // throw; } } DropDownList ddlTeamSize = (DropDownList)e.Item.FindControl("ddlTeamSize"); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { ddlTeamSize.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "TeamSize")); } DropDownList ddlDegree = (DropDownList)e.Item.FindControl("ddlDegree"); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { ddlDegree.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "Degree")); } DropDownList ddlProjectFor = (DropDownList)e.Item.FindControl("ddlProjectFor"); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { ddlProjectFor.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "ProjectFor")); } }
protected void rptrProjectDetails_ItemCommand(object source, RepeaterCommandEventArgs e) { LinkButton lnkUpdate = (LinkButton)e.Item.FindControl("lnkUpdate"); LinkButton lnkCancel = (LinkButton)e.Item.FindControl("lnkCancel"); LinkButton lnkEdit = (LinkButton)e.Item.FindControl("lnkEdit"); LinkButton lnkDelete = (LinkButton)e.Item.FindControl("lnkDelete"); Label lblrptID = (Label)e.Item.FindControl("lblID"); Label lblProjectFor = (Label)e.Item.FindControl("lblProjectFor"); Label lblProjectTiltle = (Label)e.Item.FindControl("lblProjectTiltle"); Label lblCompanyName = (Label)e.Item.FindControl("lblCompanyName"); Label lblClientName = (Label)e.Item.FindControl("lblClientName"); Label lblDuration = (Label)e.Item.FindControl("lblDuration"); Label lblProjectLocation = (Label)e.Item.FindControl("lblProjectLocation"); Label lblEmploymentType = (Label)e.Item.FindControl("lblEmploymentType"); Label lblProjectDetails = (Label)e.Item.FindControl("lblProjectDetails"); Label lblRolesandResponsibility = (Label)e.Item.FindControl("lblRolesandResponsibility"); Label lblSkillUsed = (Label)e.Item.FindControl("lblSkillUsed"); Label lblProjectLive = (Label)e.Item.FindControl("lblProjectLive"); Label lblProjectLink = (Label)e.Item.FindControl("lblProjectLink"); TextBox txtProjectTiltle = (TextBox)e.Item.FindControl("txtProjectTiltle"); TextBox txtCompanyName = (TextBox)e.Item.FindControl("txtCompanyName"); TextBox txtClientName = (TextBox)e.Item.FindControl("txtClientName"); TextBox txtDuration = (TextBox)e.Item.FindControl("txtDuration"); TextBox txtProjectLocation = (TextBox)e.Item.FindControl("txtProjectLocation"); TextBox txtEmploymentType = (TextBox)e.Item.FindControl("txtEmploymentType"); TextBox txtProjectDetails = (TextBox)e.Item.FindControl("txtProjectDetails"); TextBox txtRolesandResponsibility = (TextBox)e.Item.FindControl("txtRolesandResponsibility"); TextBox txtSkillUsed = (TextBox)e.Item.FindControl("txtSkillUsed"); TextBox txtProjectLive = (TextBox)e.Item.FindControl("txtProjectLive"); TextBox txtProjectLink = (TextBox)e.Item.FindControl("txtProjectLink"); DropDownList ddlRole = (DropDownList)e.Item.FindControl("ddlRole"); DropDownList ddlTeamSize = (DropDownList)e.Item.FindControl("ddlTeamSize"); DropDownList ddlProjectFor = (DropDownList)e.Item.FindControl("ddlProjectFor"); DropDownList ddlDegree = (DropDownList)e.Item.FindControl("ddlDegree"); CheckBox chkDelete = (CheckBox)e.Item.FindControl("chkDelete"); // Check commond for edit if (e.CommandName == "edit") { lnkCancel.Visible = true; lnkUpdate.Visible = true; lnkEdit.Visible = false; txtProjectTiltle.Visible = true; txtCompanyName.Visible = true; txtClientName.Visible = true; txtDuration.Visible = true; txtEmploymentType.Visible = true; txtRolesandResponsibility.Visible = true; txtProjectLive.Visible = true; txtProjectLocation.Visible = true; txtProjectLink.Visible = true; txtSkillUsed.Visible = true; txtProjectDetails.Visible = true; txtProjectLink.Visible = true; ddlProjectFor.Visible = true; lblProjectFor.Visible = false; lblProjectTiltle.Visible = false; lblCompanyName.Visible = false; lblClientName.Visible = false; lblDuration.Visible = false; lblProjectLocation.Visible = false; lblEmploymentType.Visible = false; lblProjectDetails.Visible = false; lblRolesandResponsibility.Visible = false; lblSkillUsed.Visible = false; lblProjectLive.Visible = false; lblProjectLink.Visible = false; } // Check commond for update if (e.CommandName == "cancel") { BindRepeater(); } // Check commond for update if (e.CommandName == "update") { try { ProjectDetailsBAL projectDetailsBAL = new ProjectDetailsBAL(); ProjectDetailsEntity projectDetailsEntity = new ProjectDetailsEntity(); projectDetailsEntity.ProjectTitle = txtProjectTiltle.Text; projectDetailsEntity.CompanyName = txtCompanyName.Text; projectDetailsEntity.YourRole = Convert.ToInt32(ddlRole.SelectedValue); projectDetailsEntity.ClientName = txtClientName.Text; projectDetailsEntity.Duration = txtDuration.Text; projectDetailsEntity.ProjectLocation = txtProjectLocation.Text; projectDetailsEntity.EmploymentType = txtEmploymentType.Text; projectDetailsEntity.ProjectDescription = txtProjectDetails.Text; projectDetailsEntity.RolesandResponsibility = txtRolesandResponsibility.Text; projectDetailsEntity.TeamSize = ddlTeamSize.SelectedValue; projectDetailsEntity.SkillUsed = txtSkillUsed.Text; projectDetailsEntity.ProjectLive = txtProjectLive.Text; projectDetailsEntity.ProjectLink = txtProjectLink.Text; projectDetailsEntity.Degree = ddlDegree.SelectedValue; projectDetailsEntity.ProjectFor = ddlProjectFor.SelectedValue; projectDetailsEntity.ProjectId = Convert.ToInt32(e.CommandArgument); projectDetailsBAL.UpdateProjectDetailsBAL(projectDetailsEntity); } catch (Exception ex) { // throw; } BindRepeater(); } // Check commond for delete if (e.CommandName == "delete") { try { ProjectDetailsBAL projectDetailsBAL = new ProjectDetailsBAL(); int projectId = Convert.ToInt32(e.CommandArgument); projectDetailsBAL.DeleteProjectDetailsBAL(projectId); } catch (Exception) { // throw; } BindRepeater(); } }