protected void btnSave_Click(object sender, EventArgs e) { if (FieldValidation()) { if (hdCustID.Value == null || hdCustID.Value == "") { hdCustID.Value = "0"; } DataTable theStrengthDT = new DataTable(); DataTable theGenericDT = new DataTable(); if (ViewState["SelStrength"] != null) { theStrengthDT = (DataTable)ViewState["SelStrength"]; } if (ViewState["SelGeneric"] != null) { theGenericDT = (DataTable)ViewState["SelGeneric"]; } if (theGenericDT.Columns.Count > 2) { RemoveColumn(theGenericDT); } Hashtable theHT = HtParameters(); IDrugMst DrugManager = (IDrugMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDrugMst, BusinessProcess.Administration"); int roweffected = DrugManager.SaveUpdateWebDrugDetails(Convert.ToInt32(hdCustID.Value), theHT, theGenericDT, Convert.ToInt32(Session["AppUserId"]), theStrengthDT); if (roweffected > 0) { ClearFields(); closeWindow(); } } }
private void BindList() { IDrugMst DrugManager = (IDrugMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDrugMst, BusinessProcess.Administration"); BindFunctions theBind = new BindFunctions(); IQCareUtils theUtils = new IQCareUtils(); txtAbbv.Visible = false; lblAbbv.Visible = false; if (ViewState["SelectedData"] == null) { DataTable Select = MakeSelectedTable(); ViewState["SelectedData"] = Select; } string strID = GetGenericID((DataTable)ViewState["SelectedData"]); theBind.BindList(lstSelected, (DataTable)ViewState["SelectedData"], "Name", "Id"); if (Request.QueryString["Type"] == "Generic") { lblAdd.Text = "Add Generic :"; if (ViewState["DrugData"] != null) { DataView theDV = new DataView((DataTable)ViewState["DrugData"]); if (strID != "") { theDV.RowFilter = "DrugTypeId=" + ViewState["DrugType"].ToString() + " and GenericId not in(" + strID + ")"; } else { theDV.RowFilter = "DrugTypeId=" + ViewState["DrugType"].ToString(); } DataTable theDT = theUtils.CreateTableFromDataView(theDV); //---- filtered data DataTable theDT1 = CreateGenericTable(theDT); ViewState["MasterTable"] = theDT1; theBind.BindList(lstAvailable, theDT1, "GenericName", "GenericId"); if (Convert.ToInt32(ViewState["DrugType"]) == 37) { txtAbbv.Visible = true; lblAbbv.Visible = true; } } } else if (Request.QueryString["Type"] == "Strength") { lblAdd.Text = "Add Strength :"; DataTable theDT = (DataTable)ViewState["DrugData"]; theBind.BindList(lstAvailable, theDT, "StrengthName", "StrengthId"); ViewState["MasterTable"] = theDT; } else if (Request.QueryString["Type"] == "Frequency") { lblAdd.Text = "Add Frequency :"; DataTable theDT = (DataTable)ViewState["DrugData"]; theBind.BindList(lstAvailable, theDT, "Name", "Id"); ViewState["MasterTable"] = theDT; } }
protected void btnSave_Click(object sender, EventArgs e) { try { #region "Data Validation" if (FieldValidation() == false) { return; } #endregion //DataTable theDT = (DataTable)ViewState["DrugData"]; //rupesh DataTable theDT = (DataTable)ViewState["MasterTable"]; IDrugMst DrugManager = (IDrugMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDrugMst, BusinessProcess.Administration"); if (ViewState["Type"].ToString() == "Schedule") { DataTable theNDT = (DataTable)DrugManager.CreateSchedule(txtAdd.Text.Trim(), Convert.ToInt32(Session["AppUserId"])); if (theNDT.Rows[0][0].ToString() == "0") { IQCareMsgBox.Show("ScheduleExists", this); return; } else { DataRow theDR = theDT.NewRow(); theDR[0] = theNDT.Rows[0][0]; theDR[1] = theNDT.Rows[0][1]; theDT.Rows.Add(theDR); IQCareUtils theUtil = new IQCareUtils(); DataView theDV = theUtil.GridSort(theDT, "Name", "asc"); ViewState["DrugScheduleAvail"] = theUtil.CreateTableFromDataView(theDV); lstAvailable.DataSource = (DataTable)ViewState["DrugScheduleAvail"]; lstAvailable.DataBind(); txtAdd.Text = ""; ViewState["MasterTable"] = ViewState["DrugScheduleAvail"]; } } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); } }
private Boolean FieldValidation() { IDrugMst DrugManager = (IDrugMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDrugMst, BusinessProcess.Administration"); IQCareUtils theUtils = new IQCareUtils(); string strRegimenName = txtRegimenName.Text; DataSet ds = new DataSet(); ds = DrugManager.GetRegimenName(strRegimenName.Trim()); if (ds.Tables[0].Rows.Count > 0) { MsgBuilder theMsg = new MsgBuilder(); IQCareMsgBox.Show("RegimenName", this); return(false); } return(true); }
protected void btnSave_Click(object sender, EventArgs e) { if (FieldValidation() == false) { return; } int DrugId = 0; int ExistDrugId = Convert.ToInt32(Session["ExistDrugId"]); DataTable theExistGeneric = new DataTable(); DataTable theStrengthDT = new DataTable(); DataTable theFrequencyDT = new DataTable(); DataTable theScheduleDT = new DataTable(); try { IDrugMst DrugManager = (IDrugMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDrugMst, BusinessProcess.Administration"); int theDrugTypeID = Convert.ToInt32(ddlDrugType.SelectedValue); if (Request.QueryString["name"] == "Add") { DrugId = (int)DrugManager.SaveUpdateDrugDetails(0, txtDrugName.Text, txtDrugAbbre.Text, Convert.ToInt32(ddlPurchaseUnit.SelectedValue), Convert.ToInt32(txtPurchaseUnitQty.Text), Convert.ToInt32(ddlDispensingUnit.SelectedItem.Value), Convert.ToInt32(ddlIsSyrup.SelectedValue), Convert.ToInt32(ddStatus.SelectedItem.Value), Convert.ToInt32(ddlDrugType.SelectedItem.Value), 1); } else if (Request.QueryString["name"] == "Edit") { theExistGeneric = (DataTable)ViewState["SelGeneric"]; ExistDrugId = Convert.ToInt32(Request.QueryString["DrugId"]); DrugId = (int)DrugManager.SaveUpdateDrugDetails(ExistDrugId, txtDrugName.Text, txtDrugAbbre.Text, Convert.ToInt32(ddlPurchaseUnit.SelectedValue), Convert.ToInt32(txtPurchaseUnitQty.Text), Convert.ToInt32(ddlDispensingUnit.SelectedItem.Value), Convert.ToInt32(ddlIsSyrup.SelectedValue), Convert.ToInt32(ddStatus.SelectedItem.Value), Convert.ToInt32(ddlDrugType.SelectedItem.Value), 1); } btn_Click(sender, e); } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); return; } }
private void BindList() { IDrugMst DrugManager = (IDrugMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDrugMst, BusinessProcess.Administration"); BindFunctions theBind = new BindFunctions(); IQCareUtils theUtils = new IQCareUtils(); if (ViewState["SelectedData"] == null) { DataTable Select = MakeSelectedTable(); ViewState["SelectedData"] = Select; } //string strID = GetGenericID((DataTable)ViewState["SelectedData"]); theBind.BindList(lstSelected, (DataTable)ViewState["SelectedData"], "Name", "Id"); if (Request.QueryString["Type"] == "Schedule") { lblAdd.Text = "Add Schedule :"; DataTable theDT = (DataTable)ViewState["DrugData"]; theBind.BindList(lstAvailable, theDT, "Name", "Id"); ViewState["MasterTable"] = theDT; } }
protected void btnSave_Click(object sender, EventArgs e) { IDrugMst DrugManager = (IDrugMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDrugMst, BusinessProcess.Administration"); string strRegimenName = txtRegimenName.Text; string strMonths = ddTrMonths.SelectedItem.Value.ToString(); string strStatus = ddStatus.SelectedItem.Value; int intSrNo = 0; if (txtSeqNo.Text != "") { intSrNo = Convert.ToInt32(txtSeqNo.Text); } string strGeneric = ""; if (lstGeneric.Items.Count > 0) { foreach (ListItem lstItem in lstGeneric.Items) { if (strGeneric == "") { strGeneric = lstItem.Value.ToString(); } else { strGeneric = strGeneric + "," + lstItem.Value.ToString(); } } } if (btnSave.Text == "Save") { try { if (strRegimenName != "") { int therows = DrugManager.SaveUpdateTBRegimenGeneric(strRegimenName, 0, Convert.ToInt32(strMonths), Convert.ToInt32(strStatus), strGeneric, Convert.ToInt32(Session["AppUserId"]), intSrNo, 1); Response.Redirect("frmAdmin_TBRegimenGenericList.aspx"); } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); return; } } if (btnSave.Text == "Update") { if (FieldValidation() == false) { return; } try { if (strRegimenName != "") { int therows = DrugManager.SaveUpdateTBRegimenGeneric(strRegimenName, Convert.ToInt32(Session["rid"]), Convert.ToInt32(strMonths), Convert.ToInt32(strStatus), strGeneric, Convert.ToInt32(Session["AppUserId"]), intSrNo, 2); Response.Redirect("frmAdmin_TBRegimenGenericList.aspx"); } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); return; } } }
protected void btnSave_Click(object sender, EventArgs e) { try { #region "Data Validation" if (FieldValidation() == false) { return; } #endregion //DataTable theDT = (DataTable)ViewState["DrugData"]; //rupesh DataTable theDT = (DataTable)ViewState["MasterTable"]; IDrugMst DrugManager = (IDrugMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BDrugMst, BusinessProcess.Administration"); if (ViewState["Type"].ToString() == "Strength") { DataTable theNDT = (DataTable)DrugManager.CreateStrength(txtAdd.Text.Trim(), Convert.ToInt32(Session["AppUserId"].ToString())); if (theNDT.Rows[0][0].ToString() == "0") { IQCareMsgBox.Show("StrengthExists", this); return; } else { DataRow theDR = theDT.NewRow(); theDR[0] = theNDT.Rows[0][0]; theDR[1] = theNDT.Rows[0][1]; theDT.Rows.Add(theDR); IQCareUtils theUtil = new IQCareUtils(); DataView theDV = theUtil.GridSort(theDT, "StrengthName", "asc"); ViewState["DrugStrengthAvail"] = theUtil.CreateTableFromDataView(theDV); lstAvailable.DataSource = (DataTable)ViewState["DrugStrengthAvail"]; lstAvailable.DataBind(); txtAdd.Text = ""; ViewState["MasterTable"] = ViewState["DrugStrengthAvail"]; } } else if (ViewState["Type"].ToString() == "Frequency") { DataTable theNDT = (DataTable)DrugManager.CreateFrequency(txtAdd.Text.Trim(), Convert.ToInt32(Session["AppUserId"])); if (theNDT.Rows[0][0].ToString() == "0") { IQCareMsgBox.Show("FrequencyExists", this); return; } else { DataRow theDR = theDT.NewRow(); theDR[0] = theNDT.Rows[0][0]; theDR[1] = theNDT.Rows[0][1]; theDT.Rows.Add(theDR); IQCareUtils theUtil = new IQCareUtils(); DataView theDV = theUtil.GridSort(theDT, "Name", "asc"); ViewState["DrugFrequencyAvail"] = theUtil.CreateTableFromDataView(theDV); lstAvailable.DataSource = (DataTable)ViewState["DrugFrequencyAvail"]; lstAvailable.DataBind(); txtAdd.Text = ""; ViewState["MasterTable"] = ViewState["DrugFrequencyAvail"]; } } else if (ViewState["Type"].ToString() == "Schedule") { DataTable theNDT = (DataTable)DrugManager.CreateSchedule(txtAdd.Text.Trim(), Convert.ToInt32(Session["AppUserId"])); if (theNDT.Rows[0][0].ToString() == "0") { IQCareMsgBox.Show("ScheduleExists", this); return; } else { DataRow theDR = theDT.NewRow(); theDR[0] = theNDT.Rows[0][0]; theDR[1] = theNDT.Rows[0][1]; theDT.Rows.Add(theDR); IQCareUtils theUtil = new IQCareUtils(); DataView theDV = theUtil.GridSort(theDT, "Name", "asc"); ViewState["DrugScheduleAvail"] = theUtil.CreateTableFromDataView(theDV); lstAvailable.DataSource = (DataTable)ViewState["DrugScheduleAvail"]; lstAvailable.DataBind(); txtAdd.Text = ""; ViewState["MasterTable"] = ViewState["DrugScheduleAvail"]; } } else if (ViewState["Type"].ToString() == "Generic") { //DataTable theDT = (DataTable)ViewState["DrugData"]; string theGenericAbbrv; if (txtAbbv.Text == "") { theGenericAbbrv = ""; } else { theGenericAbbrv = txtAbbv.Text; } int theDrgType = Convert.ToInt32(ViewState["DrugType"]); DataSet theNDT = (DataSet)DrugManager.CreateGeneric(txtAdd.Text.Trim(), theGenericAbbrv, theDrgType, Convert.ToInt32(Session["AppUserId"])); if (theNDT.Tables[0].Rows[0][0].ToString() == "0") { if (theDrgType == 37) { IQCareMsgBox.Show("GenericExists", this); return; } else { IQCareMsgBox.Show("NonARVGenericExists", this); return; } } else { DataTable DT = new DataTable(); DT = theDT.Copy(); DataRow theDR = DT.NewRow(); theDR[0] = theNDT.Tables[0].Rows[0][0]; theDR[1] = theNDT.Tables[0].Rows[0][1]; theDR[2] = theNDT.Tables[0].Rows[0][2]; theDR[3] = theNDT.Tables[1].Rows[0][0]; DT.Rows.Add(theDR); IQCareUtils theUtil = new IQCareUtils(); DataView theDV = theUtil.GridSort(DT, "GenericName", "asc"); DT = theUtil.CreateTableFromDataView(theDV); ViewState["DrugData"] = DT; theDV = new DataView(DT); theDV.RowFilter = "DrugTypeId=" + ViewState["DrugType"].ToString(); DT = theUtil.CreateTableFromDataView(theDV); ViewState["MasterTable"] = DT; lstAvailable.DataSource = DT; lstAvailable.DataBind(); if (theDrgType == 37) { txtAbbv.Text = ""; txtAdd.Text = ""; } else { txtAdd.Text = ""; } } } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); } }