예제 #1
0
        protected override void Recuperar_Registro()
        {
            CMr        oMr  = new CMr();
            CMrFactory faMr = new CMrFactory();

            if ((oMr = faMr.GetByPrimaryKey(new CMrKeys(IDMr))) != null)
            {
                tbLot.Text               = oMr.Lot;
                cbTypeMr.EditValue       = Convert.ToChar(oMr.Type_mr);
                cbDescription.EditValue  = oMr.Type_material;
                cbManufacturer.EditValue = oMr.Manufaturer;
                cbCertifier.EditValue    = oMr.Certifier;
                cbStatus.EditValue       = oMr.Status_mr;
                deBegin.DateTime         = Convert.ToDateTime(oMr.Fbegin_validity);
                deEnd.DateTime           = Convert.ToDateTime(oMr.Fend_validity);

                CMr_detail               oMr_detail   = new CMr_detail();
                CMr_detailFactory        faMr_detail  = new CMr_detailFactory();
                BindingList <CMr_detail> lstMr_detail = new BindingList <CMr_detail>(new LimsProject.BusinessLayer.Modules.ModMaterialReference().SelectByMr(oMr.Idmr));
                gcMaterialReference.DataSource = lstMr_detail;

                CMr_jarFactory        faMr_jar  = new CMr_jarFactory();
                CMr_jar               oMr_jar   = new CMr_jar();
                BindingList <CMr_jar> lstMr_jar = new BindingList <CMr_jar>(new LimsProject.BusinessLayer.Modules.ModMaterialReference().GetJarByMr(IDMr));
                gcOpenCloseJar.DataSource = lstMr_jar;
            }
        }
예제 #2
0
 protected override void Accion_Despues_Grabar()
 {
     // --- reference material
     CMrFactory faMr = new CMrFactory();
     cbCodMR.Properties.DataSource = faMr.GetAll();
     cbCodMR.Properties.ValueMember = "Idmr";
     cbCodMR.Properties.DisplayMember = "Cod_mr";
 }
예제 #3
0
        protected override void Accion_Despues_Grabar()
        {
            // --- reference material
            CMrFactory faMr = new CMrFactory();

            cbCodMR.Properties.DataSource    = faMr.GetAll();
            cbCodMR.Properties.ValueMember   = "Idmr";
            cbCodMR.Properties.DisplayMember = "Cod_mr";
        }
예제 #4
0
        bool IsSolidSolutionPattern()
        {
            CMr_detail oMr_detail =
                new CMr_detailFactory()
                .GetByPrimaryKey(new CMr_detailKeys(Convert.ToInt16(template_method_aa.Std_mrorpattern)));
            CMr oMr = new CMrFactory().GetByPrimaryKey(new CMrKeys(Convert.ToInt16(oMr_detail.Idmr)));

            return(Convert.ToBoolean(oMr.Solid));
        }
예제 #5
0
        bool IsSolidSolutionPattern()
        {
            TreeListNode nodeParent       = treeSolInterm.FocusedNode.ParentNode;
            short        Root_idmr_detail = Convert.ToInt16(nodeParent["Root_idmr_detail"]);

            CMr_detail oMr_detail =
                new CMr_detailFactory()
                .GetByPrimaryKey(new CMr_detailKeys(Convert.ToInt16(Root_idmr_detail)));
            CMr oMr = new CMrFactory().GetByPrimaryKey(new CMrKeys(Convert.ToInt16(oMr_detail.Idmr)));

            return(Convert.ToBoolean(oMr.Solid));
        }
예제 #6
0
        public IList GetConcentration_By_TypeMr(Comun.TypeMr typeMr, short idelement)
        {
            List <CMr_detail> lstMr_detail = new CMr_detailFactory().GetAll().Where(c => c.Analyte == idelement).ToList();
            List <CMr>        lstMr        = new CMrFactory().GetAll().Where(x => x.Type_mr == Convert.ToChar(typeMr)).ToList();

            // get reference material
            var query1 =
                (from t1 in lstMr_detail
                 from t2 in lstMr.Where(x => x.Idmr == t1.Idmr)
                 select new
            {
                t1.Nominal_value
            }).Distinct().ToList();

            return(query1);
        }
예제 #7
0
        public IList GetBy_Element(short idelement)
        {
            List <CMr>        lstMr        = new CMrFactory().GetAll().Where(c => c.Status_mr == true).ToList();
            List <CMr_detail> lstMr_detail = new CMr_detailFactory().GetAll().Where(c => c.Analyte == idelement).ToList();

            var lst = (from t1 in lstMr
                       join t2 in lstMr_detail on t1.Idmr equals t2.Idmr
                       select new CCustomMr_detail
            {
                Cod_mr = t1.Cod_mr,
                Idmr = t1.Idmr,
                Idmr_detail = t2.Idmr_detail
            }).ToList();

            return(lst);
        }
예제 #8
0
        public List <CCustom_solution> GetLstPatternSolution(short idelement)
        {
            CSettings oSettings = new CSettings();
            List <CConvert_unit_measurement> lstConvertUnit = new CConvert_unit_measurementFactory().GetAll().Where(c => c.Idunit2 == oSettings.GetUnitMeasureSolution()).ToList();
            List <CMr_detail> lstMr_detail = new CMr_detailFactory().GetAll().Where(c => c.Analyte == idelement).ToList();
            List <CMr>        lstMr        = new CMrFactory().GetAll();
            List <CSolution>  lstSolution  = new CSolutionFactory().GetAll().Where(c => c.Idelement == idelement).ToList();

            // get reference material
            List <CCustom_solution> query1 =
                (from t1 in lstMr_detail
                 join t2 in lstMr on t1.Idmr equals t2.Idmr
                 join t3 in lstConvertUnit on t1.Idunit1 equals t3.Idunit1
                 select new CCustom_solution
            {
                Idmr = t2.Idmr,
                Idmr_detail = t1.Idmr_detail,
                Code = t2.Cod_mr,
                Lote = t2.Lot,
                Name = t2.Cod_mr,
                Purity = 100,
                IsPattern = true,
                Concentration = Convert.ToDecimal(t1.Nominal_value) * Convert.ToDecimal(t3.Factor),
                Name_group = "Material de Referencia y Sales"
            }).ToList <CCustom_solution>();

            // get solutions
            List <CCustom_solution> query2 =
                (from t3 in lstSolution
                 select new CCustom_solution
            {
                Idsolution = t3.Idsolution,
                Code = t3.Cod_solution,
                Name = t3.Solution_name,
                Lote = t3.Lote,
                Purity = Convert.ToDecimal(t3.Purity),
                IsPattern = false,
                Concentration = Convert.ToDecimal(t3.Concentration),
                Name_group = "Soluciones"
            }).ToList <CCustom_solution>();

            List <CCustom_solution> lst = new List <CCustom_solution>(query1.Union(query2));

            return(lst);
        }
예제 #9
0
        public IList GetBy_TypeMr_And_Element(Comun.TypeMr typeMr, short idelement)
        {
            List <CMr_detail> lstMr_detail = new CMr_detailFactory().GetAll().Where(c => c.Analyte == idelement).ToList();
            List <CMr>        lstMr        = new CMrFactory().GetAll();

            // get reference material
            var query1 =
                (from t1 in lstMr_detail
                 join t2 in lstMr on t1.Idmr equals t2.Idmr
                 where t2.Type_mr == Convert.ToChar(typeMr)
                 select new
            {
                t2.Idmr,
                t1.Idmr_detail,
                t2.Cod_mr,
                t1.Nominal_value
            }).Distinct().ToList();

            return(query1);
        }
예제 #10
0
        public List <CCustom_solution> GetLstMrc(Comun.TypeMr typeMr, short idelement)
        {
            CSettings         oSettings    = new CSettings();
            List <CMr_detail> lstMr_detail = new CMr_detailFactory().GetAll().Where(c => c.Analyte == idelement).ToList();
            List <CMr>        lstMr        = new CMrFactory().GetAll();

            // get reference material
            List <CCustom_solution> query1 =
                (from t1 in lstMr_detail
                 join t2 in lstMr on t1.Idmr equals t2.Idmr
                 where t2.Type_mr == Convert.ToChar(typeMr)
                 select new CCustom_solution
            {
                Idmr = t2.Idmr,
                Idmr_detail = t1.Idmr_detail,
                Code = t2.Cod_mr,
                Name = t2.Cod_mr
            }).ToList <CCustom_solution>();

            return(query1);
        }
예제 #11
0
        private void FormMaterialReference_Load(object sender, EventArgs e)
        {
            // --- Initialize material of reference
            CMrFactory faMr = new CMrFactory();
            cbCodMR.Properties.DataSource = faMr.GetAll();
            cbCodMR.Properties.ValueMember = "Idmr";
            cbCodMR.Properties.DisplayMember = "Cod_mr";

            // --- Initialize description sample
            cbDescription.Properties.DataSource = Comun.ListTypeMaterial;
            cbDescription.Properties.ValueMember = "IdTypeMaterial";
            cbDescription.Properties.DisplayMember = "Description";

            // --- Initialize type of analysis
            CDigestion_methodFactory faDigestion_method = new CDigestion_methodFactory();
            repTypeDigestion.DataSource = faDigestion_method.GetAll();
            repTypeDigestion.ValueMember = "Cod_digestion_method";
            repTypeDigestion.DisplayMember = "Name_digestion_method";

            // --- Initialize the type of material reference
            cbTypeMr.Properties.DataSource = Comun.ListMr;
            cbTypeMr.Properties.DisplayMember = "Den_TypeMr";
            cbTypeMr.Properties.ValueMember = "IdTypeMr";

            // --- Initialize in container grid element
            CElementFactory faElement = new CElementFactory();
            repElement.DataSource = faElement.GetAll();
            repElement.DisplayMember = "Cod_element";
            repElement.ValueMember = "Idelement";

            // --- Initialize in container grid unit measurement
            CMeasurement_unitFactory faMeasurement_unit = new CMeasurement_unitFactory();
            repTypeUnit.DataSource = faMeasurement_unit.GetAll();
            repTypeUnit.DisplayMember = "Name_unit";
            repTypeUnit.ValueMember = "Idunit";

            // --- Inititalize list statusMr
            lstStatusMr = new BindingList<CStatusMr>();
            lstStatusMr.Add(new CStatusMr { IDStatusMr = true, Description = "Vigente" });
            lstStatusMr.Add(new CStatusMr { IDStatusMr = false, Description = "No vigente" });
            cbStatus.Properties.DataSource = lstStatusMr;
            cbStatus.Properties.DisplayMember = "Description";
            cbStatus.Properties.ValueMember = "IDStatusMr";

            // --- Initialize in container grid company
            CCompanyFactory faCompany = new CCompanyFactory();
            List<CCompany> lstCompany = faCompany.GetAll().Where(c=> c.Type_company == 'P').ToList();

            cbManufacturer.Properties.DataSource = lstCompany;
            cbManufacturer.Properties.DisplayMember = "Business_name";
            cbManufacturer.Properties.ValueMember = "Idcompany";

            cbCertifier.Properties.DataSource = lstCompany;
            cbCertifier.Properties.DisplayMember = "Business_name";
            cbCertifier.Properties.ValueMember = "Idcompany";

            // --- Initialize the grid
            GetDetailMaterialReference();
        }
예제 #12
0
        protected override void Recuperar_Registro()
        {
            CMr oMr = new CMr();
            CMrFactory faMr = new CMrFactory();
            if ((oMr = faMr.GetByPrimaryKey(new CMrKeys(IDMr))) != null)
            {
                tbLot.Text = oMr.Lot;
                cbTypeMr.EditValue = Convert.ToChar(oMr.Type_mr);
                cbDescription.EditValue = oMr.Type_material;
                cbManufacturer.EditValue = oMr.Manufaturer;
                cbCertifier.EditValue = oMr.Certifier;
                cbStatus.EditValue = oMr.Status_mr;
                deBegin.DateTime = Convert.ToDateTime(oMr.Fbegin_validity);
                deEnd.DateTime = Convert.ToDateTime(oMr.Fend_validity);

                CMr_detail oMr_detail = new CMr_detail();
                CMr_detailFactory faMr_detail = new CMr_detailFactory();
                BindingList<CMr_detail> lstMr_detail = new BindingList<CMr_detail>(new LimsProject.BusinessLayer.Modules.ModMaterialReference().SelectByMr(oMr.Idmr));
                gcMaterialReference.DataSource = lstMr_detail;

                CMr_jarFactory faMr_jar = new CMr_jarFactory();
                CMr_jar oMr_jar = new CMr_jar();
                BindingList<CMr_jar> lstMr_jar = new BindingList<CMr_jar>(new LimsProject.BusinessLayer.Modules.ModMaterialReference().GetJarByMr(IDMr));
                gcOpenCloseJar.DataSource = lstMr_jar;
            }
        }
예제 #13
0
 bool IsSolidSolutionPattern()
 {
     CMr_detail oMr_detail =
         new CMr_detailFactory()
         .GetByPrimaryKey(new CMr_detailKeys(Convert.ToInt16(template_method_aa.Std_mrorpattern)));
     CMr oMr = new CMrFactory().GetByPrimaryKey(new CMrKeys(Convert.ToInt16(oMr_detail.Idmr)));
     return Convert.ToBoolean(oMr.Solid);
 }
예제 #14
0
        void Show_batch()
        {
            // --- show trace groups
            gbApprove.Visible = false;
            gbReview.Visible = false;
            gv2col_Qaqc_approve.ImageIndex = 0;
            gv2col_Qaqc_review.ImageIndex = 0;

            // --- show template method
            ShowDilution();

            // --- show description method
            CBatchFactory faBatch = new CBatchFactory();
            CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch));
            laTitleModule.Text = String.Format("Bandeja {0} en Espera", Comun.FormatCorrelativeCode("B-", Convert.ToInt64(oBatch.Num_tray), 5));

            if (oBatch.Status_process == 'W')
            {
                ucSignCloseTray.Title = "Cerrar bandeja";
                ucSignCloseTray.Enabled = true;
                bgvBatchCalc2.OptionsBehavior.Editable = false;

            }
            if (oBatch.Status_process == 'P')
            {
                ucSignCloseTray.Title = "Cerrado("+oBatch.User_close_tray+")";
                ucSignCloseTray.Enabled = false;
                bgvBatchCalc2.OptionsBehavior.Editable = true;
            }

            CTemplate_methodFactory faTemplate_method = new CTemplate_methodFactory();
            oTemplate_method_current = faTemplate_method.GetByPrimaryKey(new CTemplate_methodKeys(Idtemplate_method));
            tbCodMethod.Text = oTemplate_method_current.Cod_template_method;
            tbTitle.Text = oTemplate_method_current.Title;
            tbAbbreviation.Text = oTemplate_method_current.Abbreviation;

            #region <optimizar>

            CTemplate_method_aaFactory faTemplate_method_aa = new CTemplate_method_aaFactory();
            oTemplate_method_aa_current = faTemplate_method_aa.GetByPrimaryKey(new CTemplate_method_aaKeys(Idtemplate_method));

            deDate_allowed_error.DateTime = Convert.ToDateTime(oTemplate_method_aa_current.Date_allowed_error);

            CMr_detailFactory faMr_detail = new CMr_detailFactory();
            CMr_detail oMr_detail = faMr_detail.GetByPrimaryKey(new CMr_detailKeys(Convert.ToInt16(oTemplate_method_aa_current.Idmr_detail)));
            tbLawMri.Text = oMr_detail.Nominal_value.ToString();

            CMrFactory faMr = new CMrFactory();
            CMr oMr = faMr.GetByPrimaryKey(new CMrKeys(
                Convert.ToInt16(oMr_detail.Idmr)
                ));
            tbMri.Text = oMr.Cod_mr;

            CMeasurement_unitFactory faMeasure = new CMeasurement_unitFactory();
            CMeasurement_unit oMeasurement_unit = faMeasure.GetByPrimaryKey(new CMeasurement_unitKeys(Convert.ToInt16(oMr_detail.Idunit1)));
            tbUnitMeasure.Text = oMeasurement_unit.Name_unit;

            #endregion

            // --- clear columns
            gcBachCalc.DataSource = null;

            // --- format the datatable with the number of repetitions
            oDataBatch = new CDataBatch(Idbatch, Idtemplate_method, Comun.StatusWork.Waiting, Comun.CriteriaSort.BySample);
            gcBachCalc.DataSource = oDataBatch.ListSamples;

            // --- show sd
            tbAbs.Value = oDataBatch.Absorbance;
            tbStd.Value = oDataBatch.StdVerification;
            tbAbs.BackColor = oDataBatch.ColorAbsorbance;
            tbStd.BackColor = oDataBatch.ColorStd;
            tbSdBlk.Text = oDataBatch.LrbMeasured.ToString();
            tbSdBlk.BackColor = oDataBatch.ColorLrbMeasured;
            tbSdMr.Text = oDataBatch.MriMeasured.ToString();
            tbSdMr.BackColor = oDataBatch.ColorMriMeasured;

            // --- show empty sample
            ShowParityEmptySample(false);
        }
예제 #15
0
        void Show_batch_finished()
        {
            gbApprove.Visible = true;
            gbReview.Visible = true;
            gv2col_Qaqc_approve.ImageIndex = 0;
            gv2col_Qaqc_review.ImageIndex = 0;

            // --- show template method
            ShowDilution();

            // --- show description method
            CTemplate_methodFactory faTemplate_method = new CTemplate_methodFactory();
            CTemplate_method oTemplate_method = faTemplate_method.GetByPrimaryKey(new CTemplate_methodKeys(Idtemplate_method));
            tbCodMethod.Text = oTemplate_method.Cod_template_method;
            tbTitle.Text = oTemplate_method.Title;
            tbAbbreviation.Text = oTemplate_method.Abbreviation;

            // --- get batch trace_batch
            CTrace_batchFactory faTrace_batch = new CTrace_batchFactory();
            Dictionary<string, string> dtTrace_batch = new BusinessLayer.Modules.ModProcessBatch().GetCurrentAndBelow(Idbatch, LimsProcess.PROCESS_IN_READING);

            CBatchFactory faBatch = new CBatchFactory();
            CBatch oBatch = faBatch.GetByPrimaryKey(new CBatchKeys(Idbatch));
            laTitleModule.Text = String.Format("Bandeja {0} Aprobada\n ({1})"
                , "B-" + oBatch.Num_tray.ToString().PadLeft(5, '0')
                , dtTrace_batch["User_approved"].ToString());

            laUser_approved.Text = dtTrace_batch["User_approved"].ToString();
            laDate_approved.Text = dtTrace_batch["Date_approved"].ToString();
            laUser_revised.Text = dtTrace_batch["User_revised"].ToString();
            laDate_revised.Text = dtTrace_batch["Date_revised"].ToString();

            #region <optimizar>

            CTemplate_method_aaFactory faTemplate_method_aa = new CTemplate_method_aaFactory();
            CTemplate_method_aa oTemplate_method_aa = faTemplate_method_aa.GetByPrimaryKey(new CTemplate_method_aaKeys(Idtemplate_method));

            deDate_allowed_error.DateTime = Convert.ToDateTime(oTemplate_method_aa.Date_allowed_error);

            CMr_detailFactory faMr_detail = new CMr_detailFactory();
            CMr_detail oMr_detail = faMr_detail.GetByPrimaryKey(new CMr_detailKeys(Convert.ToInt16(oTemplate_method_aa.Idmr_detail)));
            tbLawMri.Text = oMr_detail.Nominal_value.ToString();

            CMrFactory faMr = new CMrFactory();
            CMr oMr = faMr.GetByPrimaryKey(new CMrKeys(
                Convert.ToInt16(oMr_detail.Idmr)
                ));
            tbMri.Text = oMr.Cod_mr;

            CMeasurement_unitFactory faMeasure = new CMeasurement_unitFactory();
            CMeasurement_unit oMeasurement_unit = faMeasure.GetByPrimaryKey(new CMeasurement_unitKeys(Convert.ToInt16(oMr_detail.Idunit1)));
            tbUnitMeasure.Text = oMeasurement_unit.Name_unit;

            #endregion

            // --- clear columns
            gcBachCalc.DataSource = null;

            // --- format the datatable with the number of repetitions
            if (cbAuthorizationApproved.EditValue.ToString() == "0000")
                oDataBatch = new CDataBatch(Idbatch, Idtemplate_method, Comun.StatusWork.Saved, Comun.CriteriaSort.BySample);
            else
                oDataBatch = new CDataBatch(Idbatch, Idtemplate_method, Comun.StatusWork.Management, Comun.CriteriaSort.BySample);

            gcBachCalc.DataSource = oDataBatch.ListSamples;

            // --- show sd
            tbAbs.Value = oDataBatch.Absorbance;
            tbStd.Value = oDataBatch.StdVerification;
            tbAbs.BackColor = oDataBatch.ColorAbsorbance;
            tbStd.BackColor = oDataBatch.ColorStd;
            tbSdBlk.Text = oDataBatch.LrbMeasured.ToString();
            tbSdBlk.BackColor = oDataBatch.ColorLrbMeasured;
            tbSdMr.Text = oDataBatch.MriMeasured.ToString();
            tbSdMr.BackColor = oDataBatch.ColorMriMeasured;

            // --- OPTIMIZAR A USER CONTROL
            paAuthorization.Visible = true;

            // --- show empty sample
            ShowParityEmptySample(true);
        }
예제 #16
0
        protected override bool Grabar_Registro()
        {
            bool result = false;

            try
            {
                CMrFactory faMr = new CMrFactory();
                CMr        oMr  = new CMr();

                oMr.Cod_mr          = cbCodMR.Text;
                oMr.Idmr            = IDMr;
                oMr.Lot             = tbLot.Text;
                oMr.Type_material   = Convert.ToChar(cbDescription.EditValue);
                oMr.Type_mr         = Convert.ToChar(cbTypeMr.EditValue);
                oMr.Status_mr       = Convert.ToBoolean(cbStatus.EditValue);
                oMr.Type_material   = Convert.ToChar(cbDescription.EditValue);
                oMr.Manufaturer     = Convert.ToInt16(cbManufacturer.EditValue);
                oMr.Certifier       = Convert.ToInt16(cbCertifier.EditValue);
                oMr.Fbegin_validity = deBegin.DateTime;
                oMr.Fend_validity   = deEnd.DateTime;


                if (!(result = faMr.Update(oMr)))
                {
                    result = faMr.Insert(oMr);
                }

                if (result)
                {
                    IDMr = oMr.Idmr;

                    // --- detail elements

                    CMr_detailFactory faMr_detail = new CMr_detailFactory();
                    CMr_detail        oMr_detail  = new CMr_detail();

                    for (int i = 0; i < gvMaterialReference.RowCount; i++)
                    {
                        oMr_detail      = (CMr_detail)gvMaterialReference.GetRow(i);
                        oMr_detail.Idmr = IDMr;

                        if (!faMr_detail.Update(oMr_detail))
                        {
                            faMr_detail.Insert(oMr_detail);
                        }
                    }

                    // --- detail jars
                    CMr_jarFactory faMr_jar = new CMr_jarFactory();
                    CMr_jar        oMr_jar  = new CMr_jar();

                    for (int i = 0; i < gvOpenCloseJar.RowCount; i++)
                    {
                        oMr_jar      = (CMr_jar)gvOpenCloseJar.GetRow(i);
                        oMr_jar.Idmr = IDMr;

                        if (!faMr_jar.Update(oMr_jar))
                        {
                            faMr_jar.Insert(oMr_jar);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result = false;
                ComunForm.Send_message(this.Text, TypeMsg.error, ex.Message);
            }
            return(result);
        }
예제 #17
0
        private void FormMaterialReference_Load(object sender, EventArgs e)
        {
            // --- Initialize material of reference
            CMrFactory faMr = new CMrFactory();

            cbCodMR.Properties.DataSource    = faMr.GetAll();
            cbCodMR.Properties.ValueMember   = "Idmr";
            cbCodMR.Properties.DisplayMember = "Cod_mr";

            // --- Initialize description sample
            cbDescription.Properties.DataSource    = Comun.ListTypeMaterial;
            cbDescription.Properties.ValueMember   = "IdTypeMaterial";
            cbDescription.Properties.DisplayMember = "Description";

            // --- Initialize type of analysis
            CDigestion_methodFactory faDigestion_method = new CDigestion_methodFactory();

            repTypeDigestion.DataSource    = faDigestion_method.GetAll();
            repTypeDigestion.ValueMember   = "Cod_digestion_method";
            repTypeDigestion.DisplayMember = "Name_digestion_method";

            // --- Initialize the type of material reference
            cbTypeMr.Properties.DataSource    = Comun.ListMr;
            cbTypeMr.Properties.DisplayMember = "Den_TypeMr";
            cbTypeMr.Properties.ValueMember   = "IdTypeMr";

            // --- Initialize in container grid element
            CElementFactory faElement = new CElementFactory();

            repElement.DataSource    = faElement.GetAll();
            repElement.DisplayMember = "Cod_element";
            repElement.ValueMember   = "Idelement";

            // --- Initialize in container grid unit measurement
            CMeasurement_unitFactory faMeasurement_unit = new CMeasurement_unitFactory();

            repTypeUnit.DataSource    = faMeasurement_unit.GetAll();
            repTypeUnit.DisplayMember = "Name_unit";
            repTypeUnit.ValueMember   = "Idunit";

            // --- Inititalize list statusMr
            lstStatusMr = new BindingList <CStatusMr>();
            lstStatusMr.Add(new CStatusMr {
                IDStatusMr = true, Description = "Vigente"
            });
            lstStatusMr.Add(new CStatusMr {
                IDStatusMr = false, Description = "No vigente"
            });
            cbStatus.Properties.DataSource    = lstStatusMr;
            cbStatus.Properties.DisplayMember = "Description";
            cbStatus.Properties.ValueMember   = "IDStatusMr";

            // --- Initialize in container grid company
            CCompanyFactory faCompany  = new CCompanyFactory();
            List <CCompany> lstCompany = faCompany.GetAll().Where(c => c.Type_company == 'P').ToList();

            cbManufacturer.Properties.DataSource    = lstCompany;
            cbManufacturer.Properties.DisplayMember = "Business_name";
            cbManufacturer.Properties.ValueMember   = "Idcompany";

            cbCertifier.Properties.DataSource    = lstCompany;
            cbCertifier.Properties.DisplayMember = "Business_name";
            cbCertifier.Properties.ValueMember   = "Idcompany";

            // --- Initialize the grid
            GetDetailMaterialReference();
        }
예제 #18
0
        protected override bool Grabar_Registro()
        {
            bool result = false;
            try
            {
                CMrFactory faMr = new CMrFactory();
                CMr oMr = new CMr();

                oMr.Cod_mr = cbCodMR.Text;
                oMr.Idmr = IDMr;
                oMr.Lot = tbLot.Text;
                oMr.Type_material = Convert.ToChar(cbDescription.EditValue);
                oMr.Type_mr = Convert.ToChar(cbTypeMr.EditValue);
                oMr.Status_mr = Convert.ToBoolean(cbStatus.EditValue);
                oMr.Type_material = Convert.ToChar(cbDescription.EditValue);
                oMr.Manufaturer = Convert.ToInt16(cbManufacturer.EditValue);
                oMr.Certifier = Convert.ToInt16(cbCertifier.EditValue);
                oMr.Fbegin_validity = deBegin.DateTime;
                oMr.Fend_validity = deEnd.DateTime;

                if (!(result = faMr.Update(oMr)))
                    result = faMr.Insert(oMr);

                if (result)
                {
                    IDMr = oMr.Idmr;

                    // --- detail elements

                    CMr_detailFactory faMr_detail = new CMr_detailFactory();
                    CMr_detail oMr_detail = new CMr_detail();

                    for (int i = 0; i < gvMaterialReference.RowCount; i++)
                    {
                        oMr_detail = (CMr_detail)gvMaterialReference.GetRow(i);
                        oMr_detail.Idmr = IDMr;

                        if (!faMr_detail.Update(oMr_detail))
                            faMr_detail.Insert(oMr_detail);
                    }

                    // --- detail jars
                    CMr_jarFactory faMr_jar = new CMr_jarFactory();
                    CMr_jar oMr_jar = new CMr_jar();

                    for (int i = 0; i < gvOpenCloseJar.RowCount; i++)
                    {
                        oMr_jar = (CMr_jar)gvOpenCloseJar.GetRow(i);
                        oMr_jar.Idmr = IDMr;

                        if (!faMr_jar.Update(oMr_jar))
                            faMr_jar.Insert(oMr_jar);
                    }
                }
            }
            catch (Exception ex)
            {
                result = false;
                ComunForm.Send_message(this.Text, TypeMsg.error, ex.Message);
            }
            return result;
        }
예제 #19
0
        bool IsSolidSolutionPattern()
        {
            TreeListNode nodeParent = treeSolInterm.FocusedNode.ParentNode;
            short Root_idmr_detail = Convert.ToInt16(nodeParent["Root_idmr_detail"]);

            CMr_detail oMr_detail =
                new CMr_detailFactory()
                .GetByPrimaryKey(new CMr_detailKeys(Convert.ToInt16(Root_idmr_detail)));
            CMr oMr = new CMrFactory().GetByPrimaryKey(new CMrKeys(Convert.ToInt16(oMr_detail.Idmr)));
            return Convert.ToBoolean(oMr.Solid);
        }