public void Tenir(Tenido teñido, string codigoTela) { teñido.Codigo = teñido.Tela.Codigo + "_" + teñido.Tinte.Codigo + "_TÑD"; teñido.Tinte.Cantidad -= teñido.CantidadTinteUtilizada; teñido.Tela.Cantidad -= teñido.CantidadTelaUtilizada; Random r = new Random(); teñido.Tiempo = r.Next(3600, 5400); //Puede durar entre 1 hora y 1 hora y media sin importar la cantidad de tela (limitado por el límite de la máquina). // El promedio de teñido suele durar entre 1 hora a 1 hora y media y puede extenderse un poco más dependiendo a que //otros procesos de control de teñido se exponga. En este caso suponemos que puede durar entre 1 a 1 hora y media únicamente. // Aunque estos datos son generalizados y con máquinas promedio, ya que el tiempo puede ser más o menos según bastantes factores // relacionados a la máquina, a la tela y otros factores que exeden el nivel de complejidad del proyecto. int telasObtenidas = teñido.CantidadTelaUtilizada; TinteGestor tinteGestor = new TinteGestor(); tinteGestor.Modificar(teñido.Tinte); TelaGestor telaGestor = new TelaGestor(); telaGestor.Modificar(teñido.Tela); List <Tela> telasExistentes = telaGestor.GetListTela(); if (telasExistentes.Exists(t => t.Codigo == codigoTela) && telasExistentes.Exists(t => t.Color == teñido.Tinte.Color)) { Tela existente = telaGestor.GetTela(telasExistentes.Find(t => t.Codigo == codigoTela)); existente.Cantidad += telasObtenidas; existente.Color = teñido.Tinte.Color; existente.Teñido = true; telaGestor.Modificar(existente); } else { telaGestor.Alta(new Tela(codigoTela, teñido.Tela.Descripcion, telasObtenidas, teñido.Tinte.Color, true)); } bd.Alta(teñido); }
private void btn_AltaTinte_Click(object sender, EventArgs e) { TinteGestor tinteGestor = new TinteGestor(); controller.AltaTinte(txt_CodigoTinte.Text, txt_DescripcionTinte.Text, int.Parse(txt_CantidadTinte.Text), txt_ColorTinte.Text); dgv_Tintes.DataSource = null; dgv_Tintes.DataSource = tinteGestor.GetListTinte(); }
private void btn_BajaTinte_Click(object sender, EventArgs e) { TinteGestor tinteGestor = new TinteGestor(); Tinte tinte = dgv_Tintes.SelectedRows[0].DataBoundItem as Tinte; controller.BajaTinte(tinte); dgv_Tintes.DataSource = null; dgv_Tintes.DataSource = tinteGestor.GetListTinte(); }
private void btn_ModificarTinte_Click(object sender, EventArgs e) { TinteGestor tinteGestor = new TinteGestor(); Tinte tinte = dgv_Tintes.SelectedRows[0].DataBoundItem as Tinte; tinte.Descripcion = txt_DescripcionTinte.Text; tinte.Cantidad = int.Parse(txt_CantidadTinte.Text); tinte.Color = txt_ColorTinte.Text; controller.ModificarTinte(tinte); dgv_Tintes.DataSource = null; dgv_Tintes.DataSource = tinteGestor.GetListTinte(); }
private void AreaTeñidoMenu_Load(object sender, EventArgs e) { IniciarControles(); TelaGestor telaGestor = new TelaGestor(); TinteGestor tinteGestor = new TinteGestor(); dgv_Telas.DataSource = null; dgv_Telas.DataSource = telaGestor.GetListTelaSinTeñir(); dgv_TelasTeñidas.DataSource = null; dgv_TelasTeñidas.DataSource = telaGestor.GetListTelaTeñida(); dgv_Tintes.DataSource = null; dgv_Tintes.DataSource = tinteGestor.GetListTinte(); }
private void btn_Tenir_Click(object sender, EventArgs e) { Tela tela = dgv_Telas.SelectedRows[0].DataBoundItem as Tela; Tinte tinte = dgv_Tintes.SelectedRows[0].DataBoundItem as Tinte; int cantTelaUtilizada = int.Parse(Interaction.InputBox("¿Cuánta cantidad de la tela seleccionada desea utilizar?")); int cantTinteUtilizado = int.Parse(Interaction.InputBox("¿Cuánta cantidad del tinte selecionado desea utilizar?")); string codigoTela = Interaction.InputBox("Ingrese el nombre de la tela tintada resultante"); controller.Teñir(tela, cantTelaUtilizada, tinte, cantTinteUtilizado, codigoTela); TelaGestor telaGestor = new TelaGestor(); TinteGestor tinteGestor = new TinteGestor(); dgv_Telas.DataSource = null; dgv_Telas.DataSource = telaGestor.GetListTelaSinTeñir(); dgv_TelasTeñidas.DataSource = null; dgv_TelasTeñidas.DataSource = telaGestor.GetListTelaTeñida(); dgv_Tintes.DataSource = null; dgv_Tintes.DataSource = tinteGestor.GetListTinte(); }