Пример #1
0
        private void ucSign1_OnSign(bool login)
        {
            if (login)
            {
                if (nodeSolutionInProcess != null)
                {
                    ///si el nuevo nodo seleccionado es un estandar de verificación
                    ///reasignar el tipo de solucion intermedia de su solución padre
                    int type_sol = Convert.ToInt32(nodeSolutionInProcess["Type_sol"]);

                    if (type_sol == 3 || type_sol == 4)
                    {
                        if (nodeSolutionInProcess.Level == 1)
                        {
                            type_sol = 1;
                        }
                        if (nodeSolutionInProcess.Level == 2)
                        {
                            type_sol = 2;
                        }
                    }

                    FormSelMethods fmSelMethods = new FormSelMethods(group_solution, type_sol);

                    if (fmSelMethods.ShowDialog() == DialogResult.OK)
                    {
                        // --- guardar grupo de solución
                        CGroup_solutionFactory fagroup_solution = new CGroup_solutionFactory();
                        bool result = false;

                        if (!(result = fagroup_solution.Update(group_solution)))
                        {
                            result = fagroup_solution.Insert(group_solution);
                        }

                        // --- guardando soluciones
                        if (result)
                        {
                            // --- guardar los cambios en las soluciones
                            CSolutionFactory faSolution      = new CSolutionFactory();
                            bool             result_solution = false;
                            for (int i = 0; i < lstSolution.Count; i++)
                            {
                                result_solution = false;

                                if (lstSolution[i].Idsolution == 0)
                                {
                                    #region Grabar metodos a nueva solución ingresada

                                    lstSolution[i].Idgroup_solution = group_solution.Idgroup_solution;
                                    lstSolution[i].Cod_solution     = null;

                                    if (!(result_solution = faSolution.Update(lstSolution[i])))
                                    {
                                        result_solution = faSolution.Insert(lstSolution[i]);
                                    }

                                    // --- asignar un correlativo dependiendo del tipo de solución
                                    // 1:solución intermedia1, 2:solución intermedia 2, 3:estandar de verificación
                                    if (result_solution)
                                    {
                                        ModCorrelatives oModCorrelatives = new ModCorrelatives();
                                        if (lstSolution[i].Type_sol == 1 || lstSolution[i].Type_sol == 2)
                                        {
                                            lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(ModCorrelatives.Correlative.SolucionIntermedia);
                                        }
                                        else if (lstSolution[i].Type_sol == 3 || lstSolution[i].Type_sol == 4)
                                        {
                                            lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(ModCorrelatives.Correlative.EstandarVerificacion);
                                        }

                                        faSolution.Update(lstSolution[i]);
                                    }

                                    if (result_solution)
                                    {
                                        // --- grabar métodos de la solución
                                        CSolution_methodsFactory faSolution_methods = new CSolution_methodsFactory();
                                        CSolution_methods        oSolution_methods  = new CSolution_methods();
                                        string concatMethods          = "";
                                        bool   result_solution_method = false;

                                        // --- grabar linkeo de solución y métodos
                                        foreach (CMethodMini item in fmSelMethods.LstMethodMini)
                                        {
                                            if (item.Sel)
                                            {
                                                // indexar método a la solución
                                                oSolution_methods                   = new CSolution_methods();
                                                oSolution_methods.Idsolution        = lstSolution[i].Idsolution;
                                                oSolution_methods.Idtemplate_method = item.Idtemplate_method;
                                                oSolution_methods.Status            = true;

                                                if (!(result_solution_method = faSolution_methods.Update(oSolution_methods)))
                                                {
                                                    result_solution_method = faSolution_methods.Insert(oSolution_methods);
                                                }

                                                // concatenar método
                                                concatMethods += concatMethods.Trim().Length == 0 ? item.Cod_template_method : ", " + item.Cod_template_method;
                                            }
                                        }

                                        // asignar concatenado de métodos seleccionados al campo de la solucion[i]
                                        lstSolution[i].Concat_cod_methods = concatMethods;
                                        faSolution.Update(lstSolution[i]);
                                    }
                                    #endregion
                                }
                            }

                            treeSolInterm.DataSource = lstSolution;
                            FlagSolutionInProcess    = false;

                            ShowStatusButtons();

                            new FormMessage("Guardado", "Guardado correctamente.", true, false).ShowDialog();

                            ucSign1.Clear();
                            treeSolInterm.ExpandAll();
                        }

                        onSignSolInterm(group_solution);
                    }
                }
                else
                {
                    ///No existe ningún nodo en proceso, entonces los cambios
                    ///fueron sobre el estado de las soluciones
                    ///
                    CSolutionFactory faSolution = new CSolutionFactory();
                    for (int i = 0; i < lstSolution.Count; i++)
                    {
                        faSolution.Update(lstSolution[i]);
                    }

                    treeSolInterm.DataSource = lstSolution;

                    ShowStatusButtons();
                    new FormMessage("Guardado", "Guardado correctamente.", true, false).ShowDialog();
                    ucSign1.Clear();
                    treeSolInterm.ExpandAll();

                    onSignSolInterm(group_solution);
                }
            }
            else
            {
                new FormMessage("Error", "Contraseña incorrecta.", true, false).ShowDialog();
            }
        }
Пример #2
0
        private void ucSign1_OnSign(bool login)
        {
            if (login)
            {
                if (nodeSolutionInProcess != null)
                {
                    ///si el nuevo nodo seleccionado es un estandar de verificación
                    ///reasignar el tipo de solucion intermedia de su solución padre
                    int type_sol = Convert.ToInt32(nodeSolutionInProcess["Type_sol"]);

                    if (type_sol == 3 || type_sol == 4)
                    {
                        if (nodeSolutionInProcess.Level == 1)
                            type_sol = 1;
                        if (nodeSolutionInProcess.Level == 2)
                            type_sol = 2;
                    }

                    FormSelMethods fmSelMethods = new FormSelMethods(group_solution, type_sol);

                    if (fmSelMethods.ShowDialog() == DialogResult.OK)
                    {
                        // --- guardar grupo de solución
                        CGroup_solutionFactory fagroup_solution = new CGroup_solutionFactory();
                        bool result = false;

                        if (!(result = fagroup_solution.Update(group_solution)))
                            result = fagroup_solution.Insert(group_solution);

                        // --- guardando soluciones
                        if (result)
                        {
                            // --- guardar los cambios en las soluciones
                            CSolutionFactory faSolution = new CSolutionFactory();
                            bool result_solution = false;
                            for (int i = 0; i < lstSolution.Count; i++)
                            {
                                result_solution = false;

                                if (lstSolution[i].Idsolution == 0)
                                {
                                    #region Grabar metodos a nueva solución ingresada

                                    lstSolution[i].Idgroup_solution = group_solution.Idgroup_solution;
                                    lstSolution[i].Cod_solution = null;

                                    if (!(result_solution = faSolution.Update(lstSolution[i])))
                                        result_solution = faSolution.Insert(lstSolution[i]);

                                    // --- asignar un correlativo dependiendo del tipo de solución
                                    // 1:solución intermedia1, 2:solución intermedia 2, 3:estandar de verificación
                                    if (result_solution)
                                    {
                                        ModCorrelatives oModCorrelatives = new ModCorrelatives();
                                        if (lstSolution[i].Type_sol == 1 || lstSolution[i].Type_sol == 2)
                                            lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(ModCorrelatives.Correlative.SolucionIntermedia);
                                        else if (lstSolution[i].Type_sol == 3 || lstSolution[i].Type_sol == 4)
                                            lstSolution[i].Cod_solution = oModCorrelatives.GetCorrelative(ModCorrelatives.Correlative.EstandarVerificacion);

                                        faSolution.Update(lstSolution[i]);
                                    }

                                    if (result_solution)
                                    {
                                        // --- grabar métodos de la solución
                                        CSolution_methodsFactory faSolution_methods = new CSolution_methodsFactory();
                                        CSolution_methods oSolution_methods = new CSolution_methods();
                                        string concatMethods = "";
                                        bool result_solution_method = false;

                                        // --- grabar linkeo de solución y métodos
                                        foreach (CMethodMini item in fmSelMethods.LstMethodMini)
                                        {
                                            if (item.Sel)
                                            {
                                                // indexar método a la solución
                                                oSolution_methods = new CSolution_methods();
                                                oSolution_methods.Idsolution = lstSolution[i].Idsolution;
                                                oSolution_methods.Idtemplate_method = item.Idtemplate_method;
                                                oSolution_methods.Status = true;

                                                if (!(result_solution_method = faSolution_methods.Update(oSolution_methods)))
                                                    result_solution_method = faSolution_methods.Insert(oSolution_methods);

                                                // concatenar método
                                                concatMethods += concatMethods.Trim().Length == 0 ? item.Cod_template_method : ", " + item.Cod_template_method;
                                            }
                                        }

                                        // asignar concatenado de métodos seleccionados al campo de la solucion[i]
                                        lstSolution[i].Concat_cod_methods = concatMethods;
                                        faSolution.Update(lstSolution[i]);
                                    }
                                    #endregion
                                }
                            }

                            treeSolInterm.DataSource = lstSolution;
                            FlagSolutionInProcess = false;

                            ShowStatusButtons();

                            new FormMessage("Guardado", "Guardado correctamente.", true, false).ShowDialog();

                            ucSign1.Clear();
                            treeSolInterm.ExpandAll();
                        }

                        onSignSolInterm(group_solution);
                    }
                }
                else
                {
                    ///No existe ningún nodo en proceso, entonces los cambios
                    ///fueron sobre el estado de las soluciones
                    ///
                    CSolutionFactory faSolution = new CSolutionFactory();
                    for (int i = 0; i < lstSolution.Count; i++)
                        faSolution.Update(lstSolution[i]);

                    treeSolInterm.DataSource = lstSolution;

                    ShowStatusButtons();
                    new FormMessage("Guardado", "Guardado correctamente.", true, false).ShowDialog();
                    ucSign1.Clear();
                    treeSolInterm.ExpandAll();

                    onSignSolInterm(group_solution);
                }
            }
            else
                new FormMessage("Error", "Contraseña incorrecta.", true, false).ShowDialog();
        }