Example #1
0
        public CsDemandeReclamation RetourneLaDemande(int fk_demande)
        {
            //cmd.CommandText = "SPX_GUI_RETOURNE_DEMANDE";
            CsDemandeReclamation _LaDemande = new CsDemandeReclamation();

            try
            {
                galadbEntities        transaction  = new galadbEntities();
                CsReclamationRcl      _Reclamation = new CsReclamationRcl();
                List <ADMUTILISATEUR> lstUser      = transaction.ADMUTILISATEUR.ToList();
                DEMANDE _DEMANDE = new DEMANDE();
                _LaDemande.LaDemande = Entities.ConvertObject <CsDemandeBase, DEMANDE>(transaction.DEMANDE.FirstOrDefault(p => p.PK_ID == fk_demande));

                try
                {
                    DataTable dt = Galatee.Entity.Model.ReclamationProcedure.RetourneListeReclamationbyDemande(fk_demande);
                    _Reclamation = Entities.GetEntityFromQuery <CsReclamationRcl>(dt);
                    if (!string.IsNullOrEmpty(_Reclamation.AgentEmetteur))
                    {
                        _Reclamation.NOMAGENTCREATION = lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentEmetteur) != null?
                                                        lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentEmetteur).LIBELLE : string.Empty;
                    }

                    if (!string.IsNullOrEmpty(_Reclamation.AgentRecepteur))
                    {
                        _Reclamation.NOMAGENTRECEPTEUR = lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentRecepteur) != null?
                                                         lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentRecepteur).LIBELLE : string.Empty;
                    }

                    if (!string.IsNullOrEmpty(_Reclamation.AgentValidation))
                    {
                        _Reclamation.NOMAGENTVALIDATEUR = lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentValidation) != null?
                                                          lstUser.FirstOrDefault(t => t.MATRICULE == _Reclamation.AgentValidation).LIBELLE : string.Empty;
                    }


                    _LaDemande.ReclamationRcl = _Reclamation;


                    DataTable dtDoc = DevisProcedures.DEVIS_DOCUMENTSCANNE_RETOURNEByIdDemande(_LaDemande.LaDemande.PK_ID);
                    _LaDemande.DonneDeDemande = Entities.GetEntityListFromQuery <ObjDOCUMENTSCANNE>(dtDoc);
                }
                catch (Exception)
                {
                    _LaDemande.ReclamationRcl = null;
                }
                transaction.Dispose();
                return(_LaDemande);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
 public List <CsAdmMenu> GetAllModuleFonction()
 {
     try
     {
         List <CsAdmMenu> lesModule             = new List <CsAdmMenu>();
         galadbEntities   context               = new galadbEntities();
         List <Galatee.Entity.Model.ADMMENU> dt = AdminProcedures.RetourneListeToutMenuProfilTotal(context);
         foreach (Galatee.Entity.Model.ADMMENU item in dt)
         {
             CsAdmMenu leModule = new CsAdmMenu();
             leModule = Entities.ConvertObject <CsAdmMenu, Galatee.Entity.Model.ADMMENU>(item);
             leModule.lstMenuProfil = Entities.ConvertObject <CsMenuDuProfil, Galatee.Entity.Model.MENUSDUPROFIL>(item.MENUSDUPROFIL.ToList());
             lesModule.Add(leModule);
         }
         context.Dispose();
         return(lesModule);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #3
0
 public List <CsModule> GetAllModuleFonction()
 {
     try
     {
         List <CsModule> lesModule             = new List <CsModule>();
         galadbEntities  context               = new galadbEntities();
         List <Galatee.Entity.Model.MODULE> dt = AdminProcedures.RetourneListeToutModuleFonctionTotal(context);
         foreach (Galatee.Entity.Model.MODULE item in dt)
         {
             CsModule leModule = new CsModule();
             leModule             = Entities.ConvertObject <CsModule, Galatee.Entity.Model.MODULE>(item);
             leModule.lstFonction = Entities.ConvertObject <CsModuleDeFonction, Galatee.Entity.Model.MODULESDEFONCTION>(item.MODULESDEFONCTION.ToList());
             lesModule.Add(leModule);
         }
         List <CsModule> lesModules = lesModule.OrderBy(g => g.PK_ID).ToList();
         context.Dispose();
         return(lesModules);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        //Edition de facture
        public List <CsFactureClient> ListeDesFactures(string centre, string client, string ordre, string periode, string numFacture)
        {
            try
            {
                CsLafactureClient            entfacs = new CsLafactureClient();
                Galatee.Entity.Model.CENTFAC dt      = Galatee.Entity.Model.EserviceProcedure.ListeFactureABO07(centre, client, ordre, periode, numFacture).FirstOrDefault();
                entfacs._LstProfact = Entities.ConvertObject <CsProduitFacture, Galatee.Entity.Model.CPROFAC>(dt.CPROFAC.ToList());
                entfacs._LstRedFact = Entities.ConvertObject <CsRedevanceFacture, Galatee.Entity.Model.CREDFAC>(dt.CREDFAC.ToList());
                entfacs._LeEntatfac = Entities.ConvertObject <CsEnteteFacture, Galatee.Entity.Model.CENTFAC>(dt);
                decimal?AncSolde = 0;
                //Galatee.Entity.Model.FonctionCaisse.RetourneSoldeClient(entfacs._LeEntatfac.FK_IDCLIENT);

                galadbEntities       context           = new galadbEntities();
                List <UNITECOMPTAGE> _lstUniteComptage = context.UNITECOMPTAGE.ToList();
                List <REDEVANCE>     _lstRedevence     = context.REDEVANCE.ToList();

                List <CsFactureClient> lstFactureEdite = new List <CsFactureClient>();
                int i = 0;
                foreach (CsProduitFacture items in entfacs._LstProfact)
                {
                    foreach (CsRedevanceFacture itemss in entfacs._LstRedFact.OrderBy(p => p.TRANCHE))
                    {
                        CsFactureClient FactureEdite = new CsFactureClient();
                        FactureEdite.Unite = _lstUniteComptage.FirstOrDefault(x => x.CODE == itemss.UNITE).LIBELLE;
                        //FactureEdite.LibelleTranche = _lstRedevence.FirstOrDefault(x => x.PRODUIT == items.PRODUIT && x.CODE  == itemss.REDEVANCE && x.TRANCHE == itemss.TRANCHE).LIBELLE;
                        //FactureEdite.AncienReport = (AncSolde == 0 || AncSolde == null) ? 0 : AncSolde;
                        //new CsFactureClient().MajRedevanceFacture(ref FactureEdite, itemss);
                        //new CsFactureClient().MajProduitFacture(ref FactureEdite, items);
                        //new CsFactureClient().MajEnteteFacture(ref FactureEdite, entfacs._LeEntatfac);
                        FactureEdite.SoldeTotFTTC = FactureEdite.TotFTTC + AncSolde;
                        //FactureEdite.dateExige = Convert.ToDateTime(Convert.ToDateTime(entfacs._LeEntatfac.DFAC) + TimeSpan.FromDays((int)entfacs._LeEntatfac.EXIG )).ToShortDateString();
                        i++;
                        FactureEdite.OrdreAffichage = i;
                        lstFactureEdite.Add(FactureEdite);
                    }
                }
                if (entfacs._LstRedFact.Count < 19)
                {
                    for (int j = i + 1; j <= 19; j++)
                    {
                        CsFactureClient FactureEdite = new CsFactureClient();
                        //if (entfacs._LstProfact != null)
                        //{
                        //    if (entfacs._LstProfact.Count > 0)
                        //        new CsFactureClient().MajProduitFacture(ref FactureEdite, entfacs._LstProfact[0]);
                        //}
                        //if (true)
                        //{
                        //    new CsFactureClient().MajEnteteFacture(ref FactureEdite, entfacs._LeEntatfac);
                        //}

                        FactureEdite.SoldeTotFTTC   = FactureEdite.TotFTTC + AncSolde;
                        FactureEdite.OrdreAffichage = j;
                        lstFactureEdite.Add(FactureEdite);
                    }
                }

                context.Dispose();
                return(lstFactureEdite);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public static bool CheckIfConditionIsRespected(string Condition, string TableName, ref string msgErr, string IDLine,
                                                       ref bool isOk)
        {
            bool isRespected = true;

            try
            {
                Type           T       = null;
                galadbEntities context = new galadbEntities();
                object         theLine = GetObjectValueFromTable(TableName, context, IDLine, ref T);
                if (null != theLine)
                {
                    //On a l'objet et le type de l'objet, on va tester donc la condition
                    string[] tokens = Condition.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                    //normalement on a trois tokens
                    if (tokens.Count() == 3)
                    {
                        string    columnName = tokens[0];                                     //Nom de la colonne;
                        OPERATEUR op         = EnumerationString.GetOperateurEnum(tokens[1]); //l'Operateur
                        string    value      = tokens[2];                                     //La valeur

                        //Maintenant on compile notre If
                        var  currentValue = theLine.GetType().GetProperty(columnName).GetValue(theLine);
                        Type propType     = theLine.GetType().GetProperty(columnName).GetMethod.ReturnType;
                        if (propType.IsGenericType && propType.GetGenericTypeDefinition().Equals(typeof(Nullable <>)))
                        {
                            //Si le type est nullable alors, on récupère la destination
                            //Par exemple si c'est Nullable<int>, la destination est int
                            propType = Nullable.GetUnderlyingType(propType);
                        }
                        var correctValue = null != currentValue?Convert.ChangeType(currentValue, propType) : null;

                        var conditionCorrectValue = "null" != value.ToLower() ? Convert.ChangeType(GetValueFromString(value), propType) : null;

                        //Bon sincèrement il n'ya pas de plusieurs type de données dans la base généralement
                        //ce qui est sûr on teste
                        switch (op)
                        {
                        case OPERATEUR.Equals:
                            isRespected = (correctValue == conditionCorrectValue);
                            break;

                        case OPERATEUR.Different:
                            isRespected = (correctValue != conditionCorrectValue);
                            break;

                        case OPERATEUR.GreaterOrEquals:
                        case OPERATEUR.GreatherThan:
                        case OPERATEUR.LessOrEquals:
                        case OPERATEUR.LessThan:
                        {
                            //peut importe, le type, on utilise double qui est plus grand que
                            //int, decimal
                            double dbValueLine      = double.Parse(correctValue.ToString());
                            double dbValueCondition = double.Parse(conditionCorrectValue.ToString());

                            if (op == OPERATEUR.GreatherThan)
                            {
                                isRespected = dbValueLine > dbValueCondition;
                            }
                            else if (op == OPERATEUR.GreaterOrEquals)
                            {
                                isRespected = dbValueLine >= dbValueCondition;
                            }
                            else if (op == OPERATEUR.LessThan)
                            {
                                isRespected = dbValueLine < dbValueCondition;
                            }
                            else if (op == OPERATEUR.LessOrEquals)
                            {
                                isRespected = dbValueLine <= dbValueCondition;
                            }
                        };
                            break;

                        default:
                            isRespected = true;
                            break;
                        }

                        //Disposition des var
                        if (null != currentValue)
                        {
                            GC.SuppressFinalize(currentValue);
                        }
                        if (null != correctValue)
                        {
                            GC.SuppressFinalize(correctValue);
                        }
                        if (null != conditionCorrectValue)
                        {
                            GC.SuppressFinalize(conditionCorrectValue);
                        }
                        if (null != propType)
                        {
                            GC.SuppressFinalize(propType);
                        }

                        isOk = true;
                    }

                    else
                    {
                        msgErr      = "La valeur n'existe pas dans la base de données";
                        isOk        = false;
                        isRespected = false;
                    }

                    //disposition des variables
                    context.Dispose();

                    GC.SuppressFinalize(context);
                    GC.SuppressFinalize(theLine);
                    GC.SuppressFinalize(T);
                }
            }
            catch (Exception ex)
            {
                msgErr      = ex.Message;
                isOk        = false;
                isRespected = false;
            }
            return(isRespected);
        }