Example #1
0
        //-------------------------------------------------------------------
        public override CResultAErreur TraitementAvantSauvegarde(CContexteDonnee contexte)
        {
            CResultAErreur result = base.TraitementAvantSauvegarde(contexte);

            if (!result)
            {
                return(result);
            }
            DataTable table = contexte.Tables[CValorisationElement.c_nomTable];

            if (table == null)
            {
                return(result);
            }
            ArrayList lst = new ArrayList(table.Rows);

            foreach (DataRow row in lst)
            {
                if (row.RowState != DataRowState.Unchanged)
                {
                    ///Cherche les impacts sur les couts
                    CValorisationElement valorisation = new CValorisationElement(row);
                    if (row.RowState == DataRowState.Deleted)
                    {
                        valorisation.VersionToReturn = DataRowVersion.Original;
                    }
                    CLotValorisation lot = valorisation.LotValorisation;
                    if (lot.Row.RowState == DataRowState.Deleted)
                    {
                        lot.VersionToReturn = DataRowVersion.Original;
                    }
                    foreach (CLivraisonLotValorisation livs in lot.RelationsLivraisons)
                    {
                        CLivraisonEquipement livraison = livs.Livraison;
                        if (livraison == null)
                        {
                            continue;
                        }
                        if (livraison.Row.RowState == DataRowState.Deleted)
                        {
                            livraison.VersionToReturn = DataRowVersion.Original;
                        }
                        CCommande commande = livraison.Commande;
                        if (commande == null || commande.Row.RowState == DataRowState.Deleted)
                        {
                            continue;//la commande a été supprimée
                        }
                        CListeObjetsDonnees lignes = commande.Lignes;
                        foreach (CLigneCommande ligne in lignes)
                        {
                            if (ligne.Row.RowState != DataRowState.Deleted)
                            {
                                CUtilElementACout.OnChangeCout(ligne, true, false);//changement du cout réel
                            }
                        }
                    }
                }
            }
            return(result);
        }
        public ActionResult AjouterCommandeVerif(CCommande com)
        {
            CDal dal = new CDal();

            com.Plat = dal.GetPlatById(com.Plat.Id); //Seul l'id est set, ici on met le "reste" avec
            dal.AjouterCommande(com);
            return(RedirectToAction("ListCommande"));
        }
Example #3
0
        //------------------------------------------------------------------
        public void Init(CCommande commande)
        {
            m_commande = commande;
            List <CCustomizableItemLigneCommande> lstItems = new List <CCustomizableItemLigneCommande>();

            foreach (CLigneCommande ligne in m_commande.Lignes)
            {
                CCustomizableItemLigneCommande item = new CCustomizableItemLigneCommande(ligne);
                item.Tag = ligne;
                lstItems.Add(item);
            }
            m_wndListeCommandes.Items = lstItems.ToArray();
            m_wndListeCommandes.Refresh();
            m_wndListeCommandes.CurrentItemIndex = null;
        }
Example #4
0
        //-------------------------------------------------------------------
        public override CResultAErreur VerifieDonnees(CObjetDonnee objet)
        {
            CResultAErreur result = CResultAErreur.True;

            try
            {
                CCommande Commande = (CCommande)objet;

                if (Commande.TypeCommande == null)
                {
                    result.EmpileErreur(I.T("Order must be associated to an order type|20167"));
                }
            }
            catch (Exception e)
            {
                result.EmpileErreur(new CErreurException(e));
            }
            return(result);
        }
        //------------------------------------------------------------------
        public void Init(CCommande commande)
        {
            m_commande            = commande;
            m_panelLignes.Visible = false;
            m_panelLignes.SuspendDrawing();
            foreach (CControleEditeLigneCommande ctrl in ControlesCommande)
            {
                ctrl.Visible = false;
                m_controlesReserve.Push(ctrl);
            }

            bool bIsFirst = true;

            foreach (CLigneCommande ligne in m_commande.Lignes)
            {
                CControleEditeLigneCommande ctrl = AddControleLigne(ligne);
                ctrl.IsFirst = bIsFirst;
                bIsFirst     = false;
            }
            m_panelLignes.ResumeDrawing();
            m_panelLignes.Visible = true;
        }
Example #6
0
 //-------------------------------------------------------------------------
 public CFormEditionCommande(CCommande Commande, CListeObjetsDonnees liste)
     : base(Commande, liste)
 {
     // Cet appel est requis par le Concepteur Windows Form.
     InitializeComponent();
 }
Example #7
0
 //-------------------------------------------------------------------------
 public CFormEditionCommande(CCommande Commande)
     : base(Commande)
 {
     // Cet appel est requis par le Concepteur Windows Form.
     InitializeComponent();
 }
Example #8
0
 public void AjouterCommande(CCommande com)
 {
     bdd.T_Commande.Add(com);
     bdd.SaveChanges();
 }