Ejemplo n.º 1
0
        /// <summary>
        /// Handles ItemCommand event of rptrRoleSkills 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 rptrRoleSkills_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            Label lblRoleSkill = (Label)e.Item.FindControl("lblRoleSkill");
            Label lblFromDate = (Label)e.Item.FindControl("lblFromDate");
            Label lblTillDate = (Label)e.Item.FindControl("lblTillDate");
            Label lblProficiency = (Label)e.Item.FindControl("lblProficiency");

            DropDownList ddlRoleSkill = (DropDownList)e.Item.FindControl("ddlRoleSkill");
            //TextBox txtAddSkill = (TextBox)e.Item.FindControl("txtAddSkill");
            DropDownList ddlFromMonth = (DropDownList)e.Item.FindControl("ddlFromMonth");
            DropDownList ddlFromYear = (DropDownList)e.Item.FindControl("ddlFromYear");
            DropDownList ddlTillMonth = (DropDownList)e.Item.FindControl("ddlTillMonth");
            DropDownList ddlTillYear = (DropDownList)e.Item.FindControl("ddlTillYear");
            DropDownList ddlProficiency = (DropDownList)e.Item.FindControl("ddlProficiency");

            LinkButton lnkEdit = (LinkButton)e.Item.FindControl("lnkEdit");
            LinkButton lnkDelete = (LinkButton)e.Item.FindControl("lnkDelete");
            LinkButton lnkUpdate = (LinkButton)e.Item.FindControl("lnkUpdate");
            LinkButton lnkCancel = (LinkButton)e.Item.FindControl("lnkCancel");
            // Check repeater commond for edit
            if (e.CommandName == "edit")
            {
                lblRoleSkill.Visible = false;
                lblFromDate.Visible = false;
                lblTillDate.Visible = false;
                lblProficiency.Visible = false;

                ddlRoleSkill.Visible = true;
                ddlFromMonth.Visible = true;
                ddlFromYear.Visible = true;
                ddlTillMonth.Visible = true;
                ddlTillYear.Visible = true;
                ddlProficiency.Visible = true;

                lnkEdit.Visible = false;
                lnkDelete.Visible = false;
                lnkUpdate.Visible = true;
                lnkCancel.Visible = true;
            }
            // Check repeater commond for update
            if (e.CommandName == "update")
            {
                CurrentDesiredJobEntity currentDesiredJobEntity = new CurrentDesiredJobEntity();
                currentDesiredJobEntity.RoleSkills = ddlRoleSkill.SelectedValue.Trim();
                currentDesiredJobEntity.FromDate = ddlFromMonth.SelectedItem.Text.Trim() + "/" + ddlFromYear.SelectedItem.Text.Trim();
                currentDesiredJobEntity.TillDate = ddlTillMonth.SelectedItem.Text.Trim() + "/" + ddlTillYear.SelectedItem.Text.Trim();
                currentDesiredJobEntity.Proficiency = ddlProficiency.SelectedItem.Text.Trim();
                currentDesiredJobEntity.SkillId = Convert.ToInt32(e.CommandArgument);
                currentDesiredJobEntity.TotalExperience = TotalYears();
                CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
                currentDesiredJobBAL.UpdateRoleSkillsBAL(currentDesiredJobEntity);
                BindRepeaterRoleSkills();
            }
            // Check repeater commond for delete
            if (e.CommandName == "delete")
            {
                int SkillId = Convert.ToInt32(e.CommandArgument);
                CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
                currentDesiredJobBAL.DeleteRoleSkillBAL(SkillId);
                BindRepeaterRoleSkills();
            }
            // Check repeater commond for cancel
            if (e.CommandName == "cancel")
            {
                BindRepeaterRoleSkills();
            }
        }