locked
Sharepoint- Development have a problems is filtering by passing the dictionary

    Вопрос

  • Hi i have created a listed box with multiple selection and then am passing that in the code like this kindly check it and how to pass this into the BLL and DAL files

    grid view

    <asp:ListBox ID="dllFilterOffice" runat="server" AutoPostBack="true"  OnSelectedIndexChanged="ddlFilterOffice_SelectedIndexChanged" Width=100px SelectionMode="Multiple" >
                                                    <asp:ListItem Text="MatBel" Value="1" />
                                                    <asp:ListItem Text="MatUkr" Value="2"  />
                                                    <asp:ListItem Text="MatMal" Value="3"  />
                                                </asp:ListBox>
                                                <span>BU/SU</span>
                                                <asp:ListBox ID="dllFilterBU" runat="server" AutoPostBack="true"  OnSelectedIndexChanged="ddlBU_SelectedIndexChanged" Width=100px SelectionMode="Multiple">
                                                <asp:ListItem Text="AMS" Value="01" />
                                                    <asp:ListItem Text="BME" Value="02"  />
                                                    <asp:ListItem Text="CMF" Value="03"  />
                                                </asp:ListBox>
                                                </div>

     protected void linqDs_Selecting(object sender, LinqDataSourceSelectEventArgs e)
            {
                Dictionary<string, string[]> filter = new Dictionary<string, string[]>();
                filter.Add("Offices", new string[] { "MatBel", "MatMal", "MatUkr" });
                filter.Add("BU_SU", new string[] { "SAM", "AMS", "CMF" });

    }

    SElection code:

     protected void ddlFilterOffice_SelectedIndexChanged(object sender, EventArgs e)
            {
                string selectedFilter = dllFilterOffice.SelectedValue;


                Parameter prm = new Parameter("filter", System.Data.DbType.String, selectedFilter);


                linqUrgentTrainingLists.SelectParameters.Add(prm);
            }

    My columns will not have that office and bu but i have get that one by using the code behind now that one is available in my linq so jus i want to pass and filter it...by selecting seperate combination ......AM doing Linq method to sharepoint.. I have manage the meta data in the office and BU_SU that y i use that for count the private void code is below but i did not copy here am getting the office and bu jus want to filter by using that ...... kindly help me

    DAL File

    public static List<TrainingWithCount> GetUrgentTrainingNeeds(Dictionary<string, string[]> filter)
            {
               


                List<TrainingWithCount> trainings = new List<TrainingWithCount>();
                try
                {
                    SPSecurity.RunWithElevatedPrivileges(delegate()
                    {
                        using (TrainingSheetDataContext dc = new TrainingSheetDataContext(Utils.SiteUrl))
                        {
                            trainings = (from s in dc.TrainingSubscriptions.ToList()
                                         where (s.Status == "Pending")
                                         group s by s.Training.Id into trainingGroup
                                         select new TrainingWithCount
                                         {
                                             Title = trainingGroup.First().Training.Title,
                                             TrainingId = trainingGroup.First().Training.Id.ToString(),
                                             Organizer = trainingGroup.First().Training.OrganizerImnName,
                                             Date = GetLatestSessionStartDate(int.Parse(trainingGroup.First().Training.Id.ToString())),
                                             Offices = "",
                                             BU_SU = "",
                                             Count = trainingGroup.Count()
                                         }).ToList<TrainingWithCount>();
                           


                            foreach (TrainingWithCount training in trainings)
                                for (int i = 0; i < trainings.Count; i++)
                                {
                                    string trainingId = trainings[i].TrainingId;


                                    string[] extraDetails = GetOfficeAndUnit(trainingId, Utils.SiteUrl);


                                    trainings[i].BU_SU = extraDetails[0];
                                    trainings[i].Offices = extraDetails[1];
                                }
                     

    21 февраля 2012 г. 4:11

Все ответы