public void Inserta(ClientAddressBE pItem)
 {
     try
     {
         ClientAddressDL ClientAddress = new ClientAddressDL();
         ClientAddress.Inserta(pItem);
     }
     catch (Exception ex)
     { throw ex; }
 }
Пример #2
0
        public Int32 Inserta(ClientBE pItem, List <ClientAddressBE> pListaClientAddress, List <ClientContactBE> pListaClientContact, List <ClientDepartmentBE> pListaClientDepartment, List <ClientDocumentBE> pListaClientDocument, List <ClientGoalBE> pListaClientGoal, List <ClientBrandBE> pListaClientBrand)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    ClientDL           Client           = new ClientDL();
                    ClientAddressDL    ClientAddress    = new ClientAddressDL();
                    ClientContactDL    ClientContact    = new ClientContactDL();
                    ClientDepartmentDL ClientDepartment = new ClientDepartmentDL();
                    ClientDocumentDL   ClientDocument   = new ClientDocumentDL();
                    ClientGoalDL       ClientGoal       = new ClientGoalDL();
                    ClientBrandDL      ClientBrand      = new ClientBrandDL();

                    int IdClient = 0;
                    IdClient = Client.Inserta(pItem);

                    foreach (var item in pListaClientAddress)
                    {
                        item.IdClient = IdClient;
                        ClientAddress.Inserta(item);
                    }

                    foreach (var item in pListaClientContact)
                    {
                        item.IdClient = IdClient;
                        ClientContact.Inserta(item);
                    }

                    foreach (var item in pListaClientDepartment)
                    {
                        item.IdClient = IdClient;
                        ClientDepartment.Inserta(item);
                    }

                    foreach (var item in pListaClientDocument)
                    {
                        item.IdClient = IdClient;
                        ClientDocument.Inserta(item);
                    }

                    foreach (var item in pListaClientGoal)
                    {
                        item.IdClient = IdClient;
                        ClientGoal.Inserta(item);
                    }

                    foreach (var item in pListaClientBrand)
                    {
                        item.IdClient = IdClient;
                        ClientBrand.Inserta(item);
                    }

                    ts.Complete();

                    return(IdClient);
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
Пример #3
0
        public void Actualiza(ClientBE pItem, List <ClientAddressBE> pListaClientAddress, List <ClientContactBE> pListaClientContact, List <ClientDepartmentBE> pListaClientDepartment, List <ClientDocumentBE> pListaClientDocument, List <ClientGoalBE> pListaClientGoal, List <ClientBrandBE> pListaClientBrand)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    ClientDL           Client           = new ClientDL();
                    ClientAddressDL    ClientAddress    = new ClientAddressDL();
                    ClientContactDL    ClientContact    = new ClientContactDL();
                    ClientDepartmentDL ClientDepartment = new ClientDepartmentDL();
                    ClientDocumentDL   ClientDocument   = new ClientDocumentDL();
                    ClientGoalDL       ClientGoal       = new ClientGoalDL();
                    ClientBrandDL      ClientBrand      = new ClientBrandDL();

                    foreach (var item in pListaClientAddress)
                    {
                        if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo
                        {
                            item.IdClient = pItem.IdClient;
                            ClientAddress.Inserta(item);
                        }
                        else
                        {
                            ClientAddress.Actualiza(item);
                        }
                    }

                    foreach (var item in pListaClientContact)
                    {
                        if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo
                        {
                            item.IdClient = pItem.IdClient;
                            ClientContact.Inserta(item);
                        }
                        else
                        {
                            ClientContact.Actualiza(item);
                        }
                    }

                    foreach (var item in pListaClientDepartment)
                    {
                        if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo
                        {
                            item.IdClient = pItem.IdClient;
                            ClientDepartment.Inserta(item);
                        }
                        else
                        {
                            ClientDepartment.Actualiza(item);
                        }
                    }

                    foreach (var item in pListaClientDocument)
                    {
                        if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo
                        {
                            item.IdClient = pItem.IdClient;
                            ClientDocument.Inserta(item);
                        }
                        else
                        {
                            ClientDocument.Actualiza(item);
                        }
                    }

                    foreach (var item in pListaClientGoal)
                    {
                        if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo
                        {
                            item.IdClient = pItem.IdClient;
                            ClientGoal.Inserta(item);
                        }
                        else
                        {
                            ClientGoal.Actualiza(item);
                        }
                    }

                    foreach (var item in pListaClientBrand)
                    {
                        if (item.TipoOper == Convert.ToInt32(Operacion.Nuevo)) //Nuevo
                        {
                            item.IdClient = pItem.IdClient;
                            ClientBrand.Inserta(item);
                        }
                        else
                        {
                            ClientBrand.Actualiza(item);
                        }
                    }


                    Client.Actualiza(pItem);

                    ts.Complete();
                }
            }
            catch (Exception ex)
            { throw ex; }
        }