private bool Save() { try { JMMPrescriptionSchdule objJMPrescriptionSchdule = ReadScr(); JMMPrescriptionSchduleBL objJMPrescriptionSchduleBL = new JMMPrescriptionSchduleBL(); if (objJMPrescriptionSchdule != null) { objJMPrescriptionSchduleBL.ManageSchedule(objJMPrescriptionSchdule); if (hdnMode.Value == UIMode.ADD.ToString()) { ShowMsg(MsgType.Success, FrwkMsg.ADD_SUCCESS); } else { ShowMsg(MsgType.Success, FrwkMsg.UPD_SUCCESS); } if (objJMPrescriptionSchdule.JMMedPrescriptionID.HasValue) { Inquiry(ref objJMPrescriptionSchdule); } hdnMode.Value = UIMode.CHG.ToString(); } } catch (KPIException objKPIError) { ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objKPIError); } return(true); }
protected void LoadData() { string strhdnMode = UIMode.ADD.ToString(); try { JMMPrescriptionSchdule objJMPrescriptionSchdule = new JMMPrescriptionSchdule(); if (KPIHlp.CVI64(hdnMedPrescribeID.Value) > 0) { Inquiry(ref objJMPrescriptionSchdule); } } catch (Exception objError) { ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objError); } }
protected void Inquiry(ref JMMPrescriptionSchdule objJMPrescriptionSchdule) { DataSet ds = new DataSet(); JMMPrescriptionSchduleBL objJMPrescriptionSchduleBL = new JMMPrescriptionSchduleBL(); try { objJMPrescriptionSchdule.JMMedPrescriptionID = KPIHlp.CVI64(hdnMedPrescribeID.Value); JMMMedPrescription objJMMMedPrescription = new JMMMedPrescriptionBL().Select(objJMPrescriptionSchdule.JMMedPrescriptionID.Value); cddDrug.CodeValue = objJMMMedPrescription.Drug; txtDosage.Text = objJMMMedPrescription.Dosage; if (chkInactive.Checked) { objJMPrescriptionSchdule.IsActive = 1; } else { objJMPrescriptionSchdule.IsActive = 0; } ds = objJMPrescriptionSchduleBL.GetSchedule(ref objJMPrescriptionSchdule); if (ds.Tables[0].Rows.Count > 0) { hdnMode.Value = UIMode.CHG.ToString(); } grdSchedule.DataSource = ds; grdSchedule.DataBind(); } catch (Exception objError) { ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objError); } }
private JMMPrescriptionSchdule ReadScr() { JMMPrescriptionSchdule objJMPrescriptionSchdule = new JMMPrescriptionSchdule(); JMMPrescriptionSchduleList objJMPrescriptionSchduleList = null; try { if (ValidateScr()) { objJMPrescriptionSchduleList = new JMMPrescriptionSchduleList(); int times = grdSchedule.Rows.Count; for (int iRowCount = 0; iRowCount < grdSchedule.Rows.Count; iRowCount++) { if (grdSchedule.IsActiveRow(iRowCount)) { objJMPrescriptionSchdule = new JMMPrescriptionSchdule(); objJMPrescriptionSchdule.JurisID = KPIHlp.CVI32(hdnJurisId.Value); DateTime StartDate = grdSchedule.GetDateTime(iRowCount, "StartDate"); DateTime FinishDate = grdSchedule.GetDateTime(iRowCount, "FinishDate"); String RepeatEvery = grdSchedule.GetString(iRowCount, "RepeatEvery"); if (KPIHlp.CVI64(grdSchedule.GetString(iRowCount, "KPIID")) > 0) { objJMPrescriptionSchdule.JMPrescriptionSchduleID = KPIHlp.CVI64(grdSchedule.GetString(iRowCount, "KPIID")); objJMPrescriptionSchdule.cMode = grdSchedule.GetChar(iRowCount, "KPIMode"); } else { objJMPrescriptionSchdule.JMPrescriptionSchduleID = KPICounter.GetCounterID(objJMPrescriptionSchdule.JurisID.Value); if (grdSchedule.GetChar(iRowCount, "KPIMode").Equals('D')) { objJMPrescriptionSchdule.cMode = grdSchedule.GetChar(iRowCount, "KPIMode"); } else { objJMPrescriptionSchdule.cMode = 'A'; } } objJMPrescriptionSchdule.IsActive = 0; objJMPrescriptionSchdule.JMMedPrescriptionID = grdSchedule.GetLong(iRowCount, "JMMedPrescriptionID"); objJMPrescriptionSchdule.JMBookingID = grdSchedule.GetLong(iRowCount, "JMBookingID"); objJMPrescriptionSchdule.Dispense = grdSchedule.GetInt(iRowCount, "Dispense"); objJMPrescriptionSchdule.DistributionPeriod = grdSchedule.GetString(iRowCount, "DistributionPeriod"); if (grdSchedule.GetDateTime(iRowCount, "Startdttm") != DateTime.MinValue) { objJMPrescriptionSchdule.StartTime = grdSchedule.GetDateTime(iRowCount, "Startdttm"); } if (grdSchedule.GetDateTime(iRowCount, "Enddttm") != DateTime.MinValue) { objJMPrescriptionSchdule.EndTime = grdSchedule.GetDateTime(iRowCount, "Enddttm"); } if (objJMPrescriptionSchdule.cMode.Equals('D')) { times--; objJMPrescriptionSchdule.IsActive = 2; objJMPrescriptionSchdule.StartTime = grdSchedule.GetDateTime(iRowCount, "PeriodStartTime"); objJMPrescriptionSchdule.EndTime = grdSchedule.GetDateTime(iRowCount, "PeriodEndTime"); if (StartDate != DateTime.MinValue) { objJMPrescriptionSchdule.StartDttm = KPIHlp.CVDttm(grdSchedule.GetDateTime(iRowCount, "StartDate").ToString("MM/dd/yyyy") + " " + grdSchedule.GetDateTime(iRowCount, "PeriodStartTime").ToString("HH:mm:ss")); } if (FinishDate != DateTime.MinValue) { objJMPrescriptionSchdule.EndDttm = KPIHlp.CVDttm(grdSchedule.GetDateTime(iRowCount, "FinishDate").ToString("MM/dd/yyyy") + " " + grdSchedule.GetDateTime(iRowCount, "PeriodEndTime").ToString("HH:mm:ss")); } } else { if (StartDate != DateTime.MinValue) { objJMPrescriptionSchdule.StartDttm = KPIHlp.CVDttm(grdSchedule.GetDateTime(iRowCount, "StartDate").ToString("MM/dd/yyyy") + " " + grdSchedule.GetDateTime(iRowCount, "Startdttm").ToString("HH:mm:ss")); } if (FinishDate != DateTime.MinValue) { objJMPrescriptionSchdule.EndDttm = KPIHlp.CVDttm(grdSchedule.GetDateTime(iRowCount, "FinishDate").ToString("MM/dd/yyyy") + " " + grdSchedule.GetDateTime(iRowCount, "Enddttm").ToString("HH:mm:ss")); } } if (!String.IsNullOrWhiteSpace(RepeatEvery)) { objJMPrescriptionSchdule.RepeatEvery = RepeatEvery; } objJMPrescriptionSchdule.Instructions = grdSchedule.GetString(iRowCount, "Instructions"); objJMPrescriptionSchduleList.Add(objJMPrescriptionSchdule); } } objJMPrescriptionSchdule.Times = times; objJMPrescriptionSchdule.objJMMPrescriptionSchduleList = objJMPrescriptionSchduleList; } } catch (Exception objError) { ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objError); } return(objJMPrescriptionSchdule); }