protected void RadOtherVaccine_CancelCommand(object sender, GridCommandEventArgs e) { GetImmunisationDetails(); //GetImmunisationDetaisOther(); RadOtherVaccine.DataSource = (DataTable)ViewState["TblImmunisation"]; RadOtherVaccine.DataBind(); }
protected void RadOtherVaccine_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (ViewState["TblImmunisation"] == null) { DtImmunisation = CreateImmunisationTable(); } else { DtImmunisation = (DataTable)ViewState["TblImmunisation"]; } DataRow DR = DtImmunisation.NewRow(); int dtnextId = Convert.ToInt32(DtImmunisation.Rows.Count) + 1; if (e.CommandName == "Insert") { if (RadOtherVaccine != null) { // GridItem[] footerItems = RadOtherVaccine.MasterTableView.GetItems(GridItemType.Footer); GridFooterItem footeritem = (GridFooterItem)RadOtherVaccine.MasterTableView.GetItems(GridItemType.Footer)[0]; if (footeritem != null) { Telerik.Web.UI.RadTextBox txtimmuOther = (Telerik.Web.UI.RadTextBox)footeritem.FindControl("txtFooterRadVaccineName"); Telerik.Web.UI.RadButton btnFooterOthers = (Telerik.Web.UI.RadButton)footeritem.FindControl("btnFooterOthers"); Telerik.Web.UI.RadButton btnCatchupFooterOthers = (Telerik.Web.UI.RadButton)footeritem.FindControl("btnCatchupFooterOthers"); Telerik.Web.UI.RadDatePicker dtFooterOtherDate = (Telerik.Web.UI.RadDatePicker)footeritem.FindControl("dtFooterOtherDate"); if (ValidateAddImmunisation(txtimmuOther.Text.ToString(), dtFooterOtherDate.SelectedDate, btnFooterOthers.SelectedToggleState.Text.ToString()) == false) { RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "JumpToGrid", "document.location = '#sGrid';", true); return; } DR["ImmunisationOther"] = txtimmuOther.Text; DR["ImmunisationDate"] = Convert.ToDateTime(dtFooterOtherDate.SelectedDate.ToString()).ToShortDateString(); DR["ImmunisationCU"] = btnCatchupFooterOthers.SelectedToggleState.Text; DR["Administered"] = btnFooterOthers.SelectedToggleState.Text; DR["ID"] = dtnextId.ToString() + txtimmuOther.Text; DR["EditMode"] = "DELETE"; DtImmunisation.Rows.Add(DR); ViewState["TblImmunisation"] = DtImmunisation; RadOtherVaccine.DataSource = DtImmunisation; RadOtherVaccine.DataBind(); } } } //GridDataItem row = RadGrid1.Items[rowNo]; }
private void GetImmunisationDetaisOther() { BIQTouchmmunisationFields obj = new BIQTouchmmunisationFields(); obj.Ptnpk = Convert.ToInt32(Request.QueryString["PatientID"]); obj.LocationId = Int32.Parse(Session["AppLocationId"].ToString()); obj.Flag = 0; IBIQTouchImmunisation theImmunisationManager; theImmunisationManager = (IBIQTouchImmunisation)ObjectFactory.CreateInstance("BusinessProcess.Pharmacy.BIQTouchImmunisation, BusinessProcess.Pharmacy"); DataSet Ds = theImmunisationManager.GetImmunisationDetails(obj); DataTable dtImm = Ds.Tables[0]; ViewState["TblImmunisation"] = dtImm; RadOtherVaccine.DataSource = dtImm; RadOtherVaccine.DataBind(); }
protected void RadOtherVaccine_DeleteCommand(object sender, GridCommandEventArgs e) { GridDataItem dataItm = e.Item as GridDataItem; Label lblID = (Label)dataItm.FindControl("lblID"); string Id = lblID.Text; DataTable table = (DataTable)ViewState["TblImmunisation"]; table.PrimaryKey = new DataColumn[] { table.Columns["ID"] }; if (table.Rows.Find(Id) != null) { table.Rows.Find(Id).Delete(); table.AcceptChanges(); ViewState["TblImmunisation"] = table; RadOtherVaccine.DataSource = table; RadOtherVaccine.DataBind(); } else { RadOtherVaccine.DataSource = (DataTable)ViewState["TblImmunisation"]; RadOtherVaccine.DataBind(); } }
protected void RadOtherVaccine_UpdateCommand(object sender, GridCommandEventArgs e) { //GetImmunisationDetails(); //GetImmunisationDetaisOther(); //List<BIQTouchmmunisationFields> list1 = new List<BIQTouchmmunisationFields>(); if (e.CommandName == RadGrid.UpdateCommandName) { if (e.Item is GridEditFormItem) { GridEditFormItem item = (GridEditFormItem)e.Item; Telerik.Web.UI.RadDatePicker dtEditOtherDate = (Telerik.Web.UI.RadDatePicker)item.FindControl("dtEditOtherDate"); Telerik.Web.UI.RadButton btnCatchupEditOthers = (Telerik.Web.UI.RadButton)item.FindControl("btnCatchupEditOthers"); Telerik.Web.UI.RadTextBox txtEditRadVaccineName = (Telerik.Web.UI.RadTextBox)item.FindControl("txtEditRadVaccineName"); Label lblIDEdit = (Label)item.FindControl("lblIDEdit"); string id = lblIDEdit.Text; DataTable table = (DataTable)ViewState["TblImmunisation"]; table.PrimaryKey = new DataColumn[] { table.Columns["ID"] }; if (table.Rows.Find(id) != null) { DataRow dr = table.Rows.Find(id); dr["ImmunisationOther"] = txtEditRadVaccineName.Text.ToString(); dr["ImmunisationDate"] = Convert.ToDateTime(dtEditOtherDate.SelectedDate.ToString()).ToShortDateString(); dr["ImmunisationCU"] = CheckedVaue(btnCatchupEditOthers.SelectedToggleState.Text); dr["EditMode"] = "New"; table.AcceptChanges(); ViewState["TblImmunisation"] = table; RadOtherVaccine.DataSource = table; RadOtherVaccine.DataBind(); } } } }