示例#1
0
        public void UpdateTimeInfo(TimeInformationViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException("viewModel", "Argument cannot be null.");
            }

            CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));

            service.ChargerListeCodeRegroupementCompleted += new EventHandler <ChargerListeCodeRegroupementCompletedEventArgs>(FillData);

            var Status = new AsyncCallStatus <ChargerListeCodeRegroupementCompletedEventArgs>();

            service.ChargerListeCodeRegroupementAsync(Status);
            m_autoResetEvent.WaitOne();

            //if (Status.CompletedEventArgs. != null)
            //{
            //    throw Status.CompletedEventArgs.Error;
            //}
            List <CsRegCli> groupingCode = new List <CsRegCli>();

            groupingCodes = Status.CompletedEventArgs.Result;
            //viewModel.CurrentCode.AddRange(Status.CompletedEventArgs.Result);
        }
 private void RetourneCaisseNonReverser(CsHabilitationCaisse laCaisse)
 {
     try
     {
         CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleIndex(), Utility.EndPoint("Caisse"));
         service.RetourneHabileCaisseNonReversementAsync(laCaisse);
         service.RetourneHabileCaisseNonReversementCompleted += (s, args) =>
         {
             if (args.Cancelled || args.Error != null)
             {
                 Message.ShowError("Un problème est survenu lors de la fermeture de caisse", "Information");
             }
             leCaisseHabilNonReverse = args.Result;
             if (leCaisseHabilNonReverse != null && leCaisseHabilNonReverse.Count != 0)
             {
                 this.btn_Detail.IsEnabled  = true;
                 Txt_MontantNonReverse.Text = leCaisseHabilNonReverse.Sum(t => t.ECART).Value.ToString(SessionObject.FormatMontant);
             }
             else
             {
                 this.Txt_MontantNonReverse.Text = initValue.ToString(SessionObject.FormatMontant);
             }
             RetourneReversement(laCaisse);
         };
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        void RetourneCaisseCourante()
        {
            try
            {
                CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));
                service.RetouneLaCaisseCouranteAsync(UserConnecte.matricule);
                service.RetouneLaCaisseCouranteCompleted += (s, args) =>
                {
                    if (args.Cancelled || args.Error != null)
                    {
                        Message.ShowError("Erreur de chargement des reçus de la caisse. Réessayez svp !", "Erreur");
                        this.DialogResult = true;
                    }

                    if (args.Result != null)
                    {
                        SessionObject.LaCaisseCourante = args.Result;
                    }
                };
                service.CloseAsync();
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void ValidationFermetureCaisse(CsHabilitationCaisse laCaisse)
        {
            CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleIndex(), Utility.EndPoint("Caisse"));

            service.FermetureCaisseCompleted += (s, args) =>
            {
                if (args.Cancelled || args.Error != null || args.Result == null)
                {
                    Message.ShowError("Un problème est survenu lors de la fermeture de caisse", "Information");
                }
                else
                {
                    // log out current user
                    if (args.Result.Value == true)
                    {
                        //Message.ShowInformation("La caisse est fermée, vous allez devoir vous reconnecter","Information");// "Information", MessageBoxButton.OK) == MessageBoxResult.OK)
                        HtmlPage.Document.Submit();
                    }
                    else
                    {
                        Message.ShowError("Impossible de fermer la caisse. Veuillez réessayer", "Information");
                    }
                }
            };
            service.FermetureCaisseAsync(laCaisse);
        }
示例#5
0
        void RetourneReglementEncaisse()
        {
            try
            {
                CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));
                service.RetourneRecuDeCaissePourAnnulationAsync(SessionObject.LaCaisseCourante.PK_ID);
                service.RetourneRecuDeCaissePourAnnulationCompleted += (s, args) =>
                {
                    if (args.Cancelled || args.Error != null)
                    {
                        Message.ShowError("Erreur de chargement des reçus de la caisse. Réessayez svp !", "Erreur");
                        this.DialogResult = true;
                    }

                    if (args.Result == null || args.Result.Count == 0)
                    {
                        Message.ShowError("Aucun encaissement n'a été effectué.", Langue.errorTitle);
                        return;
                    }
                    List <CsLclient> _LstReglement = new List <CsLclient>();
                    _LstReglement    = args.Result;
                    _LstrefReglement = _LstReglement;
                    if (_LstReglement != null && _LstReglement.Count != 0)
                    {
                        RemplireCombo(_LstReglement.Where(t => string.IsNullOrEmpty(t.TOPANNUL)).OrderBy(a => a.ACQUIT).ToList());
                    }
                };
                service.CloseAsync();
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#6
0
        private void ChargerHabilitationCaisse()
        {
            CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));

            service.RetouneLaCaisseCouranteAsync(UserConnecte.matricule);
            service.RetouneLaCaisseCouranteCompleted += (sender, es) =>
            {
                try
                {
                    if (es.Cancelled || es.Error != null)
                    {
                        Message.ShowError("Erreur d'invocation du service . Veuillez réssayer svp!", Galatee.Silverlight.Resources.Langue.errorTitle);
                        this.DialogResult = true;
                    }

                    if (es.Result == null)
                    {
                        Message.ShowError("Aucune données trouvées", Langue.errorTitle);
                        return;
                    }

                    SessionObject.LaCaisseCourante = es.Result;
                    RetourneReglementEncaisse();
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, Langue.errorTitle);
                }
            };
        }
示例#7
0
        private void ChargerListeCaisseDispo()
        {
            //UserConnecte.Centre = Silverlight.Classes.IsolatedStorage.getCentre();
            CaisseServiceClient srv = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));

            srv.ListeCaisseDisponibleCompleted += (ss, ee) =>
            {
                try
                {
                    if (ee.Cancelled || ee.Error != null || ee.Result == null)
                    {
                        string error = ee.Error.InnerException.ToString();
                        return;
                    }
                    SessionObject.ListeCaisse = ee.Result;
                    if (SessionObject.ListeCaisse.Count > 0)
                    {
                        LoadInfoInControl();
                    }
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, Galatee.Silverlight.Resources.Caisse.Langue.errorTitle);
                }
            };
            srv.ListeCaisseDisponibleAsync(UserConnecte.Centre, UserConnecte.matricule);
        }
        private void ValidationReversementCaisse(List <CsHabilitationCaisse> leIdCaisse)
        {
            List <CsReversementCaisse> lstReversemnt = new List <CsReversementCaisse>();

            foreach (CsHabilitationCaisse item in leIdCaisse)
            {
                lstReversemnt.Add(new CsReversementCaisse()
                {
                    FK_IDHABILITATIONCAISSE = item.PK_ID,
                    MONTANT          = item.MONTANTENCAISSE,
                    DATE             = DateTime.Now,
                    IsCAISSECOURANTE = item.IsCAISSECOURANTE
                });
            }
            CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleIndex(), Utility.EndPoint(this));

            service.ReverserCaisseCompleted += (s, args) =>
            {
                if (args.Cancelled || args.Error != null || args.Result == null)
                {
                    Message.ShowError("Un problème est survenu lors de la fermeture de caisse", "Information");
                }
                else
                {
                    if (args.Result == true)
                    {
                        Message.ShowInformation(Langue.msgReversement, Langue.LibelleModule);
                    }
                }
            };
            service.ReverserCaisseAsync(lstReversemnt);
        }
 public void validerAnnulation(List <CsLclient> _lstReglement)
 {
     try
     {
         CaisseServiceClient srv = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));
         srv.ValiderAnnuleEncaissementAsync(Galatee.Silverlight.Caisse.MethodeGenerics.RetourneDistincAcquitement(_lstReglement));
         srv.ValiderAnnuleEncaissementCompleted += (factor, es) =>
         {
             if (es.Error != null || es.Cancelled)
             {
                 Message.ShowError("L'insertion des encaissements a retournée une erreur. Réessayer svp! :" + es.Error.Message, "Erreur");
                 return;
             }
             if (es.Result == null)
             {
                 Message.ShowError("L'insertion des encaissements a retournée une erreur. Réessayer svp!", "Erreur");
                 return;
             }
             EditionDeRecu(_lstReglement);
             this.OKButton.IsEnabled = false;
         };
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#10
0
        private void AjustementDeFondCaisse()
        {
            CaisseServiceClient srv = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));

            srv.AjustementDeFondCaisseCompleted += (ss, ee) =>
            {
                try
                {
                    if (ee.Cancelled || ee.Error != null || ee.Result == null)
                    {
                        string error = ee.Error.InnerException.ToString();
                        return;
                    }
                    Message.ShowError("Ajustement effectué avec succès", "");
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, Galatee.Silverlight.Resources.Caisse.Langue.errorTitle);
                }
            };
            if (!string.IsNullOrEmpty(this.txtNumCaisse.Text) && !string.IsNullOrEmpty(this.txtFondNouveau.Text) && !string.IsNullOrEmpty(this.txtFondActuel.Text) && !string.IsNullOrEmpty(this.cbo_MoisComptable.SelectedValue.ToString()))
            {
                srv.AjustementDeFondCaisseAsync(this.txtNumCaisse.Text, (decimal.Parse(this.txtFondNouveau.Text) - decimal.Parse(this.txtFondActuel.Text)).ToString(), this.cbo_MoisComptable.SelectedValue.ToString(), UserConnecte.matricule);
            }
        }
 public void validerRejetAnnulation(List <CsLclient> _lstReglement)
 {
     try
     {
         this.DialogResult = true;
         CaisseServiceClient srv = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));
         srv.RejeterAnnuleEncaissementAsync(_lstReglement);
         srv.RejeterAnnuleEncaissementCompleted += (factor, es) =>
         {
             if (es.Error != null || es.Cancelled)
             {
                 Message.ShowError("L'insertion des encaissements a retournée une erreur. Réessayer svp! :" + es.Error.Message, "Erreur");
                 return;
             }
             if (es.Result == null)
             {
                 Message.ShowError("L'insertion des encaissements a retournée une erreur. Réessayer svp!", "Erreur");
                 return;
             }
             this.OKButton.IsEnabled = false;
         };
     }
     catch (Exception)
     {
         throw;
     }
 }
        private void RecuperationListBanque()
        {
            if (SessionObject.ListeBanques != null || SessionObject.ListeBanques.Count > 0)
            {
                return;
            }

            CaisseServiceClient srv = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));

            srv.RetourneListeDesBanquesCompleted += (ss, ee) =>
            {
                try
                {
                    if (ee.Cancelled || ee.Error != null || ee.Result == null)
                    {
                        string error = ee.Error.InnerException.ToString();
                        return;
                    }

                    //Assignation de la variable de session contenant la liste des banques
                    SessionObject.ListeBanques = ee.Result;
                    if (SessionObject.ListeBanques == null || SessionObject.ListeBanques.Count == 0)
                    {
                        return;
                    }
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, Langue.errorTitle);
                }
            };
            srv.RetourneListeDesBanquesAsync();
        }
        private void ListeDesTransactions(CsHabilitationCaisse laCaisse)
        {
            int handler = LoadingManager.BeginLoading("Traitement en cours ...");

            try
            {
                if (!string.IsNullOrWhiteSpace(TxtDateCaisse.Text))
                {
                    DateTime debut = DateTime.Today;
                    DateTime fin   = (DateTime.Today.AddDays(1));

                    CaisseServiceClient proxy = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));
                    proxy.LitseDesTransactionAsync(laCaisse);
                    proxy.LitseDesTransactionCompleted += (senders, results) =>
                    {
                        if (results.Cancelled || results.Error != null)
                        {
                            string error = results.Error.Message;
                            MessageBox.Show("errror occurs while calling remote method", "ReportListeEncaissements", MessageBoxButton.OK);
                            return;
                        }
                        if (results.Result == null || results.Result.Count == 0)
                        {
                            Message.ShowInformation("Aucune donnée trouvée", "Caisse");
                            return;
                        }

                        List <ServiceCaisse.CsLclient> dataTable = new List <ServiceCaisse.CsLclient>();
                        List <ServiceCaisse.CsLclient> tri       = new List <ServiceCaisse.CsLclient>();
                        dataTable.AddRange(results.Result);

                        tri   = results.Result.OrderBy(t => t.DTRANS).ToList();
                        debut = tri[0].DTRANS.Value;
                        fin   = tri[tri.Count - 1].DTRANS.Value;


                        Dictionary <string, string> param = new Dictionary <string, string>();
                        param.Add("pUser", !string.IsNullOrWhiteSpace(SessionObject.LaCaisseCourante.MATRICULE) ? "Matricule : " + SessionObject.LaCaisseCourante.NOMCAISSE  : "Matricule :Aucun");
                        param.Add("pDateDebut", "Date debut : " + debut);
                        param.Add("pDateFin", "Date fin : " + fin);

                        string key = Utility.getKey();
                        Utility.ActionDirectOrientation <ServicePrintings.CsLclient, ServiceCaisse.CsLclient>(dataTable, param, SessionObject.CheminImpression, "ListeDesTransactions".Trim(), "Caisse".Trim(), true);
                        LoadingManager.EndLoading(handler);
                    };
                }
                else
                {
                    Message.Show("Veuillez choisir un utilisateur et réessayer svp! ", "Information");
                    LoadingManager.EndLoading(handler);
                }
            }
            catch (Exception ex)
            {
                LoadingManager.EndLoading(handler);
            }
            finally
            {
            }
        }
 private void RetourneCaisseHabille(List <int> LstCentreCaisse)
 {
     try
     {
         CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint(this));
         service.RetourneListeCaisseHabiliteAsync(LstCentreCaisse);
         service.RetourneListeCaisseHabiliteCompleted += (sender, es) =>
         {
             try
             {
                 if (es.Cancelled || es.Error != null || es.Result == null)
                 {
                     Message.ShowError("Erreur d'annulation du reçu. Veuillez réessayer svp !", Langue.errorTitle);
                     return;
                 }
                 _listDesCaisseOuverte = es.Result;
             }
             catch (Exception ex)
             {
                 Message.ShowError(ex, Langue.errorTitle);
             }
         };
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#15
0
        private void RetourneLstFraixTimbre()
        {
            string ServerMode = "Online";

            CaisseServiceClient cais = new CaisseServiceClient(Utility.Protocole(), Utility.EndPoint("Caisse"));

            cais.RetourneListeTimbreCompleted += (send, aa) =>
            {
                try
                {
                    if (aa.Cancelled || aa.Error != null)
                    {
                        Message.Show(Galatee.Silverlight.Resources.Langue.wcf_error, Galatee.Silverlight.Resources.Langue.errorTitle);
                        return;
                    }
                    if (aa.Result == null || aa.Result.Count == 0)
                    {
                        Message.Show(Galatee.Silverlight.Resources.Langue.msgNodata, "RetourneListeTimbre =>" + Galatee.Silverlight.Resources.Langue.informationTitle);
                        return;
                    }
                    SessionObject.LstFraisTimbre = aa.Result;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            };
            cais.RetourneListeTimbreAsync(ServerMode);
        }
示例#16
0
        void ChargerTauxMini(string code)
        {
            CaisseServiceClient service = new CaisseServiceClient(Utility.Protocole(), Utility.EndPoint("Caisse"));

            service.RetourneListeTa58Completed += (s, args) =>
            {
                if (args.Error != null && args.Cancelled)
                {
                    Message.ShowError("Erreur du serveur. Réessayer svp!", Langue.errorTitle);
                    return;
                }

                if (args.Result == null)
                {
                    Message.ShowError("Echec lors de la récupération du taux minimal.Réessayer svp!", Langue.errorTitle);
                    return;
                }

                try
                {
                    Txt_NumeroDemande.IsEnabled = true;
                    CsParametresGeneraux _LeParametre = args.Result;
                    _LetauxMinimal = int.Parse(_LeParametre.LIBELLE);
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, Langue.errorTitle);
                }
            };
            service.RetourneListeTa58Async(code);
        }
        private void MiseAjourDemandeAnnulation(List <ServiceCaisse.CsLclient> leReglement)
        {
            CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint(this));

            service.DemandeAnnulationEncaissementAsync(leReglement);
            service.DemandeAnnulationEncaissementCompleted += (sender, es) =>
            {
                try
                {
                    if (es.Cancelled || es.Error != null || es.Result == null)
                    {
                        Message.ShowError("Erreur d'annulation du reçu. Veuillez réessayer svp !", Langue.errorTitle);
                        return;
                    }

                    List <ServiceCaisse.CsLclient> lstInitData1 = (List <ServiceCaisse.CsLclient>) this.dtg_FactureAjouter.ItemsSource;
                    lstInitData1.AddRange(_LstrefReglement.Where(t => t.ACQUIT == leReglement.First().ACQUIT));
                    List <ServiceCaisse.CsLclient> lstReglementAjouter = RetourneEltsDataGrid2(lstInitData1);
                    dtg_FactureAjouter.ItemsSource = null;
                    dtg_FactureAjouter.ItemsSource = lstReglementAjouter;

                    List <ServiceCaisse.CsLclient> lstInitData2 = (List <ServiceCaisse.CsLclient>) this.dtg_FactureAAnnule.ItemsSource;
                    List <ServiceCaisse.CsLclient> lstAAfficher = new List <ServiceCaisse.CsLclient>();
                    lstInitData2.RemoveAll(t => t.ACQUIT == leReglement.First().ACQUIT);
                    dtg_FactureAAnnule.ItemsSource = null;
                    dtg_FactureAAnnule.ItemsSource = lstInitData2;
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, Langue.errorTitle);
                }
            };
        }
示例#18
0
        private void RecuperationListBanque()
        {
            if (SessionObject.ListeBanques == null)
            {
                int loaderHandler       = LoadingManager.BeginLoading(Langue.Data_Loading);
                CaisseServiceClient srv = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));
                srv.RetourneListeDesBanquesCompleted += (ss, ee) =>
                {
                    try
                    {
                        if (ee.Cancelled || ee.Error != null || ee.Result == null)
                        {
                            string error = ee.Error.InnerException.ToString();
                            return;
                        }

                        //Assignation de la variable de session contenant la liste des banques
                        SessionObject.ListeBanques = ee.Result;
                        if (SessionObject.ListeBanques == null || SessionObject.ListeBanques.Count == 0)
                        {
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        Message.ShowError(ex, Galatee.Silverlight.Resources.Caisse.Langue.errorTitle);
                    }
                    finally
                    {
                        LoadingManager.EndLoading(loaderHandler);
                    }
                };
                srv.RetourneListeDesBanquesAsync();
            }
        }
        private void btnView_Click(object sender, RoutedEventArgs e)
        {
            if (selectedClient != null)
            {
                btnView.IsEnabled = false;
                CaisseServiceClient Service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));
                Service.RetourneListeFactureNonSoldeCompleted += (s, results) =>
                {
                    if (results.Cancelled || results.Error != null)
                    {
                        MessageBox.Show("error d'invocation du service");
                        btnView.IsEnabled = true;
                        return;
                    }

                    if (results.Result == null)
                    {
                        MessageBox.Show("no data match for those criteria");
                        btnView.IsEnabled = true;
                        return;
                    }
                    else
                    {
                        if (results.Result.Count > 0)
                        {
                            List <CsLclient> _lstFact = results.Result;
                            //if (_rang == 2)
                            //{
                            //    if (this.comboBox1.SelectedItem.ToString() == "=")
                            //        _lstFact = _lstFact.Where(p => p.MONTANT == Convert.ToDecimal(this.txtreference.Text)).ToList();
                            //    else if (this.comboBox1.SelectedItem.ToString() == ">=")
                            //        _lstFact = _lstFact.Where(p => p.MONTANT >= Convert.ToDecimal(this.txtreference.Text)).ToList();
                            //    else if (this.comboBox1.SelectedItem.ToString() == "<=")
                            //        _lstFact = _lstFact.Where(p => p.MONTANT <= Convert.ToDecimal(this.txtreference.Text)).ToList();
                            //}

                            _lstFact.ForEach(p => p.REFEMNDOC = p.REFEM + "-" + p.NDOC);
                            _lstFact.ForEach(p => p.NOM       = selectedClient.NOMABON);
                            List <CsClient>       clients = new List <CsClient>();
                            UcConsulClientAccount consult = new UcConsulClientAccount(_lstFact);
                            consult.Closed += new EventHandler(UcConsulClientAccountClosed);
                            consult.Show();
                        }
                        else
                        {
                            Message.ShowInformation("Ce Client n'a pas de facture", "information");
                        }
                        btnView.IsEnabled = true;
                    }
                };
                Service.RetourneListeFactureNonSoldeAsync(selectedClient);
            }
            else
            {
                MessageBox.Show("No Item selected in the Grid");
            }

            //passage++;
        }
        private void LoadEtatCaisse()
        {
            List <int> lstCentre  = new List <int>();
            DateTime?  DateCaisse = this.dtp_debut.Text == null ? null : this.dtp_debut.SelectedDate;
            bool       IsEncour   = false;

            if (this.Chk_EnCours.IsChecked == true)
            {
                IsEncour = true;
            }

            if (this.Cbo_Centre.Tag != null)
            {
                List <Galatee.Silverlight.ServiceAccueil.CsCentre> lstCentreSelect = Cbo_Centre.Tag as List <Galatee.Silverlight.ServiceAccueil.CsCentre>;
                foreach (Galatee.Silverlight.ServiceAccueil.CsCentre item in lstCentreSelect)
                {
                    lstCentre.Add(item.PK_ID);
                }
            }
            else if (this.Cbo_Site.Tag != null)
            {
                List <Galatee.Silverlight.ServiceAccueil.CsSite> lstSiteSelect = Cbo_Site.Tag as List <Galatee.Silverlight.ServiceAccueil.CsSite>;
                foreach (Galatee.Silverlight.ServiceAccueil.CsSite item in lstSiteSelect)
                {
                    List <Galatee.Silverlight.ServiceAccueil.CsCentre> stCentreS = SessionObject.LstCentre.Where(t => t.FK_IDCODESITE == item.PK_ID).ToList();
                    foreach (Galatee.Silverlight.ServiceAccueil.CsCentre items in stCentreS)
                    {
                        lstCentre.Add(items.PK_ID);
                    }
                }
            }
            else
            {
                if (Cbo_Centre.Tag == null && Cbo_Site.Tag == null)
                {
                    lstCentre = SessionObject.LstIdCentreDuPerimetreAction;
                }
            }
            //List<int> lstCentreCaisse = string.IsNullOrEmpty( this.Txt_CodeCentre .Text) ? SessionObject.LstIdCentreDuPerimetreAction:  ((CsCentre)Txt_CodeCentre.Tag).PK_ID
            CaisseServiceClient service1 = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));

            service1.RetourneSuppervisionCaisseCompleted += (es, argss) =>
            {
                List <CsHabilitationCaisse> LstHabilCaisse = new List <CsHabilitationCaisse>();
                if (argss != null && argss.Cancelled)
                {
                    return;
                }
                LstHabilCaisse            = argss.Result;
                dtgEtatCaisse.ItemsSource = null;
                dtgEtatCaisse.ItemsSource = LstHabilCaisse;
            };
            service1.RetourneSuppervisionCaisseAsync(lstCentre, DateCaisse, IsEncour);
            service1.CloseAsync();
        }
        private void RetourneReversement(CsHabilitationCaisse laCaisse)
        {
            try
            {
                CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleIndex(), Utility.EndPoint("Caisse"));
                service.RetourneHabileCaisseReversementCompleted += (s, args) =>
                {
                    CsHabilitationCaisse leCaisseHabil = new CsHabilitationCaisse();
                    if (args.Cancelled || args.Error != null)
                    {
                        Message.ShowError("Un problème est survenu lors de la fermeture de caisse", "Information");
                    }
                    leCaisseHabil = args.Result;


                    if (leCaisseHabil.MONTANTENCAISSE != null)
                    {
                        this.txt_MontantEncaisse.Text = leCaisseHabil.MONTANTENCAISSE.Value.ToString(SessionObject.FormatMontant);
                    }
                    else
                    {
                        this.txt_MontantEncaisse.Text = initValue.ToString(SessionObject.FormatMontant);
                    }

                    if (leCaisseHabil.MONTANTREVERSER != null)
                    {
                        this.Txt_MontantReverse.Text = leCaisseHabil.MONTANTREVERSER.Value.ToString(SessionObject.FormatMontant);
                    }
                    else
                    {
                        this.Txt_MontantReverse.Text = initValue.ToString(SessionObject.FormatMontant);
                    }


                    if (leCaisseHabil.MONTANTREVERSER != null)
                    {
                        this.Txt_MontantAReverser.Text = ((Convert.ToDecimal(this.txt_MontantEncaisse.Text) - Convert.ToDecimal(this.Txt_MontantReverse.Text)) + Convert.ToDecimal(this.Txt_MontantNonReverse.Text)).ToString(SessionObject.FormatMontant);
                        SessionObject.LaCaisseCourante.MONTANTENCAISSE = (Convert.ToDecimal(this.txt_MontantEncaisse.Text) - Convert.ToDecimal(this.Txt_MontantReverse.Text));
                    }
                    else
                    {
                        this.Txt_MontantAReverser.Text = (Convert.ToDecimal(this.txt_MontantEncaisse.Text) + Convert.ToDecimal(this.Txt_MontantNonReverse.Text)).ToString(SessionObject.FormatMontant);
                        SessionObject.LaCaisseCourante.MONTANTENCAISSE = Convert.ToDecimal(this.txt_MontantEncaisse.Text);
                    }
                };
                service.RetourneHabileCaisseReversementAsync(laCaisse);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void RetourneTypeTimbre()
        {
            CaisseServiceClient service = new  CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));

            service.RetouneTypeTimbreCompleted += (s, args) =>
            {
                if (args != null && args.Cancelled)
                {
                    return;
                }
            };
            service.RetouneTypeTimbreAsync();
            service.CloseAsync();
        }
示例#23
0
        private void RetourneListeDesLibelleTop()
        {
            CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));

            service.RetourneTousLibelleTopCompleted += (s, args) =>
            {
                if (args != null && args.Cancelled)
                {
                    return;
                }
                SessionObject.LstDesLibelleTop = args.Result;
            };
            service.RetourneTousLibelleTopAsync();
            service.CloseAsync();
        }
        private void RetourneTypeTimbre()
        {
            CaisseServiceClient service = new  CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));

            service.RetouneTypeTimbreCompleted += (s, args) =>
            {
                if (args != null && args.Cancelled)
                {
                    return;
                }
                cbo_TypeTimbre.ItemsSource       = args.Result;
                cbo_TypeTimbre.DisplayMemberPath = "LIBELLE";
            };
            service.RetouneTypeTimbreAsync();
            service.CloseAsync();
        }
        void RetourneReglementEncaisse()
        {
            try
            {
                this.OKButton.IsEnabled = false;
                CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));
                service.RetourneRecuDeCaissePourAnnulationAsync(SessionObject.LaCaisseCourante.PK_ID);
                service.RetourneRecuDeCaissePourAnnulationCompleted += (s, args) =>
                {
                    if (args.Cancelled || args.Error != null)
                    {
                        Message.ShowError("Erreur de chargement des reçus de la caisse. Réessayez svp !", "Erreur");
                        this.DialogResult = true;
                    }

                    if (args.Result == null || args.Result.Count == 0)
                    {
                        ValidationFermetureCaisse(SessionObject.LaCaisseCourante);
                        this.DialogResult = true;
                        return;
                    }

                    List <CsLclient> _LstReglement = new List <CsLclient>();
                    _LstReglement = args.Result;
                    if (_LstReglement != null && _LstReglement.Count != 0)
                    {
                        List <CsLclient> lstReglementAnnulationEncour = _LstReglement.Where(t => (!string.IsNullOrEmpty(t.STATUS) && t.STATUS == SessionObject.Enumere.StatusDemandeInitier)).ToList();
                        if (lstReglementAnnulationEncour != null && lstReglementAnnulationEncour.Count != 0)
                        {
                            Message.ShowError(Langue.MsgImposibleArretCaisse, Langue.errorTitle);
                            this.DialogResult = true;
                            return;
                        }
                        else
                        {
                            ValidationFermetureCaisse(SessionObject.LaCaisseCourante);
                            this.DialogResult = true;
                        }
                    }
                };
                service.CloseAsync();
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void RetourneEtatClient(CsClient leClient)
        {
            try
            {
                this.DialogResult = true;
                CaisseServiceClient srv = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));
                srv.RetourneEtatClientAsync(leClient.PK_ID);
                srv.RetourneEtatClientCompleted += (factor, es) =>
                {
                    if (es.Error != null || es.Cancelled)
                    {
                        Message.ShowError("L'insertion des encaissements a retournée une erreur. Réessayer svp! :" + es.Error.Message, "Erreur");
                        return;
                    }
                    if (es.Result == null)
                    {
                        Message.ShowError("L'insertion des encaissements a retournée une erreur. Réessayer svp!", "Erreur");
                        return;
                    }
                    decimal?         MontantExigible    = es.Result.Where(t => t.EXIGIBILITE < System.DateTime.Today.Date).Sum(y => y.MONTANT);
                    decimal?         MontantNonExigible = es.Result.Where(t => t.EXIGIBILITE > System.DateTime.Today.Date).Sum(y => y.MONTANT);
                    decimal?         Solde = MontantExigible + MontantNonExigible;
                    List <CsLclient> lstFactureDuClient = _ListeDesReglementDuRecu.Where(t => t.FK_IDCLIENT == leClient.PK_ID).ToList();

                    foreach (CsLclient item in lstFactureDuClient)
                    {
                        item.MONTANTEXIGIBLE    = MontantExigible;
                        item.MONTANTNONEXIGIBLE = MontantNonExigible;
                        item.SOLDECLIENT        = Solde;
                    }
                    List <CsReglementRecu> _ListeDesRecu = Galatee.Silverlight.Caisse.EditionRecu.ReorganiserReglement(lstFactureDuClient, SessionObject.Enumere.ActionRecuDuplicat);
                    int nbreDeCopie = 2;
                    for (int i = 1; i <= nbreDeCopie; i++)
                    {
                        string key = Utility.getKey();
                        Dictionary <string, string> param = new Dictionary <string, string>();
                        param.Add("pTypeRecu", "RECU D'ANNULATION D'ENCAISSEMENT");
                        LanceImpression(key, param, _ListeDesRecu, false);
                    }
                };
            }
            catch (Exception)
            {
                throw;
            }
        }
        void RetourneReglementEncaisse()
        {
            try
            {
                CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));
                service.RetourneRecuDeCaissePourAnnulationAsync(SessionObject.LaCaisseCourante.PK_ID);
                service.RetourneRecuDeCaissePourAnnulationCompleted += (s, args) =>
                {
                    if (args.Cancelled || args.Error != null)
                    {
                        Message.ShowError("Erreur de chargement des reçus de la caisse. Réessayez svp !", "Erreur");
                        this.DialogResult = true;
                    }

                    if (args.Result == null || args.Result.Count == 0)
                    {
                        Message.ShowError("Aucun encaissement n'a été effectué.", Langue.errorTitle);
                        return;
                    }

                    List <ServiceCaisse.CsLclient> _LstReglement = new List <ServiceCaisse.CsLclient>();
                    _LstReglement    = args.Result;
                    _LstrefReglement = _LstReglement;



                    if (_LstReglement != null && _LstReglement.Count != 0)
                    {
                        List <ServiceCaisse.CsLclient> lstReglementClient = _LstReglement.Where(t => (string.IsNullOrEmpty(t.STATUS) || t.STATUS == SessionObject.Enumere.StatusDemandeRetirer)).ToList();
                        this.dtg_FactureAAnnule.ItemsSource = null;
                        this.dtg_FactureAAnnule.ItemsSource = RetourneEltsDataGrid1(lstReglementClient);

                        List <ServiceCaisse.CsLclient> lstReglementClientEncour = _LstReglement.Where(t => (!string.IsNullOrEmpty(t.STATUS) && t.STATUS != SessionObject.Enumere.StatusDemandeRetirer)).ToList();
                        this.dtg_FactureAjouter.ItemsSource = null;
                        this.dtg_FactureAjouter.ItemsSource = RetourneEltsDataGrid2(lstReglementClientEncour);
                    }
                };
                service.CloseAsync();
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#28
0
        private void RetourneListeDesModReglement()
        {
            if (SessionObject.ListeModesReglement != null && SessionObject.ListeModesReglement.Count != 0)
            {
                return;
            }
            CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));

            service.RetourneModesReglementCompleted += (s, args) =>
            {
                if (args != null && args.Cancelled)
                {
                    return;
                }
                SessionObject.ListeModesReglement = args.Result;
            };
            service.RetourneModesReglementAsync();
            service.CloseAsync();
        }
        public FrmAutrePayement()
        {
            InitializeComponent();

            try
            {
                translate();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex, Langue.errorTitle);
            }

            CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));

            service.RetourneListeDeCoperODCompleted += new EventHandler <RetourneListeDeCoperODCompletedEventArgs>(ChargerListCoperParDc);
            service.RetourneListeDeCoperODAsync();
            this.txt_Matricule.IsEnabled = false;
        }
        private void MiseAjourRetraitDemandeAnnulation(List <ServiceCaisse.CsLclient> leReglement)
        {
            CaisseServiceClient service = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint(this));

            service.RetirerDemandeAnnulationEncaissementAsync(leReglement);
            service.RetirerDemandeAnnulationEncaissementCompleted += (sender, es) =>
            {
                try
                {
                    if (es.Cancelled || es.Error != null || es.Result == null)
                    {
                        Message.ShowError("Erreur d'annulation du reçu. Veuillez réessayer svp !", Langue.errorTitle);
                        return;
                    }

                    List <ServiceCaisse.CsLclient> lstInitData  = ((List <ServiceCaisse.CsLclient>) this.dtg_FactureAjouter.ItemsSource).Where(t => t.Selectionner == true).ToList();
                    List <ServiceCaisse.CsLclient> lstInitData2 = (List <ServiceCaisse.CsLclient>) this.dtg_FactureAjouter.ItemsSource;
                    List <string> lstAcquit = new List <string>();
                    foreach (var item in lstInitData)
                    {
                        if (lstAcquit.FirstOrDefault(t => t == item.ACQUIT) == null)
                        {
                            lstAcquit.Add(item.ACQUIT);
                        }
                    }
                    List <ServiceCaisse.CsLclient> lstAAfficher = new List <ServiceCaisse.CsLclient>();
                    lstInitData2.RemoveAll(t => lstAcquit.Contains(t.ACQUIT));
                    dtg_FactureAjouter.ItemsSource = null;
                    dtg_FactureAjouter.ItemsSource = lstInitData2;

                    List <ServiceCaisse.CsLclient> lstInitData1        = (List <ServiceCaisse.CsLclient>) this.dtg_FactureAAnnule.ItemsSource;
                    List <ServiceCaisse.CsLclient> lstInitAjouter      = _LstrefReglement.Where(t => lstAcquit.Contains(t.ACQUIT)).ToList();
                    List <ServiceCaisse.CsLclient> lstReglementAjouter = RetourneEltsDataGrid1(lstInitAjouter);
                    lstInitData1.AddRange(lstReglementAjouter);
                    dtg_FactureAAnnule.ItemsSource = null;
                    dtg_FactureAAnnule.ItemsSource = lstInitData1;
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, Langue.errorTitle);
                }
            };
        }