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);
        }
        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);
            }
        }
        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);
        }
Exemple #4
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);
        }
        public Dictionary <string, string> GetCurrentAndBelow(long idbatch, string process)
        {
            /*
             * CREATE TEMP TABLE tmp_batch_P013 ON COMMIT DROP AS
             *  SELECT idbatch, cod_module, cod_process,
             *          useredit as user_approved, dateedit as date_approved, status_process
             *  FROM trace_batch
             *  WHERE idbatch = p_idbatch
             *          AND cod_process = 'P013';
             *
             *  CREATE TEMP TABLE tmp_batch_P014 ON COMMIT DROP AS
             *  SELECT idbatch, cod_module, cod_process,
             *          useredit as user_revised, dateedit as date_revised, status_process
             *  FROM trace_batch
             *  WHERE idbatch = p_idbatch
             *          AND cod_process = 'P014';
             *
             *  RETURN QUERY
             *  SELECT DISTINCT t1.idbatch, t1.cod_module, t1.cod_process, t1.status_process
             *          , t5.user_approved, t5.date_approved, t6.user_revised, t6.date_revised
             *          , CAST(CASE
             *                  WHEN t1.idbatch = p_idbatch THEN 1
             *                  ELSE 0
             *            END AS BOOLEAN) AS flag_current_batch
             *  FROM batch t1
             *          LEFT OUTER JOIN tmp_batch_P013 t5
             *                  ON t1.idbatch = t5.idbatch
             *          LEFT OUTER JOIN tmp_batch_P014 t6
             *                  ON t1.idbatch = t6.idbatch
             *  WHERE t1.idbatch = p_idbatch;
             */
            var tmp_batch_P013 = new CTrace_batchFactory().GetAll().Where(x => x.Idbatch == idbatch && x.Cod_process == "P013");
            var tmp_batch_P014 = new CTrace_batchFactory().GetAll().Where(x => x.Idbatch == idbatch && x.Cod_process == "P014");

            var query =
                (from m in new CBatchFactory().GetAll().Where(x => x.Idbatch == idbatch)
                 join n in tmp_batch_P013 on m.Idbatch equals n.Idbatch into mn
                 from p in mn.DefaultIfEmpty()
                 join q in tmp_batch_P014 on p.Idbatch equals q.Idbatch into pq
                 from r in pq.DefaultIfEmpty()
                 select new
            {
                m.Idbatch,
                m.Cod_module,
                m.Cod_process,
                m.Status_process,
                User_approved = p.Useredit,
                Date_approved = p.Dateedit,
                User_revised = r.Useredit,
                Date_revised = r.Dateedit,
                Flag_current_batch = m.Idbatch == idbatch ? 1 : 0
            }).ToList();

            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("User_approved", query[0].User_approved);
            dic.Add("Date_approved", query[0].Date_approved.ToString());
            dic.Add("User_revised", query[0].User_revised);
            dic.Add("Date_revised", query[0].Date_revised.ToString());

            return(dic);
        }
        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);
        }
        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);
        }
        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);
        }