Click here to Skip to main content
15,916,835 members
Home / Discussions / C#
   

C#

 
AnswerRe: file can be write on XP but can not on VISTA Pin
Calla30-Sep-09 1:01
Calla30-Sep-09 1:01 
GeneralRe: file can be write on XP but can not on VISTA Pin
khosnur30-Sep-09 1:07
khosnur30-Sep-09 1:07 
GeneralRe: file can be write on XP but can not on VISTA Pin
Calla30-Sep-09 1:21
Calla30-Sep-09 1:21 
GeneralRe: file can be write on XP but can not on VISTA Pin
khosnur30-Sep-09 1:43
khosnur30-Sep-09 1:43 
GeneralRe: file can be write on XP but can not on VISTA Pin
DaveyM6930-Sep-09 1:28
professionalDaveyM6930-Sep-09 1:28 
GeneralRe: file can be write on XP but can not on VISTA Pin
khosnur30-Sep-09 1:45
khosnur30-Sep-09 1:45 
AnswerRe: file can be write on XP but can not on VISTA Pin
Keith Barrow30-Sep-09 1:09
professionalKeith Barrow30-Sep-09 1:09 
GeneralRe: file can be write on XP but can not on VISTA Pin
khosnur30-Sep-09 1:13
khosnur30-Sep-09 1:13 
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 

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.