public List <ProviderSkillDTO> GetProviderSkills(long providerid)
    {
        ProviderSkills = new List <ProviderSkillDTO>();

        command             = new SqlCommand(StoredProcedureName.Names.GetProviderSkills.ToString(), connection);
        command.CommandType = CommandType.StoredProcedure;

        command.Parameters.Add("@ProviderId", SqlDbType.BigInt);

        command.Parameters[0].Value = providerid;

        connection.Open();
        datareader = command.ExecuteReader();

        if (!datareader.HasRows)
        {
            return(null);
        }
        while (datareader.Read())
        {
            ProviderSkill              = new ProviderSkillDTO();
            ProviderSkill.ProviderId   = Convert.ToInt64(datareader["ProviderId"]);
            ProviderSkill.SkillId      = Convert.ToInt32(datareader["SkillId"]);
            ProviderSkill.SkillName    = datareader["SkillName"].ToString();
            ProviderSkill.Proficency   = (datareader["Proficency"]).ToString();
            ProviderSkill.ProjectUrl   = datareader["ProjectUrl"].ToString();
            ProviderSkill.Years        = (datareader["Years"]).ToString();
            ProviderSkill.CategoryName = datareader["CategoryName"].ToString();
            ProviderSkills.Add(ProviderSkill);
        }
        connection.Close();
        return(ProviderSkills);
    }
    public int InsertProviderSkill(ProviderSkillDTO ProviderSkill)
    {
        int rowaffected = 0;

        command             = new SqlCommand(StoredProcedureName.Names.AddProviderSkill.ToString(), connection);
        command.CommandType = CommandType.StoredProcedure;

        command.Parameters.Add("@ProviderId", SqlDbType.BigInt);
        command.Parameters.Add("@SkillId", SqlDbType.Int);
        command.Parameters.Add("@Proficency", SqlDbType.VarChar);
        command.Parameters.Add("@Years", SqlDbType.VarChar);
        command.Parameters.Add("@ProjectUrl", SqlDbType.VarChar);


        command.Parameters[0].Value = ProviderSkill.ProviderId;
        command.Parameters[1].Value = ProviderSkill.SkillId;
        command.Parameters[2].Value = ProviderSkill.Proficency;
        command.Parameters[3].Value = ProviderSkill.Years;
        command.Parameters[4].Value = ProviderSkill.ProjectUrl;

        connection.Open();
        rowaffected = command.ExecuteNonQuery();
        connection.Close();

        return(rowaffected);
    }
    //THIS FUNCTION IS AN EXCEPTION IT IS GETTING ALL THE SKILLS OF THE CATEGORY ID PROVIDED
    public List <ProviderSkillDTO> GetSkillByCategory(int skillCategoryId)
    {
        ProviderSkills = new List <ProviderSkillDTO>();

        command             = new SqlCommand(StoredProcedureName.Names.GetSkillByCategory.ToString(), connection);
        command.CommandType = CommandType.StoredProcedure;

        command.Parameters.Add("@SkillCategoryId", SqlDbType.Int);

        command.Parameters[0].Value = skillCategoryId;

        connection.Open();
        datareader = command.ExecuteReader();

        if (!datareader.HasRows)
        {
            return(null);
        }
        while (datareader.Read())
        {
            ProviderSkill                 = new ProviderSkillDTO();
            ProviderSkill.SkillId         = Convert.ToInt32(datareader["SkillId"]);
            ProviderSkill.SkillName       = datareader["SkillName"].ToString();
            ProviderSkill.SkillCategoryId = Convert.ToInt16(datareader["SkillCategoryId"]);
            ProviderSkills.Add(ProviderSkill);
        }
        connection.Close();
        return(ProviderSkills);
    }
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        ProviderSkill   = new ProviderSkillDTO();
        ProviderSkillbl = new ProviderSkillBL();

        ProviderSkill.ProviderId = ProviderId;
        ProviderSkill.SkillId    = Convert.ToInt32(DropDownSkill.SelectedValue);
        ProviderSkill.Proficency = DrpDwnLstProficency.SelectedItem.Value;
        ProviderSkill.Years      = DrpDwnYears.SelectedItem.Value;
        ProviderSkill.ProjectUrl = TxtProjectUrl.Text;

        int rowinserted = -1;

        rowinserted = ProviderSkillbl.InsertProviderSkill(ProviderSkill);

        if (rowinserted == -1)
        {
            LblAlreadyAdded.Visible = true;
        }
        else
        {
            Response.Redirect("~/Provider/Skill/AddProviderSkill.aspx");
        }
    }
Esempio n. 5
0
 public int InsertProviderSkill(ProviderSkillDTO ProviderSkill)
 {
     ProviderSkilldal = new ProviderSkillDAL();
     return(ProviderSkilldal.InsertProviderSkill(ProviderSkill));
 }