public void BindSolCalib() { Init(); List<CSolution_interm> lstSolCalib = new CSolution_intermFactory() .GetAll() .Where(x => x.Type_sol == 4).ToList(); this.Properties.DataSource = lstSolCalib; this.Properties.ValueMember = "Idsolution_interm"; this.Properties.DisplayMember = "Cod_solution"; }
public void BindSolInt2() { Init(); List<CSolution_interm> lstReactive = new CSolution_intermFactory() .GetAll() .Where(x => x.Type_sol == 2).ToList(); this.Properties.DataSource = lstReactive; this.Properties.ValueMember = "Idsolution_interm"; this.Properties.DisplayMember = "Cod_solution"; }
public void BindSolInt1And2() { Init(); List<CSolution_interm> lstReactive = new CSolution_intermFactory() .GetAll() .Where(x => x.Type_sol == 1 || x.Type_sol == 2).ToList(); this.Properties.DataSource = lstReactive; this.Properties.ValueMember = "Idsolution_interm"; this.Properties.DisplayMember = "Cod_solution"; }
private void ucSign1_OnSign(bool login) { if (login) { if (ckDisabledSolution.Checked) { //desactiva toda solución y sus métodos if (MessageBox.Show("Esta seguro que desea desactivar la solución.", "Desactivando solución", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { //desactivar solucion TreeListNode node = treeSolInterm.FocusedNode; int idsolution_interm = Convert.ToInt32(node["Idsolution_interm"]); CSolution_interm sol = new CSolution_intermFactory().GetAll().Where(x => x.Idsolution_interm == idsolution_interm).FirstOrDefault(); sol.Solution_obs = cbMotivo.Text; sol.Solution_status = false; if (sol != null) { new CSolution_intermFactory().Update(sol); } } } else { if (Son_Datos_Correctos()) { //según la ubicación de la pagina graba //guardando soluciones int idsolution_interm = 0; CSolution_intermFactory faSolution_interm = new CSolution_intermFactory(); bool result_solution = false; TreeListNode node = treeSolInterm.FocusedNode; idsolution_interm = Convert.ToInt32(node["Idsolution_interm"]); int typeSol = Convert.ToInt32(node["Type_sol"]); for (int i = 0; i < lstSolution.Count; i++) { result_solution = false; if (lstSolution[i].Idsolution_interm == idsolution_interm) { if (idsolution_interm == 0) { // 1:{solución intermedia1}, 2:{solución intermedia 2}, 3:{estandar de verificación} lstSolution[i].Cod_solution = null; if (!(result_solution = faSolution_interm.Update(lstSolution[i]))) { result_solution = faSolution_interm.Insert(lstSolution[i]); } // --- asignar un correlativo dependiendo del tipo de solución if (result_solution) { idsolution_interm = lstSolution[i].Idsolution_interm; ModCorrelatives oModCorrelatives = new ModCorrelatives(); if (lstSolution[i].Type_sol == 1) { lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(Comun.Correlative.SolucionInterm1); } else if (lstSolution[i].Type_sol == 2) { lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(Comun.Correlative.SolucionInterm2); } else if (lstSolution[i].Type_sol == 3) { lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(Comun.Correlative.EstandarVerificacion); } else if (lstSolution[i].Type_sol == 4) { lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(Comun.Correlative.EstandarCalibracion); } faSolution_interm.Update(lstSolution[i]); // guardar método actual a la solución CSolution_interm_methods oSolution_interm_methods = new CSolution_interm_methods(); oSolution_interm_methods.Idsolution_interm = lstSolution[i].Idsolution_interm; oSolution_interm_methods.Idtemplate_method = Convert.ToInt32(cbMethod1.EditValue); oSolution_interm_methods.Status = true; if (!new CSolution_interm_methodsFactory().Update(oSolution_interm_methods)) { new CSolution_interm_methodsFactory().Insert(oSolution_interm_methods); } if (typeSol == 4) { // guardar estandares de calibración ucCalibStd1.SaveCalibs(lstSolution[i]); } } } else // solucion existente { if (typeSol == 1 || typeSol == 2 || typeSol == 3) { if (ckAssignMethod.Checked) { // guardar método actual a la solución CSolution_interm_methods oSolution_interm_methods = new CSolution_interm_methods(); oSolution_interm_methods.Idsolution_interm = lstSolution[i].Idsolution_interm; oSolution_interm_methods.Idtemplate_method = Convert.ToInt32(cbMethod1.EditValue); oSolution_interm_methods.Status = true; if (!new CSolution_interm_methodsFactory().Update(oSolution_interm_methods)) { new CSolution_interm_methodsFactory().Insert(oSolution_interm_methods); } } } else if (typeSol == 4) { // asignar método, solo si no lo está CSolution_interm_methods oSolution_interm_methods = new CSolution_interm_methods(); oSolution_interm_methods.Idsolution_interm = lstSolution[i].Idsolution_interm; oSolution_interm_methods.Idtemplate_method = Convert.ToInt32(cbMethod1.EditValue); oSolution_interm_methods.Status = true; if (!new CSolution_interm_methodsFactory().Update(oSolution_interm_methods)) { new CSolution_interm_methodsFactory().Insert(oSolution_interm_methods); } // guardar estandares de calibración ucCalibStd1.SaveCalibs(lstSolution[i]); } } } } treeSolInterm.DataSource = lstSolution; gcMethods.DataSource = new ModSolInterm().GetMethodsBySol(idsolution_interm); // Seleccionar solucion if (idsolution_interm != 0) { TreeListNode nodo = treeSolInterm.FindNodeByFieldValue("Idsolution_interm", idsolution_interm); treeSolInterm.FocusedNode = nodo; } new FormMessage("Guardado", "Guardado correctamente.", true, false).ShowDialog(); ucSign1.Clear(); treeSolInterm.ExpandAll(); } else { ucSign1.Clear(); } } } else { new FormMessage("Error", "Contraseña incorrecta.", true, false).ShowDialog(); } }
private void ucSign1_OnSign(bool login) { if (login) { if (ckDisabledSolution.Checked) { //desactiva toda solución y sus métodos if (MessageBox.Show("Esta seguro que desea desactivar la solución.", "Desactivando solución", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { //desactivar solucion TreeListNode node = treeSolInterm.FocusedNode; int idsolution_interm = Convert.ToInt32(node["Idsolution_interm"]); CSolution_interm sol = new CSolution_intermFactory().GetAll().Where(x => x.Idsolution_interm == idsolution_interm).FirstOrDefault(); sol.Solution_obs = cbMotivo.Text; sol.Solution_status = false; if (sol != null) new CSolution_intermFactory().Update(sol); } } else { if (Son_Datos_Correctos()) { //según la ubicación de la pagina graba //guardando soluciones int idsolution_interm = 0; CSolution_intermFactory faSolution_interm = new CSolution_intermFactory(); bool result_solution = false; TreeListNode node = treeSolInterm.FocusedNode; idsolution_interm = Convert.ToInt32(node["Idsolution_interm"]); int typeSol = Convert.ToInt32(node["Type_sol"]); for (int i = 0; i < lstSolution.Count; i++) { result_solution = false; if (lstSolution[i].Idsolution_interm == idsolution_interm) { if (idsolution_interm == 0) { // 1:{solución intermedia1}, 2:{solución intermedia 2}, 3:{estandar de verificación} lstSolution[i].Cod_solution = null; if (!(result_solution = faSolution_interm.Update(lstSolution[i]))) result_solution = faSolution_interm.Insert(lstSolution[i]); // --- asignar un correlativo dependiendo del tipo de solución if (result_solution) { idsolution_interm = lstSolution[i].Idsolution_interm; ModCorrelatives oModCorrelatives = new ModCorrelatives(); if (lstSolution[i].Type_sol == 1) lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(Comun.Correlative.SolucionInterm1); else if (lstSolution[i].Type_sol == 2) lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(Comun.Correlative.SolucionInterm2); else if (lstSolution[i].Type_sol == 3) lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(Comun.Correlative.EstandarVerificacion); else if (lstSolution[i].Type_sol == 4) lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(Comun.Correlative.EstandarCalibracion); faSolution_interm.Update(lstSolution[i]); // guardar método actual a la solución CSolution_interm_methods oSolution_interm_methods = new CSolution_interm_methods(); oSolution_interm_methods.Idsolution_interm = lstSolution[i].Idsolution_interm; oSolution_interm_methods.Idtemplate_method = Convert.ToInt32(cbMethod1.EditValue); oSolution_interm_methods.Status = true; if (!new CSolution_interm_methodsFactory().Update(oSolution_interm_methods)) new CSolution_interm_methodsFactory().Insert(oSolution_interm_methods); if (typeSol == 4) { // guardar estandares de calibración ucCalibStd1.SaveCalibs(lstSolution[i]); } } } else // solucion existente { if (typeSol == 1 || typeSol == 2 || typeSol == 3) { if (ckAssignMethod.Checked) { // guardar método actual a la solución CSolution_interm_methods oSolution_interm_methods = new CSolution_interm_methods(); oSolution_interm_methods.Idsolution_interm = lstSolution[i].Idsolution_interm; oSolution_interm_methods.Idtemplate_method = Convert.ToInt32(cbMethod1.EditValue); oSolution_interm_methods.Status = true; if (!new CSolution_interm_methodsFactory().Update(oSolution_interm_methods)) new CSolution_interm_methodsFactory().Insert(oSolution_interm_methods); } } else if (typeSol == 4) { // asignar método, solo si no lo está CSolution_interm_methods oSolution_interm_methods = new CSolution_interm_methods(); oSolution_interm_methods.Idsolution_interm = lstSolution[i].Idsolution_interm; oSolution_interm_methods.Idtemplate_method = Convert.ToInt32(cbMethod1.EditValue); oSolution_interm_methods.Status = true; if (!new CSolution_interm_methodsFactory().Update(oSolution_interm_methods)) new CSolution_interm_methodsFactory().Insert(oSolution_interm_methods); // guardar estandares de calibración ucCalibStd1.SaveCalibs(lstSolution[i]); } } } } treeSolInterm.DataSource = lstSolution; gcMethods.DataSource = new ModSolInterm().GetMethodsBySol(idsolution_interm); // Seleccionar solucion if (idsolution_interm != 0) { TreeListNode nodo = treeSolInterm.FindNodeByFieldValue("Idsolution_interm", idsolution_interm); treeSolInterm.FocusedNode = nodo; } new FormMessage("Guardado", "Guardado correctamente.", true, false).ShowDialog(); ucSign1.Clear(); treeSolInterm.ExpandAll(); } else { ucSign1.Clear(); } } } else new FormMessage("Error", "Contraseña incorrecta.", true, false).ShowDialog(); }