protected string GetClientId(object container) { System.Web.UI.WebControls.RepeaterItem ri = container as System.Web.UI.WebControls.RepeaterItem; MetricTrac.Bll.MetricValue.Extend val = ri.DataItem as MetricTrac.Bll.MetricValue.Extend; string ClientId = String.Empty; switch (val.MetricDataTypeID) { case 2: System.Web.UI.WebControls.TextBox tbValue = (System.Web.UI.WebControls.TextBox)ri.FindControl("tbValue"); ClientId = tbValue.ClientID; break; case 3: System.Web.UI.WebControls.CheckBox chbValue = (System.Web.UI.WebControls.CheckBox)ri.FindControl("chbValue"); ClientId = chbValue.ClientID; break; case 4: Telerik.Web.UI.RadDatePicker rdpDateValue = (Telerik.Web.UI.RadDatePicker)ri.FindControl("rdpDateValue"); ClientId = rdpDateValue.ClientID; break; case 1: default: Telerik.Web.UI.RadNumericTextBox rntValue = (Telerik.Web.UI.RadNumericTextBox)ri.FindControl("rntValue"); ClientId = rntValue.ClientID; break; } return(ClientId); }
protected void rgUpComingProject_ItemDataBound(object sender, GridItemEventArgs e) { try { if (e.Item is GridDataItem && e.Item.IsInEditMode) { GridDataItem item = (GridDataItem)e.Item; TextBox txtProject = (e.Item as GridEditableItem)["Project"].FindControl("txtProject") as TextBox; Telerik.Web.UI.RadDatePicker DesiredStart = (e.Item as GridEditableItem)["DesiredStart"].FindControl("DesiredStart") as Telerik.Web.UI.RadDatePicker; Telerik.Web.UI.RadDatePicker PlannedStart = (e.Item as GridEditableItem)["PlannedStart"].FindControl("PlannedStart") as Telerik.Web.UI.RadDatePicker; TextBox txtResource = (e.Item as GridEditableItem)["Resources"].FindControl("txtResource") as TextBox; TextBox txtComment = (e.Item as GridEditableItem)["Comments"].FindControl("txtComment") as TextBox; if (e.Item is GridEditFormInsertItem || e.Item is GridDataInsertItem) { // insert item } else { txtProject.Text = Session["Project"].ToString(); DesiredStart.SelectedDate = Convert.ToDateTime(Session["DesiredStart"].ToString()); PlannedStart.SelectedDate = Convert.ToDateTime(Session["PlannedStart"].ToString()); txtResource.Text = Session["Resource"].ToString(); txtComment.Text = Session["Comment"].ToString(); } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, typeof(string), "validation", "alert('" + ex.Message + "')", true); } }
private void SetFocusItemControl() { int rowCount = grv.Items.Count; Telerik.Web.UI.GridItem lastRow = grv.Items[rowCount - 1]; Telerik.Web.UI.RadDatePicker DatePicker = lastRow.FindControl("dtmTimeStamp") as Telerik.Web.UI.RadDatePicker; DatePicker.Focus(); }
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]; }
public virtual void FillRadDatePickerAnswer(Telerik.Web.UI.RadDatePicker rdp, DateTime?answer) { if (answer != null) { try { rdp.SelectedDate = answer.Value; } catch { rdp.SelectedDate = DateTime.Now; } } else { rdp.SelectedDate = null; } }
private List <t_Data_Raw_Indexes> GetIndexes() { List <t_Data_Raw_Indexes> list = new List <t_Data_Raw_Indexes>(); foreach (Telerik.Web.UI.GridItem row in grv.Items) { Telerik.Web.UI.RadTextBox TextBoxDescription = row.FindControl("txtDescription") as Telerik.Web.UI.RadTextBox; Telerik.Web.UI.RadDatePicker DatePicker = row.FindControl("dtmTimeStamp") as Telerik.Web.UI.RadDatePicker; Telerik.Web.UI.RadNumericTextBox NummericTextBoxIndex = row.FindControl("nmrIndex") as Telerik.Web.UI.RadNumericTextBox; t_Data_Raw_Indexes data = new t_Data_Raw_Indexes(); if (NummericTextBoxIndex.Value != null && DatePicker.SelectedDate != null) { data.Description = TextBoxDescription.Text; data.Index = (double)NummericTextBoxIndex.Value; data.TimeStamp = (DateTime)DatePicker.SelectedDate; data.SiteId = cboSites.SelectedValue; list.Add(data); } } return(list); }
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(); } }
private void SaveBulkValues() { int i = 0; LastFrequencyMetric = GetData(); List <Bll.MetricValue.Extend> NewValues = new List <MetricValue.Extend>(); List <Bll.MetricValue.Extend> OldValues = new List <MetricValue.Extend>(); List <Bll.MetricOrgLocationUoM> MetricOrgLocationUoMList = new List <Bll.MetricOrgLocationUoM>(); foreach (RepeaterItem ri in rMetric.Items) { MetricOrgValue mov = LastFrequencyMetric.Metrics[i]; DateTime iTime = DateTime.Now; DropDownList ddlInputUnitOfMeasure = (DropDownList)ri.FindControl("ddlInputUnitOfMeasure"); HiddenField hfUoM = (HiddenField)ri.FindControl("hfUoM"); HiddenField hfMetric = (HiddenField)ri.FindControl("hfMetric"); HiddenField hfOrgLocation = (HiddenField)ri.FindControl("hfOrgLocation"); Repeater r = (Repeater)ri.FindControl("rMericValue"); Guid?ActualUoMID = null; if (ddlInputUnitOfMeasure.Visible) { if (!String.IsNullOrEmpty(ddlInputUnitOfMeasure.SelectedValue)) { ActualUoMID = new Guid(ddlInputUnitOfMeasure.SelectedValue); } } else { if (!String.IsNullOrEmpty(hfUoM.Value)) { ActualUoMID = new Guid(hfUoM.Value); } } Guid oMetricID = new Guid(hfMetric.Value); Guid oOrgLocationID = new Guid(hfOrgLocation.Value); Bll.MetricOrgLocationUoM muom = new Bll.MetricOrgLocationUoM(); muom.MetricID = oMetricID; muom.OrgLocationID = oOrgLocationID; muom.InputUnitOfMeasureID = ActualUoMID; MetricOrgLocationUoMList.Add(muom); int j = 0; foreach (RepeaterItem rri in r.Items) { DateTime jTime = DateTime.Now; HiddenField hfDate = (HiddenField)rri.FindControl("hfDate"); DateTime oDate = DateTime.Parse(hfDate.Value); Telerik.Web.UI.RadNumericTextBox rntValue = (Telerik.Web.UI.RadNumericTextBox)rri.FindControl("rntValue"); System.Web.UI.WebControls.TextBox tbValue = (System.Web.UI.WebControls.TextBox)rri.FindControl("tbValue"); System.Web.UI.WebControls.CheckBox chbValue = (System.Web.UI.WebControls.CheckBox)rri.FindControl("chbValue"); Telerik.Web.UI.RadDatePicker rdpDateValue = (Telerik.Web.UI.RadDatePicker)rri.FindControl("rdpDateValue"); System.Web.UI.WebControls.DropDownList ddlApprovalStatus = (System.Web.UI.WebControls.DropDownList)rri.FindControl("ddlApprovalStatus"); Bll.MetricValue.Extend OldMetricValue = mov.MetricValues[j]; string Value = String.Empty; if (rntValue.Visible) { Value = rntValue.Value.ToString(); } else if (tbValue.Visible) { Value = tbValue.Text; } else if (chbValue.Visible) { Value = chbValue.Checked ? bool.TrueString : bool.FalseString; } else if (rdpDateValue.Visible) { Value = rdpDateValue.SelectedDate.ToString(); } bool?Approved = OldMetricValue.Approved; if (DataMode == Mode.Approve) { switch (ddlApprovalStatus.SelectedValue) { case "": Approved = null; break; case "True": Approved = true; break; case "False": default: Approved = false; break; } } if ( ( ( !String.IsNullOrEmpty(Value) || (OldMetricValue.MetricValueID != Guid.Empty && String.IsNullOrEmpty(Value)) ) && Value != OldMetricValue.Value ) || (DataMode == Mode.Approve && Approved != OldMetricValue.Approved)) { MetricValue.Extend nv = new MetricValue.Extend(); nv.MetricID = oMetricID; nv.Date = oDate; nv.OrgLocationID = oOrgLocationID; nv.InputUnitOfMeasureID = ActualUoMID; nv.Value = Value; nv.Approved = Approved; // additional fields nv.Period = Frequency.GetPeriodName(oDate, FrequencyID); nv.MetricName = mov.Name; nv.OrgLocationFullName = mov.OrgLocationFullName; nv.Notes = OldMetricValue.Notes; nv.ValueInputUnitOfMeasureName = mov.OrgLocationUnitOfMeasureName; NewValues.Add(nv); OldValues.Add(OldMetricValue); } LogTime += " value " + j.ToString() + " time " + ((TimeSpan)(DateTime.Now - jTime)).TotalMilliseconds; j++; } LogTime += "Row " + i.ToString() + " time " + ((TimeSpan)(DateTime.Now - iTime)).TotalMilliseconds + "<br />"; i++; } Bll.MetricValue.SaveBulkValues(MetricOrgLocationUoMList, NewValues, OldValues, Micajah.Common.Security.UserContext.Current, DataMode == Mode.Input); }
protected void rpMetricValue_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType < ListItemType.Item || e.Item.ItemType > ListItemType.EditItem) { return; } MetricTrac.Bll.MetricValue.Extend MVS = (MetricTrac.Bll.MetricValue.Extend)e.Item.DataItem; Telerik.Web.UI.RadNumericTextBox rntValue = (Telerik.Web.UI.RadNumericTextBox)e.Item.FindControl("rntValue"); System.Web.UI.WebControls.TextBox tbValue = (System.Web.UI.WebControls.TextBox)e.Item.FindControl("tbValue"); System.Web.UI.WebControls.CheckBox chbValue = (System.Web.UI.WebControls.CheckBox)e.Item.FindControl("chbValue"); Telerik.Web.UI.RadDatePicker rdpDateValue = (Telerik.Web.UI.RadDatePicker)e.Item.FindControl("rdpDateValue"); System.Web.UI.WebControls.DropDownList ddlApprovalStatus = (System.Web.UI.WebControls.DropDownList)e.Item.FindControl("ddlApprovalStatus"); ddlApprovalStatus.Attributes.Add("onchange", "valueChanged();return false;"); if ((DataMode == Mode.Approve) && (MVS.Value != null)) { ListsStringArray += ddlApprovalStatus.ClientID + "|"; } bool IsDataTypeChanged = false; bool IsNewRecord = false; if (MVS.MetricValueID == Guid.Empty) { IsNewRecord = true; } else if (MVS.MetricDataTypeID != MVS.ActualMetricDataTypeID) { IsDataTypeChanged = true; } switch (LastMetricMetricValue.MetricDataTypeID) { case 2: //Text tbValue.Visible = true; rntValue.Visible = chbValue.Visible = rdpDateValue.Visible = false; tbValue.Text = String.Empty; if (!IsDataTypeChanged) { tbValue.Text = MVS.Value; } break; case 3: //Bool - checkbox chbValue.Visible = true; rntValue.Visible = tbValue.Visible = rdpDateValue.Visible = false; chbValue.Checked = false; if (!IsDataTypeChanged) { chbValue.Checked = MVS.Value == bool.TrueString; } break; case 4: //Date rdpDateValue.Visible = true; rntValue.Visible = tbValue.Visible = chbValue.Visible = false; rdpDateValue.SelectedDate = DateTime.Now; DateTime _dt = DateTime.Now; if (!IsDataTypeChanged) { if (DateTime.TryParse(MVS.Value, out _dt)) { rdpDateValue.SelectedDate = _dt; } } break; case 1: //Numeric default: rntValue.Visible = true; rntValue.ReadOnly = LastMetricMetricValue.MetricTypeID > 1; tbValue.Visible = chbValue.Visible = rdpDateValue.Visible = false; rntValue.Text = String.Empty; if ((!IsDataTypeChanged) && ((MVS.UnitOfMeasureID == MVS.MetricUnitOfMeasureID) || IsNewRecord)) { double _Value = double.NaN; if (double.TryParse(MVS.Value, out _Value)) { rntValue.Value = _Value; } } // Range label if ((MVS.NOMinValue != null) || (MVS.NOMaxValue != null) || (MVS.NODecPlaces != null)) { int defPlaces = 2; if (MVS.NODecPlaces != null) { rntValue.NumberFormat.DecimalDigits = (int)MVS.NODecPlaces; defPlaces = (int)MVS.NODecPlaces; } if (MVS.NOMinValue != null) { rntValue.MinValue = decimal.ToDouble((decimal)MVS.NOMinValue); } if (MVS.NOMaxValue != null) { rntValue.MaxValue = decimal.ToDouble((decimal)MVS.NOMaxValue); } } break; } }
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; } }
/// <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; } }
protected void rgActionItem_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName.Equals("PerformInsert")) { GridDataItem item = (GridDataItem)e.Item; TextBox txtActionItem = (e.Item as GridEditableItem)["ActionItem"].FindControl("txtActionItem") as TextBox; DropDownList ddlResourceName = (e.Item as GridEditableItem)["Resource_name"].FindControl("comboResourceName") as DropDownList; Telerik.Web.UI.RadDatePicker Target = (e.Item as GridEditableItem)["Target"].FindControl("Target") as Telerik.Web.UI.RadDatePicker; TextBox txtStatus = (e.Item as GridEditableItem)["Status"].FindControl("txtStatus") as TextBox; string ActionItem = txtActionItem.Text; string ResourceID = ddlResourceName.SelectedValue; DateTime DTarget = (DateTime)Target.SelectedDate; string Status = txtStatus.Text; string p_message1 = String.Empty; objBLL = new MetisBLL(); objBLL.insertActionItem(ActionItem, ResourceID, DTarget, Status, ddlDepartment.SelectedValue, out p_message1); rgActionItem.Rebind(); } if (e.CommandName.Equals("Edit")) { GridDataItem item = (GridDataItem)e.Item; string ActionItem = ((DataBoundLiteralControl)item.Controls[3].Controls[0]).Text.Trim(); string Resource = ((DataBoundLiteralControl)item.Controls[4].Controls[0]).Text.Trim(); string Target = ((DataBoundLiteralControl)item.Controls[5].Controls[0]).Text.Trim(); string Status = ((DataBoundLiteralControl)item.Controls[6].Controls[0]).Text.Trim(); Session["ActionItem"] = ActionItem; Session["Resource_name"] = Resource; Session["Target"] = Target; Session["Status"] = Status; } if (e.CommandName.Equals("Update")) { GridDataItem item = (GridDataItem)e.Item; TextBox txtActionItem = (e.Item as GridEditableItem)["ActionItem"].FindControl("txtActionItem") as TextBox; DropDownList ddlResourceName = (e.Item as GridEditableItem)["Resource_name"].FindControl("comboResourceName") as DropDownList; Telerik.Web.UI.RadDatePicker Target = (e.Item as GridEditableItem)["Target"].FindControl("Target") as Telerik.Web.UI.RadDatePicker; TextBox txtStatus = (e.Item as GridEditableItem)["Status"].FindControl("txtStatus") as TextBox; string ActionItem = txtActionItem.Text; string ResourceID = ddlResourceName.SelectedValue; DateTime DTarget = (DateTime)Target.SelectedDate; string Status = txtStatus.Text; string p_message1 = String.Empty; objBLL = new MetisBLL(); objBLL.updateActionItem(Convert.ToInt32(item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["pkID"].ToString()), ActionItem, ResourceID, DTarget, Status, ddlDepartment.SelectedValue, out p_message1); rgActionItem.Rebind(); } if (e.CommandName.Equals("Cancel")) { rgActionItem.DataBind(); } if (e.CommandName.Equals("Archive")) { GridDataItem item = (GridDataItem)e.Item; string p_message1 = String.Empty; objBLL = new MetisBLL(); objBLL.archiveActionItem(int.Parse(item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["pkID"].ToString()), out p_message1); rgActionItem.Rebind(); } if (e.CommandName.Equals("unArchive")) { GridDataItem item = (GridDataItem)e.Item; string p_message1 = String.Empty; objBLL = new MetisBLL(); objBLL.unArchiveActionItem(int.Parse(item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["pkID"].ToString()), out p_message1); rgActionItem.Rebind(); } }
protected void rgActionItem_ItemDataBound(object sender, GridItemEventArgs e) { try { if (e.Item is GridDataItem && e.Item.IsInEditMode) { GridDataItem item = (GridDataItem)e.Item; TextBox txtActionItem = (e.Item as GridEditableItem)["ActionItem"].FindControl("txtActionItem") as TextBox; DropDownList ddlResourceName = (e.Item as GridEditableItem)["Resource_name"].FindControl("comboResourceName") as DropDownList; objBLL = new MetisBLL(); ddlResourceName.DataSource = objBLL.getAllResources(Session["user"].ToString()); ddlResourceName.DataTextField = objBLL.getAllResources(Session["user"].ToString()).Columns[1].ToString(); ddlResourceName.DataValueField = objBLL.getAllResources(Session["user"].ToString()).Columns[0].ToString(); ddlResourceName.DataBind(); ddlResourceName.Width = Unit.Pixel(240); // Set the width ddlResourceName.Focus(); Telerik.Web.UI.RadDatePicker Target = (e.Item as GridEditableItem)["Target"].FindControl("Target") as Telerik.Web.UI.RadDatePicker; TextBox txtStatus = (e.Item as GridEditableItem)["Status"].FindControl("txtStatus") as TextBox; if (e.Item is GridEditFormInsertItem || e.Item is GridDataInsertItem) { } else { txtActionItem.Text = Session["ActionItem"].ToString(); ddlResourceName.Items.FindByText(Session["Resource_name"].ToString()).Selected = true; Target.SelectedDate = Convert.ToDateTime(Session["Target"].ToString()); txtStatus.Text = Session["Status"].ToString(); } } else { //GridDataItem item = e.Item as GridDataItem; //if (item != null) //{ // GridButtonColumn gBtnCol = item.OwnerTableView.GetColumn("ArchiveColumn") as GridButtonColumn; // ImageButton ImgBtn = item["ArchiveColumn"].Controls[0] as ImageButton; // if (chkbArchive.Checked) // { // ImgBtn.ImageUrl = "images/show.png"; // ImgBtn.CommandName = "unArchive"; // gBtnCol.ConfirmText = "Are you sure you want to UnArchive?"; // gBtnCol.ConfirmTitle = "UnArchive"; // ImgBtn.ToolTip = "UnArchive"; // } // else // { // ImgBtn.ImageUrl = "images/hide.png"; // ImgBtn.CommandName = "Archive"; // gBtnCol.ConfirmText = "Are you sure you want to Archive?"; // gBtnCol.ConfirmTitle = "Archive"; // ImgBtn.ToolTip = "Archive"; // } //} } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, typeof(string), "validation", "alert('" + ex.Message + "')", true); } }
protected void rgUpComingProject_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName.Equals("PerformInsert")) { GridDataItem item = (GridDataItem)e.Item; TextBox txtProject = (e.Item as GridEditableItem)["Project"].FindControl("txtProject") as TextBox; Telerik.Web.UI.RadDatePicker DesiredStart = (e.Item as GridEditableItem)["DesiredStart"].FindControl("DesiredStart") as Telerik.Web.UI.RadDatePicker; Telerik.Web.UI.RadDatePicker PlannedStart = (e.Item as GridEditableItem)["PlannedStart"].FindControl("PlannedStart") as Telerik.Web.UI.RadDatePicker; TextBox txtResource = (e.Item as GridEditableItem)["Resources"].FindControl("txtResource") as TextBox; TextBox txtComment = (e.Item as GridEditableItem)["Comments"].FindControl("txtComment") as TextBox; string project = txtProject.Text; DateTime dDesiredStart = (DateTime)DesiredStart.SelectedDate; DateTime dPlannedStart = (DateTime)PlannedStart.SelectedDate; string resource = txtResource.Text; string comment = txtComment.Text; string p_message1 = String.Empty; objBLL = new MetisBLL(); objBLL.insertUpComingProject(project, dDesiredStart, dPlannedStart, resource, comment, ddlDepartment.SelectedValue, out p_message1); rgUpComingProject.Rebind(); } if (e.CommandName.Equals("Edit")) { GridDataItem item = (GridDataItem)e.Item; string project = ((DataBoundLiteralControl)item.Controls[3].Controls[0]).Text.Trim(); string desiredStart = ((DataBoundLiteralControl)item.Controls[4].Controls[0]).Text.Trim(); string plannedStart = ((DataBoundLiteralControl)item.Controls[5].Controls[0]).Text.Trim(); string resource = ((DataBoundLiteralControl)item.Controls[6].Controls[0]).Text.Trim(); string comment = ((DataBoundLiteralControl)item.Controls[7].Controls[0]).Text.Trim(); Session["Project"] = project; Session["DesiredStart"] = desiredStart; Session["PlannedStart"] = plannedStart; Session["Resource"] = resource; Session["Comment"] = comment; } if (e.CommandName.Equals("Update")) { GridDataItem item = (GridDataItem)e.Item; TextBox txtProject = (e.Item as GridEditableItem)["Project"].FindControl("txtProject") as TextBox; Telerik.Web.UI.RadDatePicker DesiredStart = (e.Item as GridEditableItem)["DesiredStart"].FindControl("DesiredStart") as Telerik.Web.UI.RadDatePicker; Telerik.Web.UI.RadDatePicker PlannedStart = (e.Item as GridEditableItem)["PlannedStart"].FindControl("PlannedStart") as Telerik.Web.UI.RadDatePicker; TextBox txtResource = (e.Item as GridEditableItem)["Resources"].FindControl("txtResource") as TextBox; TextBox txtComment = (e.Item as GridEditableItem)["Comments"].FindControl("txtComment") as TextBox; string project = txtProject.Text; DateTime dDesiredStart = (DateTime)DesiredStart.SelectedDate; DateTime dPlannedStart = (DateTime)PlannedStart.SelectedDate; string resource = txtResource.Text; string comment = txtComment.Text; string p_message1 = String.Empty; objBLL = new MetisBLL(); objBLL.updateUpComingProject(Convert.ToInt32(item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["pkID"].ToString()), project, Convert.ToDateTime(dDesiredStart), Convert.ToDateTime(dPlannedStart), resource, comment, ddlDepartment.SelectedValue, out p_message1); rgUpComingProject.Rebind(); } if (e.CommandName.Equals("Cancel")) { rgUpComingProject.Rebind(); } }