Пример #1
0
        public void Put(paramClient p)
        {
            Paramètres param = db.Paramètres.Where(po => po.ID == 1).FirstOrDefault();

            param.MultiplicationFE   = p.FE;
            param.MultiplicationWE   = p.WE;
            param.MultiplicationWEFE = p.WEFE;
            param.NbJourCDP          = p.cdp;
            param.NbJourDT           = p.dt;
            param.PrixSupport        = p.support;
            db.SaveChanges();
        }
Пример #2
0
        // GET: api/Ressource/5
        public Ressource Get(int id)// renvoie la ressource de par son ID
        {
            Paramètres para = db.Paramètres.Where(p => p.ID == 1).FirstOrDefault();
            Ressource  res  = this.db.Ressource.Where(s => s.ID == id).FirstOrDefault(); // renvoi l'objet pointé par l'id pris en paramètre

            if (res != null)
            {
                return(res);
            }
            else
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, "pas d'objet pour cet ID"));
            }
        }
Пример #3
0
        public DevisElements(string _nomFichier, decimal _totalTable, bool isFactu = false, decimal?_tarCDP = null, decimal?_tarDT = null)
        {
            this.db = new DevisFacturationEntities();
            Paramètres param = db.Paramètres.Where(p => p.ID == 1).FirstOrDefault();

            this.dateCreation = DateTime.Now.ToShortDateString();
            this.dateVersion  = DateTime.Now.ToShortDateString();
            this.annee        = DateTime.Now.Year.ToString();
            this.mois         = new CultureInfo("fr-FR").DateTimeFormat.GetMonthName(isFactu ? DateTime.Now.AddMonths(-1).Month : DateTime.Now.Month).ToString();
            this.numVersion   = 1.0m;
            this.numEdition   = 1;
            this.nomFichier   = _nomFichier;
            this.totalTable   = _totalTable.ToString("G29");
            this.support      = (decimal)param.PrixSupport;
            DateTime firstOfTheMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);

            this.dateDebut      = firstOfTheMonth.AddMonths(1).ToLongDateString();
            this.livraisonFinal = firstOfTheMonth.AddMonths(2).AddDays(-1).ToLongDateString();

            if (_tarCDP == null)
            {
                decimal cdp = db.Tarification.Where(s => s.Type == "Chef de projet technique").Select(s => s.Tar5).First();
                decimal dt  = db.Tarification.Where(s => s.Type == "Directeur technique").Select(s => s.Tar5).First();
                //TODO possibiliter de saisir le nombre de jour
                decimal factuCDP = (decimal)param.NbJourCDP * cdp;
                this.facturationCDP = factuCDP.ToString("G29");
                decimal factuDT = (decimal)param.NbJourDT * dt;
                this.facturationDT = factuDT.ToString("G29");
                decimal totalDTCDP = factuCDP + factuDT;
                this.estimationDTCDP = totalDTCDP.ToString("G29");
                decimal total = decimal.Parse(this.estimationDTCDP) + decimal.Parse(this.totalTable) + this.support;
                this.totalCumule = total.ToString("G29");
            }
            else
            {
                decimal cdp      = db.Tarification.Where(s => s.Type == "Chef de projet technique").Select(s => s.Tar5).First();
                decimal dt       = db.Tarification.Where(s => s.Type == "Directeur technique").Select(s => s.Tar5).First();
                decimal factuCDP = Convert.ToDecimal(_tarCDP) * cdp;
                this.facturationCDP = factuCDP.ToString("G29");
                decimal factuDT = Convert.ToDecimal(_tarDT) * dt;
                this.facturationDT = factuDT.ToString("G29");
                decimal totalDTCDP = factuCDP + factuDT;
                this.estimationDTCDP = totalDTCDP.ToString("G29");
                decimal total = decimal.Parse(this.estimationDTCDP) + decimal.Parse(this.totalTable) + this.support;
                this.totalCumule = total.ToString("G29");
            }
        }
Пример #4
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);
            }
        }
Пример #5
0
        public Paramètres Get() // Devra return TOUUUUT les emplacements des DEVIS existant
        {
            Paramètres param = db.Paramètres.Where(p => p.ID == 1).FirstOrDefault();

            return(param);
        }