void galatee_OkClickedSite(object sender, EventArgs e)
        {
            UcListeGenerique ctrs = sender as UcListeGenerique;

            if (ctrs.isOkClick)
            {
                CsSite leSite = (CsSite)ctrs.MyObject;
                this.Txt_LibelleSite.Text = leSite.LIBELLE;
                this.Txt_LibelleSite.Tag  = leSite.PK_ID;
                lSiteSelect = leSite;
                this.txtClient.IsReadOnly = false;
                List <ServiceAccueil.CsCentre> lsiteCentre = LstCentrePerimetre.Where(t => t.FK_IDCODESITE == (int)this.Txt_LibelleSite.Tag).ToList();
                if (lsiteCentre.Count == 1)
                {
                    this.Txt_LibelleCentre.Text = lsiteCentre.First().LIBELLE;
                    this.Txt_LibelleCentre.Tag  = lsiteCentre.First();
                    this.btn_Centre.IsEnabled   = false;
                    lProduitSelect = lsiteCentre.First().LESPRODUITSDUSITE;

                    this.Txt_Produit.Text = lProduitSelect.First().LIBELLE;
                    this.Txt_Produit.Tag  = lProduitSelect.First().CODE;
                }
                else
                {
                    this.Txt_LibelleCentre.Text = string.Empty;
                    this.Txt_LibelleCentre.Tag  = null;
                    this.btn_Centre.IsEnabled   = true;

                    this.Txt_Produit.Text = string.Empty;
                    this.Txt_Produit.Tag  = null;
                }
            }
            this.btn_Site.IsEnabled = true;
        }
        public static List <CsSite> RetourneSiteByCentre(List <CsCentre> _lstCentre)
        {
            try
            {
                // La grid doit afficher le detail d un recu par mode de reglement
                var leCentres = (from p in _lstCentre
                                 group new { p } by new { p.CODESITE, p.FK_IDCODESITE, p.LIBELLESITE } into pResult
                                 select new
                {
                    pResult.Key.CODESITE,
                    pResult.Key.FK_IDCODESITE,
                    pResult.Key.LIBELLESITE
                });

                List <CsSite> _LstSite = new List <CsSite>();

                foreach (var r in leCentres.OrderByDescending(p => p.CODESITE))
                {
                    CsSite _leSite = new CsSite();
                    _leSite.CODESITE = r.CODESITE;
                    _leSite.PK_ID    = r.FK_IDCODESITE;
                    _leSite.LIBELLE  = r.LIBELLESITE;
                    _LstSite.Add(_leSite);
                }
                return(_LstSite);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
 public List <CsSite> RetourneAgentFromCampagne(List <CsCAMPAGNE> _lstCampagne)
 {
     try
     {
         List <CsSite> _lstSiteDistinct = new List <CsSite>();
         var           ListSiteTemp     = (from p in _lstCampagne
                                           group new { p } by new { p.MATRICULEPIA, p.AGENTPIA, p.FK_IDMATRICULE } into pResult
                                           select new
         {
             pResult.Key.MATRICULEPIA,
             pResult.Key.AGENTPIA,
             pResult.Key.FK_IDMATRICULE
         });
         foreach (var item in ListSiteTemp)
         {
             CsSite leSite = new CsSite()
             {
                 CODE    = item.MATRICULEPIA,
                 LIBELLE = item.AGENTPIA,
                 PK_ID   = item.FK_IDMATRICULE
             };
             _lstSiteDistinct.Add(leSite);
         }
         return(_lstSiteDistinct);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#4
0
        private void cmbSite_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if ((this.cmbSite.SelectedItem != null) &&
                    ((this.cmbSite.SelectedItem as Galatee.Silverlight.ServiceRecouvrement.CsSite).CODE != string.Empty))
                {
                    CsSite leSiteSelect = this.cmbSite.SelectedItem as Galatee.Silverlight.ServiceRecouvrement.CsSite;
                    this.txtSite.Text = leSiteSelect.CODE;
                    this.txtSite.Tag  = leSiteSelect.PK_ID;
                    List <CsCAMPAGNE> lstCampagne = lesCampagne.Where(t => t.CODESITE == leSiteSelect.CODE && t.FK_IDSITE == leSiteSelect.PK_ID).ToList();
                    lstCentreCampagne          = RetourneCentreFromCampagne(lstCampagne);
                    this.cmbCentre.ItemsSource = null;
                    this.cmbCentre.ItemsSource = lstCentreCampagne;
                    lstAgentCampagne           = RetourneAgentFromCampagne(lstCampagne);
                    this.cmbAgent.ItemsSource  = null;
                    this.cmbAgent.ItemsSource  = lstAgentCampagne;

                    this.cmbCampagne.ItemsSource = null;
                    this.cmbCampagne.ItemsSource = lstCampagne;
                }
            }
            catch (Exception ex)
            {
                Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
            }
        }
示例#5
0
 public List <CsSite> RetourneSiteFromCampagne(List <CsCAMPAGNE> _lstCampagne)
 {
     try
     {
         List <CsSite> _lstSiteDistinct = new List <CsSite>();
         var           ListSiteTemp     = (from p in _lstCampagne
                                           group new { p } by new { p.FK_IDSITE, p.CODESITE, p.LIBELLESITE } into pResult
                                           select new
         {
             pResult.Key.FK_IDSITE,
             pResult.Key.CODESITE,
             pResult.Key.LIBELLESITE
         });
         foreach (var item in ListSiteTemp)
         {
             CsSite leSite = new CsSite()
             {
                 CODESITE = item.CODESITE,
                 PK_ID    = item.FK_IDSITE,
                 LIBELLE  = item.LIBELLESITE
             };
             _lstSiteDistinct.Add(leSite);
         }
         return(_lstSiteDistinct);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void galatee_OkSiteClicked(object sender, EventArgs e)
        {
            UcListeGenerique ctrs    = sender as UcListeGenerique;
            CsSite           _LeSite = (CsSite)ctrs.MyObject;

            this.Txt_CodeSite.Text = _LeSite.CODE;
            LstCentre = SessionObject.LstCentre.Where(t => t.FK_IDCODESITE == _LeSite.PK_ID).ToList();
        }
示例#7
0
 public bool Insert(CsSite pSite)
 {
     try
     {
         return(Entities.InsertEntity <Galatee.Entity.Model.SITE>(Entities.ConvertObject <Galatee.Entity.Model.SITE, CsSite>(pSite)));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private List <CsSite> GetInformationsFromScreen()
        {
            var listObjetForInsertOrUpdate = new List <CsSite>();

            try
            {
                if (Txt_Pwd.Password != Txt_ConfirmationPwd.Password)
                {
                    throw new Exception(Languages.MotDePasseIncorrect);
                }
                if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation)
                {
                    Txt_Site.Focus();
                    var Site = new CsSite
                    {
                        CODE          = Txt_Site.Text,
                        SERVEUR       = Txt_Serveur.Text,
                        LIBELLE       = Txt_Libelle.Text,
                        CATALOGUE     = Txt_Catalogue.Text,
                        PWD           = Galatee.Silverlight.Security.Cryptage.Encrypt(Txt_Pwd.Password),
                        NUMERODEMANDE = "1",
                        NUMEROFACTURE = "1",
                        DATECREATION  = DateTime.Now,
                        USERID        = Txt_Utilisateur.Text,
                        USERCREATION  = UserConnecte.matricule
                    };
                    if (!string.IsNullOrEmpty(Txt_Site.Text) && donnesDatagrid.FirstOrDefault(p => p.CODE != null && p.CODE == Site.CODE) != null)
                    {
                        throw new Exception(Languages.CetElementExisteDeja);
                    }
                    listObjetForInsertOrUpdate.Add(Site);
                }
                if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification)
                {
                    ObjetSelectionnee.CODE          = Txt_Site.Text;
                    ObjetSelectionnee.SERVEUR       = Txt_Serveur.Text;
                    ObjetSelectionnee.LIBELLE       = Txt_Libelle.Text;
                    ObjetSelectionnee.CATALOGUE     = Txt_Catalogue.Text;
                    ObjetSelectionnee.USERID        = Txt_Utilisateur.Text;
                    ObjetSelectionnee.NUMERODEMANDE = "1";
                    ObjetSelectionnee.NUMEROFACTURE = "1";
                    ObjetSelectionnee.PWD           = Security.Cryptage.Encrypt(Txt_Pwd.Password);
                    ObjetSelectionnee.DATECREATION  = DateTime.Now;
                    ObjetSelectionnee.USERCREATION  = UserConnecte.matricule;
                    listObjetForInsertOrUpdate.Add(ObjetSelectionnee);
                }
                return(listObjetForInsertOrUpdate);
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, Languages.Site);
                return(null);
            }
        }
        void galatee_OkClickedSite(object sender, EventArgs e)
        {
            UcListeGenerique ctrs = sender as UcListeGenerique;

            if (ctrs.isOkClick)
            {
                CsSite leSite = (CsSite)ctrs.MyObject;
                this.Txt_CodeSite.Text = leSite.CODESITE;
                this.LstCentre         = LstCentre.Where(t => t.FK_IDCODESITE == leSite.PK_ID).ToList();
            }
        }
示例#10
0
        void galatee_OkClickedSite2(object sender, EventArgs e)
        {
            UcListeGenerique ctrs = sender as UcListeGenerique;

            if (ctrs.isOkClick)
            {
                this.btn_Site.IsEnabled = true;
                CsSite leSite = (CsSite)ctrs.MyObject;
                this.Txt_CodeSite2.Text = leSite.CODE;
            }
            else
            {
                this.btn_Centre.IsEnabled = true;
            }
        }
 private void cmbAgent_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if ((this.cmbAgent.SelectedItem != null) &&
             ((this.cmbAgent.SelectedItem as CsSite).LIBELLE != string.Empty))
         {
             CsSite leAgentSelect = this.cmbAgent.SelectedItem as CsSite;
             this.txtAgent.Text = leAgentSelect.CODE;
             this.txtAgent.Tag  = leAgentSelect.PK_ID;
         }
     }
     catch (Exception ex)
     {
         Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
     }
 }
示例#12
0
        public UcSite(object[] pObjects, SessionObject.ExecMode[] pExecMode, DataGrid[] pGrid)
        {
            try
            {
                InitializeComponent();
                Translate();
                var site = new CsSite();
                if (pObjects[0] != null)
                {
                    ObjetSelectionnee = Utility.ParseObject(site, pObjects[0] as CsSite);
                }
                ModeExecution = pExecMode[0];
                dataGrid      = pGrid[0];
                if (dataGrid != null)
                {
                    donnesDatagrid = dataGrid.ItemsSource as ObservableCollection <CsSite>;
                }
                if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification ||
                    (SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Consultation)
                {
                    if (ObjetSelectionnee != null)
                    {
                        Txt_Site.Text                = ObjetSelectionnee.CODE ?? string.Empty;
                        Txt_Serveur.Text             = ObjetSelectionnee.SERVEUR ?? string.Empty;
                        Txt_Libelle.Text             = ObjetSelectionnee.LIBELLE ?? string.Empty;
                        Txt_Catalogue.Text           = ObjetSelectionnee.CATALOGUE ?? string.Empty;
                        Txt_Utilisateur.Text         = ObjetSelectionnee.USERID ?? string.Empty;
                        Txt_Pwd.Password             = Security.Cryptage.Decrypt(ObjetSelectionnee.PWD) ?? string.Empty;
                        Txt_ConfirmationPwd.Password = Security.Cryptage.Decrypt(ObjetSelectionnee.PWD) ?? string.Empty;
                        Txt_Libelle.Focus();
                        btnOk.IsEnabled = false;

                        //Txt_Site.IsReadOnly = true;
                    }
                }
                if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Consultation)
                {
                    AllInOne.ActivateControlsFromXaml(LayoutRoot, false);
                }
                VerifierSaisie();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, Languages.Site);
            }
        }
示例#13
0
        private bool TesterConnexion(CsSite pSite, out string pErreur)
        {
            pErreur = string.Empty;
            string connexion = "Data Source={0};Initial Catalog={1};User ID={2};Password={3};Persist Security Info=True";

            try
            {
                string myConnexion  = string.Format(connexion, pSite.SERVEUR, pSite.CATALOGUE, pSite.USERID, pSite.PWD);
                var    sqlConnexion = new SqlConnection(myConnexion);
                sqlConnexion.Open();
                return(true);
            }
            catch (Exception ex)
            {
                pErreur = ex.Message;
                return(false);
            }
        }
 private void Txt_CodeSite_TextChanged(object sender, TextChangedEventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(Txt_CodeSite.Text) && Txt_CodeSite.Text.Length == SessionObject.Enumere.TailleCentre)
         {
             CsSite _LeSiteClient = ClasseMEthodeGenerique.RetourneObjectFromList(lstSite, this.Txt_CodeSite.Text, "CODE");
             if (!string.IsNullOrEmpty(_LeSiteClient.LIBELLE))
             {
                 this.Txt_LibelleSite.Text = _LeSiteClient.LIBELLE;
                 LstCentre = SessionObject.LstCentre.Where(t => t.FK_IDCODESITE == _LeSiteClient.PK_ID).ToList();
             }
         }
     }
     catch (Exception ex)
     {
         Message.ShowError(ex.Message, Langue.lbl_Menu);
     }
 }
 private void Txt_CodeSite_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (this.Txt_CodeSite.Text.Length == SessionObject.Enumere.TailleCentre)
     {
         CsSite _LeSite = ClasseMEthodeGenerique.RetourneObjectFromList <CsSite>(lstSite, this.Txt_CodeSite.Text, "CODESITE");
         if (_LeSite != null && !string.IsNullOrEmpty(_LeSite.CODESITE))
         {
             this.Txt_LibelleSite.Text = _LeSite.LIBELLE;
         }
         else
         {
             var w = new MessageBoxControl.MessageBoxChildWindow(Langue.lbl_Menu, Langue.MsgEltInexistent, MessageBoxControl.MessageBoxButtons.Ok, MessageBoxControl.MessageBoxIcon.Information);
             w.OnMessageBoxClosed += (_, result) =>
             {
                 this.Txt_CodeCentre.Focus();
             };
             w.Show();
         }
     }
 }
示例#16
0
 private void UpdateParentList(CsSite pSite)
 {
     try
     {
         if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation)
         {
             GetDataNew();
             //donnesDatagrid.Add(pSite);
             //donnesDatagrid.OrderBy(p=>p.PK_ID);
         }
         if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification)
         {
             GetDataNew();
             //var Site = donnesDatagrid.First(p => p.PK_ID == pSite.PK_ID);
             //donnesDatagrid.Remove(Site);
             //donnesDatagrid.Add(pSite);
             //donnesDatagrid.OrderBy(p => p.PK_ID);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#17
0
        private void cmbAgent_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if ((this.cmbAgent.SelectedItem != null) &&
                    ((this.cmbAgent.SelectedItem as CsSite).LIBELLE != string.Empty))
                {
                    CsSite leAgentSelect = this.cmbAgent.SelectedItem as CsSite;
                    this.txtAgent.Text = leAgentSelect.CODE;
                    this.txtAgent.Tag  = leAgentSelect.PK_ID;



                    List <CsCAMPAGNE> lstCampagne       = lesCampagne.Where(t => t.FK_IDMATRICULE == leAgentSelect.PK_ID).ToList();
                    List <CsSite>     lsteAgentCampagne = RetourneAgentFromCampagne(lstCampagne);
                    this.cmbCampagne.ItemsSource = null;
                    this.cmbCampagne.ItemsSource = lstCampagne;
                }
            }
            catch (Exception ex)
            {
                Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
            }
        }