protected void RadGridLabOrder_ItemDataBound(object sender, GridItemEventArgs e)
 {
     if (e.Item is GridDataItem)
     {
         GridDataItem             item             = (GridDataItem)e.Item;
         Telerik.Web.UI.RadButton btnReportResults = (Telerik.Web.UI.RadButton)item.FindControl("btnReportResults");
         btnReportResults.NavigateUrl = "frmLabOrderTouchResults.aspx?patientId=" + Request.QueryString["PatientID"].ToString();
     }
 }
        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];
        }
        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();
                    }
                }
            }
        }
        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");
                    if (dtEditOtherDate.DbSelectedDate.ToString() != "")
                    {
                        BIQTouchmmunisationFields obj1 = new BIQTouchmmunisationFields();
                        obj1.Ptnpk      = Convert.ToInt32(Request.QueryString["PatientID"]);;
                        obj1.LocationId = Int32.Parse(Session["AppLocationId"].ToString());
                        obj1.UserId     = Int32.Parse(Session["AppUserId"].ToString());
                        obj1.Flag       = 1;

                        obj1.ImmunisationDate  = Convert.ToDateTime(dtEditOtherDate.DbSelectedDate.ToString());
                        obj1.ImmunisationOther = txtEditRadVaccineName.Text;
                        obj1.ImmunisationCU    = CheckedVaue(btnCatchupEditOthers.SelectedToggleState.Text);
                        obj1.ImmunisationCode  = "";
                        list1.Add(obj1);
                    }
                }
                IBIQTouchImmunisation theImmunisationManager;
                theImmunisationManager = (IBIQTouchImmunisation)ObjectFactory.CreateInstance("BusinessProcess.Pharmacy.BImmunisation, BusinessProcess.Pharmacy");
                int result = theImmunisationManager.SaveUpdateImmunisationDetail(list1);
                GetImmunisationDetails();
                GetImmunisationDetaisOther();
            }
        }
示例#5
0
    private void DisableControl(Control objC)
    {
        try
        {
            if (objC is Telerik.Web.UI.RadTextBox)
            {
                Telerik.Web.UI.RadTextBox obj = (Telerik.Web.UI.RadTextBox)objC;
                obj.ReadOnly = true;
            }

            if (objC is Telerik.Web.UI.RadComboBox)
            {
                Telerik.Web.UI.RadComboBox obj = (Telerik.Web.UI.RadComboBox)objC;
                obj.Enabled   = false;
                obj.BackColor = Color.White;
                obj.ForeColor = Color.Black;
            }

            if (objC is Telerik.Web.UI.RadNumericTextBox)
            {
                Telerik.Web.UI.RadNumericTextBox obj = (Telerik.Web.UI.RadNumericTextBox)objC;
                obj.ReadOnly = true;
            }

            if (objC is Telerik.Web.UI.RadDatePicker)
            {
                Telerik.Web.UI.RadDatePicker obj = (Telerik.Web.UI.RadDatePicker)objC;
                obj.Enabled = false;
            }

            if (objC is Telerik.Web.UI.DatePickingCalendar)
            {
                Telerik.Web.UI.DatePickingCalendar obj = (Telerik.Web.UI.DatePickingCalendar)objC;
                obj.Enabled = false;
            }

            if (objC is System.Web.UI.WebControls.RadioButtonList)
            {
                System.Web.UI.WebControls.RadioButtonList obj = (System.Web.UI.WebControls.RadioButtonList)objC;
                obj.Enabled = false;
            }

            if (objC is System.Web.UI.WebControls.TextBox)
            {
                System.Web.UI.WebControls.TextBox obj = (System.Web.UI.WebControls.TextBox)objC;
                obj.ReadOnly = true;
            }

            if (objC is Telerik.Web.UI.RadUpload)
            {
                Telerik.Web.UI.RadUpload obj = (Telerik.Web.UI.RadUpload)objC;
                obj.Enabled = false;
            }

            if (objC is Telerik.Web.UI.RadButton)
            {
                Telerik.Web.UI.RadButton obj = (Telerik.Web.UI.RadButton)objC;
                obj.ReadOnly = true;
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
        protected void RadOtherVaccine_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataBoundItem = e.Item as GridDataItem;

                Label lblImmunisationName = (Label)dataBoundItem.FindControl("lblImmunisation_name");

                if (lblImmunisationName.Text.ToString() == "")
                {
                    e.Item.Display = false;
                }
                else
                {
                    Label lblAdministered = (Label)dataBoundItem.FindControl("lblAdministered");
                    Label lblcatchUp      = (Label)dataBoundItem.FindControl("lblcatchUp");
                    Label lblEditMode     = (Label)dataBoundItem.FindControl("lblEditMode");
                    Telerik.Web.UI.RadButton btnOthers        = (Telerik.Web.UI.RadButton)dataBoundItem.FindControl("btnOthers");
                    Telerik.Web.UI.RadButton btnCatchupOthers = (Telerik.Web.UI.RadButton)dataBoundItem.FindControl("btnCatchupOthers");
                    Telerik.Web.UI.RadButton btnRemove        = (Telerik.Web.UI.RadButton)dataBoundItem.FindControl("btnRemove");

                    btnOthers.SetSelectedToggleStateByText(lblAdministered.Text);
                    btnCatchupOthers.SetSelectedToggleStateByText(lblcatchUp.Text);
                    btnRemove.Visible = true;
                    if (lblEditMode.Text.ToString().Trim() == "EDIT")
                    {
                        // Button Enable for EDIT
                        btnRemove.Visible = false;
                    }
                }
            }



            //if (e.Item is GridFooterItem)
            //{

            //    GridFooterItem itemFooter = e.Item as GridFooterItem;
            //    Telerik.Web.UI.RadButton btnFooterAdd = (Telerik.Web.UI.RadButton)itemFooter.FindControl("btnFooterAdd");
            //    Telerik.Web.UI.RadTextBox txtFooterRadVaccineName = (Telerik.Web.UI.RadTextBox)itemFooter.FindControl("txtFooterRadVaccineName");
            //    Telerik.Web.UI.RadDatePicker dtFooterOtherDate = (Telerik.Web.UI.RadDatePicker)itemFooter.FindControl("dtFooterOtherDate");
            //    Telerik.Web.UI.RadButton btnOthers = (Telerik.Web.UI.RadButton)itemFooter.FindControl("btnFooterOthers");
            //    btnFooterAdd.Attributes.Add("onclick", "return ShowValidatemsgImmuOthers('" + txtFooterRadVaccineName.ClientID + "','" + dtFooterOtherDate.ClientID + "','" + btnOthers.ClientID+ "');");

            //}

            // Edit control

            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                if (e.Item is GridEditFormInsertItem)
                {
                    // insert
                }
                else
                {
                    // Edit
                    // Please add below code in your page
                    //GridEditableItem item = e.Item as GridEditableItem;
                    //Telerik.Web.UI.RadButton btnRemove = (Telerik.Web.UI.RadButton)item.FindControl("btnRemove");
                    //Telerik.Web.UI.RadTextBox txtEditRadVaccineName = (Telerik.Web.UI.RadTextBox)item.FindControl("txtEditRadVaccineName");
                    //btnRemove.Enabled = false;
                    //txtEditRadVaccineName.Enabled = false;
                    //item["Name"].Controls[0].Visible = false;
                }
            }
        }
		/// <summary>
		/// The Schedules_Edit control is made up of a set of date windows, each with a begin date, end date, and lock toggle. The set of date 
		/// windows is passed/assigned to this control by the page or control hosting us. To keep this control generic, we don't know how many 
		/// date windows we'll get to display, so we'll assume the set is handed to us and we can iterate through them one by one. Given that, 
		/// the configuration of each date window is the same - consisting of a radDatePicker control for the begin date, a radDatePicker 
		/// control for the end date, and a radButton made to look like a check box for the lock/unlock toggle. Iterating through the set of 
		/// date windows, we will build and configure the controls for each window here in the code-behind.  
		/// </summary>
		public void RenderEditControl()
		{
			if (ScheduleTypes != null)
			{
				int i = 1; //intentionally set to 1 so as to create row and insert after the header row.
				foreach (Scheduling.ScheduleType schedType in ScheduleTypes)
				{
					HtmlTableRow row = new HtmlTableRow();

					HtmlTableCell cell;
					//
					// Create the label - this label describes this date window is for.
					//
					Label lbl = new Label();
					lbl.Text = schedType.TypeName;
					lbl.CssClass += " Schedules_Edit_Control label " + schedType.TypeName;
					lbl.Attributes.Add("ScheduleTypeID", schedType.TypeID.ToString());
					lbl.Attributes.Add("DocTypeID", schedType.DocTypeID.ToString());
					lbl.Attributes.Add("DefaultValues", "");
					cell = new HtmlTableCell();
					cell.Controls.Add(lbl);
					row.Controls.Add(cell);

					//
					// Create the Begin Date Control
					//
					RadDatePicker ctrlBegDate = new RadDatePicker();
					ctrlBegDate.ID = schedType.TypeName + "_ctrlBeginDate";
					ctrlBegDate.CssClass += " Schedules_Edit_Control BeginDate " + schedType.TypeName;

					//Styling for our calendar control
					ctrlBegDate.Skin = "Vista";		//just one of Telerik's styles - If we don't specify, then what you get is a ghost-like transparency.

					//Styling - Make current date stand out (but not selected).
					RadCalendarDay rcd = new RadCalendarDay();
					rcd.Repeatable = RecurringEvents.Today;
					rcd.ItemStyle.BackColor = System.Drawing.Color.Bisque;
					ctrlBegDate.Calendar.SpecialDays.Add(rcd);

					ctrlBegDate.MinDate = new DateTime(1980, 1, 1);
					ctrlBegDate.MaxDate = new DateTime(3000, 12, 31);

					// If a default date is provided, then a) set our control to that date, and b) store off date as an attribute
					if (!string.IsNullOrEmpty(schedType.DefaultStart))
					{
						ctrlBegDate.SelectedDate = DataIntegrity.ConvertToDate(schedType.DefaultStart);
						lbl.Attributes["DefaultValues"] = schedType.DefaultStart;
					}
					else
						lbl.Attributes["DefaultValues"] = DateTime.Now.ToString();
					// Add control to the row.
					cell = new HtmlTableCell();
					cell.Controls.Add(ctrlBegDate);
					row.Controls.Add(cell);

					//
					// Create the End Date Control
					//
					RadDatePicker ctrlEndDate = new Telerik.Web.UI.RadDatePicker();
					ctrlEndDate.ID = schedType.TypeName + "_ctrlEndDate";
					ctrlEndDate.CssClass += " Schedules_Edit_Control EndDate " + schedType.TypeName;

					//Styling for our calendar control
					ctrlEndDate.Skin = "Vista";		//just one of Telerik's styles - If we don't specify, then what you get is a ghost-like transparency.

					//Styling - Make current date stand out (but not selected).  rcd was created up above for use in ctrlBegDate.
					ctrlEndDate.Calendar.SpecialDays.Add(rcd);
					ctrlEndDate.MinDate = new DateTime(1980, 1, 1);
					ctrlEndDate.MaxDate = new DateTime(3000, 12, 31);

					// If a default date is provided, then a) set our control to that date, and b) store off date as an attribute
					if (!string.IsNullOrEmpty(schedType.DefaultEnd))
					{
						ctrlEndDate.SelectedDate = DataIntegrity.ConvertToDate(schedType.DefaultEnd);
						lbl.Attributes["DefaultValues"] += "|" + schedType.DefaultEnd;
					}
					else
						lbl.Attributes["DefaultValues"] = "|" + DateTime.Now.ToString();
					// Add control to the row.
					cell = new HtmlTableCell();
					cell.Controls.Add(ctrlEndDate);
					row.Controls.Add(cell);

					//
					// Create the Clear Dates image
					//
					HtmlImage img = new HtmlImage();
					img.ID = schedType.TypeName + "_ctrlClearDates";
					img.Attributes.Add("class", " Schedules_Edit_Control ClearDates " + schedType.TypeName);
					img.Src = "~/Images/Eraser_Small.png";
					img.Attributes.Add("OnClick", "Schedules_Edit_Control.ClearDatesByType(\"" + schedType.TypeName + "\")");
					// Add control to the row.
					cell = new HtmlTableCell();
					cell.Controls.Add(img);
					row.Controls.Add(cell);

					//
					// Create Lock/Unlock check box.
					//
					RadButton ctrlRadButton = new Telerik.Web.UI.RadButton();
					ctrlRadButton.ButtonType = RadButtonType.ToggleButton;
					ctrlRadButton.ToggleType = ButtonToggleType.CustomToggle;
					ctrlRadButton.ID = schedType.TypeName + "_btnToggle";
					ctrlRadButton.CssClass += " Schedules_Edit_Control Toggle " + schedType.TypeName;
					ctrlRadButton.AutoPostBack = false;
					// Add to our button the toggle states
					RadButtonToggleState tglState = new RadButtonToggleState();
					tglState.PrimaryIconCssClass = "rbToggleCheckbox";
					ctrlRadButton.ToggleStates.Add(tglState);
					
					tglState = new RadButtonToggleState();
					tglState.PrimaryIconCssClass = "rbToggleCheckboxChecked";
					ctrlRadButton.ToggleStates.Add(tglState);

					tglState = new RadButtonToggleState();
					tglState.PrimaryIconCssClass = "rbToggleCheckboxFilled";
					ctrlRadButton.ToggleStates.Add(tglState);

					// Set default value for our check box
					// The check boxes in this control are a three-state checkbox - 
					//	 - not checked,
					//	 - checked,
					//	 - heterogeneous (a state representing multiple schedules some of which are checked and others of which are not.
					//
					// The initial state of the checkboxes should be set to "Heterogeneous" (numeric value of 2) because the schedule 
					// control is not even displayed until user clicks on a schedule in the grid.  At that point, there is javascript 
					// logic in AssessmentScheduling.ascx that will populate the checkboxes and dates within this control according to 
					// business logic there.  By setting the checkbox to 2, the logic in AssessmentScheduling.ascx will interpret this 
					// to mean that the checkbox has not been set to any value yet.
					//
					
					if (schedType.DefaultLock.HasValue)
					{
						ctrlRadButton.SelectedToggleStateIndex = (schedType.DefaultLock.Value ? cbxChecked : cbxUnchecked);
						lbl.Attributes["DefaultValues"] += "|" + (schedType.DefaultLock.Value ? cbxChecked.ToString() : cbxUnchecked.ToString());
					}
					else
					{
						ctrlRadButton.SelectedToggleStateIndex = cbxFilled;
						lbl.Attributes["DefaultValues"] += "|" + cbxFilled.ToString();
					}
					// Add our button to the row
					cell = new HtmlTableCell();
					cell.Controls.Add(ctrlRadButton);
					row.Controls.Add(cell);

					// Add our row to the table.
					SchedControlsTable.Rows.Insert(i, row);
					i++;
				}
				Schedules_Edit_EditPanel.Visible = true;
				Schedules_Edit_ResultPanel.Visible = false;
			}
			else
			{
				lblResultMessage.Text = "No scheduling purposes found.";
				Schedules_Edit_EditPanel.Visible = false;
				Schedules_Edit_ResultPanel.Visible = true;
			}
		}