private bool Save() { JMMDiabeticBL objJMMDiabeticBL = null; JMMDiabeticList objJMMDiabeticList = null; JMMDiabetic objJMMDiabetic = new JMMDiabetic(); try { objJMMDiabeticList = ReadScr(); objJMMDiabeticBL = new JMMDiabeticBL(); KPITrace.Debug(TraceWeight.Five, "Calling Manage for frmMedDiabetic"); ((BasePage)this.Page).WrtActivityLog(long.MinValue, " Managing frmMedDiabetic.", ((HtmlInputHidden)(((BasePage)this.Page).FindControl("hdnMode"))).Value); if (objJMMDiabeticList == null) { return(false); } else { objJMMDiabeticBL.ManageDiabetic(objJMMDiabeticList); if (objJMMDiabeticList.Count > 0) { ((BasePage)Page).ShowMsg(MsgType.Success, FrwkMsg.UPD_SUCCESS, null); } objJMMDiabetic.JMBookingID = KPIHlp.CVI64(((HtmlInputHidden)(((BasePage)this.Page).FindControl("hdnBookingID"))).Value); objJMMDiabetic.JurisID = KPIHlp.CVI32(((HtmlInputHidden)(((BasePage)this.Page).FindControl("hdnJurisId"))).Value); Inquiry(ref objJMMDiabetic); return(true); } } catch (Exception objErr) { ((BasePage)this.Page).ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objErr); throw; } finally { } }
public JMMDiabeticList ReadScr() { try { JMMDiabeticList objJMMDiabeticList = new JMMDiabeticList(); for (int iRowCnt = 0; iRowCnt < grdDiabetic.Rows.Count; iRowCnt++) { if (grdDiabetic.IsActiveRow(iRowCnt)) { JMMDiabetic objJMMDiabetic = new JMMDiabetic(); objJMMDiabetic.JMBookingID = KPIHlp.CVI64(((HtmlInputHidden)(((BasePage)this.Page).FindControl("hdnBookingID"))).Value); objJMMDiabetic.JurisID = KPIHlp.CVI32(((HtmlInputHidden)(((BasePage)this.Page).FindControl("hdnJurisId"))).Value); long JMMDiabeticID = grdDiabetic.GetLong(iRowCnt, "KPIID"); if (JMMDiabeticID != long.MinValue && JMMDiabeticID > 0) { objJMMDiabetic.JMMDiabeticID = JMMDiabeticID; objJMMDiabetic.cMode = grdDiabetic.GetChar(iRowCnt, "KPIMode"); } else { objJMMDiabetic.JMMDiabeticID = KPICounter.GetCounterID(objJMMDiabetic.JurisID.Value); objJMMDiabetic.cMode = 'A'; } objJMMDiabetic.TestType = String.IsNullOrEmpty(grdDiabetic.GetString(iRowCnt, "TestType")) ? null : grdDiabetic.GetString(iRowCnt, "TestType"); objJMMDiabetic.GlucoseReading = String.IsNullOrEmpty(grdDiabetic.GetString(iRowCnt, "GlucoseReading")) ? null : grdDiabetic.GetString(iRowCnt, "GlucoseReading"); if (grdDiabetic.GetLong(iRowCnt, "AdministeredPFID") != long.MinValue) { objJMMDiabetic.AdministeredPFID = grdDiabetic.GetLong(iRowCnt, "AdministeredPFID"); } if (grdDiabetic.GetDateTime(iRowCnt, "AdministeredDttm") != DateTime.MinValue) { objJMMDiabetic.AdministeredDttm = grdDiabetic.GetDateTime(iRowCnt, "AdministeredDttm"); } if (grdDiabetic.GetShort(iRowCnt, "IsAdministered") != short.MinValue) { objJMMDiabetic.IsAdministered = grdDiabetic.GetShort(iRowCnt, "IsAdministered"); } if (grdDiabetic.GetShort(iRowCnt, "IsAdministered") == 1) { objJMMDiabetic.IsAdministered = grdDiabetic.GetShort(iRowCnt, "IsAdministered"); } else { objJMMDiabetic.IsAdministered = null; } objJMMDiabetic.ActionNotes = String.IsNullOrEmpty(grdDiabetic.GetString(iRowCnt, "DiabeticNotes")) ? null : System.Web.HttpUtility.HtmlDecode(grdDiabetic.GetString(iRowCnt, "DiabeticNotes")); if (!String.IsNullOrEmpty(objJMMDiabetic.ActionNotes)) { if (objJMMDiabetic.ActionNotes.Length <= 254) { objJMMDiabetic.ActionNotes = objJMMDiabetic.ActionNotes.Substring(0, objJMMDiabetic.ActionNotes.Length); } else { objJMMDiabetic.ActionNotes = objJMMDiabetic.ActionNotes.Substring(0, txtActions.MaxLength); } } objJMMDiabeticList.Add(objJMMDiabetic); } } return(objJMMDiabeticList); } catch (Exception objErr) { ((BasePage)this.Page).ShowMsg(MsgType.Error, FrwkMsg.OP_FAIL, objErr); throw; } }