Пример #1
0
        public decimal calculateStoriesCost(Dictionary <string, Dictionary <string, decimal> > myDic)
        {
            decimal storycost = 0;

            foreach (KeyValuePair <string, Dictionary <string, decimal> > entry in myDic)
            {
                foreach (KeyValuePair <string, decimal> entryT in entry.Value)
                {
                    Ressource ressourceTemp = db.Ressource.Where(ressource => ressource.Initial == entryT.Key).FirstOrDefault(); // Recuperation de la ressource correspondante
                    decimal?  dailyValue    = entry.Value != null?Math.Round(Convert.ToDecimal(entryT.Value / 7), 2) : 0;        // conversion en jour

                    dailyValue = getDecimalPart(dailyValue);                                                                     //Arrondie au supérieur
                    decimal resFact;
                    if (entry.Key == "AMO")
                    {
                        resFact = ressourceTemp.getCurrentTarification(true);
                    }
                    else
                    {
                        resFact = ressourceTemp.getCurrentTarification(false);
                    }
                    storycost += resFact * (decimal)dailyValue;
                    this.logFile.WriteLine(entry.Key + "  |  " + entry.Value + "   |   " + dailyValue + " x " + resFact + " = " + dailyValue * resFact + '\n' + '\r');
                    this.logFile.WriteLine('\n');
                }
            }
            return(storycost);
        }
Пример #2
0
        public decimal calculateStoriesCostfactu(List <UserProcess> myList)
        {
            try
            {
                decimal storycost = 0;
                foreach (UserProcess user in myList)
                {
                    Ressource ressourceTemp = db.Ressource.Where(ressource => ressource.Initial == user.name).FirstOrDefault(); // Recuperation de la ressource correspondante
                    if (user.name == "AR")
                    {
                        decimal mescouilles = ressourceTemp.getCurrentTarification(true);
                    }
                    Paramètres param        = db.Paramètres.Where(p => p.ID == 1).FirstOrDefault();
                    decimal?   dailyValueFE = user.fe != null?Math.Round(Convert.ToDecimal(user.fe / 7), 2) : 0;    // conversion en jour

                    decimal?dailyValueWE = user.we != null?Math.Round(Convert.ToDecimal(user.we / 7), 2) : 0;       // conversion en jour

                    decimal?dailyValueWEFE = user.wefe != null?Math.Round(Convert.ToDecimal(user.wefe / 7), 2) : 0; // conversion en jour

                    decimal?dailyValueNO = user.no != null?Math.Round(Convert.ToDecimal(user.no / 7), 2) : 0;       // conversion en jour

                    dailyValueFE   = getDecimalPart(dailyValueFE);                                                  //Arrondie au supérieur
                    dailyValueWE   = getDecimalPart(dailyValueWE);                                                  //Arrondie au supérieur
                    dailyValueWEFE = getDecimalPart(dailyValueWEFE);                                                //Arrondie au supérieur
                    dailyValueNO   = getDecimalPart(dailyValueNO);                                                  //Arrondie au supérieur
                    decimal resFact = ressourceTemp.getCurrentTarification(user.isAmo);
                    storycost += resFact * (decimal)dailyValueFE * (decimal)param.MultiplicationFE;
                    storycost += resFact * (decimal)dailyValueWE * (decimal)param.MultiplicationWE;
                    storycost += resFact * (decimal)dailyValueWEFE * (decimal)param.MultiplicationWEFE;
                    storycost += resFact * (decimal)dailyValueNO;
                    this.logFile.WriteLine(user.name + "  |  " + "Valeur FE    " + dailyValueFE + " x " + resFact + " = " + dailyValueFE * resFact + '\n' + '\r');
                    this.logFile.WriteLine(user.name + "  |  " + "Valeur WE    " + dailyValueWE + " x " + resFact + " = " + dailyValueWE * resFact + '\n' + '\r');
                    this.logFile.WriteLine(user.name + "  |  " + "Valeur WEFE   " + dailyValueWEFE + " x " + resFact + " = " + dailyValueWEFE * resFact + '\n' + '\r');
                    this.logFile.WriteLine(user.name + "  |  " + "Valeur Normal   " + dailyValueNO + " x " + resFact + " = " + dailyValueNO * resFact + '\n' + '\r');
                    this.logFile.WriteLine('\n');
                }
                return(storycost);
            }
            catch (Exception e)
            {
                this.logFile.Close();
                return(-1);
            }
        }