Click here to Skip to main content
15,887,135 members
Home / Discussions / C#
   

C#

 
AnswerRe: file can be write on XP but can not on VISTA Pin
Richard MacCutchan30-Sep-09 3:05
mveRichard MacCutchan30-Sep-09 3:05 
QuestionCD Burning in VISTA Pin
Edward Topalian30-Sep-09 0:39
Edward Topalian30-Sep-09 0:39 
AnswerRe: CD Burning in VISTA Pin
Christian Graus30-Sep-09 0:43
protectorChristian Graus30-Sep-09 0:43 
AnswerRe: CD Burning in VISTA [modified] Pin
User 21559730-Sep-09 0:57
User 21559730-Sep-09 0:57 
QuestionCrystal report color Pin
antala30-Sep-09 0:27
antala30-Sep-09 0:27 
AnswerRe: Crystal report color Pin
Christian Graus30-Sep-09 0:42
protectorChristian Graus30-Sep-09 0:42 
QuestionFind MIN value in binding? Pin
kanchoette30-Sep-09 0:02
kanchoette30-Sep-09 0:02 
QuestionThe type of a linq request Pin
teycir29-Sep-09 23:50
teycir29-Sep-09 23:50 
Hi;
I'm calling stored procedures using linq to sql to fill comboboxes from a database.
I have the method ConnectFilter() above that i want to refactor.
I started refactoring using FillComboWithData(ComboBox combo, string value, string display, DataClassesReferentielDataContext dc, XXXXX) above.
DataClassesReferentielDataContext is the Linq datacontext, it contains all the database mapped into objects.
By the way the stored procedures call many fields of many tables.
Here an example of a stored proc: P_ESS_Categorie_BIS.
I don't know how to enter the stored procedure as an argument (in place of XXXXX).
I think the argument should be an enumerable.
Thanks.


private DataClassesReferentielDataContext _dc = new DataClassesReferentielDataContext();
// The method I want to refactor
 private void ConnectFilter()
        {
            comboBoxCountryFilter.DataSource = _dc.P_ESS_Entite();
            comboBoxCountryFilter.ValueMember = "PAY_Code";
            comboBoxCountryFilter.DisplayMember = "PAY_Libelle";
            var statut = from s in _dc.TR_Statuts select s;
            comboBoxStatusFilter.DataSource = statut.ToArray();
            comboBoxStatusFilter.ValueMember = "STA_ID";
            comboBoxStatusFilter.DisplayMember = "STA_Libelle";
            comboBoxCategoryFilter.DataSource = _dc.P_ESS_Categorie_BIS((int) Selections.VueRefId);
            comboBoxCategoryFilter.ValueMember = "CAT_Code";
            comboBoxCategoryFilter.DisplayMember = "CAT_Libelle";
            comboBoxItPlanFilter.DataSource = _dc.P_ESS_ITPlan_BIS((int) Selections.VueRefId);
            comboBoxItPlanFilter.ValueMember = "ITP_Code";
            comboBoxItPlanFilter.DisplayMember = "ITP_Libelle";
            comboBoxGroupFilter.DataSource = _dc.P_ESS_GroupeProjet_BIS((int) Selections.VueRefId);
            comboBoxGroupFilter.ValueMember = "GRP_Code";
            comboBoxGroupFilter.DisplayMember = "GRP_Libelle";
            comboBoxSponsorFilter.DataSource = _dc.P_ESS_Sponsor_BIS((int) Selections.VueRefId);
            comboBoxSponsorFilter.ValueMember = "SPO_Code";
            comboBoxSponsorFilter.DisplayMember = "SPO_Libelle";
            comboBoxThemaFilter.DataSource = _dc.P_ESS_ThematiqueProjet_BIS((int) Selections.VueRefId);
            comboBoxThemaFilter.ValueMember = "THE_Code";
            comboBoxThemaFilter.DisplayMember = "THE_Libelle";
            comboBoxPersonFilter.DataSource = _dc.P_TR_Personne_Liste_Filtre();
            comboBoxPersonFilter.ValueMember = "PER_ID";
            comboBoxPersonFilter.DisplayMember = "PER_NomUT";
        }
 
 
// The refactoring
  private void FillComboWithData(ComboBox combo, string value, string display, DataClassesReferentielDataContext dc, XXXXX)
        {
            combo.DataSource = _dc.P_ESS_NatureProjet_BIS((int)Selections.VueRefId); // The proc call i want to enter as an argument of FillComboWithData
            combo.ValueMember = value.Trim();
            combo.DisplayMember = display.Trim();
        }


ALTER PROCEDURE  [dbo].[P_ESS_Categorie_BIS]  
	 @Vue_Referentiel numeric(10,0)
AS
BEGIN
 
SELECT [CAT_Code]
      ,[CAT_Libelle]
  FROM [TR_Categorie] 
WHERE     ([TR_Categorie].VUR_Id = @Vue_Referentiel) 
order by [CAT_Libelle]
END 

QuestionGo to line ! Pin
amir-haghighi29-Sep-09 23:27
amir-haghighi29-Sep-09 23:27 
AnswerRe: Go to line ! Pin
Christian Graus30-Sep-09 0:37
protectorChristian Graus30-Sep-09 0:37 
AnswerRe: Go to line ! Pin
Henry Minute30-Sep-09 0:45
Henry Minute30-Sep-09 0:45 
QuestionTextbox input validation Pin
teknolog12329-Sep-09 23:18
teknolog12329-Sep-09 23:18 
AnswerRe: Textbox input validation Pin
stancrm29-Sep-09 23:24
stancrm29-Sep-09 23:24 
GeneralRe: Textbox input validation Pin
teknolog12329-Sep-09 23:58
teknolog12329-Sep-09 23:58 
GeneralRe: Textbox input validation Pin
Calla30-Sep-09 2:34
Calla30-Sep-09 2:34 
QuestionHow to create a Zip Folder with C#.Net Pin
Rahad Rahman29-Sep-09 23:06
professionalRahad Rahman29-Sep-09 23:06 
AnswerRe: How to create a Zip Folder with C#.Net Pin
stancrm29-Sep-09 23:21
stancrm29-Sep-09 23:21 
AnswerRe: How to create a Zip Folder with C#.Net Pin
Paramhans Dubey29-Sep-09 23:26
professionalParamhans Dubey29-Sep-09 23:26 
GeneralRe: How to create a Zip Folder with C#.Net Pin
Paramhans Dubey29-Sep-09 23:27
professionalParamhans Dubey29-Sep-09 23:27 
QuestionHow to stop MSSQL database server with C#.net Pin
Rahad Rahman29-Sep-09 22:39
professionalRahad Rahman29-Sep-09 22:39 
AnswerRe: How to stop MSSQL database server with C#.net Pin
Manas Bhardwaj29-Sep-09 22:44
professionalManas Bhardwaj29-Sep-09 22:44 
AnswerRe: How to stop MSSQL database server with C#.net Pin
Mirko198029-Sep-09 22:44
Mirko198029-Sep-09 22:44 
Questionsocket over the internet? Pin
Tridip Bhattacharjee29-Sep-09 22:34
professionalTridip Bhattacharjee29-Sep-09 22:34 
AnswerRe: socket over the internet? Pin
SeMartens29-Sep-09 22:37
SeMartens29-Sep-09 22:37 
QuestionRetrieve timetable from website to send out as SMS Pin
sheateng29-Sep-09 21:54
sheateng29-Sep-09 21:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.