protected void gvCustomerAlertSetup_OnItemCommand(object source, GridCommandEventArgs e) { if (e.CommandName == RadGrid.PerformInsertCommandName) { GridEditableItem gridEditableItem = (GridEditableItem)e.Item; DropDownList ddlSIPDiscription = (DropDownList)e.Item.FindControl("ddlSIPDiscription"); DropDownList ddlAlert = (DropDownList)e.Item.FindControl("ddlAlert"); TextBox txtMsg = (TextBox)e.Item.FindControl("txtMsg"); RadDatePicker txtEventSubscription = (RadDatePicker)e.Item.FindControl("txtEventSubscription"); int count = alertBo.SIPRuleCheck(int.Parse(ddlSIPDiscription.SelectedValue), int.Parse(ddlAlert.SelectedValue)); if (count > 0) { ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "alert('Same rule exist for this Scheme!!');", true); return; } else { alertBo.CreateCustomerAlertConfiguration(int.Parse(ddlSIPDiscription.SelectedValue), int.Parse(ddlAlert.SelectedValue), txtMsg.Text, Convert.ToDateTime(txtEventSubscription.SelectedDate), userVo.UserId); } } if (e.CommandName == RadGrid.DeleteCommandName) { int alertId = Convert.ToInt32(gvCustomerAlertSetup.MasterTableView.DataKeyValues[e.Item.ItemIndex]["AES_EventSetupID"].ToString()); alertBo.DeleteCustomerAlertConfiguration(alertId); } BindCustomerAlertSetup(); }
protected void FecVigencia_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e) { try { RadDatePicker rdp_FecVigencia = sender as RadDatePicker; RadDatePicker rdp_FecIni = (rdp_FecVigencia.Parent.FindControl("rdp_FecIni") as RadDatePicker); if (rdp_FecIni.SelectedDate.HasValue && rdp_FecVigencia.SelectedDate.HasValue) { if (rdp_FecIni.SelectedDate > rdp_FecVigencia.SelectedDate) { AlertaFocus("La fecha de fin debe ser mayor a la fecha de inicio", rdp_FecVigencia.DateInput.ClientID); rdp_FecVigencia.DbSelectedDate = null; return; } else { ((Telerik.Web.UI.GridDataItem)(rdp_FecVigencia.Parent.Parent))["EditCommandColumn"].Controls[0].Focus(); } } else if (rdp_FecIni.SelectedDate.HasValue) { rdp_FecVigencia.DateInput.Focus(); } else { rdp_FecIni.DateInput.Focus(); } } catch (Exception ex) { ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name); } }
protected void rgStaffAttendanceHistory_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditableItem item = e.Item as GridEditableItem; if (item != null) { RadDatePicker rdpCheckInCheckOutDateTime = item["CheckInCheckOutDateTime"].FindControl("rdpCheckInCheckOutDateTime") as RadDatePicker; if (rdpCheckInCheckOutDateTime != null) { TableCell cell = (TableCell)rdpCheckInCheckOutDateTime.Parent; RequiredFieldValidator validator = new RequiredFieldValidator(); if (cell != null) { rdpCheckInCheckOutDateTime.ID = "rdpCheckInCheckOutDateTime"; validator.ControlToValidate = rdpCheckInCheckOutDateTime.ID; validator.ErrorMessage = "Please select Date\n"; validator.SetFocusOnError = true; validator.Display = ValidatorDisplay.None; } ValidationSummary validationsum = new ValidationSummary(); validationsum.ID = "validationsum1"; validationsum.ShowMessageBox = true; validationsum.ShowSummary = false; validationsum.DisplayMode = ValidationSummaryDisplayMode.SingleParagraph; cell.Controls.Add(validator); cell.Controls.Add(validationsum); } } } }
protected void dtVisit2_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e) { try { foreach (GridDataItem item in grd1.Items) { if (item is GridDataItem) { CheckBox chk = (CheckBox)(item["SelectRow"].FindControl("chkSelect")); if (chk.Checked == true) { RadDatePicker pic1 = (RadDatePicker)(item["PlannedDate"].FindControl("picVisitDate")); pic1.SelectedDate = dtVisit1.SelectedDate; RadDatePicker pic2 = (RadDatePicker)(item["PlannedDate2"].FindControl("picVisitDate2")); pic2.SelectedDate = dtVisit2.SelectedDate; } } } } catch (Exception ex) { Label1.Text = ex.Message; //RadWindowManager1.RadAlert(ex.Source + "<br />" + ex.Message, 400, 200, "Alert!", null, ""); } finally { //con.Close(); } }
// client side validation function for hoilday form input controls public void ValidateHolidays(GridItemEventArgs e) { GridEditableItem editForm = (GridEditableItem)e.Item; ImageButton update = (ImageButton)editForm.FindControl("UpdateButton"); ImageButton insert = (ImageButton)editForm.FindControl("PerformInsertButton"); RadDatePicker dtpExpectedDate = (editForm.FindControl("dtpExpectedDate") as RadDatePicker); RadComboBox ddlDayType = (editForm.FindControl("ddlDayType") as RadComboBox); RadTextBox txtDescription = (editForm.FindControl("txtDescription") as RadTextBox); if (update != null) { update.Attributes.Add("onclick", "return ValidateHolidays('" + dtpExpectedDate.ClientID + "','" + ddlDayType.ClientID + "','" + txtDescription.ClientID + "')"); } if (insert != null) { insert.Attributes.Add("onclick", "return ValidateHolidays('" + dtpExpectedDate.ClientID + "','" + ddlDayType.ClientID + "','" + txtDescription.ClientID + "')"); } }
protected void RadGridFieldName_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "ChildGrid") { GridDataItem item = (GridDataItem)e.Item; Label lblControlFlag = (Label)item.FindControl("lblControlFlag"); //Telerik.Web.UI.RadButton btnradRadioButtonList = (Telerik.Web.UI.RadButton)item.FindControl("btnRadRadiolist"); RadButton rbtnYesNo = (RadButton)item.FindControl("rbtnYesNo"); Telerik.Web.UI.RadTextBox txtRadText = (Telerik.Web.UI.RadTextBox)item.FindControl("txtRadText"); RadDatePicker dtDateValue = (RadDatePicker)item.FindControl("dtDateValue"); rbtnYesNo.Visible = false; txtRadText.Visible = false; dtDateValue.Visible = false; if (lblControlFlag.Text == "Text SingleLine") { txtRadText.Visible = true; } else if (lblControlFlag.Text == "Date") { dtDateValue.Visible = true; } } }
public int AddUpdateINCFORM_CONTAIN(decimal incidentId) { var itemList = new List <INCFORM_CONTAIN>(); int seqnumber = 0; int status = 0; foreach (RepeaterItem containtem in rptContain.Items) { var item = new INCFORM_CONTAIN(); TextBox tbca = (TextBox)containtem.FindControl("tbContainAction"); RadDropDownList rddlp = (RadDropDownList)containtem.FindControl("rddlContainPerson"); Label lb = (Label)containtem.FindControl("lbItemSeq"); RadDatePicker sd = (RadDatePicker)containtem.FindControl("rdpStartDate"); seqnumber = seqnumber + 1; item.ITEM_DESCRIPTION = tbca.Text; item.ASSIGNED_PERSON_ID = (String.IsNullOrEmpty(rddlp.SelectedValue)) ? 0 : Convert.ToInt32(rddlp.SelectedValue); item.ITEM_SEQ = seqnumber; item.START_DATE = sd.SelectedDate; itemList.Add(item); } if (itemList.Count > 0) { status = SaveContainment(incidentId, itemList); } return(status); }
protected void fin_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e) { try { RadDatePicker dpFin = sender as RadDatePicker; RadDatePicker dpIni = (dpFin.Parent.FindControl("txtFechaFin") as RadDatePicker); if (dpIni.SelectedDate.HasValue && dpFin.SelectedDate.HasValue) { if (dpIni.SelectedDate > dpFin.SelectedDate) { Alerta("La fecha de fin debe ser mayor a la fecha de inicio"); dpFin.DbSelectedDate = null; return; } } else if (dpIni.SelectedDate.HasValue) { dpFin.DateInput.Focus(); } else { dpIni.DateInput.Focus(); } } catch (Exception ex) { ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name); } }
protected void rgChildEnrollmentStatus_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item.ItemType == Telerik.Web.UI.GridItemType.EditItem) { DropDownList ddlEnrollmentStatus = e.Item.FindControl("ddlEnrollmentStatus") as DropDownList; RadDatePicker rdpEnrollmentDate = e.Item.FindControl("rdpEnrollmentDate") as RadDatePicker; if (ddlEnrollmentStatus != null) { Common.BindEnrollmentStatus(ddlEnrollmentStatus, new Guid(Session["SchoolId"].ToString())); if (e.Item.ItemIndex != -1) { DayCarePL.ChildEnrollmentStatusProperties dataItem = e.Item.DataItem as DayCarePL.ChildEnrollmentStatusProperties; ddlEnrollmentStatus.SelectedValue = dataItem.EnrollmentStatusId.ToString(); } } if (rdpEnrollmentDate != null) { DayCarePL.ChildEnrollmentStatusProperties dataItem = e.Item.DataItem as DayCarePL.ChildEnrollmentStatusProperties; if (dataItem != null) { rdpEnrollmentDate.SelectedDate = dataItem.EnrollmentDate; } } } }
private void ShoppingCartGrid_RentalsItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { var cartDetail = (CartDetail)e.Item.DataItem; RadDatePicker startDatePicker = (RadDatePicker)e.Item.FindControl("startDatePicker"); RadDatePicker endDatePicker = (RadDatePicker)e.Item.FindControl("endDatePicker"); //Hide the date pickers if it's not a notebook ProductType notebook = CatalogManager.GetProductTypes().Where(pt => pt.Title == "Notebook").SingleOrDefault(); Product product = CatalogManager.GetProduct(cartDetail.ProductId); if (product.ClrType != notebook.ClrType) { startDatePicker.Visible = false; endDatePicker.Visible = false; } else { DateTime startDate; DateTime endDate; if (DateTime.TryParse(DataExtensions.GetValue <string>(cartDetail, "startDate"), out startDate)) { startDatePicker.SelectedDate = startDate; } if (DateTime.TryParse(DataExtensions.GetValue <string>(cartDetail, "endDate"), out endDate)) { endDatePicker.SelectedDate = startDate; } } } }
protected void btnSaveVendorChanges_Click(object sender, EventArgs e) { foreach (GridDataItem vendorItem in rdVendorService.Items) { Hashtable typeValues = new Hashtable(); vendorItem.ExtractValues(typeValues); int serviceId = Convert.ToInt32(typeValues["RecycleVendorServiceId"].ToString()); RecycleVendorServiceEntity recycleVendor = new RecycleVendorServiceEntity(serviceId); RadDatePicker rdpDate = vendorItem.FindControl("rdpDate") as RadDatePicker; TextBox txtWeight = vendorItem.FindControl("txtWeight") as TextBox; DropDownList ddlRecycleType = vendorItem.FindControl("ddlType") as DropDownList; DropDownList ddlVendor = vendorItem.FindControl("ddlVendor") as DropDownList; DropDownList ddlAccount = vendorItem.FindControl("ddlAccount") as DropDownList; TextBox txtTotalMonthlyPulls = vendorItem.FindControl("txtTotalMonthlyPulls") as TextBox; TextBox txtTotalMonthlyWeight = vendorItem.FindControl("txtTotalMonthlyWeight") as TextBox; var weight = 0M; var totalMonthlyWeight = 0M; Decimal.TryParse(txtWeight.Text, out weight); Decimal.TryParse(txtTotalMonthlyWeight.Text, out totalMonthlyWeight); recycleVendor.Weight = weight; recycleVendor.RecycleTypeId = Convert.ToInt32(ddlRecycleType.SelectedValue); recycleVendor.RecycleVendorId = Convert.ToInt32(ddlRecycleVendor.SelectedValue); recycleVendor.ServiceDate = rdpDate.SelectedDate.GetValueOrDefault(DateTime.Today); recycleVendor.AccountId = Convert.ToInt32(ddlAccount.SelectedValue); recycleVendor.TotalMonthlyPulls = Convert.ToInt32(txtTotalMonthlyPulls.Text); recycleVendor.TotalMonthlyWeight = totalMonthlyWeight; recycleVendor.Save(); } }
private void billFilter_EditorCreated(object sender, Telerik.Windows.Controls.Data.DataFilter.EditorCreatedEventArgs e) { switch (e.ItemPropertyDefinition.PropertyName) { case "StorageID": RadComboBox cbxStorage = (RadComboBox)e.Editor; cbxStorage.ItemsSource = StorageInfoVM.Storages; break; case "BrandID": RadComboBox cbxBrand = (RadComboBox)e.Editor; cbxBrand.ItemsSource = VMGlobal.PoweredBrands; break; case "NameID": RadComboBox cbxName = (RadComboBox)e.Editor; cbxName.ItemsSource = VMGlobal.ProNames; break; case "Year": RadDatePicker dateTimePickerEditor = (RadDatePicker)e.Editor; dateTimePickerEditor.SelectionChanged += (ss, ee) => { DateTime date = (DateTime)ee.AddedItems[0]; dateTimePickerEditor.DateTimeText = date.Year.ToString(); }; break; case "Quarter": RadComboBox cbxQuarter = (RadComboBox)e.Editor; cbxQuarter.ItemsSource = VMGlobal.Quarters; break; } SysProcessView.UIHelper.ToggleShowEqualFilterOperatorOnly(e.Editor); }
protected void rgChildAbsentHistory_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) { try { if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { DayCarePL.ChildAbsentHistoryProperties objChildAbsentHistory = e.Item.DataItem as DayCarePL.ChildAbsentHistoryProperties; if (objChildAbsentHistory != null) { Label lblStartDate = e.Item.FindControl("lblStartDate") as Label; Label lblEndDate = e.Item.FindControl("lblEndDate") as Label; if (objChildAbsentHistory.StartDate != null) { //lblStartDate.Text = Convert.ToDateTime(objChildAbsentHistory.StartDate).ToShortDateString().ToString(); lblStartDate.Text = string.Format("{0:MM/dd/yy}", objChildAbsentHistory.StartDate); } if (objChildAbsentHistory.EndDate != null) { //lblEndDate.Text = Convert.ToDateTime(objChildAbsentHistory.EndDate).ToShortDateString().ToString(); lblEndDate.Text = string.Format("{0:MM/dd/yy}", objChildAbsentHistory.EndDate); } lblChild.Text = "of " + objChildAbsentHistory.ChildFullName; } } if (e.Item.ItemType == GridItemType.EditItem) { DayCarePL.ChildAbsentHistoryProperties objChildAbsentHistory = e.Item.DataItem as DayCarePL.ChildAbsentHistoryProperties; RadDatePicker rdpStartDate = e.Item.FindControl("rdpStartDate") as RadDatePicker; RadDatePicker rdpEndDate = e.Item.FindControl("rdpEndDate") as RadDatePicker; DropDownList ddlAbsentReason = e.Item.FindControl("ddlAbsentReson") as DropDownList; Guid SchooId = new Guid(); if (Session["SchoolId"] != null) { SchooId = new Guid(Session["SchoolId"].ToString()); } Common.BindAbsentReson(ddlAbsentReason, SchooId); if (objChildAbsentHistory != null) { if (ddlAbsentReason.Items != null && ddlAbsentReason.Items.Count > 0) { ddlAbsentReason.SelectedValue = objChildAbsentHistory.AbsentReasonId.ToString(); } if (objChildAbsentHistory.StartDate != null) { rdpStartDate.SelectedDate = objChildAbsentHistory.StartDate; } if (objChildAbsentHistory.EndDate != null) { rdpEndDate.SelectedDate = objChildAbsentHistory.EndDate; } } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.ChildAbsentHistory, "rgChildAbsentHistory_ItemDataBound", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); } }
protected void btnGuardar_Click(object sender, EventArgs e) { lFechasEnvio = new List <E_FECHA_ENVIO_SOLICITUDES>(); string vIdFechaActual = ""; foreach (GridDataItem item in rgFechas.MasterTableView.Items) { RadDatePicker rdtFechaEnvio = (RadDatePicker)item["rdtFechaEnvio"].FindControl("rdtFeEnvio"); string vPeriodo = (item.GetDataKeyValue("ID_PERIODO").ToString()); string vFecha = rdtFechaEnvio.SelectedDate == null? "" : rdtFechaEnvio.SelectedDate.Value.ToString("MM/dd/yyyy"); if (vFecha != "") { //if (vFecha == DateTime.Now.ToString("MM/dd/yyyy")) //{ vIdFechaActual = vPeriodo; //} lFechasEnvio.Add(new E_FECHA_ENVIO_SOLICITUDES { ID_PERIODO = vPeriodo, FE_ENVIO_SOLICITUD = vFecha }); var vXelements = lFechasEnvio.Select(x => new XElement("FECHAS_ENVIO", new XAttribute("ID_PERIODO", x.ID_PERIODO), new XAttribute("FE_ENVIO", x.FE_ENVIO_SOLICITUD)) ); FECHASENVIOSOLICITUDES = new XElement("ASIGNACION", vXelements ); } } if (FECHASENVIOSOLICITUDES != null) { PeriodoDesempenoNegocio pNegocio = new PeriodoDesempenoNegocio(); E_RESULTADO vResultado = pNegocio.InsertaFeEnvioSolicitud(FECHASENVIOSOLICITUDES.ToString(), vClUsuario, vNbPrograma, "I"); string vMensaje = vResultado.MENSAJE.Where(w => w.CL_IDIOMA.Equals(vClIdioma.ToString())).FirstOrDefault().DS_MENSAJE; if (vResultado.CL_TIPO_ERROR == E_TIPO_RESPUESTA_DB.SUCCESSFUL) { if (vIdFechaActual != "") { ClientScript.RegisterStartupScript(GetType(), "script", "OpenSendMessage(" + vIdFechaActual + ");", true); } //else //{ // UtilMensajes.MensajeResultadoDB(rwmMensaje, vMensaje, vResultado.CL_TIPO_ERROR, pCallBackFunction: "closeWindow"); //} } else { UtilMensajes.MensajeResultadoDB(rwmMensaje, vMensaje, vResultado.CL_TIPO_ERROR, pCallBackFunction: ""); } } else { UtilMensajes.MensajeResultadoDB(rwmMensaje, "Asigne las fechas de envío de solicitudes.", E_TIPO_RESPUESTA_DB.WARNING, pCallBackFunction: ""); } }
private void radDataFilter_EditorCreated(object sender, EditorCreatedEventArgs e) { //ProductListVM context = this.DataContext as ProductListVM; switch (e.ItemPropertyDefinition.PropertyName) { case "BrandID": // This is a custom editor specified through the EditorTemplateSelector. RadComboBox cbxBrand = (RadComboBox)e.Editor; cbxBrand.ItemsSource = VMGlobal.PoweredBrands; break; case "Year": // This is a default editor. //RadDateTimePicker dateTimePickerEditor = (RadDateTimePicker)e.Editor; ////dateTimePickerEditor.InputMode = Telerik.Windows.Controls.InputMode.DatePicker; //dateTimePickerEditor.DateSelectionMode = DateSelectionMode.Year; //dateTimePickerEditor.IsTooltipEnabled = true; //dateTimePickerEditor.ErrorTooltipContent = "输入格式不正确"; //dateTimePickerEditor.DateTimeWatermarkContent = "选择年份"; //dateTimePickerEditor.SelectionChanged += (ss, ee) => //{ // DateTime date = (DateTime)ee.AddedItems[0]; // dateTimePickerEditor.DateTimeText = date.Year.ToString(); //}; //break; RadDatePicker dateTimePickerEditor = (RadDatePicker)e.Editor; //dateTimePickerEditor.InputMode = Telerik.Windows.Controls.InputMode.DatePicker; dateTimePickerEditor.SelectionChanged += (ss, ee) => { DateTime date = (DateTime)ee.AddedItems[0]; dateTimePickerEditor.DateTimeText = date.Year.ToString(); }; break; case "BoduanID": RadComboBox cbxBoduan = (RadComboBox)e.Editor; cbxBoduan.ItemsSource = VMGlobal.Boduans; break; case "Quarter": RadComboBox cbxQuarter = (RadComboBox)e.Editor; cbxQuarter.ItemsSource = VMGlobal.Quarters; break; case "SizeID": RadComboBox cbxSize = (RadComboBox)e.Editor; cbxSize.ItemsSource = VMGlobal.Sizes; break; case "NameID": RadComboBox cbxName = (RadComboBox)e.Editor; cbxName.ItemsSource = VMGlobal.ProNames; break; } SysProcessView.UIHelper.ToggleShowEqualFilterOperatorOnly(e.Editor); }
}//end void //Solo aplica en rangos public static bool ValidaDatoIntroducidoAmbasFechas(RadDatePicker rdpFechaInicio, RadDatePicker rdpFechaFin) { if (rdpFechaInicio.SelectedDate.HasValue && rdpFechaFin.SelectedDate.HasValue) { return(true); }//if return(false); }//end void
private void RadDatePicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0) { DateTime date = (DateTime)e.AddedItems[0]; RadDatePicker picker = sender as RadDatePicker; picker.DateTimeText = date.Year.ToString(); } }
private void RadDatePicker_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0) { RadDatePicker datePicker = (RadDatePicker)sender; DateTime date = (DateTime)e.AddedItems[0]; datePicker.DateTimeText = date.ToString("yyyy-MM"); } }
public void InitializeComponent() { if (!this._contentLoaded) { this._contentLoaded = true; Application.LoadComponent(this, new Uri("/Examples.Calendar;component/Examples/Calendar/DatePicker/Example.xaml", UriKind.Relative)); this.datePicker = (RadDatePicker)base.FindName("datePicker"); } }
protected void gvCvrg_RowCreated(object sender, GridViewRowEventArgs e) { DataTable dt = (DataTable)gvCvrg.DataSource; if (dt == null) return; int intRowIndex = e.Row.RowIndex; if ((intRowIndex < 0) || (intRowIndex >= dt.Rows.Count)) return; //string strIndex = intRowIndex.ToString(); string strIndex = dt.Rows[e.Row.RowIndex]["record_id"].ToString(); LinkButton lnkbtnD = new LinkButton(); lnkbtnD.ID = "lnkbtnD_" + strIndex; lnkbtnD.Text = "/ Decline"; lnkbtnD.Click += new System.EventHandler(this.Clicked); LinkButton lnkbtnA = new LinkButton(); lnkbtnA.ID = "lnkbtnA_" + strIndex; lnkbtnA.Text = "Approve "; lnkbtnA.Click += new System.EventHandler(this.ClickedA); Label lbl_chilld = new Label(); lbl_chilld.ID = "lbl_chilld_" + strIndex; lbl_chilld.Text = "Child Plan (Bundled Coverage)"; TableCell cell_req = e.Row.Cells[3]; if ((dt.Rows[intRowIndex]["links_detail_item_type"].ToString().Equals("0")) && (dt.Rows.Count > 1)) cell_req.Controls.Add(lbl_chilld); else { cell_req.Controls.Add(lnkbtnA); cell_req.Controls.Add(lnkbtnD); } Label lbl_Status = new Label(); lbl_Status.ID = "lbl_Status" + strIndex; if (dt.Rows[intRowIndex]["family_status_code"].ToString().Equals("010")) lbl_Status.Text = dt.Rows[intRowIndex]["Benefit_Level"].ToString(); else lbl_Status.Text = dt.Rows[intRowIndex]["description"].ToString(); TableCell cell_Status = e.Row.Cells[1]; cell_Status.Controls.Add(lbl_Status); RadDatePicker txtEffDate = new RadDatePicker(); txtEffDate.ID = "txtEffDate"+strIndex; txtEffDate.Width = new Unit(110, UnitType.Pixel); txtEffDate.DateInput.DisplayDateFormat="M/d/yyyy"; try { txtEffDate.SelectedDate = Convert.ToDateTime(dt.Rows[intRowIndex]["effective_date"].ToString()); } catch { } TableCell cell_eff = e.Row.Cells[2]; cell_eff.Controls.Add(txtEffDate); }
/// <summary> /// Called when the Framework <see cref="M:OnApplyTemplate" /> is called. Inheritors should override this method should they have some custom template-related logic. /// This is done to ensure that the <see cref="P:IsTemplateApplied" /> property is properly initialized. /// </summary> protected override bool ApplyTemplateCore() { bool applied = base.ApplyTemplateCore(); this.datePicker = this.GetTemplatePartField <RadDatePicker>("PART_DatePicker"); applied = applied && this.datePicker != null; return(applied); }
public static bool ValidaFecha(RadDatePicker rdp) { if (rdp.DateInput.InvalidTextBoxValue != string.Empty) { return(false); } return(true); }//end void
protected void gvCashSavingTransaction_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted) { GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item; DataTable dtCFCCategory = new DataTable(); GridEditFormItem gefi = (GridEditFormItem)e.Item; DropDownList ddlCFCCategory = (DropDownList)gefi.FindControl("ddlCFCCategory"); dtCFCCategory = customerAccountBo.GetCashFlowCategory(); ddlCFCCategory.DataSource = dtCFCCategory; ddlCFCCategory.DataValueField = dtCFCCategory.Columns["WERP_CFCCode"].ToString(); ddlCFCCategory.DataTextField = dtCFCCategory.Columns["WERP_CFCName"].ToString(); ddlCFCCategory.DataBind(); ddlCFCCategory.Items.Insert(0, new ListItem("Select", "Select")); } string strCasflowcategory; if (e.Item is GridEditFormItem && e.Item.IsInEditMode && e.Item.ItemIndex != -1) { int accountId = int.Parse(gvCashSavingTransaction.MasterTableView.DataKeyValues[e.Item.ItemIndex]["CCST_TransactionId"].ToString()); strCasflowcategory = gvCashSavingTransaction.MasterTableView.DataKeyValues[e.Item.ItemIndex]["WERP_CFCCode"].ToString(); string rdbType = gvCashSavingTransaction.MasterTableView.DataKeyValues[e.Item.ItemIndex]["CCST_IsWithdrwal"].ToString(); GridEditFormItem editedItem = (GridEditFormItem)e.Item; DataTable dtCFCCategory = new DataTable(); DropDownList ddlCFCCategory = (DropDownList)editedItem.FindControl("ddlCFCCategory"); RadioButton rbtnY = (RadioButton)e.Item.FindControl("rbtnYes"); RadioButton rbtnN = (RadioButton)e.Item.FindControl("rbtnNo"); dtCFCCategory = customerAccountBo.GetCashFlowCategory(); ddlCFCCategory.DataSource = dtCFCCategory; ddlCFCCategory.DataValueField = dtCFCCategory.Columns["WERP_CFCCode"].ToString(); ddlCFCCategory.DataTextField = dtCFCCategory.Columns["WERP_CFCName"].ToString(); ddlCFCCategory.DataBind(); ddlCFCCategory.SelectedValue = strCasflowcategory; if (rdbType == "CR") { rbtnY.Checked = false; rbtnN.Checked = true; } else { rbtnY.Checked = true; rbtnN.Checked = false; } rbtnN.Enabled = false; rbtnY.Enabled = false; RadDatePicker dpTransactionDate = (RadDatePicker)e.Item.FindControl("dpTransactionDate"); dpTransactionDate.SelectedDate = customeraccountVo.Transactiondate; } else { rbtnN.Enabled = true; rbtnY.Enabled = true; } }
public DatePickerGettingStartedCSharp() { // >> datepicker-getting-started-csharp var datePicker = new RadDatePicker(); // << datepicker-getting-started-csharp var panel = new StackLayout(); panel.Children.Add(datePicker); this.Content = panel; }
public int AddUpdateINCFORM_CONTAIN(decimal incidentId) { lblStatusMsg.Visible = false; var itemList = new List <INCFORM_CONTAIN>(); int seqnumber = 0; int status = 0; bool allFieldsComplete = true; foreach (RepeaterItem containtem in rptContain.Items) { var item = new INCFORM_CONTAIN(); TextBox tbca = (TextBox)containtem.FindControl("tbContainAction"); RadComboBox rddlp = (RadComboBox)containtem.FindControl("rddlContainPerson"); Label lb = (Label)containtem.FindControl("lbItemSeq"); RadDatePicker sd = (RadDatePicker)containtem.FindControl("rdpStartDate"); seqnumber = seqnumber + 1; if (string.IsNullOrEmpty(tbca.Text.Trim()) || !sd.SelectedDate.HasValue) { allFieldsComplete = false; } else { item.ITEM_DESCRIPTION = tbca.Text.Trim(); item.ASSIGNED_PERSON_ID = (String.IsNullOrEmpty(rddlp.SelectedValue)) ? 0 : Convert.ToInt32(rddlp.SelectedValue); item.ITEM_SEQ = seqnumber; item.START_DATE = sd.SelectedDate; if ((tbca = (TextBox)containtem.FindControl("tbComments")) != null) { item.COMMENTS = tbca.Text; } } itemList.Add(item); } if (itemList.Count > 0) { if (allFieldsComplete) { status = SaveContainment(incidentId, itemList); } else { lblStatusMsg.Text = Resources.LocalizedText.ENVProfileRequiredsMsg; lblStatusMsg.Visible = true; status = -1; } } return(status); }
private void CheckControlCollection(UpdatePanel TheCont) { foreach (Control item in TheCont.ContentTemplateContainer.Controls) { string cntrlNme = item.GetType().Name; if (cntrlNme == "RadTextBox") { RadTextBox thecont = (RadTextBox)item; if (!thecont.ID.Contains("ZZZ")) { if (int.Parse(thecont.Width.Value.ToString()) < 200) { thecont.Width = 200; } } } else if (cntrlNme == "RadComboBox") { RadComboBox thecont = (RadComboBox)item; if (int.Parse(thecont.Width.Value.ToString()) < 200) { thecont.Width = 200; } } else if (cntrlNme == "RadDatePicker") { RadDatePicker thecont = (RadDatePicker)item; thecont.Calendar.ShowRowHeaders = false; if (int.Parse(thecont.Width.Value.ToString()) < 200) { thecont.Width = 200; } } else if (cntrlNme == "RadButton") { RadButton thecont = (RadButton)item; if (thecont.ToggleType == ButtonToggleType.Radio) { thecont.Attributes.Add("onmouseup", "up(this);"); thecont.Attributes.Add("onfocus", "up(this);"); thecont.OnClientClicked = "down"; } } else if (cntrlNme == "UpdatePanel") { UpdatePanel thecont = (UpdatePanel)item; CheckControlCollection(thecont); } } if (TheCont.UpdateMode == UpdatePanelUpdateMode.Conditional) { TheCont.Update(); } }
public override object GetNewValueFromEditor(object editor) { RadDatePicker picker = editor as RadDatePicker; if (picker != null) { picker.DateTimeText = picker.CurrentDateTimeText; } return(base.GetNewValueFromEditor(editor)); }
/// <summary> /// Returns a control to display and edit the underlying data. /// </summary> /// <returns></returns> protected override Control GetControl() { RadDatePicker control = (RadDatePicker)base.GetControl(); control.SetBinding(RadDatePicker.InputModeProperty, new Binding("InputMode") { Source = this }); return(control); }
public int AddUpdateINCFORM_LOSTTIME_HIST(decimal incidentId) { lblStatusMsg.Visible = false; var itemList = new List <INCFORM_LOSTTIME_HIST>(); int status = 0; bool allFieldsComplete = true; foreach (RepeaterItem losttimeitem in rptLostTime.Items) { if (losttimeitem.ItemType == ListItemType.AlternatingItem || losttimeitem.ItemType == ListItemType.Item) { INCFORM_LOSTTIME_HIST item = new INCFORM_LOSTTIME_HIST(); Label lb = (Label)losttimeitem.FindControl("lbItemSeq"); RadDropDownList rddlw = (RadDropDownList)losttimeitem.FindControl("rddlWorkStatus"); TextBox tbr = (TextBox)losttimeitem.FindControl("tbRestrictDesc"); RadDatePicker bd = (RadDatePicker)losttimeitem.FindControl("rdpBeginDate"); RadDatePicker md = (RadDatePicker)losttimeitem.FindControl("rdpNextMedDate"); RadDatePicker ed = (RadDatePicker)losttimeitem.FindControl("rdpExpectedReturnDT"); if (rddlw.SelectedItem == null || string.IsNullOrEmpty(rddlw.SelectedValue) || bd.SelectedDate.HasValue == false) { allFieldsComplete = false; } else { item.WORK_STATUS = rddlw.SelectedValue; item.ITEM_DESCRIPTION = tbr.Text; item.BEGIN_DT = bd.SelectedDate; //item.RETURN_TOWORK_DT = rd.SelectedDate; item.NEXT_MEDAPPT_DT = md.SelectedDate; item.RETURN_EXPECTED_DT = ed.SelectedDate; } itemList.Add(item); } } if (itemList.Count > 0) { if (allFieldsComplete) { status = SaveLostTime(incidentId, itemList); } else { lblStatusMsg.Text = Resources.LocalizedText.ENVProfileRequiredsMsg; lblStatusMsg.Visible = true; status = -1; } } return(status); }
private string Get_Control_Value(Control myControl, Input_Option Control_Option) { switch (Control_Option) { case Input_Option.TextBox: TextBox myTextBox = (TextBox)myControl; return(myTextBox.Text); case Input_Option.NumberBox: RadNumericTextBox myRadNumericTextBox = (RadNumericTextBox)myControl; return(myRadNumericTextBox.Text); case Input_Option.DropdownList: DropDownList myDropDownList = (DropDownList)myControl; return(myDropDownList.SelectedValue); case Input_Option.RadioButtonList: RadioButtonList myRadioButtonList = (RadioButtonList)myControl; return(myRadioButtonList.SelectedValue); case Input_Option.DatePicker: RadDatePicker myRadDatePicker = (RadDatePicker)myControl; return(myRadDatePicker.SelectedDate.ToString()); case Input_Option.CheckBox: CheckBox myCheckBox = (CheckBox)myControl; return(myCheckBox.Checked.ToString()); case Input_Option.CheckBoxList: CheckBoxList myCheckBoxList = (CheckBoxList)myControl; string return_value = ""; foreach (ListItem myItem in myCheckBoxList.Items) { if (!DataEval.IsEmptyQuery(return_value)) { return_value += ","; } if (myItem.Selected) { return_value += myItem.Value; } } return(return_value); case Input_Option.ImageURL: TextBox myImageURL = (TextBox)myControl; return(myImageURL.Text); default: return(null); } }
/// <summary> /// Sets the initial values of the controls for a date range bound. /// </summary> /// <param name="bound">The bound to load</param> /// <param name="rangeBoundList">The main range bound list.</param> /// <param name="specificDatePicker">The picker for the specific date.</param> /// <param name="windowAmountTextBox">The text box for the window amount.</param> /// <param name="windowIntervalList">The window interval list.</param> private void LoadBoundSettings(DateRangeBound bound, ListControl rangeBoundList, RadDatePicker specificDatePicker, RadNumericTextBox windowAmountTextBox, ListControl windowIntervalList) { Utility.LocalizeListControl(rangeBoundList, this.LocalResourceFile); Utility.LocalizeListControl(windowIntervalList, this.LocalResourceFile); SelectListValue(rangeBoundList, DateRangeBoundJsonTransferObject.GetListValueForBound(bound)); if (bound.IsSpecificDate) { specificDatePicker.SelectedDate = bound.SpecificDate; } else if (bound.IsWindow) { windowAmountTextBox.Value = bound.WindowAmount; SelectListValue(windowIntervalList, bound.WindowInterval.Value.ToString()); } }
private void LoadControls() { ds = BankProject.DataProvider.KhanhND.B_BDYNAMICCONTROLS_GetControls(Request.QueryString["tabid"].ToString(), this.ID.ToString(), Session["DataKey"].ToString()); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (i > 0) { Label lb = new Label(); lb.ID = "lbl" + ds.Tables[0].Rows[i]["DataControlID"].ToString(); lb.Text = VVTLabel; RadDatePicker dp = new RadDatePicker(); dp.ID = "txtName" + ds.Tables[0].Rows[0]["DataControlID"].ToString(); dp.AutoPostBack = true; dp.Width = Unit.Parse(Width); if (OnBlur != "") dp.Attributes.Add("onblur", OnBlur + "(this,'" + this.ID + "');"); ImageButton ibt = new ImageButton(); ibt.ID = "ibt" + ds.Tables[0].Rows[i]["DataControlID"].ToString(); IbtId = ibt.ID; ibt.ImageUrl = "~/Icons/Sigma/Delete_16X16_Standard.png"; ibt.Click += ibt_Click; TableRow tr = new TableRow(); tr.ID = ds.Tables[0].Rows[i]["DataControlID"].ToString(); TableCell tc = new TableCell(); tc.CssClass = "MyLable"; tc.Controls.Add(lb); tc.Width = Unit.Parse(LBWidth); TableCell tc2 = new TableCell(); tc2.CssClass = "MyContent"; tc2.Width = Unit.Parse(Width); tc2.Controls.Add(dp); TableCell tc3 = new TableCell(); tc3.Controls.Add(ibt); tr.Cells.Add(tc); tr.Cells.Add(tc2); if (Icon) tr.Cells.Add(tc3); if (tblMain == null) tblMain = new Table(); tblMain.Rows.Add(tr); } else { Label lb = new Label(); lb.ID = "lbl" + ds.Tables[0].Rows[i]["DataControlID"].ToString(); lb.Text = VVTLabel; RadDatePicker dp = new RadDatePicker(); dp.ID = "txtName" + ds.Tables[0].Rows[0]["DataControlID"].ToString(); dp.AutoPostBack = true; dp.Width = Unit.Parse(Width); if (OnBlur != "") dp.Attributes.Add("onblur", OnBlur + "(this,'" + this.ID + "');"); ImageButton ibt = new ImageButton(); ibt.ID = "ibt" + ds.Tables[0].Rows[i]["DataControlID"].ToString(); IbtId = ibt.ID; ibt.ImageUrl = "~/Icons/Sigma/Add_16X16_Standard.png"; ibt.Click += ibtVVT_Click; ibt.Enabled = Enabled; TableRow tr = new TableRow(); tr.ID = ds.Tables[0].Rows[i]["DataControlID"].ToString(); TableCell tc = new TableCell(); tc.CssClass = "MyLable"; tc.Controls.Add(lb); tc.Width = Unit.Parse(LBWidth); TableCell tc2 = new TableCell(); tc2.CssClass = "MyContent"; tc2.Width = Unit.Parse(Width); tc2.Controls.Add(dp); TableCell tc3 = new TableCell(); tc3.Controls.Add(ibt); tr.Cells.Add(tc); tr.Cells.Add(tc2); if (Icon) tr.Cells.Add(tc3); if (tblMain == null) tblMain = new Table(); tblMain.Rows.Add(tr); } } }
public void AddNewRow() { DataSet dst = DataProvider.KhanhND.B_BDYNAMICCONTROLS_Update("0", Request.QueryString["tabid"].ToString(), this.ID.ToString(), "", "", Session["DataKey"].ToString()); Label lb = new Label(); lb.ID = "lbl" + dst.Tables[0].Rows[0]["DataControlID"].ToString(); lb.Text = VVTLabel; RadDatePicker dp = new RadDatePicker(); dp.ID = "txtName" + dst.Tables[0].Rows[0]["DataControlID"].ToString(); dp.AutoPostBack = true; dp.Width = Unit.Parse(Width); if (OnBlur != "") dp.Attributes.Add("onblur", OnBlur + "(this,'" + this.ID + "');"); ImageButton ibt = new ImageButton(); ibt.ID = "ibt" + dst.Tables[0].Rows[0]["DataControlID"].ToString(); IbtId = ibt.ID; ibt.ImageUrl = "~/Icons/Sigma/Delete_16X16_Standard.png"; ibt.Click += ibt_Click; TableRow tr = new TableRow(); tr.ID = dst.Tables[0].Rows[0]["DataControlID"].ToString(); TableCell tc = new TableCell(); tc.CssClass = "MyLable"; tc.Controls.Add(lb); tc.Width = Unit.Parse(LBWidth); TableCell tc2 = new TableCell(); tc2.CssClass = "MyContent"; tc2.Width = Unit.Parse(Width); tc2.Controls.Add(dp); TableCell tc3 = new TableCell(); tc3.Controls.Add(ibt); tr.Cells.Add(tc); tr.Cells.Add(tc2); if (Icon) tr.Cells.Add(tc3); if (tblMain == null) tblMain = new Table(); tblMain.Rows.Add(tr); }
/// <summary> /// Create the action step entities from the controls /// </summary> /// <param name="actionCtrl"></param> /// <param name="statusCtrl"></param> /// <param name="strategyCtrl"></param> /// <param name="actionStepCtrl"></param> /// <param name="personResponsibleCtrl"></param> /// <param name="startDateCtrl"></param> /// <param name="finishDateCtrl"></param> /// <param name="resourceCostsCtrl"></param> /// <param name="expectedResultsCtrl"></param> /// <returns></returns> private ImprovementPlanActionStep CreateActionStepFromControl(HiddenField actionCtrl, DropDownList statusCtrl, DropDownList strategyCtrl, TextBox actionStepCtrl, TextBox personResponsibleCtrl, RadDatePicker startDateCtrl, RadDatePicker finishDateCtrl, TextBox resourceCostsCtrl, TextBox expectedResultsCtrl) { return new ImprovementPlanActionStep { ID = DataIntegrity.ConvertToInt(actionCtrl.Value), StrategicGoalID = DataIntegrity.ConvertToNullableInt(strategyCtrl.SelectedValue), StrategyID = DataIntegrity.ConvertToInt(this.ddlStrategy.SelectedValue), ActionStep = actionStepCtrl.Text, PersonResponsible = personResponsibleCtrl.Text, ImprovementPlanID = this.ImprovementID, StartDate = startDateCtrl.SelectedDate, FinishDate = finishDateCtrl.SelectedDate, StatusID = DataIntegrity.ConvertToNullableInt(statusCtrl.SelectedValue), ResourceCosts = resourceCostsCtrl.Text, ExpectedResults = expectedResultsCtrl.Text }; }
//Fix bug //A critical error has occurred. Value of '1/1/1900 12:00:00 AM' is not valid for 'SelectedDate'. 'SelectedDate' should be between 'MinDate' and 'MaxDate'. Parameter name: SelectedDate public static void setDate(object dbDate, ref RadDatePicker txtDate) { if (dbDate != DBNull.Value) { if (!Convert.ToDateTime(dbDate).ToString("yyyyMMdd").Equals("19000101")) txtDate.SelectedDate = Convert.ToDateTime(dbDate); } }
private void SetLoanC(string loanName, RadDatePicker dt) { //Fill up the detail now LoansBLL bll = new LoansBLL(); //Loans loan = bll.GetLoanByCode(txtLoanNameC.Text); // txtBoxTradeDate3.SelectedDate = DateTime.Now; string strLoanName = loanName; if (strLoanName.Contains(';')) { strLoanName = strLoanName.Replace(';', ' '); } // Session.Add("Legend", strLoanName); Loans loan = bll.GetLoanByCode(strLoanName.Trim()); //lblNameC.Visible = true; //lblLoanNameC.Visible = true; //lblLoanNameC.InnerText = strLoanName; txtBoxTradeDate3.SelectedDate = Convert.ToDateTime(Session["Trade3"]); try { QuotesAndTradesBLL quotesBL = new QuotesAndTradesBLL(); QuotesAndTrades quotes = quotesBL.GetQuotesAndTrades(loanName); if (quotes != null) { if (quotes.BidPrice != null) txtBoxBidPriceC.Text = quotes.BidPrice.Value.ToString(); if (quotes.BidSpread != null) txtBoxBidSpreadC.Text = quotes.BidSpread.Value.ToString(); if (quotes.OfferPrice != null) txtBoxOfferPriceC.Text = quotes.OfferPrice.Value.ToString(); if (quotes.OfferSpread != null) txtBoxOfferSpreadC.Text = quotes.OfferSpread.Value.ToString(); if (quotes.AverageLife != null) txtAvgLifeC.Text = quotes.AverageLife.Value.ToString(); if (quotes.AvgLifeDisc != null) txtBoxAveLifDiscC.Text = quotes.AvgLifeDisc.Value.ToString(); if (quotes.AvgLifeRiskDisc != null) txtBoxAveLifRiskyDiscC.Text = quotes.AvgLifeRiskDisc.Value.ToString(); if (quotes.Traded != null) chkBoxTradedC.Checked = quotes.Traded.Value; } } catch (Exception) { } txtLoanNameC.SelectedValue = strLoanName; if (txtBoxTradeDate3.SelectedDate != null) { txtBoxSettlementDate3.SelectedDate = AddBusinessDays(txtBoxTradeDate3.SelectedDate.Value, 10); } if (loan != null) { hfSelectedLoanC.Value = loan.ID.ToString(); if (loan.Signing_Date != string.Empty || loan.Signing_Date != "") { txtBoxSettlementDate3.SelectedDate = Convert.ToDateTime(loan.Signing_Date); } if (loan.Maturity_Date != string.Empty || loan.Maturity_Date != "") { txtMaturityDateC.SelectedDate = Convert.ToDateTime(loan.Maturity_Date); } txtInterestRateC.Text = loan.Margin; // txtLoanNameC.Text = loan.CodeName; // Nik Commented //txtDiscountMarginC.Text = loan.Margin; txtCurrencyC.Text = loan.Currency; txtBoxCouponFrequencyLoanC.Text = loan.CouponFrequency; txtLastFixingC.Text = loan.FixedOrFloating; // txtBoxIRCouponC.Text = loan.Margin; //DropDownListItem frequency = ddlAddCouponFrequency.FindItemByValue(loan.CouponFrequency); //if (frequency != null) //{ // frequency.Selected = true; //} if (loan.Maturity_Date != string.Empty && loan.Maturity_Date != null) {// && loan.Signing_Date != null && loan.Signing_Date != string.Empty ComputeCouponDatesAndFractions(dt, txtLoanNameC, txtBoxSettlementDate3, txtMaturityDateC, txtBoxCouponFrequencyLoanC, txtBoxAveLifNonDiscC, grdCalculatedDates3, 3, txtBoxNotional3, txtInterestRateC, txtCurrencyC); } else { grdCalculatedDates3.DataSource = null; grdCalculatedDates3.DataBind(); RadWindowManager1.RadAlert("Cashflow generation failed as coupon frequency not valid or blank", 330, 180, "realedge associates", "alertCallBackFn"); } LogActivity("Compute the CashFlow C", "Compute the cashflow for compact view C", string.Empty); } else { RadWindowManager1.RadAlert("This loan name does not exist in database", 330, 180, "realedge associates", "alertCallBackFn"); } }
private void ComputeCouponDatesAndFractionsOld(RadDatePicker txtBoxTradeDate, RadComboBox txtBoxLoanName, RadDatePicker txtBoxSettlementDate, RadDatePicker txtBoxMaturityDate, RadTextBox txtBoxCouponFrequency, RadTextBox txtNonDiscountedAverageLife, RadGrid grdCalculatedDates, int type, RadTextBox txtNotional, RadTextBox txtMargin, RadTextBox txtCurrency) { try { int countryID = getCountryForLoan(txtBoxLoanName); PublicHolidayBLL bll = new PublicHolidayBLL(); List<tblHoliday> publicHolidays = bll.GetPublicHolidays(countryID); List<CalculatedDates> calculatedList = new List<CalculatedDates>(); DateTime cpnDT; cpnDT = AddBusinessDays(DateTime.Now, 10); LoanScheduleBL loanScheduleBL = new LoanScheduleBL(); DataTable dtSchedule = loanScheduleBL.GenerateTable(15, 10, cpnDT, txtBoxCouponFrequency.Text, txtNotional.Text, txtBoxMaturityDate.SelectedDate.Value, cpnDT, Convert.ToDecimal(txtMargin.Text), Convert.ToString(txtCurrency.Text), Convert.ToDateTime(txtBoxTradeDate.SelectedDate.Value), txtBoxSettlementDate.SelectedDate.Value); DateTime currentCouponDate; DateTime previousCouponDate; DateTime maturityDate; DateTime tradeDate; DateTime tradeDate1 = DateTime.Now.Date; if (txtBoxTradeDate.SelectedDate != null) { tradeDate1 = txtBoxTradeDate.SelectedDate.Value; } //DateTime settlementDate = DateTime.Now.Date; //if (txtBoxSettlementDate.SelectedDate != null) //{ // settlementDate = AddBusinessDays(txtBoxSettlementDate.SelectedDate.Value, 10); //} DateTime boxMaturityDate = DateTime.Now.Date; DateTime.TryParse(txtBoxSettlementDate.SelectedDate.Value.ToShortDateString(), out currentCouponDate); DateTime.TryParse(txtBoxSettlementDate.SelectedDate.Value.ToShortDateString(), out previousCouponDate); if (txtBoxMaturityDate.SelectedDate != null) { boxMaturityDate = txtBoxMaturityDate.SelectedDate.Value; } DateTime.TryParse(boxMaturityDate.ToShortDateString(), out maturityDate); DateTime.TryParse(tradeDate1.ToShortDateString(), out tradeDate); if (DateTime.TryParse(txtBoxSettlementDate.SelectedDate.Value.ToShortDateString(), out currentCouponDate)) { int cF = 0; System.Numeric.Frequency f = new System.Numeric.Frequency(); while (CurrentCouponDateLessThanMaturityDate(currentCouponDate, maturityDate)) { if (txtBoxCouponFrequency.Text == "Annual") { cF = 1; f = System.Numeric.Frequency.Annual; } if (txtBoxCouponFrequency.Text == "Semi-Annual") { cF = 2; f = System.Numeric.Frequency.SemiAnnual; } if (txtBoxCouponFrequency.Text == "Quarterly") { cF = 4; f = System.Numeric.Frequency.Quarterly; } if (txtBoxCouponFrequency.Text == "Monthly") { cF = 12; } int numberOfDaysPassed = 0; // if a weekend date or holiday move forward //while (IsSaturdaySundayDay(currentCouponDate) || IsPublicHoliday(publicHolidays, currentCouponDate)) //{ // currentCouponDate = currentCouponDate.AddDays(1); // numberOfDaysPassed = numberOfDaysPassed + 1; //} // Compute next coupon date using CoupNCD and correct for weekends CalculatedDates cal = new CalculatedDates(); System.Numeric.DayCountBasis d = System.Numeric.DayCountBasis.Actual365; previousCouponDate = currentCouponDate; currentCouponDate = System.Numeric.Financial.CoupNCD(currentCouponDate, maturityDate, f, d); DateTime previousBusinessDay = PreviousBusinessDay(currentCouponDate); cal.CalculatedDate = previousBusinessDay; //numberOfDaysPassed = currentCouponDate.Subtract(tradeDate).Days; // removed 31-03- 2014 asked by avr numberOfDaysPassed = currentCouponDate.Subtract(txtBoxSettlementDate.SelectedDate.Value).Days; //cal.Fraction = String.Format("{0:00.000}", numberOfDaysPassed / 365.25); cal.Fraction = String.Format("{0:00.00}", numberOfDaysPassed / 365.25); cal.ActualFraction = numberOfDaysPassed / 365.25; calculatedList.Add(cal); } if (calculatedList != null && calculatedList.Count > 0) { // When the cashflow is computed take the average of the fractions and set that to the non discounted average life text box. // txtNonDiscountedAverageLife.Text =Convert.ToDecimal( calculatedList.Last().ActualFraction).ToString("0.00"); } grdCalculatedDates.Visible = true; grdCalculatedDates.DataSource = calculatedList; grdCalculatedDates.DataBind(); switch (type) { case 1: tempCalculatedList1 = calculatedList; break; case 2: tempCalculatedList2 = calculatedList; break; case 3: tempCalculatedList3 = calculatedList; break; default: break; } } // tempLegend = txtBoxLoanName; } catch (Exception) { } }
private void ComputeCouponDatesAndFractions(RadDatePicker txtBoxTradeDate, RadComboBox txtBoxLoanName, RadDatePicker txtBoxSettlementDate, RadDatePicker txtBoxMaturityDate, RadTextBox txtBoxCouponFrequency, RadTextBox txtNonDiscountedAverageLife, RadGrid grdCalculatedDates, int type, RadTextBox txtNotional, RadTextBox txtMargin, RadTextBox txtCurrency) { try { int countryID = getCountryForLoan(txtBoxLoanName); //PublicHolidayBLL bll = new PublicHolidayBLL(); //List<tblHoliday> publicHolidays = bll.GetPublicHolidays(countryID); List<CalculatedDates> calculatedList = new List<CalculatedDates>(); DateTime cpnDT; cpnDT = AddBusinessDays(DateTime.Now, 10); LoanScheduleBL loanScheduleBL = new LoanScheduleBL(); DataTable dtSchedule = loanScheduleBL.GenerateTable(15, 10, cpnDT, txtBoxCouponFrequency.Text, txtNotional.Text, txtBoxMaturityDate.SelectedDate.Value, cpnDT, Convert.ToDecimal(txtMargin.Text), Convert.ToString(txtCurrency.Text), Convert.ToDateTime(txtBoxTradeDate.SelectedDate.Value), txtBoxSettlementDate.SelectedDate.Value); if (dtSchedule.Rows.Count > 0) { LoansBLL loanBL = new LoansBLL(); int loanID = loanBL.GetLoanByCode(txtBoxLoanName.Text).ID; loanScheduleBL.EditSchedule(loanID, dtSchedule); } foreach (DataRow dr in dtSchedule.Rows) { CalculatedDates cal = new CalculatedDates(); cal.Fraction = dr["CoupFrac"].ToString(); cal.CalculatedDate = Convert.ToDateTime(dr["EndDate"]); calculatedList.Add(cal); } grdCalculatedDates.Visible = true; grdCalculatedDates.DataSource = calculatedList; grdCalculatedDates.DataBind(); switch (type) { case 1: tempCalculatedList1 = calculatedList; break; case 2: tempCalculatedList2 = calculatedList; break; case 3: tempCalculatedList3 = calculatedList; break; default: break; } } catch (Exception) { } }
protected void Page_Load(object sender, EventArgs e) { try { if (firstTime == 0) { LogActivity("Dashboard Page", "Session Activity Start", string.Empty); timeStamp = DateTime.Now; firstTime++; } if (DateTime.Now.Subtract(timeStamp).TotalMinutes <= 60) { try { BindPieChart(); } catch (Exception ex) { RadWindowManager1.RadAlert(ex.Message, 330, 180, "realedge associates", "alertCallBackFn"); } LogActivity("Dashboard Page", "On Page Load In a Particular Session", string.Empty); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "getSelected", "function getSelected(){__doPostBack(\"" + btnHidden.UniqueID + "\",\"\");}", true); if (Request.QueryString["flag"] != null) { InsertRecord(Request.Params[1].ToString(), Convert.ToInt16(Request.QueryString["flag"])); return; } if (!IsPostBack) { BindLoanDetails(); if (Session["LoanDetail"] != null) { ddlLoanDetailsCode.SelectedValue = Session["LoanDetail"].ToString(); BindLoanDetailData(Session["LoanDetail"].ToString()); } BindLoansData(); LogActivity("Dashboard Page", "On Post back of Page Load", string.Empty); Session.Timeout = 60; timeStamp = DateTime.Now; firstTime = 0; firstTime++; dt1.Clear(); dt1 = new DataTable(); dt1.Columns.Add("ID"); dt1.Columns.Add("StartDate"); dt1.Columns.Add("EndDate"); dt1.Columns.Add("CoupFrac"); dt1.Columns.Add("Notation"); dt1.Columns.Add("Amortisation"); dt1.Columns.Add("Factor"); dt1.Columns.Add("Spread"); dt1.Columns.Add("CouponPaymentDate"); dt1.Columns.Add("RiskFreeDP1"); dt1.Columns.Add("RiskFreeDP2"); dt1.Columns.Add("FloatingRate"); dt1.Columns.Add("AllInRate"); dt1.Columns.Add("Interest"); dt1.Columns.Add("Days"); dt1.Columns.Add("AmortisationInt"); BindLoanAData(); BindLoanBData(); BindLoanCData(); BindLoanCode(); BindCounterParty(); txtLoanNameA.Filter = (RadComboBoxFilter)Convert.ToInt32(2); txtLoanNameB.Filter = (RadComboBoxFilter)Convert.ToInt32(2); txtLoanNameC.Filter = (RadComboBoxFilter)Convert.ToInt32(2); ddlCountry.Filter = (RadComboBoxFilter)Convert.ToInt32(2); ddlAddLoanCode.Filter = (RadComboBoxFilter)Convert.ToInt32(2); ddlQuotesLoanName.Filter = (RadComboBoxFilter)Convert.ToInt32(2); ddlQuoteCountry.Filter = (RadComboBoxFilter)Convert.ToInt32(2); ddlBorrower.Filter = (RadComboBoxFilter)Convert.ToInt32(2); //ddlRegionB.Filter = (RadComboBoxFilter)Convert.ToInt32(2); //ddlRegionC.Filter = (RadComboBoxFilter)Convert.ToInt32(2); BindRegion(); txtBoxTradeDate1.SelectedDate = DateTime.Now; txtBoxTradeDate2.SelectedDate = DateTime.Now; txtBoxTradeDate3.SelectedDate = DateTime.Now; txtBoxSettlementDate1.SelectedDate = AddBusinessDays(txtBoxTradeDate2.SelectedDate.Value, 10); txtBoxSettlementDate2.SelectedDate = AddBusinessDays(txtBoxTradeDate2.SelectedDate.Value, 10); txtBoxSettlementDate3.SelectedDate = AddBusinessDays(txtBoxTradeDate2.SelectedDate.Value, 10); BindCreditRatingTree(); //GetCompletionList(); string queryString = Path.GetFileName(Request.Url.AbsoluteUri); if (Session["LoanType"] != null && !queryString.Contains("?")) { string loanType = Session["LoanType"].ToString(); string loanNameA = string.Empty; string loanNameB = string.Empty; string loanNameC = string.Empty; RadDatePicker dt = new RadDatePicker(); dt.SelectedDate = DateTime.Now.Date; if (Session["LoanNameA"] != null) { loanNameA = Session["LoanNameA"].ToString(); SetLoanA(loanNameA, dt); } if (Session["LoanNameB"] != null) { loanNameB = Session["LoanNameB"].ToString(); SetLoanB(loanNameB, dt); } if (Session["LoanNameC"] != null) { loanNameC = Session["LoanNameC"].ToString(); SetLoanC(loanNameC, dt); } // RadDatePicker dt = (RadDatePicker) Session["BoxTradeDate"]; } BindChartData(); string urlWithSessionID = Response.ApplyAppPathModifier(Request.Url.PathAndQuery); RadTab tab = RadTabStrip1.FindTabByUrl(urlWithSessionID); if (tab != null) { hdnSaved.Value = "N"; tab.SelectParents(); tab.PageView.Selected = true; } Sorting(); DupicateSorting(); if (Session["LogedInUser"] != null && (Session["LogedInUser"] as DAL.Login) != null) { } else { // Move back to the login page Response.Redirect("~/Banner.aspx"); } BindBorrower(); BindCurrency(); // txtBoxTradeDate1.SelectedDate = DateTime.Now.Date; txtBoxNotional1.Text = Convert.ToDecimal(10000000).ToString("N"); txtBoxNotional2.Text = Convert.ToDecimal(10000000).ToString("N"); txtBoxNotional3.Text = Convert.ToDecimal(10000000).ToString("N"); txtNotional.Text = Convert.ToDecimal(10000000).ToString("N"); // txtBoxFacilitySize.Text = Convert.ToDecimal(10000000).ToString("N"); //txtBoxCounterPartyA.Text = "CounteryPartyA"; //txtBoxCounterPartyB.Text = "CounteryPartyB"; //txtBoxCounterPartyC.Text = "CounteryPartyC"; //BindQuotesAndTrades(); // txtBoxFacilitySize.Text = Convert.ToDecimal(10000000).ToString("N"); BindLoansTab(); BindHistoricalQuotesAndTradesTab(); bindCountry(); ddlCountry.SelectedValue = "Russia"; BindQuotesAndGridsFilterSettings(); string str = HttpContext.Current.Request.RawUrl; if (str == "/default.aspx?page=addstaticloan" && Session["EditLoanID"] != null) FillData(); else Clear(); string strQuoteTrade = HttpContext.Current.Request.RawUrl; if (str == "/default.aspx?page=edithistoricalquotes" && Session["EditQuoteID"] != null) FillQuoteData(); else ClearQuotes(); if (ddlAmortizing.SelectedValue == "No") { trNo.Visible = false; trDate.Visible = false; tblAmortisation.Visible = false; dt1.Clear(); btnCalculatSchedule.Visible = false; grdAmortizing.Visible = false; pnlAmortizing.Visible = false; } LogActivity("Dashboard Page", "Page Load Complete", string.Empty); } } else { firstTime = 0; timeStamp = DateTime.Now; Response.Redirect("Logout.aspx"); } } catch (Exception ex) { LogActivity("Dashboard Page", "Page Load Error : " + ex.Message, ex.Message); } }
private void LoadControlToPage(int ReportId) { try { Panel.Controls.Clear(); cls_Report_User objUser = new cls_Report_User(); DataSet _ds = objUser.GetConfigReport(ReportId); DataTable _dtConfig = _ds.Tables[0]; if (_dtConfig.Rows.Count == 0) return; ViewState["Config"] = _dtConfig; short TabIndex = 1; Label LB; string[] ArrRow =null; int t = 0; int k = 0; while (k < _dtConfig.Rows.Count) { if (ArrRow == null) Array.Resize(ref ArrRow, 1); else Array.Resize(ref ArrRow, ArrRow.Length + 1); if (k < _dtConfig.Rows.Count - 1 && (Convert.ToInt32(_dtConfig.Rows[k]["Width"]) + Convert.ToInt32(_dtConfig.Rows[k + 1]["Width"]) <= (848 - 848 / 3))) { ArrRow[t] = k.ToString() + ":" + (k + 1).ToString(); k++; } else { ArrRow[t] = k.ToString(); } t++; k++; } //Lay max text string strMax = ""; for (k = 0; k < ArrRow.Length; k++) { if (ArrRow[k] != null && ArrRow[k].Length > 0) { if (ArrRow[k].IndexOf(":") >= 0) { string[] ArStr = ArrRow[k].Split(':'); if (_dtConfig.Rows[Convert.ToInt32(ArStr[0])]["Parameter_Name"].ToString().Length > strMax.Length) strMax = _dtConfig.Rows[Convert.ToInt32(ArStr[0])]["Parameter_Name"].ToString(); } else { if (_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Name"].ToString().Length > strMax.Length) strMax = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Name"].ToString(); } } } strMax += ": "; // for (k = 0; k < ArrRow.Length; k++) { if (k > 0) { HtmlAnchor te = new HtmlAnchor(); te.InnerHtml = "<br />"; Panel.Controls.Add(te); HtmlAnchor te1 = new HtmlAnchor(); te1.InnerHtml = "<br />"; Panel.Controls.Add(te1); } if (ArrRow[k].Length > 0) { if (ArrRow[k].IndexOf(":") >= 0) { string[] ArStr = ArrRow[k].Split(':'); for (int j = 0; j < ArStr.Length; j++) { LB = new Label(); if (j > 0) { HtmlAnchor tex = new HtmlAnchor(); //tex.InnerText = tex.InnerHtml = " "; Panel.Controls.Add(tex); } string str = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Parameter_Name"].ToString() + ": "; LB.Text = str; Panel.Controls.Add(LB); if(j==0) if (str.Length < strMax.Length) { string sadd =""; for (int y = 0; y <= strMax.Length - str.Length;y++ ) sadd += " "; HtmlAnchor add = new HtmlAnchor(); add.InnerHtml = sadd; Panel.Controls.Add(add); } string sCate = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Control_Type"].ToString(); if (sCate == "TextBox") { TextBox TB = new TextBox(); TB.ID = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Parameter_Code"].ToString(); TB.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Height"]); TB.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Width"]); TB.TabIndex = TabIndex; Panel.Controls.Add(TB); } if (sCate == "DatePicker") { RadDatePicker date = new RadDatePicker(); date.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Height"]); date.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Width"]); date.Skin = "Vista"; date.DateInput.DateFormat = "dd/MM/yyyy"; date.ID = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Parameter_Code"].ToString(); // date.Culture = new System.Globalization.CultureInfo("Vietnamese"); date.Font.Bold = true; date.Font.Name = "Times New Roman"; date.Font.Size = 12; date.SelectedDate = DateTime.Now; date.TabIndex = TabIndex; Panel.Controls.Add(date); } if (sCate == "DateTimePicker") { RadDateTimePicker date = new RadDateTimePicker(); date.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Height"]); date.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Width"]); date.Skin = "Vista"; date.DateInput.DateFormat = "dd/MM/yyyy"; date.ID = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Parameter_Code"].ToString(); // date.Culture = new System.Globalization.CultureInfo("Vietnamese"); date.Font.Bold = true; date.Font.Name = "Times New Roman"; date.Font.Size = 12; date.SelectedDate = DateTime.Now; date.TabIndex = TabIndex; Panel.Controls.Add(date); } if (sCate == "ComboBox") { RadComboBox com = new RadComboBox(); com.Skin = "Vista"; com.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Height"])*5; com.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Width"]); com.ID = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Parameter_Code"].ToString(); com.EnableVirtualScrolling = true; string SQL = _dtConfig.Rows[Convert.ToInt32(ArStr[j])]["Data_SQL"].ToString(); if (SQL.Length > 0) { DataTable _dt; if (_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["IsSP"] != null && Convert.ToBoolean(_dtConfig.Rows[Convert.ToInt32(ArStr[j])]["IsSP"]) == true) { int Index = SQL.IndexOf('@'); if (Index >= 0) _dt = objUser.GetSP(SQL.Substring(0, Index), SQL.Substring(Index, SQL.Length - Index), Session["UserId"] == null ? "0" : Session["UserId"].ToString()); else _dt = objUser.GetSP(SQL); } else _dt = objUser.GetSQL(SQL); com.DataValueField = "ID"; com.DataTextField = "Name"; com.DataSource = _dt; com.DataBind(); } com.TabIndex = TabIndex; Panel.Controls.Add(com); } TabIndex++; } } else { LB = new Label(); string str = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Name"].ToString() + ": "; LB.Text = str; Panel.Controls.Add(LB); if (str.Length < strMax.Length) { string sadd = ""; for (int y = 0; y <= strMax.Length - str.Length; y++) sadd += " "; HtmlAnchor add = new HtmlAnchor(); add.InnerHtml = sadd; Panel.Controls.Add(add); } string sCate = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Control_Type"].ToString(); if (sCate == "TextBox") { TextBox TB = new TextBox(); TB.ID = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Code"].ToString(); TB.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Height"]); TB.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Width"]); TB.TabIndex = TabIndex; Panel.Controls.Add(TB); } if (sCate == "DatePicker") { RadDatePicker date = new RadDatePicker(); date.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Height"]); date.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Width"]); date.Skin = "Vista"; date.DateInput.DateFormat = "dd/MM/yyyy"; date.ID = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Code"].ToString(); // date.Culture = new System.Globalization.CultureInfo("Vietnamese"); date.Font.Bold = true; date.Font.Name = "Times New Roman"; date.Font.Size = 12; date.SelectedDate = DateTime.Now; date.TabIndex = TabIndex; Panel.Controls.Add(date); } if (sCate == "DateTimePicker") { RadDateTimePicker date = new RadDateTimePicker(); date.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Height"]); date.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Width"]); date.Skin = "Vista"; date.DateInput.DateFormat = "dd/MM/yyyy"; date.ID = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Code"].ToString(); // date.Culture = new System.Globalization.CultureInfo("Vietnamese"); date.Font.Bold = true; date.Font.Name = "Times New Roman"; date.Font.Size = 12; date.SelectedDate = DateTime.Now; date.TabIndex = TabIndex; Panel.Controls.Add(date); } if (sCate == "ComboBox") { RadComboBox com = new RadComboBox(); com.Skin = "Vista"; com.Height = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Height"]) * 5; com.Width = Convert.ToInt32(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Width"]); com.ID = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Parameter_Code"].ToString(); com.EnableVirtualScrolling = true; string SQL = _dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["Data_SQL"].ToString(); if (SQL.Length > 0) { DataTable _dt; if (_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["IsSP"] != null && Convert.ToBoolean(_dtConfig.Rows[Convert.ToInt32(ArrRow[k])]["IsSP"]) == true) { int Index = SQL.IndexOf('@'); if (Index >= 0) _dt = objUser.GetSP(SQL.Substring(0, Index), SQL.Substring(Index, SQL.Length - Index), Session["UserId"] == null ? "0" : Session["UserId"].ToString()); else _dt = objUser.GetSP(SQL); } else _dt = objUser.GetSQL(SQL); com.DataValueField = "ID"; com.DataTextField = "Name"; com.DataSource = _dt; com.DataBind(); } com.TabIndex = TabIndex; Panel.Controls.Add(com); } TabIndex++; } } } // } catch (Exception ex) { } }
private static HtmlGenericControl CreateDatePicker(string adjustedID, Criterion startCriterion, Criterion endCriterion) { var radMinDate = new RadDatePicker { ID = "RadMinDatePicker", AutoPostBack = false, Skin = "Vista", Width = System.Web.UI.WebControls.Unit.Pixel(140), MinDate = DateTime.Parse("01/01/1000"), MaxDate = DateTime.Parse("01/01/3000"), ZIndex = 9999 }; radMinDate.ClientEvents.OnDateSelected = "DateSelected"; radMinDate.Attributes.Add("DateRangePosition", startCriterion.Key); radMinDate.Attributes["updateMessageHeader"] = adjustedID; radMinDate.Calendar.SpecialDays.Add( new RadCalendarDay { Repeatable = Telerik.Web.UI.Calendar.RecurringEvents.Today }); radMinDate.DateInput.EmptyMessage = "Start..."; var radMaxDate = new RadDatePicker { ID = "RadMaxDatePicker", AutoPostBack = false, Skin = "Vista", ZIndex = 9999 }; radMaxDate.ClientEvents.OnDateSelected = "DateSelected"; radMaxDate.Attributes.Add("DateRangePosition", endCriterion.Key); radMaxDate.Attributes["updateMessageHeader"] = adjustedID; radMaxDate.DateInput.EmptyMessage = "End..."; radMaxDate.Calendar.SpecialDays.Add( new RadCalendarDay { Repeatable = Telerik.Web.UI.Calendar.RecurringEvents.Today }); //textBox.ClientEvents.OnBlur = "onInputBlur"; //textBox.Attributes["updateMessageHeader"] = adjustedID; //textBox.Text = criterion.Object == null ? string.Empty : criterion.Object.ToString(); var wrapperDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); var wrapperDivLeft = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); wrapperDivLeft.Style.Add("float", "left"); wrapperDivLeft.Style.Add("width", "149px"); wrapperDivLeft.Controls.Add(radMinDate); var wrapperDivRight = new System.Web.UI.HtmlControls.HtmlGenericControl("div"); wrapperDivRight.Style.Add("float", "right"); wrapperDivRight.Style.Add("width", "149px"); wrapperDivRight.Controls.Add(radMaxDate); wrapperDiv.Controls.Add(wrapperDivLeft); wrapperDiv.Controls.Add(wrapperDivRight); return wrapperDiv; }
/// <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; } }