Exemplo n.º 1
0
        public static void Finalize_process(long idbatch, string process, string sgtProcess)
        {
            CTrace_batchFactory faTrace_batch = new CTrace_batchFactory();

            // --- get a process existing
            CTrace_batch oTrace_batch = new LimsProject.BusinessLayer.Modules.ModProcessBatch().GetLastProcessBatch(process, idbatch);
            CProcess     oProcess     = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(process));

            if (oTrace_batch == null)
            {
                oTrace_batch         = new CTrace_batch();
                oTrace_batch.Date_in = Comun.GetDate();
                oTrace_batch.Usernew = Comun.GetUser();
                oTrace_batch.Idbatch = idbatch;
            }

            oTrace_batch.Date_out    = Comun.GetDate();
            oTrace_batch.Cod_process = process;
            //oTrace_batch.Cod_module = modulo;
            oTrace_batch.Useredit       = Comun.GetUser();
            oTrace_batch.Status_process = Convert.ToChar(LimsProcess.Status_Process.Finished);

            if (!faTrace_batch.Update(oTrace_batch))
            {
                faTrace_batch.Insert(oTrace_batch);
            }

            // --- create a new process
            Initialize_process(idbatch, sgtProcess);
        }
Exemplo n.º 2
0
        public static void Advance_process(long idrecep_sample_detail_elem, string process)
        {
            CTrace_sample_elemFactory faTrace_sample_elem = new CTrace_sample_elemFactory();

            // --- get a process existing
            CTrace_sample_elem oTrace_sample_elem =
                faTrace_sample_elem.GetAll()
                .Where(x => x.Idrecep_sample_detail_elem == idrecep_sample_detail_elem && x.Cod_process == process)
                .OrderBy(x => x.Idtrace_sample_elem).OrderByDescending(x => x.Date_in).FirstOrDefault();

            if (oTrace_sample_elem == null)
            {
                oTrace_sample_elem         = new CTrace_sample_elem();
                oTrace_sample_elem.Usernew = Comun.GetUser();
                oTrace_sample_elem.Date_in = Comun.GetDate();
            }

            oTrace_sample_elem.Cod_process = process;
            oTrace_sample_elem.Idrecep_sample_detail_elem = idrecep_sample_detail_elem;
            oTrace_sample_elem.Status_process             = Convert.ToChar(LimsProcess.ModuleStatus.InProcess);
            oTrace_sample_elem.Useredit = Comun.GetUser();

            if (!faTrace_sample_elem.Update(oTrace_sample_elem))
            {
                faTrace_sample_elem.Insert(oTrace_sample_elem);
            }
        }
Exemplo n.º 3
0
        public static void Advance_process(long idbatch, string process)
        {
            CTrace_batchFactory faTrace_batch = new CTrace_batchFactory();

            // --- get a process existing
            CTrace_batch oTrace_batch = new LimsProject.BusinessLayer.Modules.ModProcessBatch().GetLastProcessBatch(process, idbatch);

            if (oTrace_batch == null)
            {
                oTrace_batch         = new CTrace_batch();
                oTrace_batch.Date_in = Comun.GetDate();
                oTrace_batch.Usernew = Comun.GetUser();
                oTrace_batch.Idbatch = idbatch;
            }

            oTrace_batch.Cod_process = process;
            //oTrace_batch.Cod_module = module;
            oTrace_batch.Usernew        = Comun.GetUser();
            oTrace_batch.Useredit       = Comun.GetUser();
            oTrace_batch.Status_process = Convert.ToChar(LimsProcess.Status_Process.InProcess);

            if (!faTrace_batch.Update(oTrace_batch))
            {
                faTrace_batch.Insert(oTrace_batch);
            }
        }
Exemplo n.º 4
0
        public static void Finalize_process(long idrecep_sample_detail_elem, string process, string sgtProcess)
        {
            CTrace_sample_elemFactory faTrace_sample_elem = new CTrace_sample_elemFactory();

            // --- get a process existing
            CTrace_sample_elem oTrace_sample_elem =
                faTrace_sample_elem.GetAll()
                .Where(x => x.Idrecep_sample_detail_elem == idrecep_sample_detail_elem && x.Cod_process == process)
                .OrderBy(x => x.Idtrace_sample_elem).OrderByDescending(x => x.Date_in).FirstOrDefault();

            if (oTrace_sample_elem == null)
            {
                oTrace_sample_elem         = new CTrace_sample_elem();
                oTrace_sample_elem.Date_in = Comun.GetDate();
                oTrace_sample_elem.Usernew = Comun.User_system.Cod_user;
                oTrace_sample_elem.Idrecep_sample_detail_elem = idrecep_sample_detail_elem;
                //oTrace_sample_elem.Cod_module = module;
                oTrace_sample_elem.Cod_process = process;
            }

            oTrace_sample_elem.Date_out       = Comun.GetDate();
            oTrace_sample_elem.Status_process = Convert.ToChar(LimsProcess.Status_Process.Finished);
            oTrace_sample_elem.Useredit       = Comun.GetUser();

            if (!faTrace_sample_elem.Update(oTrace_sample_elem))
            {
                faTrace_sample_elem.Insert(oTrace_sample_elem);
            }

            // --- create a new process
            Initialize_process(idrecep_sample_detail_elem, sgtProcess);
        }
Exemplo n.º 5
0
        private void repSelect_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
        {
            // --- edit if user row is equal to current user
            // --- guardar check
            bool sign_factor_authorized = SignFactorAuthorized();

            CSolution_titration oSolution_titration = gvSolTitration.GetRow(gvSolTitration.FocusedRowHandle) as CSolution_titration;

            if (oSolution_titration.Prepared_by == Comun.User_system.Iduser ||
                sign_factor_authorized)
            {
                oSolution_titration.Status_titration = Convert.ToBoolean(e.NewValue);
                oSolution_titration.Date_prepared    = Comun.GetDate();
                faSolution_titration.Update(oSolution_titration);
                gvSolTitration.UpdateCurrentRow();

                // --- recalcular promedio
                Assign_average();

                // --- habilitar para firmar
                EnabledSignData();
            }
            else
            {
                e.Cancel = true;
            }
        }
Exemplo n.º 6
0
        public void RetestBatch()
        {
            try
            {
                CBatchFactory faBatch = new CBatchFactory();
                CBatch        oBatch  = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch));

                // --- check parity
                for (int i = 0; i < ListSamples.Count; i++)
                {
                    CBatch_detail_aa_twofold        row = ListSamples[i];
                    CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();

                    if (Convert.ToInt32(row.Flag_mri) == 0)
                    {
                        // --- approved samples with additional retest mark
                        row.Qaqc_has_retest = 1;
                        faBatch_detail_aa_twofold.Update(row);

                        // --- save retest
                        string       cod_type_sample = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(Convert.ToInt32(row.Idtemplate_method))).Cod_type_sample;
                        CCorrelative oCorrelative    = new CCorrelativeFactory().GetByPrimaryKey(new CCorrelativeKeys(cod_type_sample));

                        CBatchManager oBatchManager = new CBatchManager();

                        oBatchManager.CallSaveFromRetestFullBatch(
                            Convert.ToInt32(row.Idtemplate_method),
                            Convert.ToInt64(row.Idrecep_sample),
                            Convert.ToInt64(row.Idrecep_sample_detail),
                            Convert.ToInt64(row.Idrecep_sample_detail_elem),
                            Convert.ToInt64(row.Cod_interno),
                            row.Cod_sample,
                            Comun.GetUser(),
                            oCorrelative,
                            row.Qaqc_par);

                        // --- register as finished trace process
                        CProcess_Sample_Manage.Finalize_process(Convert.ToInt64(row.Idrecep_sample_detail_elem), LimsProcess.PROCESS_IN_READING, LimsProcess.PROCESS_APPROVE_SAMPLES);
                    }
                }

                // --- modify the batch status, put in other process
                CProcess oProcess = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(LimsProcess.PROCESS_APPROVE_SAMPLES));
                oBatch.Status_process    = Convert.ToChar(LimsProcess.Status_Process.Waiting);
                oBatch.Cod_module        = oProcess.Cod_module;
                oBatch.Cod_area          = oProcess.Cod_area;
                oBatch.Cod_process       = LimsProcess.PROCESS_APPROVE_SAMPLES;
                oBatch.User_approve_tray = Comun.GetUser();
                oBatch.Date_approve_tray = Comun.GetDate();
                faBatch.Update(oBatch);

                // --- register as finished trace batch
                Cprocess_Batch_Manage.Finalize_process(Idbatch, LimsProcess.PROCESS_IN_READING, LimsProcess.PROCESS_APPROVE_SAMPLES);
            }
            catch (Exception ex)
            {
                Comun.Save_log(ex.InnerException.ToString());
                throw new Exception("pivot data::approve::Error occured.", ex);
            }
        }
Exemplo n.º 7
0
        protected override bool Grabar_Registro()
        {
            try
            {
                // borrar datos
                foreach (CCompound item in new CCompoundFactory().GetAll())
                {
                    item.Status = false;
                    new CCompoundFactory().Update(item);
                }

                // guardar grid
                foreach (CCompound item in gcCompound.DataSource as BindingList <CCompound> )
                {
                    item.Status   = true;
                    item.Useredit = Comun.GetUser();
                    item.Dateedit = Comun.GetDate();
                    if (!new CCompoundFactory().Update(item))
                    {
                        item.Usernew = Comun.GetUser();
                        item.Datenew = Comun.GetDate();
                        new CCompoundFactory().Insert(item);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                ComunForm.Send_message("Compuestos", TypeMsg.error, ex.Message);
                return(false);
            }
        }
Exemplo n.º 8
0
        protected override bool Grabar_Registro()
        {
            CElement oElement = new CElement();

            oElement.Idelement      = Idelement;
            oElement.Cod_element    = tbCodElement.Text;
            oElement.Name_element   = tbDenomination.Text;
            oElement.Description    = tbDescription.Text;
            oElement.Native_element = tbGroup.Text;
            oElement.Type_element   = 'C';

            if (Idelement == 0)
            {
                oElement.Usernew  = Comun.GetUser();
                oElement.Useredit = Comun.GetUser();
                oElement.Datenew  = Comun.GetDate();
                oElement.Dateedit = Comun.GetDate();
            }
            else
            {
                oElement.Datenew  = Comun.GetDate();
                oElement.Dateedit = Comun.GetDate();
            }

            CElementFactory faElement = new CElementFactory();

            if (!faElement.Update(oElement))
            {
                faElement.Insert(oElement);
            }
            ComunForm.Send_message(this.Text, TypeMsg.ok, "");
            return(true);
        }
Exemplo n.º 9
0
        protected override bool Grabar_Registro()
        {
            try
            {
                // eliminar todo
                foreach (CFactor_estequiometrico item in new CFactor_estequiometricoFactory().GetAll())
                {
                    item.Status = false;
                    new CFactor_estequiometricoFactory().Update(item);
                }

                // guardar
                foreach (CFactor_estequiometrico item in gcFactorEstequ.DataSource as BindingList <CFactor_estequiometrico> )
                {
                    item.Status   = true;
                    item.Dateedit = Comun.GetDate();
                    item.Useredit = Comun.GetUser();
                    if (!new CFactor_estequiometricoFactory().Update(item))
                    {
                        item.Useredit = Comun.GetUser();
                        item.Datenew  = Comun.GetDate();
                        new CFactor_estequiometricoFactory().Insert(item);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                ComunForm.Send_message("Factores estequiométricos", TypeMsg.error, ex.Message);
                return(true);
            }
        }
Exemplo n.º 10
0
        private void gvSolTitration_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column == gcCol_Practice_reading || e.Column == gcCol_Theorical_reading)
            {
                if (gvSolTitration.GetFocusedRowCellValue(gcCol_Theorical_reading) != null)
                {
                    CSolution_titration oSolution_titration = gvSolTitration.GetRow(gvSolTitration.FocusedRowHandle) as CSolution_titration;
                    oSolution_titration.Date_prepared = Comun.GetDate();
                    if (!faSolution_titration.Update(oSolution_titration))
                    {
                        faSolution_titration.Insert(oSolution_titration);
                    }
                }

                if (gvSolTitration.GetFocusedRowCellValue(gcCol_Practice_reading) != null)
                {
                    CSolution_titration oSolution_titration = gvSolTitration.GetRow(gvSolTitration.FocusedRowHandle) as CSolution_titration;
                    oSolution_titration.Date_prepared = Comun.GetDate();
                    if (!faSolution_titration.Update(oSolution_titration))
                    {
                        faSolution_titration.Insert(oSolution_titration);
                    }
                }

                if (gvSolTitration.GetFocusedRowCellValue(gcCol_Theorical_reading) != null &&
                    gvSolTitration.GetFocusedRowCellValue(gcCol_Practice_reading) != null)
                {
                    decimal theorical_reading = Convert.ToDecimal(gvSolTitration.GetFocusedRowCellValue(gcCol_Theorical_reading));
                    decimal practice_reading  = Convert.ToDecimal(gvSolTitration.GetFocusedRowCellValue(gcCol_Practice_reading));
                    decimal factor            = 0;

                    if (practice_reading > 0)
                    {
                        factor = Math.Round(theorical_reading / practice_reading, 4);
                    }

                    gvSolTitration.SetFocusedRowCellValue(gcCol_Factor, factor);

                    CSolution_titration oSolution_titration = gvSolTitration.GetRow(gvSolTitration.FocusedRowHandle) as CSolution_titration;
                    oSolution_titration.Date_prepared = Comun.GetDate();
                    if (!faSolution_titration.Update(oSolution_titration))
                    {
                        faSolution_titration.Insert(oSolution_titration);
                    }
                }

                // --- habilitar la firma del analista
                Flag_Date_Modified = true;

                EnabledSignData();
            }
            if (e.Column == gcCol_Factor)
            {
                Assign_average();
            }
        }
Exemplo n.º 11
0
        protected override bool Grabar_Registro()
        {
            CType_solutionFactory faType_solution = new CType_solutionFactory();

            try
            {
                // --- remove all
                List <CType_solution> lstType_solution = new List <CType_solution>(new CType_solutionFactory().GetAll());

                for (int i = 0; i < lstType_solution.Count; i++)
                {
                    CType_solution current_row = lstType_solution[i];

                    if (current_row.Idtype_solution > 0)
                    {
                        current_row.Status = false;
                        faType_solution.Update(current_row);
                    }
                }

                // --- save all
                for (int i = 0; i < gvTypeSolution.RowCount; i++)
                {
                    CType_solution current_row = gvTypeSolution.GetRow(i) as CType_solution;

                    if (current_row.Idtype_solution == 0)
                    {
                        current_row.Usernew = Comun.GetUser();
                        current_row.Datenew = Comun.GetDate();
                        current_row.Status  = true;
                    }
                    else
                    {
                        current_row.Useredit = Comun.GetUser();
                        current_row.Dateedit = Comun.GetDate();
                        current_row.Status   = true;
                    }


                    if (!faType_solution.Update(current_row))
                    {
                        faType_solution.Insert(current_row);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                ComunForm.Send_message(this.Text, TypeMsg.error, ex.Message);
                return(false);
            }
        }
Exemplo n.º 12
0
        void SaveData()
        {
            //guardar las filas cuyo valor de idelement_wavelength sea igual a 0
            foreach (CElement_wavelength item in gcElemWavelength.DataSource as BindingList <CElement_wavelength> )
            {
                if (item.Idelement_wavelength == 0)
                {
                    item.Status   = true;
                    item.Dateedit = Comun.GetDate();
                    item.Useredit = Comun.GetUser();

                    new CElement_wavelengthFactory().Insert(item);
                }
            }
        }
Exemplo n.º 13
0
        protected override bool Grabar_Registro()
        {
            CCompanyFactory faCompany = new CCompanyFactory();
            CCompany        oCompany;

            if ((oCompany = faCompany.GetByPrimaryKey(new CCompanyKeys(IDCompany))) == null)
            {
                oCompany = new CCompany();
            }

            oCompany.Idcompany     = IDCompany;
            oCompany.Business_name = tbBusinessName.Text;
            oCompany.Domicile      = tbClientDomicile.Text;
            oCompany.Mail          = tbClientEmail.Text;
            oCompany.Phone_client  = tbClientPhone.Text;
            oCompany.Ruc           = tbClientRuc.Text;
            oCompany.Type_company  = Convert.ToChar(cbTypeCompany.EditValue);

            if (IDCompany == 0)
            {
                oCompany.Usernew  = Comun.GetUser();
                oCompany.Useredit = Comun.GetUser();
                oCompany.Datenew  = Comun.GetDate();
                oCompany.Dateedit = Comun.GetDate();
            }
            else
            {
                oCompany.Useredit = Comun.GetUser();
                oCompany.Dateedit = Comun.GetDate();
            }

            bool result = false;

            if (!(result = faCompany.Update(oCompany)))
            {
                if (!result)
                {
                    result = faCompany.Insert(oCompany);
                }
            }

            if (result)
            {
                LoadDataMasterSearh(new CCompanyFactory().GetAllDataTable());
            }

            return(result);
        }
Exemplo n.º 14
0
        public static void Initialize_process(long idrecep_sample_detail_elem, string process)
        {
            // --- register the finished process,
            CTrace_sample_elemFactory faTrace_sample_elem = new CTrace_sample_elemFactory();
            CTrace_sample_elem        oTrace_sample_elem  = new CTrace_sample_elem();

            // --- register the initiatied process
            oTrace_sample_elem         = new CTrace_sample_elem();
            oTrace_sample_elem.Date_in = Comun.GetDate();
            //oTrace_sample_elem.Cod_module = module;
            oTrace_sample_elem.Cod_process = process;
            oTrace_sample_elem.Idrecep_sample_detail_elem = idrecep_sample_detail_elem;
            oTrace_sample_elem.Status_process             = Convert.ToChar(LimsProcess.Status_Process.Waiting);
            oTrace_sample_elem.Usernew  = Comun.GetUser();
            oTrace_sample_elem.Useredit = Comun.GetUser();

            faTrace_sample_elem.Insert(oTrace_sample_elem);
        }
Exemplo n.º 15
0
        public static void Initialize_process(long idbatch, string process)
        {
            // --- register the finished process,
            CTrace_batchFactory faTrace_batch = new CTrace_batchFactory();
            CTrace_batch        oTrace_batch  = new CTrace_batch();

            // --- register the initiatied process
            oTrace_batch             = new CTrace_batch();
            oTrace_batch.Date_in     = Comun.GetDate();
            oTrace_batch.Cod_process = process;
            //oTrace_batch.Cod_module = module;
            oTrace_batch.Idbatch        = idbatch;
            oTrace_batch.Status_process = Convert.ToChar(LimsProcess.Status_Process.Waiting);
            oTrace_batch.Usernew        = Comun.GetUser();
            oTrace_batch.Datenew        = Comun.GetDate();

            faTrace_batch.Insert(oTrace_batch);
        }
Exemplo n.º 16
0
        protected override void Limpiar_Campos()
        {
            oPrice                  = null;
            oPrice_version          = null;
            LstPrice_version_detail = null;
            totalAmount             = 0;

            cbTypeSample.EditValue  = null;
            cbCompany.EditValue     = null;
            deDateCreation.DateTime = Comun.GetDate();
            tbNumDaysValid.Value    = new CSettings().GetNumDaysPriceDefault();

            tbClientDomicile.Text       = "";
            tbClientPhone.Text          = "";
            tbClientRuc.Text            = "";
            tabHead.Text                = "Datos";
            tbCodPrice.Text             = "";
            tbNumVersion.Text           = "";
            ckDispatchCurier.Checked    = false;
            ckDispatchFax.Checked       = false;
            ckDispatchPerson.Checked    = false;
            ckDispatchTransport.Checked = false;
            ckSaveHistoryEnd.Checked    = false;
            ckSaveHistoryIni.Checked    = false;
            tbObservation.Text          = "";

            tbSubTotalAmount.Value = 0;
            tbTotalAmount.Value    = 0;
            tbTotalIgv.Value       = 0;

            gcPrice.DataSource   = new BindingList <PriceMethod>(new ModPrice().GetPriceMethod(null));
            gcContact.DataSource = null;

            richTextIni.RichTextBox.Clear();
            richTextEnd.RichTextBox.Clear();

            gcAnexos.DataSource = new BindingList <Anexos>(new ModPrice().GetLstAnexos(null));

            previewControl1.Clear();

            loadData = LoadData.Nothing;

            ShowStatusControl();
        }
Exemplo n.º 17
0
        private void ucSignFactor_OnSign(bool login)
        {
            // --- firmar jefe de guardia
            if (login)
            {
                // --- guardar trazabilidad y aceptar el factor.
                Titration_main.Analyst4              = Comun.User_system.Iduser;
                Titration_main.Date_analyst4         = Comun.GetDate();
                Titration_main.Factor                = tbFactorEnd.Value;
                Titration_main.Idunit_measure_factor = Convert.ToInt16(cbFactorUnitMeasure.EditValue);

                //if (faTitration_main.Update(Titration_main))
                //    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                //else
                //{
                //    ComunForm.Send_message(this.Text, TypeMsg.error, "Error de conexión.");
                //    this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                //}
            }
        }
Exemplo n.º 18
0
        void InitData()
        {
            CReactiveFactory faReactive  = new CReactiveFactory();
            List <CReactive> lstReactive = faReactive.GetAll();

            lstReactive.Add(new CReactive()
            {
                Idreactive = 0, Reactive_name = "---", Chemical_formula = "---"
            });

            cbMedium.Properties.DataSource    = lstReactive;
            cbMedium.Properties.ValueMember   = "Idreactive";
            cbMedium.Properties.DisplayMember = "Reactive_name";

            cbModif.Properties.DataSource    = lstReactive;
            cbModif.Properties.ValueMember   = "Idreactive";
            cbModif.Properties.DisplayMember = "Reactive_name";

            CTemplate_method_aa        oTemplate_method_aa  = new CTemplate_method_aa();
            CTemplate_method_aaFactory faTemplate_method_aa = new CTemplate_method_aaFactory();

            oTemplate_method_aa =
                faTemplate_method_aa.GetByPrimaryKey(new CTemplate_method_aaKeys(idtemplate_method));

            idreactive_medium = oTemplate_method_aa.Medium;
            idreactive_modif  = oTemplate_method_aa.Modif;

            LstAllCalibs          = oModCalibStd.GetCustomCalibStd(idelement, idmr_detail, idreactive_medium, idreactive_modif);
            gcCalibStd.DataSource = LstAllCalibs;
            gvCalibStd.ExpandAllGroups();


            //oGroup_solution = oModCalibStd.GetMethodCalib(idelement, idmr_detail, idreactive_medium, idreactive_modif);

            CElement oElement = new CElementFactory()
                                .GetByPrimaryKey(new CElementKeys(Convert.ToInt16(idelement)));


            ucTraceUser1.UserSign = Comun.GetUser();
            ucTraceUser1.DateSign = Comun.GetDate();
        }
Exemplo n.º 19
0
        void InitDataControls()
        {
            deDateCreation.DateTime = Comun.GetDate();
            tbNumDaysValid.Value    = new CSettings().GetNumDaysPriceDefault();

            // --- init company
            cbCompany.Properties.DataSource    = new CCompanyFactory().GetAll();
            cbCompany.Properties.DisplayMember = "Business_name";
            cbCompany.Properties.ValueMember   = "Idcompany";

            // --- init type sample combo
            CType_sampleFactory faType_Sample = new CType_sampleFactory();

            cbTypeSample.Properties.DataSource    = faType_Sample.GetAll();
            cbTypeSample.Properties.ValueMember   = "Cod_type_sample";
            cbTypeSample.Properties.DisplayMember = "Name_type_sample";

            Reception oReception = new Reception();

            // --- init type person
            repPerson_type.DataSource    = oReception.GetLstPersonType();
            repPerson_type.DisplayMember = "Name";
            repPerson_type.ValueMember   = "Id";

            // --- init methods
            gcPrice.DataSource = new BindingList <PriceMethod>(new ModPrice().GetPriceMethod(null));

            // --- init plantillas
            CMemo_templateFactory faMemo_template = new CMemo_templateFactory();

            gcParagraphHistoryIni.DataSource = faMemo_template.GetAll().Where(c => c.Memo_type == 1).ToList();

            gcParagraphHistoryEnd.DataSource = faMemo_template.GetAll().Where(c => c.Memo_type == 2).ToList();

            // --- init adjuntos
            List <Anexos> list = new ModPrice().GetLstAnexos(null);

            gcAnexos.DataSource = new BindingList <Anexos>(list);
        }
Exemplo n.º 20
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            if (cbCompany.EditValue != null && cbMethodAdd.EditValue != null)
            {
                BindingList <PriceMethod> lst = gcPrice.DataSource as BindingList <PriceMethod>;
                List <PriceMethod>        myLstPriceMethod = lst.ToList();

                // agregar un método a la lista
                int idtemplate_method             = Convert.ToInt32(cbMethodAdd.EditValue);
                CTemplate_method oTemplate_method = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(idtemplate_method));

                CPrice_version price_version = new CPrice_version();
                price_version.Idprice_version = 0;
                price_version.Idcompany       = Convert.ToInt16(cbCompany.EditValue);
                price_version.Date_creation   = Comun.GetDate();

                CPrice_version_detail price_version_detail = new CPrice_version_detail();
                price_version_detail.Num_item          = myLstPriceMethod.Count + 1;
                price_version_detail.Amount_item       = 1;
                price_version_detail.Idtemplate_method = idtemplate_method;
                price_version_detail.Unit_price        = oTemplate_method.Cost_method;
                price_version_detail.Sale_price        = oTemplate_method.Cost_method * price_version_detail.Amount_item;

                myLstPriceMethod.Add(
                    new PriceMethod(price_version_detail, new ModPrice().GetPriceMethodHistory(price_version, price_version_detail.Idtemplate_method)));

                gcPrice.DataSource = new BindingList <PriceMethod>(myLstPriceMethod);
                gvPrice.LayoutChanged();

                cbMethodAdd.EditValue = null;

                SumTotals();

                ShowPreviewReport();
            }
        }
Exemplo n.º 21
0
        private void gvPrepSample_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (e.Column == gcol_Weight_gross)
            {
                // actualizar fecha entrada y usuario
                CPrep_samples oPrep_sample = gvPrepSample.GetRow(e.RowHandle) as CPrep_samples;
                oPrep_sample.Weight_gross_date = Comun.GetDate();
                oPrep_sample.Weight_gross_user = Comun.GetUser();
                SetComplete(oPrep_sample);
                new CPrep_samplesFactory().Update(oPrep_sample);
            }
            else if (e.Column == gcol_Weight_moisture)
            {
                // actualizar fecha de peso húmedo y usuario
                CPrep_samples oPrep_sample = gvPrepSample.GetRow(e.RowHandle) as CPrep_samples;
                if (oPrep_sample.Weight_moisture != null && oPrep_sample.Weight_dry != null &&
                    oPrep_sample.Weight_dry > 0 && oPrep_sample.Weight_moisture > 0)
                {
                    oPrep_sample.Percent_moisture = Math.Round(Convert.ToDecimal((oPrep_sample.Weight_moisture - oPrep_sample.Weight_dry) / oPrep_sample.Weight_moisture), 2);
                }

                oPrep_sample.Weight_moisture_date = Comun.GetDate();
                oPrep_sample.Weight_moisture_user = Comun.GetUser();
                SetComplete(oPrep_sample);
                new CPrep_samplesFactory().Update(oPrep_sample);
            }
            else if (e.Column == gcol_Weight_dry)
            {
                // actualizar fecha de peso seco y usuario y calcular la humedad
                CPrep_samples oPrep_sample = gvPrepSample.GetRow(e.RowHandle) as CPrep_samples;

                if (oPrep_sample.Weight_moisture != null && oPrep_sample.Weight_dry != null &&
                    oPrep_sample.Weight_dry > 0 && oPrep_sample.Weight_moisture > 0)
                {
                    oPrep_sample.Percent_moisture = Math.Round(Convert.ToDecimal((oPrep_sample.Weight_moisture - oPrep_sample.Weight_dry) / oPrep_sample.Weight_moisture), 2);
                    oPrep_sample.Weight_dry_date  = Comun.GetDate();
                    oPrep_sample.Weight_dry_user  = Comun.GetUser();
                    SetComplete(oPrep_sample);
                    new CPrep_samplesFactory().Update(oPrep_sample);
                }
            }
            else if (e.Column == gcol_Weight_gross_reject)
            {
                // actualizar fecha de rechazo y usuario
                CPrep_samples oPrep_sample = gvPrepSample.GetRow(e.RowHandle) as CPrep_samples;

                oPrep_sample.Weight_gross_reject_date = Comun.GetDate();
                oPrep_sample.Weight_gross_reject_user = Comun.GetUser();
                SetComplete(oPrep_sample);
                new CPrep_samplesFactory().Update(oPrep_sample);
            }
            else if (e.Column == gcol_Moisture_reject)
            {
                // actualizar fecha, usuario de humedad
                CPrep_samples oPrep_sample = gvPrepSample.GetRow(e.RowHandle) as CPrep_samples;

                oPrep_sample.Moisture_reject_date = Comun.GetDate();
                oPrep_sample.Moisture_reject_user = Comun.GetUser();
                SetComplete(oPrep_sample);
                new CPrep_samplesFactory().Update(oPrep_sample);
            }
            else if (e.Column == gcol_Output_flag_sample)
            {
                // actualizar fecha, usuario en salida de muestra
                CPrep_samples oPrep_sample = gvPrepSample.GetRow(e.RowHandle) as CPrep_samples;

                oPrep_sample.Output_date_sample = Comun.GetDate();
                oPrep_sample.Output_user_sample = Comun.GetUser();
                SetComplete(oPrep_sample);
                new CPrep_samplesFactory().Update(oPrep_sample);
            }
            else if (e.Column == gcol_Output_flag_cs)
            {
                // actualizar fecha, usuario en salida de contramuestra
                CPrep_samples oPrep_sample = gvPrepSample.GetRow(e.RowHandle) as CPrep_samples;

                oPrep_sample.Output_date_cs = Comun.GetDate();
                oPrep_sample.Output_user_cs = Comun.GetUser();
                SetComplete(oPrep_sample);
                new CPrep_samplesFactory().Update(oPrep_sample);
            }
            else if (e.Column == gcol_Output_flag_re)
            {
                // actualizar fecha, usuario en salida de contramuestra
                CPrep_samples oPrep_sample = gvPrepSample.GetRow(e.RowHandle) as CPrep_samples;

                oPrep_sample.Output_date_re = Comun.GetDate();
                oPrep_sample.Output_user_re = Comun.GetUser();
                SetComplete(oPrep_sample);
                new CPrep_samplesFactory().Update(oPrep_sample);
            }
            else if (e.Column == gcol_Observation1 || e.Column == gcol_Observation2)
            {
                CPrep_samples oPrep_sample = gvPrepSample.GetRow(e.RowHandle) as CPrep_samples;
                new CPrep_samplesFactory().Update(oPrep_sample);
            }
        }
Exemplo n.º 22
0
        bool SaveAA()
        {
            try
            {
                string Cod_method = gluCod_method.Text;
                string Title      = tbTitle.Text;
                string messageOk  = "";

                Methods oMethods = new Methods();
                Comun.MethodSaveProperty InspectionChanges = RequireNewVersionOrMethod(Comun.GetTypeAnalysis(Convert.ToChar(cbTypeAnalysis.EditValue)));

                if (InspectionChanges == Comun.MethodSaveProperty.NewMethod)
                {
                    Num_version = 1;
                    messageOk   = "Se guardó un nuevo método con código " + Cod_method +
                                  "\ncon título " + Title;
                }
                if (InspectionChanges == Comun.MethodSaveProperty.InspectionNewVersion)
                {
                    // --- save as new version or overwrite
                    FormConfirmSaveMethod fmConfirmSaveMethod = new FormConfirmSaveMethod(true);
                    if (fmConfirmSaveMethod.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        if (fmConfirmSaveMethod.SaveType == Comun.Save_type.SaveAs)
                        {
                            FormMethodSaveAs fmMethodSaveAs = new FormMethodSaveAs();
                            fmMethodSaveAs.ListTemplate =
                                oMethods.GetAllLastVersionMethods(
                                    Convert.ToInt32(cbElement.EditValue),
                                    cbTypeSample.EditValue.ToString(),
                                    Convert.ToChar(cbTypeAnalysis.EditValue));

                            if (fmMethodSaveAs.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                Num_version       = 1;
                                IDTemplate_Method = 0;
                                Cod_method        = fmMethodSaveAs.Cod_method;
                                Title             = fmMethodSaveAs.Title;
                                messageOk         = "Se guardó un nuevo método con código " + fmMethodSaveAs.Cod_method +
                                                    "\n con título '" + fmMethodSaveAs.Title + "'";
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        if (fmConfirmSaveMethod.SaveType == Comun.Save_type.Save)
                        {
                            Num_version       = oMethods.GetNumNewVersion(IDTemplate_Method);
                            IDTemplate_Method = 0;
                            messageOk         = "Se guardó una nueva versión [" + Num_version.ToString() + "] del método " + Cod_method;
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (InspectionChanges == Comun.MethodSaveProperty.InspectionNewMethod)
                {
                    FormMethodSaveAs fmMethodSaveAs = new FormMethodSaveAs();
                    fmMethodSaveAs.ListTemplate =
                        oMethods.GetAllLastVersionMethods(
                            Convert.ToInt32(cbElement.EditValue),
                            cbTypeSample.EditValue.ToString(),
                            Convert.ToChar(cbTypeAnalysis.EditValue));

                    if (fmMethodSaveAs.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        Num_version       = 1;
                        IDTemplate_Method = 0;
                        Cod_method        = fmMethodSaveAs.Cod_method;
                        Title             = fmMethodSaveAs.Title;
                        messageOk         = "Se guardó un nuevo método con código " + fmMethodSaveAs.Cod_method +
                                            "\n con título " + fmMethodSaveAs.Title;
                    }
                    else
                    {
                        return(false);
                    }
                }
                if (InspectionChanges == Comun.MethodSaveProperty.Nothing)
                {
                    messageOk = "Se guardó correctamente";
                }
                // --- save head
                CTemplate_methodFactory faTemplate_Method = new CTemplate_methodFactory();
                CTemplate_method        oTemplate_Method  = new CTemplate_method();
                oTemplate_Method.Idtemplate_method   = IDTemplate_Method;
                oTemplate_Method.Num_version         = Num_version;
                oTemplate_Method.Idelement           = Convert.ToInt32(cbElement.EditValue);
                oTemplate_Method.Cod_template_method = Cod_method;
                oTemplate_Method.Title = Title;
                oTemplate_Method.Cod_digestion_method = cbDigestion.EditValue.ToString();
                oTemplate_Method.Cod_repetition       = Convert.ToInt16(cbRepetition.EditValue);
                oTemplate_Method.Abbreviation         = tbAbreviation.Text;
                oTemplate_Method.Recognized           = ckRecognized.Checked;
                oTemplate_Method.Cod_type_sample      = cbTypeSample.EditValue.ToString();
                oTemplate_Method.Cost_method          = tbCost_Method.Value;
                oTemplate_Method.Type_analisys        = Convert.ToChar(cbTypeAnalysis.EditValue);
                oTemplate_Method.Status = true;

                if (IDTemplate_Method == 0)
                {
                    oTemplate_Method.Usernew  = Comun.GetUser();
                    oTemplate_Method.Datenew  = Comun.GetDate();
                    oTemplate_Method.Useredit = Comun.GetUser();
                    oTemplate_Method.Dateedit = Comun.GetDate();
                }
                else
                {
                    oTemplate_Method.Useredit = Comun.GetUser();
                    oTemplate_Method.Dateedit = Comun.GetDate();
                }

                bool result_template_method = false;

                if (!(result_template_method = faTemplate_Method.Update(oTemplate_Method)))
                {
                    result_template_method = faTemplate_Method.Insert(oTemplate_Method);
                }

                if (result_template_method)
                {
                    IDTemplate_Method = oTemplate_Method.Idtemplate_method;
                    SaveTypeAnalysis();
                }

                FormResult fmResult = new FormResult();
                fmResult.Message = messageOk;
                fmResult.ShowDialog();
                gluCod_method.Text = Cod_method;
                return(true);
            }
            catch (Exception ex)
            {
                ComunForm.Send_message(this.Text, TypeMsg.error, ex.Message);
                return(false);
            }
        }
Exemplo n.º 23
0
        public void Review()
        {
            try
            {
                CBatchFactory faBatch = new CBatchFactory();
                CBatch        oBatch  = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch));

                // --- save trace
                CRecep_sample_detail_elemFactory faRecep_sample_detail_elem = new CRecep_sample_detail_elemFactory();

                for (int i = 0; i < ListSamples.Count; i++)
                {
                    CBatch_detail_aa_twofold current_row = ListSamples[i];

                    int status_result = Convert.ToInt32(current_row.Qaqc_status_result);

                    if (Convert.ToInt32(current_row.Flag_mri) == 0)
                    {
                        // --- set how accepted sample
                        // Espera = 0,
                        // Incorrecto = 1,
                        // Plausible = 2,
                        // Aceptado = 3,
                        // IncorrectoPlausible = 4,
                        // Espera reensayos = 5
                        // --- save only the accept samples
                        long Idrecep_sample_detail_elem = Convert.ToInt64(current_row.Idrecep_sample_detail_elem);

                        if (Convert.ToBoolean(oBatch.Flag_correct_mri) && Convert.ToBoolean(oBatch.Flag_correct_lrb))
                        {
                            if (status_result == Convert.ToInt32(Comun.Status_result.Plausible))
                            {
                                current_row.Qaqc_status_result = Convert.ToInt16(Comun.Status_result.Aceptado);
                            }

                            Qaqc oQaqc = new Qaqc();
                            if (!oQaqc.IsRetest(Idrecep_sample_detail_elem, Idbatch))
                            {
                                // --- save final element law
                                if (current_row.Qaqc_status_result == Convert.ToInt16(Comun.Status_result.Aceptado))
                                {
                                    CRecep_sample_detail_elem oRecep_sample_detail_elem = faRecep_sample_detail_elem.GetByPrimaryKey(new CRecep_sample_detail_elemKeys(Idrecep_sample_detail_elem));
                                    oRecep_sample_detail_elem.Result_analysis     = current_row.Result_analysis;
                                    oRecep_sample_detail_elem.Str_result_analysis = current_row.Str_result_analysis.ToString();
                                    oRecep_sample_detail_elem.With_result         = true;
                                    if (current_row.Str_result_analysis == null)
                                    {
                                        oRecep_sample_detail_elem.With_result = false;
                                    }
                                    faRecep_sample_detail_elem.Update(oRecep_sample_detail_elem);
                                }
                                CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
                                faBatch_detail_aa_twofold.Update(current_row);
                            }
                            else// --- es un reensayo
                            {
                                if (!oQaqc.ExistsResultPendingSel(Idrecep_sample_detail_elem, Idbatch))
                                {
                                    // --- si no está pendiente de seleccionar entre varios análisis
                                    // --- save final element law
                                    if (current_row.Qaqc_status_result == Convert.ToInt16(Comun.Status_result.Aceptado))
                                    {
                                        CRecep_sample_detail_elem oRecep_sample_detail_elem = faRecep_sample_detail_elem.GetByPrimaryKey(new CRecep_sample_detail_elemKeys(Idrecep_sample_detail_elem));
                                        oRecep_sample_detail_elem.Result_analysis     = current_row.Result_analysis;
                                        oRecep_sample_detail_elem.Str_result_analysis = current_row.Str_result_analysis.ToString();
                                        oRecep_sample_detail_elem.With_result         = true;
                                        if (current_row.Str_result_analysis == null)
                                        {
                                            oRecep_sample_detail_elem.With_result = false;
                                        }
                                        faRecep_sample_detail_elem.Update(oRecep_sample_detail_elem);
                                    }
                                    CBatch_detail_aa_twofoldFactory faBatch_detail_aa_twofold = new CBatch_detail_aa_twofoldFactory();
                                    faBatch_detail_aa_twofold.Update(current_row);
                                }
                            }

                            // --- save retest
                            if (current_row.Qaqc_tmp_retest == 1)
                            {
                                string       cod_type_sample = new CTemplate_methodFactory().GetByPrimaryKey(new CTemplate_methodKeys(Convert.ToInt32(current_row.Idtemplate_method))).Cod_type_sample;
                                CCorrelative oCorrelative    = new CCorrelativeFactory().GetByPrimaryKey(new CCorrelativeKeys(cod_type_sample));

                                CBatchManager oBatchManager = new CBatchManager();

                                oBatchManager.CallSaveSampleBatchWithRetest(
                                    Convert.ToInt32(current_row.Idtemplate_method),
                                    Convert.ToInt64(current_row.Idrecep_sample),
                                    Convert.ToInt64(current_row.Idrecep_sample_detail),
                                    Convert.ToInt64(current_row.Idrecep_sample_detail_elem),
                                    Convert.ToInt64(current_row.Cod_interno),
                                    current_row.Cod_sample,
                                    Comun.GetUser(),
                                    oCorrelative, Convert.ToInt32(current_row.Qaqc_par), Idbatch);
                            }

                            // --- register as finished trace process
                            CProcess_Sample_Manage.Finalize_process(Idrecep_sample_detail_elem, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS);
                        }
                        else
                        {
                            // --- the samples pertain to batch with full batch retest
                            CProcess_Sample_Manage.Finalize_process(Idrecep_sample_detail_elem, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS);
                        }
                    }
                }

                // --- modify the batch status, put in other process
                CProcess oProcess = new CProcessFactory().GetByPrimaryKey(new CProcessKeys(LimsProcess.PROCESS_ACCEPT_RESULTS));
                oBatch.Status_process   = Convert.ToChar(LimsProcess.Status_Process.Waiting);
                oBatch.Cod_module       = oProcess.Cod_module;
                oBatch.Cod_area         = oProcess.Cod_area;
                oBatch.Cod_process      = LimsProcess.PROCESS_ACCEPT_RESULTS;
                oBatch.User_review_tray = Comun.GetUser();
                oBatch.Date_review_tray = Comun.GetDate();
                faBatch.Update(oBatch);

                // --- register as finished trace batch
                Cprocess_Batch_Manage.Finalize_process(Idbatch, LimsProcess.PROCESS_APPROVE_SAMPLES, LimsProcess.PROCESS_ACCEPT_RESULTS);
            }
            catch (Exception ex)
            {
                Comun.Save_log(ex.InnerException.ToString());
                throw new Exception("pivot data::approve::Error occured.", ex);
            }
        }
Exemplo n.º 24
0
        private void treeSolInterm_FocusedNodeChanged(object sender, FocusedNodeChangedEventArgs e)
        {
            // mostrar detalle del nodo padre
            TreeListNode node = treeSolInterm.FocusedNode;

            if (node != null)
            {
                //apariencia
                TreeListNode parentNode = treeSolInterm.FocusedNode.ParentNode;

                if (parentNode == null)
                {
                    // solo mostrar panel de padre, mostrar los datos del padre en las cajas
                    gcSolutionParent.Visible = true;
                    gcSolutionChild.Visible  = false;
                    paHeader.Height          = 85;
                    paSeparator.Visible      = false;

                    tbParentConcentration.Text = node["Concentration"].ToString();

                    gcSolutionParent.Text = node["Cod_solution"].ToString() + " - Solución Padre";
                }
                else if (parentNode != null)
                {
                    // mostrar paneles padre e hijo
                    gcSolutionParent.Visible = true;
                    gcSolutionChild.Visible  = true;
                    paHeader.Height          = 252;
                    paSeparator.Visible      = true;

                    //tbConcentration.Text = node["Concentration"].ToString();
                    //tbVolumen.Value = Convert.ToDecimal(node["Volumen"]);
                    //tbAliquot.Value = Convert.ToDecimal(node["Aliquot"]);
                    deDateIni.DateTime = Convert.ToDateTime(node["Date_begin"]);
                    deDateEnd.DateTime = Convert.ToDateTime(node["Date_end"]);
                    cbUser1.EditValue  = Convert.ToInt16(node["Prepared_by"]);
                    //ckDisabledSolution.Checked = !Convert.ToBoolean(node["Solution_status"]);
                    //exPanel.Expanded = Convert.ToBoolean(node["Solution_status"]) ? false : true;
                    DateTime currentDate = Comun.GetDate();
                    //laVigencia.Visible = currentDate >= deDateIni.DateTime.RankIni() && currentDate <= deDateEnd.DateTime.RankEnd() ? false : true;

                    tbParentConcentration.Text = parentNode["Concentration"].ToString();

                    gcSolutionParent.Text = parentNode["Cod_solution"].ToString() + " - Solución Padre";
                    gcSolutionChild.Text  = node["Cod_solution"].ToString() + " - Solución Hijo";
                }

                // mostrar métodos
                int idsolution_interm            = Convert.ToInt32(node["Idsolution_interm"]);
                Comun.TypePatternMr typePatterMr = Convert.ToInt32(node["Root_type_pattern"]) == 1 ? Comun.TypePatternMr.MrCertificado : Comun.TypePatternMr.SolucionPatron;
                gcMethods.DataSource = new ModSolInterm().GetLstTemplate_methodBySolution(idsolution_interm);

                ///si es nueva solución seleccionada, no mostrar chekbox y habilitar firma una vez modificado el volumen.
                ///si es solución existente, y el método seleccionado no está linkeado mostrar el chekbox.
                if (idsolution_interm == 0)
                {
                    ckAssignMethod.Visible = false;
                    ckAssignMethod.Checked = false;
                }
                else
                {
                    CSolution_interm_methods solFound =
                        new CSolution_interm_methodsFactory()
                        .GetAll()
                        .Where(x => x.Idsolution_interm == idsolution_interm &&
                               x.Idtemplate_method == Convert.ToInt32(cbMethod1.EditValue)).FirstOrDefault();

                    if (solFound == null)
                    {
                        ckAssignMethod.Visible = true;
                        ckAssignMethod.Checked = false;
                    }
                    else
                    {
                        ckAssignMethod.Visible = false;
                        ckAssignMethod.Checked = false;
                    }
                }
            }
        }
Exemplo n.º 25
0
        public void SaveCalibs(CSolution_interm pSolution_interm)
        {
            solution_interm = pSolution_interm;

            Date_init = Convert.ToDateTime(solution_interm.Date_begin);
            Date_end  = Convert.ToDateTime(solution_interm.Date_end);

            UserSign = Comun.GetUser();
            DateSign = Comun.GetDate();

            //poner como historico la actual grupo de calibraciones
            CSet_calibs oSet_calib = oModCalibStd.GetSet_CalibBy(solution_interm.Idsolution_interm, idtemplate_method);

            if (oSet_calib != null)
            {
                oSet_calib.Last_calib = false;
                new CSet_calibsFactory().Update(oSet_calib);
            }

            // --- guardar la nueva calibración
            oSet_calib = new CSet_calibs();
            oSet_calib.Idset_calibs      = 0;
            oSet_calib.Idtemplate_method = idtemplate_method;
            oSet_calib.Idsolution_interm = solution_interm.Idsolution_interm;
            oSet_calib.Datesign          = Comun.GetDate();
            oSet_calib.Usersign          = Comun.GetUser();
            oSet_calib.Last_calib        = true;

            bool result_set_calib = new CSet_calibsFactory().Insert(oSet_calib);

            // --- guardar estandares de calibración
            if (result_set_calib)
            {
                for (int i = 0; i < gvCalibStd.RowCount; i++)
                {
                    CSet_calibsFactory faSet_calibs = new CSet_calibsFactory();

                    CCustomCalibStd customCalibStd = gvCalibStd.GetRow(i) as CCustomCalibStd;

                    // --- guardar calibración
                    CCalib_stdFactory faCalib_std = new CCalib_stdFactory();
                    CCalib_std        oCalib_std  = new CCalib_std();

                    oCalib_std                   = new CCalib_std();
                    oCalib_std.Idcalib           = customCalibStd.Idcalib;
                    oCalib_std.Absorbance        = customCalibStd.Absorbance;
                    oCalib_std.Concentration     = customCalibStd.Concentration;
                    oCalib_std.Idset_calibs      = oSet_calib.Idset_calibs;
                    oCalib_std.Idsolution_interm = solution_interm.Idsolution_interm;
                    oCalib_std.Idtemplate_method = idtemplate_method;

                    bool result_std = false;
                    if (!(result_std = faCalib_std.Update(oCalib_std)))
                    {
                        result_std = faCalib_std.Insert(oCalib_std);
                    }

                    if (result_std)
                    {
                        gvCalibStd.SetRowCellValue(i, gcCal_Idcalib_std, oCalib_std.Idcalib_std);
                    }
                }
            }
        }