private bool Save() { JMMPrescriptionOrder objJMPrescriptionOrder = null; JMMPreOrderHist objJMPreOrderHist = null; JMMPrescriptionOrderBL objJMPrescriptionOrderBL = null; JMMPreOrderHistBL objJMPreOrderHistBL = null; try { if (KPIHlp.CVI64(hdnJMPreOrderHistID.Value) == long.MinValue) { objJMPrescriptionOrder = NewReadScr(); objJMPrescriptionOrderBL = new JMMPrescriptionOrderBL(); KPITrace.Debug(TraceWeight.Five, "Calling Manage for Prescription Order Entry"); WrtActivityLog(long.MinValue, " Managing Prescription Order Entry Dtls.", hdnMode.Value); objJMPrescriptionOrderBL.Manage(ref objJMPrescriptionOrder); hdnJMPrescriptionOrderID.Value = objJMPrescriptionOrder.JMPrescriptionOrderID.HasValue ? objJMPrescriptionOrder.JMPrescriptionOrderID.Value.ToString() : null; NewRecordInquiry(); } else { objJMPreOrderHistBL = new JMMPreOrderHistBL(); objJMPreOrderHist = OldReadScr(); objJMPreOrderHistBL.UpdateHistory(objJMPreOrderHist); ExistingRecordInquiry(); } AutoUpdateParent(); ShowMsg(MsgType.Success, FrwkMsg.UPD_SUCCESS); } catch (Exception objErr) { ShowMsg(MsgType.Error, FrwkMsg.PAGE_ERR, objErr); } return(true); }
protected void ExistingRecordInquiry() { JMMPreOrderHistBL objJMPreOrderHistBL = null; long?JMPreOrderHistID = KPIHlp.CVI64(hdnJMPreOrderHistID.Value); try { objJMPreOrderHistBL = new JMMPreOrderHistBL(); if (JMPreOrderHistID.HasValue && JMPreOrderHistID.Value != long.MinValue) { JMMPreOrderHist objJMPreOrderHist = objJMPreOrderHistBL.Select(JMPreOrderHistID.Value); if (objJMPreOrderHist != null) { hdnJMPreOrderHistID.Value = objJMPreOrderHist.JMPreOrderHistID.HasValue ? objJMPreOrderHist.JMPreOrderHistID.Value.ToString() : null; hdnBookingID.Value = objJMPreOrderHist.JMBookingID.HasValue ? objJMPreOrderHist.JMBookingID.Value.ToString() : null; hdnJMMedPrescriptionID.Value = objJMPreOrderHist.JMMedPrescriptionID.HasValue ? objJMPreOrderHist.JMMedPrescriptionID.Value.ToString() : null; hdnJMPrescriptionOrderID.Value = objJMPreOrderHist.JMPrescriptionOrderID.HasValue ? objJMPreOrderHist.JMPrescriptionOrderID.Value.ToString() : null; hdnOrderNo.Value = objJMPreOrderHist.OrderedNo.HasValue ? objJMPreOrderHist.OrderedNo.Value.ToString() : null; hdnJurisId.Value = objJMPreOrderHist.JurisID.HasValue ? objJMPreOrderHist.JurisID.Value.ToString() : null; hdnOrderNo.Value = objJMPreOrderHist.OrderedNo.HasValue ? objJMPreOrderHist.OrderedNo.Value.ToString() : null; dttmOrderedDate.DateValue = objJMPreOrderHist.OrderedDttm.HasValue ? objJMPreOrderHist.OrderedDttm.Value : DateTime.MinValue; lupOrderedPF.KPIID = objJMPreOrderHist.OrderedPFID.HasValue ? objJMPreOrderHist.OrderedPFID.Value : long.MinValue; txtQuantity.Text = objJMPreOrderHist.QtyBalance.HasValue ? objJMPreOrderHist.QtyBalance.Value.ToString() : null; cddOrderAction.KPISelectedCodeValue = objJMPreOrderHist.OrderAction; cddStorageLocation.KPISelectedCodeValue = objJMPreOrderHist.StorageLocation; cddQuantityType.KPISelectedCodeValue = objJMPreOrderHist.MedicationType; cddDestroyed.KPISelectedCodeValue = objJMPreOrderHist.HowDestroyed; lupWitness.KPIID = objJMPreOrderHist.WitnessPFID.HasValue ? objJMPreOrderHist.WitnessPFID.Value : long.MinValue; hdnOrderAction.Value = objJMPreOrderHist.OrderAction; hdnQuantity.Value = objJMPreOrderHist.QtyBalance.HasValue ? objJMPreOrderHist.QtyBalance.Value.ToString() : string.Empty; txtDescription.Text = string.Empty; } } } catch (Exception) { throw; } }
private JMMPreOrderHist OldReadScr() { JMMPreOrderHist objJMPreOrderHist = new JMMPreOrderHist(); KPITrace.Debug(TraceWeight.Five, "Calling Readscreen for Prescription Order Entry"); try { objJMPreOrderHist.JMBookingID = KPIHlp.CVI64(hdnBookingID.Value); objJMPreOrderHist.JMMedPrescriptionID = KPIHlp.CVI64(hdnJMMedPrescriptionID.Value); objJMPreOrderHist.JurisID = KPIHlp.CVI32(hdnJurisId.Value); objJMPreOrderHist.Drug = !String.IsNullOrWhiteSpace(hdnDrugID.Value) ? hdnDrugID.Value : null; objJMPreOrderHist.JMPrescriptionOrderID = KPIHlp.CVI64(hdnJMPrescriptionOrderID.Value); objJMPreOrderHist.JMPreOrderHistID = KPIHlp.CVI64(hdnJMPreOrderHistID.Value); objJMPreOrderHist.OrderedNo = KPIHlp.CVI64(hdnOrderNo.Value); objJMPreOrderHist.JMPreOrderHistNo = KPIHlp.CVI64(hdnJMPreOrderHistNo.Value); objJMPreOrderHist.OrderAction = cddOrderAction.CodeValue; objJMPreOrderHist.StorageLocation = cddStorageLocation.CodeValue; if (dttmOrderedDate.DateValue != DateTime.MinValue) { objJMPreOrderHist.OrderedDttm = dttmOrderedDate.DateValue; } if (lupOrderedPF.KPIID > 0) { objJMPreOrderHist.OrderedPFID = lupOrderedPF.KPIID; } if (!String.IsNullOrWhiteSpace(txtQuantity.Text)) { objJMPreOrderHist.QtyBalance = KPIHlp.CVI32(txtQuantity.Text); objJMPreOrderHist.MedicationType = cddQuantityType.CodeValue; } if (txtDescription.Text.Length > txtDescription.MaxLength && txtDescription.MaxLength > 0) //Notes field as a OrderNotes column { objJMPreOrderHist.OrderNotes = txtDescription.Text.Substring(0, txtDescription.MaxLength); } else { objJMPreOrderHist.OrderNotes = txtDescription.Text; } switch (objJMPreOrderHist.OrderAction) { case "D": case "RI": objJMPreOrderHist.CurQuantity = (-1) * objJMPreOrderHist.QtyBalance; objJMPreOrderHist.HowDestroyed = cddDestroyed.CodeValue; if (lupWitness.KPIID > 0) { objJMPreOrderHist.WitnessPFID = lupWitness.KPIID; } break; case "F": case "RC": objJMPreOrderHist.CurQuantity = objJMPreOrderHist.QtyBalance; break; case "O": case "R": break; } } catch (Exception objErr) { ShowMsg(MsgType.Error, FrwkMsg.PAGE_ERR, objErr); } return(objJMPreOrderHist); }