private void RegisterToolbarSettings() { Telerik.Web.UI.RadToolBarButton btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideFinished"); if (btn != null) { Session["HideFinished"] = btn.Checked; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("Separations"); if (btn != null) { Session["SelectedAllSeps"] = btn.Checked; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideApproved"); if (btn != null) { Session["HideApproved"] = btn.Checked; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideCommon"); if (btn != null) { Session["HideCommon"] = btn.Checked; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("ShowCopies"); if (btn != null) { Session["SelectedAllCopies"] = btn.Checked; } }
private void CreateLocationDropDownTelerik() { Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue("Item1"); if (item == null) { return; } DropDownList1 = (DropDownList)item.FindControl("PressSelector"); if (DropDownList1 == null) { return; } string locationsallowed = (string)Application["LogLocations"]; string[] loclist = locationsallowed.Split(','); foreach (string s in loclist) { DropDownList1.Items.Add(s); } if ((string)Session["SelectedLogLocation"] == "") { DropDownList1.SelectedIndex = 0; } else { DropDownList1.SelectedValue = (string)Session["SelectedLogLocation"]; } }
protected void RadToolBar1_ButtonClick(object sender, RadToolBarEventArgs e) { RadToolBarButton btn = e.Item as RadToolBarButton; string caseSwitch = btn.CommandName.ToString(); RadToolBarItem textItem = RadToolBar1.FindItemByValue("PagesAll"); CheckBox chkPagesAll = (CheckBox)textItem.FindControl("chkPagesAll"); if (chkPagesAll.Checked) { rgEEDoc.ExportSettings.IgnorePaging = true; } else { rgEEDoc.ExportSettings.IgnorePaging = false; } rgEEDoc.ExportSettings.ExportOnlyData = true; rgEEDoc.ExportSettings.OpenInNewWindow = true; string datetimerun = DateTime.Now.ToString("yyyy-MM-dd_HH-mm"); // DateTime.Now.ToString("MMddyyHHmm"); string filename = "ABC"; // DataAccess.get_report_name(Convert.ToInt32(ViewState["recid"].ToString())); rgEEDoc.ExportSettings.FileName = filename.Replace(" ", "_") + "_" + datetimerun; switch (caseSwitch) { case "XLSX": //rgEEDoc.ExportSettings.Excel.Format = GridExcelExportFormat.Html; rgEEDoc.MasterTableView.ExportToExcel(); break; case "PDF": int itemsCount = rgEEDoc.PageCount * rgEEDoc.Items.Count; if (itemsCount >= 3000 && rgEEDoc.ExportSettings.IgnorePaging) { ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alert('The data is too large for PDF file. Please filter the data or Export in CSV/XSL/DOC format');", true); return; } rgEEDoc.ExportSettings.Pdf.ForceTextWrap = true; rgEEDoc.ExportSettings.Pdf.PaperSize = Telerik.Web.UI.GridPaperSize.Letter; rgEEDoc.ExportSettings.Pdf.PageHeight = Unit.Parse("215mm"); rgEEDoc.ExportSettings.Pdf.PageWidth = Unit.Parse("750mm"); rgEEDoc.ExportSettings.Pdf.PageLeftMargin = Unit.Parse("13mm"); rgEEDoc.ExportSettings.Pdf.PageRightMargin = Unit.Parse("13mm"); rgEEDoc.ExportSettings.Pdf.PageTopMargin = Unit.Parse("13mm"); rgEEDoc.ExportSettings.Pdf.PageBottomMargin = Unit.Parse("13mm"); rgEEDoc.ExportSettings.Pdf.AllowAdd = false; rgEEDoc.ExportSettings.Pdf.AllowModify = false; rgEEDoc.MasterTableView.ExportToPdf(); break; case "CSV": rgEEDoc.MasterTableView.ExportToCSV(); break; case "DOC": rgEEDoc.ExportSettings.Word.Format = GridWordExportFormat.Html; rgEEDoc.MasterTableView.ExportToWord(); break; } }
protected void btnClearFilter_Click(object sender, ImageClickEventArgs e) { rgEEDoc.MasterTableView.FilterExpression = string.Empty; Telerik.Web.UI.RadToolBarItem textItem = RadToolBar1.FindItemByValue("ClearFilter"); Telerik.Web.UI.RadToolTip RadToolTip1 = (Telerik.Web.UI.RadToolTip)textItem.FindControl("RadToolTip1"); ImageButton btnClearFilter = (ImageButton)textItem.FindControl("btnClearFilter"); btnClearFilter.Enabled = false; btnClearFilter.Visible = false; RadToolTip1.Text = "Clear All Grid Filters"; foreach (Telerik.Web.UI.GridColumn column in rgEEDoc.MasterTableView.RenderColumns) { column.ResetCurrentFilterValue(); column.ListOfFilterValues = null; if (column is Telerik.Web.UI.GridBoundColumn) { Telerik.Web.UI.GridBoundColumn boundColumn = column as Telerik.Web.UI.GridBoundColumn; boundColumn.CurrentFilterValue = string.Empty; } } Telerik.Web.UI.RadToolBarItem textItemFilter = RadToolBar1.FindItemByValue("Filters"); Telerik.Web.UI.RadMenu tlbrMenu = (Telerik.Web.UI.RadMenu)textItemFilter.FindControl("tlbrMenu"); Telerik.Web.UI.RadMenuItem SaveFilter = (Telerik.Web.UI.RadMenuItem)tlbrMenu.FindItemByValue("SaveFilter"); SaveFilter.Enabled = false; rgEEDoc.MasterTableView.Rebind(); }
private void DisplayPageName() { Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue("Item3"); if (item == null) { return; } Label lbl = (Label)item.FindControl("PageName"); if (lbl == null) { return; } lbl.ForeColor = Color.Black; lbl.BackColor = Color.Transparent; string sApp = Global.rm.GetString("txtNoApprovalRequired"); if ((int)Session["CurrentApprovalState"] == 0) { sApp = Global.rm.GetString("txtNotApproved"); lbl.BackColor = Color.Yellow; } else if ((int)Session["CurrentApprovalState"] == 1) { sApp = Global.rm.GetString("txtApproved"); lbl.BackColor = Color.LightGreen; } else if ((int)Session["CurrentApprovalState"] == 2) { sApp = Global.rm.GetString("txtRejected"); lbl.BackColor = Color.Red; } lbl.Text = Global.rm.GetString("txtPage") + " " + (string)Session["CurrentPageName"] + " - " + sApp; }
private void SetRadToolbarTooltip(string buttonID, string text) { Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue(buttonID); if (item == null) { return; } item.ToolTip = text; }
private void SetRadToolbarEnable(string buttonID, bool enable) { Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue(buttonID); if (item == null) { return; } item.Enabled = enable; }
private void SetRadToolbarLabel(string buttonID, string labelID, string text) { Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue(buttonID); if (item == null) { return; } Label label = (Label)item.FindControl(labelID); if (label == null) { return; } label.Text = text; }
private void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { SetLanguage(); Telerik.Web.UI.RadToolBarButton item = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideOld"); if (item != null) { item.Checked = (bool)Session["HideOld"]; } if ((bool)Application["ShowCustomMenu"] && (bool)Session["IsAdmin"]) { item = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("CustomMenu"); if (item != null) { item.Visible = true; item.Text = (string)Application["ShowCustomMenuName"]; } } RefreshPubDateFilter(); /* bool setPressRunDate = false; * if (Session["PubDateFilter"] == null) * setPressRunDate = true; * else if ((DateTime)Session["PubDateFilter"] == DateTime.MinValue) * setPressRunDate = true; * * if (Session["PubDateFilter"] != null) * { * ArrayList alFilterList = (ArrayList)Session["PubDateFilter"]; * if (alFilterList != null) * { * foreach () * } * DateTime tToday = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); * if (DateTime.Now.Hour > 5) * Session["PressRunPubDate"] = tToday.AddDays(1); * else * Session["PressRunPubDate"] = tToday; * }*/ } }
protected void cboTipoUsuario_SelectedIndexChanged1(object o, RadComboBoxSelectedIndexChangedEventArgs e) { TrRepresentante.Visible = false; ListUen.Visible = false; lblUen.Visible = false; ListSegmento.Visible = false; lblSegmento.Visible = false; cmbRepresentante.Items.Clear(); chkMultiOficina.Enabled = true; ListUen.Items.Clear(); ListSegmento.Items.Clear(); RadToolBar1.FindItemByValue("config").Visible = !(cboTipoUsuario.SelectedValue == "2" || cboTipoUsuario.SelectedValue == "0"); if (cboTipoUsuario.SelectedValue == "2") { chkMultiOficina.Enabled = false; chkMultiOficina.Checked = false; foreach (RadListBoxItem rlbi in RadListBox1.Items) { rlbi.Checked = false; rlbi.Enabled = true; } RadListBox1.Enabled = false; TrRepresentante.Visible = true; CargarRik(); } else if (cboTipoUsuario.SelectedValue == "8") { CargarUen(); ListUen.Visible = true; lblUen.Visible = true; } else if (cboTipoUsuario.SelectedValue == "7") { CargarSegmentos(); ListSegmento.Visible = true; lblSegmento.Visible = true; } }
protected void click(object sender, RadToolBarEventArgs e) { if (RadToolBar1.FindButtonByCommandName("logout").Text == "Login") { Response.Redirect(ResolveUrl("~/Login.aspx")); } else if (RadToolBar1.FindButtonByCommandName("logout").Text == "Log Out") { if (e.Item == RadToolBar1.FindButtonByCommandName("logout")) { Session["UserId"] = null; Response.Cookies["RFriend_Email"].Value = null; Response.Cookies["RFriend_UID"].Value = null; Response.Cookies["RFriend_PWD"].Value = null; Session.Abandon(); System.Web.Security.FormsAuthentication.SignOut(); Response.Redirect(ResolveUrl("~/Login.aspx")); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["userID"] != null) { idUser = (int)Session["userID"]; } else { Response.Redirect("~/Login.aspx"); } RadToolBar1.FindItemByValue("Reset").Attributes.Add("onClick", "reset()"); if (!IsPostBack) { // Load data into each combobox cbm.LoadCombobox(cboTTHonNhan, _entities.TinhTrangHonNhans, "TinhTrangHonNhan1", "IDTinhTrangHonNhan"); cbm.LoadCombobox(cboDanToc, _entities.DanTocs, "DanToc1", "IDDanToc"); cbm.LoadCombobox(cboTonGiao, _entities.TonGiaos, "TonGiao1", "IDTonGiao"); cbm.LoadCombobox(cboQuocTich, _entities.QuocTiches, "QuocTich1", "IDQuocTich"); txtMaNV.Focus(); // End load } }
public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //var scriptManager = (RadScriptManager)Page.Master.FindControl("RadScriptManager1"); //scriptManager.RegisterPostBackControl(RadToolBar1.FindItemByText("Excel")); if (CurrentGroupId == (int)CConstValue.UserGroupForAccountExcelExport.Accounting || CurrentGroupId == (int)CConstValue.UserGroupForAccountExcelExport.IT) { RadToolBar1.FindItemByText("Excel").Visible = true; RadToolBar1.FindItemByText("ExcelDetail").Visible = true; } } // find user control _sqlDataSourceInvoiceItems = InvoiceItemGrid1.GetSqlDataSourceInvoiceItems(); _radGridInvoiceItems = InvoiceItemGrid1.GetRadGridInvoiceItems(); // connect event of invoice Items. _radGridInvoiceItems.PreRender += _radGridInvoiceItems_PreRender; InvoiceListSearch(); }
protected void Page_Load(object sender, EventArgs e) { if ((!object.Equals(Request.Cookies["RFriend_Email"], null)) && (!object.Equals(Request.Cookies["RFriend_PWD"], null)) && (!object.Equals(Request.Cookies["RFriend_UID"], null))) { if ((!object.Equals(Request.Cookies["RFriend_Email"].Value, "")) && (!object.Equals(Request.Cookies["RFriend_PWD"].Value, "")) && (!object.Equals(Request.Cookies["RFriend_UID"], ""))) { Session["UserEmail"] = Request.Cookies["RFriend_Email"].Value; Session["Password"] = Request.Cookies["RFriend_PWD"].Value; Session["UserId"] = Request.Cookies["RFriend_UID"].Value; } else { } } else { Response.Redirect(ResolveUrl("~/Login.aspx")); } if (!object.Equals(Session["UserId"], null)) { string getpimage = @"SELECT [User].ID, Propic.Image FROM [User] INNER JOIN Propic ON [User].ID = Propic.UID WHERE (Propic.[Current] = 1) AND ([User].ID = " + Session["UserID"] + ")"; dt = new DataTable(); dt = dbClass.ReturnDT(getpimage); if (dt.Rows[0]["Image"] is DBNull == false) { propic.Attributes.Add("onclick", "goto('Profile/profile.aspx?id=" + dt.Rows[0]["ID"] + "')"); propic.DataValue = (byte[])dt.Rows[0]["Image"]; } } else { RadToolBar1.FindButtonByCommandName("logout").Text = "Login"; } }
private void ReBind() { Response.ContentEncoding = Encoding.GetEncoding((string)Session["encoding"]); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture((string)Session["language"]); Thread.CurrentThread.CurrentUICulture = new CultureInfo((string)Session["language"]); ImageC = System.Drawing.Image.FromFile(Request.MapPath(Request.ApplicationPath) + "/Images/colorC.gif"); ImageM = System.Drawing.Image.FromFile(Request.MapPath(Request.ApplicationPath) + "/Images/colorM.gif"); ImageY = System.Drawing.Image.FromFile(Request.MapPath(Request.ApplicationPath) + "/Images/colorY.gif"); ImageK = System.Drawing.Image.FromFile(Request.MapPath(Request.ApplicationPath) + "/Images/colorK.gif"); ImageS = System.Drawing.Image.FromFile(Request.MapPath(Request.ApplicationPath) + "/Images/colorS.gif"); if ((string)Session["SelectedPublication"] == "") { lblChooseProduct.Visible = true; return; } lblChooseProduct.Visible = false; Telerik.Web.UI.RadToolBarButton btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideFinished"); if (btn != null) { Session["HideFinished"] = btn.Checked; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("Separations"); if (btn != null) { Session["SelectedAllSeps"] = btn.Checked; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideApproved"); if (btn != null) { Session["HideApproved"] = btn.Checked; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideCommon"); if (btn != null) { Session["HideCommon"] = btn.Checked; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("ShowCopies"); if (btn != null) { Session["SelectedAllCopies"] = btn.Checked; } CCDBaccess db = new CCDBaccess(); string errmsg = ""; DataTable tbl = null; if ((bool)Session["SelectedAllSeps"]) { tbl = db.GetTablePageSeparationCollection(false, (bool)Session["SelectedAllCopies"], out errmsg); } else { tbl = db.GetTablePageCollection(false, (bool)Session["SelectedAllCopies"], out errmsg); } if (tbl != null) { lblError.Text = ""; ViewState["MasterSetColumn"] = tbl.Columns["MasterCopySeparationSet"].Ordinal + 1; ViewState["FlatSeparationColumn"] = tbl.Columns["FlatSeparation"].Ordinal + 1; ViewState["FlatSeparationSetColumn"] = tbl.Columns["FlatSeparationSet"].Ordinal + 1; ViewState["PrioColumn"] = tbl.Columns["Priority"].Ordinal + 1; ViewState["ColorColumn"] = tbl.Columns["Color"].Ordinal + 1; ViewState["ActiveColumn"] = tbl.Columns["Active"].Ordinal + 1; ViewState["SetColumn"] = tbl.Columns["SeparationSet"].Ordinal + 1; ViewState["TemplateColumn"] = tbl.Columns["Template"].Ordinal + 1; ViewState["EditionColumn"] = tbl.Columns["Edition"].Ordinal + 1; ViewState["SectionColumn"] = tbl.Columns["Section"].Ordinal + 1; string s = " "; foreach (DataColumn col in tbl.Columns) { if (s != "") { s += ","; } s += col.ColumnName; } ViewState["DefColumnOrder"] = s; if ((string)ViewState["DataSortExpression"] != "") { DataView dv1 = new DataView(tbl, "", (string)ViewState["DataSortExpression"], DataViewRowState.CurrentRows); DataGrid1.DataSource = dv1; } else { DataGrid1.DataSource = tbl.DefaultView; } DataView dv = (DataView)DataGrid1.DataSource; // string translatedSectionName = "Section"; //string translatedEditionName = "Edition"; foreach (DataColumn col in dv.Table.Columns) { string ss = Global.rm.GetString("txt" + col.ColumnName); if (ss != null && ss != "" && ss != " ") { /* if (col.ColumnName == "Section") * translatedSectionName = ss; * if (col.ColumnName == "Edition") * translatedEditionName = ss; */ col.Caption = ss; } } List <string> uniqueSections = new List <string>(); List <string> uniqueEditions = new List <string>(); foreach (DataRow row in tbl.Rows) { s = (string)row["Section"]; if (uniqueSections.Contains(s) == false) { uniqueSections.Add(s); } s = (string)row["Edition"]; if (uniqueEditions.Contains(s) == false) { uniqueEditions.Add(s); } } ViewState["HideEditionColumn"] = uniqueEditions.Count < 2; ViewState["HideSectionColumn"] = uniqueSections.Count < 2; DataGrid1.DataBind(); } else { lblError.Text = errmsg; } }
private void RefreshPubDateFilter() { string allString = Global.rm.GetString("txtAll"); string weekString = Global.rm.GetString("txtWeek"); string hideOldString = Global.rm.GetString("txtHideOld"); CCDBaccess db = new CCDBaccess(); string errmsg = ""; ArrayList weekList = new ArrayList(); ArrayList weekListDate = new ArrayList(); ArrayList al = db.GetPubDateList(GetCurrentPressIDList(), false, ref weekList, ref weekListDate, out errmsg); Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue("Item1"); if (item == null) { return; } DropDownList DropDownList1 = (DropDownList)item.FindControl("PubDateFilter"); string currentSelection = ""; if (DropDownList1.Items.Count > 0) { currentSelection = DropDownList1.SelectedItem.Value; } DropDownList1.Items.Clear(); DropDownList1.Items.Add(new ListItem(allString, "All")); // 0 DropDownList1.Items.Add(new ListItem(hideOldString, "Hide old")); // 1 if ((bool)Application["ShowWeeknumberInTreeFilter"] == false) { foreach (DateTime dt in al) { DropDownList1.Items.Add(new ListItem(LocalDateFormat(dt), PubDate2String(dt))); } } else { //foreach (int w in weekList) for (int i = 0; i < weekList.Count; i++) { DropDownList1.Items.Add(new ListItem(string.Format("{0} {1:00}", weekString, weekList[i]), PubDate2String((DateTime)weekListDate[i]))); } } string s = PubDate2String((DateTime)Session["PubDateFilter"]); if (DropDownList1.Items.FindByValue(currentSelection) != null) { DropDownList1.SelectedValue = currentSelection; } else if (DropDownList1.Items.FindByValue(s) != null) { DropDownList1.SelectedValue = s; } else { DateTime t = (DateTime)Session["PubDateFilter"]; t = t.AddDays(-1); s = PubDate2String(t); if (DropDownList1.Items.FindByValue(s) != null) { DropDownList1.SelectedValue = s; Session["PubDateFilter"] = t; } else { DropDownList1.SelectedIndex = 0; Session["PubDateFilter"] = ((bool)Session["HideOld"]) ? DateTime.MaxValue : DateTime.MinValue; } } }
protected void Page_Load(object sender, EventArgs e) { if ((string)Session["UserName"] == null) { Response.Redirect("~/SessionTimeout.htm"); } if ((string)Session["UserName"] == "") { Response.Redirect("/Denied.htm"); } Session["SelectedSeps"] = null; SetScreenSize(); if (!this.IsPostBack) { Telerik.Web.UI.RadToolBarButton btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideFinished"); if (btn != null) { btn.Checked = (bool)Session["HideFinished"]; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("Separations"); if (btn != null) { btn.Checked = (bool)Session["SelectedAllSeps"]; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideApproved"); if (btn != null) { btn.Checked = (bool)Session["HideApproved"]; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideCommon"); if (btn != null) { btn.Checked = (bool)Session["HideCommon"]; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("Reimage"); if (btn != null) { btn.Visible = (bool)Session["MayReimage"] || (bool)Session["IsAdmin"]; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideCopies"); if (btn != null) { btn.Checked = (bool)Session["SelectedAllCopies"]; } SetLanguage(); SetAccess(); // Defaults ViewState["HideEditionColumn"] = false; ViewState["HideSectiontionColumn"] = false; ViewState["DataSortExpression"] = ""; ViewState["MasterSetColumn"] = 1; ViewState["SetColumn"] = 1; ViewState["FlatSeparationColumn"] = 1; ViewState["FlatSeparationSetColumn"] = 1; ViewState["DefColumnOrder"] = (string)Application["ColumnOrder"]; ViewState["SectionColumn"] = 1; ViewState["EditionColumn"] = 1; ViewState["ActiveColumn"] = 50; ViewState["PrioColumn"] = 50; ViewState["ColorColumn"] = 1; Session["TableSelectMode"] = "Page"; lblError.Text = ""; ReBind(); } //Loop through all windows in the WindowManager.Windows collection foreach (Telerik.Web.UI.RadWindow win in RadWindowManager1.Windows) { //Set whether the first window will be visible on page load win.VisibleOnPageLoad = false; } if (HiddenReturendFromPopup.Value == "1") { HiddenReturendFromPopup.Value = "0"; ReBind(); } SetRefreshheader(); }
protected void Page_Load(object sender, EventArgs e) { if ((string)Session["UserName"] == null) { Response.Redirect("~/SessionTimeout.htm"); } if ((string)Session["UserName"] == "") { Response.Redirect("/Denied.htm"); } if (!this.IsPostBack) { Telerik.Web.UI.RadToolBarButton btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideFinished"); if (btn != null) { btn.Checked = (bool)Session["HideFinished"]; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("Separations"); if (btn != null) { btn.Checked = (bool)Session["SelectedAllSeps"]; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideApproved"); if (btn != null) { btn.Checked = (bool)Session["HideApproved"]; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideCommon"); if (btn != null) { btn.Checked = (bool)Session["HideCommon"]; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("Reimage"); if (btn != null) { btn.Visible = (bool)Session["MayReimage"] || (bool)Session["IsAdmin"]; } btn = (Telerik.Web.UI.RadToolBarButton)RadToolBar1.FindItemByValue("HideCopies"); if (btn != null) { btn.Checked = (bool)Session["SelectedAllCopies"]; } } Session["SelectedSeps"] = null; ImageC = System.Drawing.Image.FromFile(Request.MapPath(Request.ApplicationPath) + "/Images/colorC.gif"); ImageM = System.Drawing.Image.FromFile(Request.MapPath(Request.ApplicationPath) + "/Images/colorM.gif"); ImageY = System.Drawing.Image.FromFile(Request.MapPath(Request.ApplicationPath) + "/Images/colorY.gif"); ImageK = System.Drawing.Image.FromFile(Request.MapPath(Request.ApplicationPath) + "/Images/colorK.gif"); ImageS = System.Drawing.Image.FromFile(Request.MapPath(Request.ApplicationPath) + "/Images/colorS.gif"); if (!this.IsPostBack) { SetLanguage(); SetAccess(); // Defaults ViewState["HideEditionColumn"] = false; ViewState["HideSectiontionColumn"] = false; ViewState["DataSortExpression"] = ""; ViewState["MasterSetColumn"] = 1; ViewState["SetColumn"] = 1; ViewState["FlatSeparationColumn"] = 1; ViewState["FlatSeparationSetColumn"] = 1; ViewState["DefColumnOrder"] = (string)Application["ColumnOrder"]; ViewState["SectionColumn"] = 1; ViewState["EditionColumn"] = 1; ViewState["ActiveColumn"] = 50; ViewState["PrioColumn"] = 50; ViewState["ColorColumn"] = 1; Session["TableSelectMode"] = "Page"; } SetScreenSize(); if (!this.IsPostBack) { lblError.Text = ""; ReBind(); } SetRefreshheader(); }
private void Nuevo() { try { list = new List <RelacionGestor>(); this.HiddenId_Ofi.Value = string.Empty; this.HiddenId_U.Value = string.Empty; this.HiddenU_Usuario.Value = string.Empty; this.HiddenId_TU.Value = string.Empty; this.txtNombre.Text = string.Empty; this.txtCorreo.Text = string.Empty; this.txtFechaNac.SelectedDate = null; this.txtUsuario.Text = string.Empty; RadComboBoxItem item1 = new RadComboBoxItem(); item1.Value = "0"; item1.Text = "-- Seleccionar --"; this.chkActivo.Checked = true; this.chkMultiOficina.Checked = false; this.chkVerTodo.Checked = false; this.RadGrid1.Rebind(); rgSucursal.Rebind(); RadListBox1.Enabled = false; foreach (RadListBoxItem rlbi in RadListBox1.Items) { if (rlbi.Value == sesion.Id_Cd_Ver.ToString()) { rlbi.Checked = true; rlbi.Enabled = false; } else { rlbi.Checked = false; rlbi.Enabled = true; } } cboTipoUsuario.SelectedIndex = 0; cboTipoUsuario.Text = cboTipoUsuario.Items[0].Text; if (cmbRepresentante.Items.Count > 0) { cmbRepresentante.SelectedIndex = 0; cmbRepresentante.Text = cmbRepresentante.Items[0].Text; } TrRepresentante.Visible = false; ListUen.Items.Clear(); ListSegmento.Items.Clear(); ListUen.Visible = false; lblUen.Visible = false; ListSegmento.Visible = false; lblSegmento.Visible = false; chkCredito.Checked = false; txtDias.Value = null; RadToolBar1.FindItemByValue("config").Visible = !(cboTipoUsuario.SelectedValue == "2" || cboTipoUsuario.SelectedValue == "0"); } catch (Exception ex) { throw ex; } }
protected void GetAgencyInfo() { ResetForm(); if (RadGridAgency.SelectedValue != null) { var cAgc = new CAgency(); var agc = cAgc.Get(Convert.ToInt32(RadGridAgency.SelectedValue)); if (agc.AgencyId > 0) { ddlPAgency.SelectedValue = Convert.ToString(agc.ParentAgencyId); RadComboBoxAgencyName.Text = agc.Name; tbAgencyShortName.Text = agc.Abbreviation; tbAgencyGroupName.Text = agc.GroupName; tbAgencyPrintName.Text = agc.PrintingName; tbAgencyType.Text = agc.AgencyType; tbCommissionRateBasic.Text = agc.CommissionRateBasic.ToString(); tbCommissionRateSeason.Text = agc.CommissionRateSeasonal.ToString(); tbCreditLimit.Text = agc.CreditLimit.ToString(); ddlBusinessLocation.SelectedValue = agc.Location.ToString(); ddlMainTarget.SelectedValue = agc.MainTargetCountry.ToString(); tbContractStart.SelectedDate = agc.ContractStartDate; tbContractEnd.SelectedDate = agc.ContractEndDate; tbAPPayTerm.Text = agc.APPaymentTerm; tbAPPayMethod.Text = agc.APPaymentMethod; tbAPBillingType.Text = agc.APBillingType; tbAPPAymentPriority.Text = agc.APPaymentPriority; tbAPPaySchedule.Text = agc.APPaymentSchedule; tbARCollectionTerm.Text = agc.ARCollectionTerm; tbARType.Text = agc.ARType; tbARCollection.Text = agc.ARCollectionPriority; tbARCollectionSchedule.Text = agc.ARCollectionSchedule; tbARCollectionMethod.Text = agc.ARCollectionMethod; tbAgencyNo.Text = agc.AgencyRegNo; tbCurrency.Text = agc.Currency; tbComment.Text = agc.Comment; RadButtonActive.Checked = agc.IsActive; agFname.Text = agc.FirstName; agLname.Text = agc.LastName; agTitle.Text = agc.Salutation; agPhone.Text = agc.Phone; agMobile.Text = agc.Mobile; agFax.Text = agc.Fax; agPEmail.Text = agc.PEmail; agSEmail.Text = agc.SEmail; agWebsite.Text = agc.Website; agAddress.Text = agc.Address; agCity.Text = agc.City; agProvince.Text = agc.Province; agPostal.Text = agc.Postal; ddlAgencyCountry.SelectedValue = agc.CountryId.ToString(); agFname1.Text = agc.FirstName1; agLname1.Text = agc.LastName1; agTitle1.Text = agc.Salutation1; agPhone1.Text = agc.Phone1; agMobile1.Text = agc.Mobile1; agFax1.Text = agc.Fax1; agPEmail1.Text = agc.PEmail1; agSEmail1.Text = agc.SEmail1; agWebsite1.Text = agc.Website1; agAddress1.Text = agc.Address1; agCity1.Text = agc.City1; agProvince1.Text = agc.Province1; agPostal1.Text = agc.Postal1; ddlAgencyCountry1.SelectedValue = agc.CountryId1.ToString(); if (RadToolBar1.FindItemByText("New") != null) { RadToolBar1.FindItemByText("New").Enabled = true; } if (RadToolBar1.FindItemByText("Save") != null) { RadToolBar1.FindItemByText("Save").Text = @"Update"; } } } }
public void GetInvoiceItems() { var btnConfirm = RadToolBar1.FindItemByText("Confirm"); var btnModify = RadToolBar1.FindItemByText("Modify"); var btnCancel = RadToolBar1.FindItemByText("Cancel"); var btnStudentInvoice = RadToolBar1.FindItemByText("Student Invoice"); var btnAgencyInvoice = RadToolBar1.FindItemByText("Agency Invoice"); var btnNewSimpleInvoice = RadToolBar1.FindItemByText("New Simple Invoice"); if (RadGridInvoice.SelectedValue == null) { _sqlDataSourceInvoiceItems.WhereParameters.Clear(); _sqlDataSourceInvoiceItems.WhereParameters.Add("InvoiceId", DbType.Int32, "0"); _sqlDataSourceInvoiceItems.Where = "InvoiceId == @InvoiceId"; LinqDataSourceInvoiceHistory.WhereParameters.Clear(); LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceId", DbType.Int32, "0"); LinqDataSourceInvoiceHistory.Where = "InvoiceId == @InvoiceId"; } else { var cInvoice = new CInvoice(); var invoice = cInvoice.Get(Convert.ToInt32(RadGridInvoice.SelectedValue.ToString())); _sqlDataSourceInvoiceItems.WhereParameters.Clear(); _sqlDataSourceInvoiceItems.WhereParameters.Add("InvoiceId", DbType.Int32, RadGridInvoice.SelectedValue.ToString()); _sqlDataSourceInvoiceItems.Where = "InvoiceId == @InvoiceId"; if (invoice.OriginalInvoiceId != null) { LinqDataSourceInvoiceHistory.WhereParameters.Clear(); LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceId", DbType.Int32, invoice.InvoiceId.ToString()); LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoiceNumber", DbType.String, invoice.InvoiceNumber.Substring(2, 8)); LinqDataSourceInvoiceHistory.WhereParameters.Add("InvoicePartialIndex", DbType.Int32, invoice.InvoicePartialIndex.ToString()); LinqDataSourceInvoiceHistory.Where = "InvoiceId != @InvoiceId && InvoiceNumber.Contains(@InvoiceNumber) && InvoicePartialIndex < @InvoicePartialIndex"; } else { LinqDataSourceInvoiceHistory.WhereParameters.Clear(); LinqDataSourceInvoiceHistory.WhereParameters.Add("OriginalInvoiceId", DbType.Int32, "0"); LinqDataSourceInvoiceHistory.Where = "InvoiceId == @OriginalInvoiceId"; } ddlFG.SelectedValue = invoice.IsFinancialGurantee.ToString(); var status = Convert.ToInt32(invoice.Status); var invoiceType = Convert.ToInt32(invoice.InvoiceType); var delete = _radGridInvoiceItems.MasterTableView.GetColumn("DeleteColumn"); if (status == (int)CConstValue.InvoiceStatus.Pending) { switch (invoiceType) { case (int)CConstValue.InvoiceType.Simple: case (int)CConstValue.InvoiceType.General: case (int)CConstValue.InvoiceType.Manual: case (int)CConstValue.InvoiceType.Dormitory: case (int)CConstValue.InvoiceType.Homestay: btnConfirm.Enabled = true; btnModify.Enabled = false; btnCancel.Enabled = true; btnStudentInvoice.Enabled = true; btnAgencyInvoice.Enabled = true; _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top; _radGridInvoiceItems.MasterTableView.EditMode = GridEditMode.Batch; delete.Visible = true; ddlFG.Enabled = true; break; default: btnConfirm.Enabled = false; //Confirm btnModify.Enabled = false; //Modify btnCancel.Enabled = false; //Cancel btnStudentInvoice.Enabled = true; //Student Invoice Print btnAgencyInvoice.Enabled = true; //Agency Invoice Print _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; _radGridInvoiceItems.MasterTableView.EditMode = GridEditMode.InPlace; delete.Visible = false; ddlFG.Enabled = false; break; } } else if (status == (int)CConstValue.InvoiceStatus.Invoiced) //Invoiced { switch (invoiceType) { case (int)CConstValue.InvoiceType.Simple: case (int)CConstValue.InvoiceType.General: case (int)CConstValue.InvoiceType.Manual: case (int)CConstValue.InvoiceType.Dormitory: case (int)CConstValue.InvoiceType.Homestay: btnConfirm.Enabled = false; btnModify.Enabled = true; btnCancel.Enabled = true; btnStudentInvoice.Enabled = true; btnAgencyInvoice.Enabled = true; _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; _radGridInvoiceItems.MasterTableView.EditMode = GridEditMode.InPlace; delete.Visible = false; ddlFG.Enabled = false; break; default: btnConfirm.Enabled = false; //Confirm btnModify.Enabled = false; //Modify btnCancel.Enabled = false; //Cancel btnStudentInvoice.Enabled = true; //Student Invoice Print btnAgencyInvoice.Enabled = true; //Agency Invoice Print _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; _radGridInvoiceItems.MasterTableView.EditMode = GridEditMode.InPlace; delete.Visible = false; ddlFG.Enabled = false; break; } } else { btnConfirm.Enabled = false; btnModify.Enabled = false; btnCancel.Enabled = false; btnStudentInvoice.Enabled = true; btnAgencyInvoice.Enabled = true; _radGridInvoiceItems.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None; _radGridInvoiceItems.MasterTableView.EditMode = GridEditMode.InPlace; delete.Visible = false; ddlFG.Enabled = false; } if (invoice.AgencyId != null) { var cAgency = new CAgency(); var agency = cAgency.Get(Convert.ToInt32(invoice.AgencyId)); if (agency != null) { tbAgencyName.Text = agency.Name; if (agency.Location != null) { var country = new CCountry().Get((int)agency.Location); tbCountryCity.Text = country.Name; } else { tbCountryCity.Text = string.Empty; } if (agency.ContractStartDate != null && agency.ContractEndDate != null) { tbContractDate.Text = agency.ContractStartDate.Value.Date.ToString("MM-dd-yyyy") + " - " + agency.ContractEndDate.Value.Date.ToString("MM-dd-yyyy"); } tbCommissionRate.Text = invoice.AgencyRate + "%"; tbDescription.Text = agency.Comment; } } else { tbAgencyName.Text = "Direct Student"; tbCountryCity.Text = string.Empty; tbContractDate.Text = string.Empty; tbCommissionRate.Text = string.Empty; tbDescription.Text = string.Empty; } if (_radGridInvoiceItems.MasterTableView.EditMode == GridEditMode.Batch) { InvoiceItemGrid1.SetTypeOfInvoiceCoaItem(invoice.InvoiceType); } } _radGridInvoiceItems.Rebind(); RadGridInvoiceHistory.Rebind(); }
protected void ResetForm() { var global = new CGlobal(); var agcname = new CAgency(); ddlBusinessLocation.Items.Clear(); ddlBusinessLocation.Text = string.Empty; ddlBusinessLocation.DataSource = global.GetCountry(); ddlBusinessLocation.DataTextField = "Name"; ddlBusinessLocation.DataValueField = "Value"; ddlBusinessLocation.Filter = (RadComboBoxFilter)Convert.ToInt32(1); ddlBusinessLocation.DataBind(); ddlMainTarget.Items.Clear(); ddlMainTarget.Text = string.Empty; ddlMainTarget.DataSource = global.GetCountry(); ddlMainTarget.DataTextField = "Name"; ddlMainTarget.DataValueField = "Value"; ddlMainTarget.Filter = (RadComboBoxFilter)Convert.ToInt32(1); ddlMainTarget.DataBind(); ddlAgencyCountry.Items.Clear(); ddlAgencyCountry.Text = string.Empty; ddlAgencyCountry.DataSource = global.GetCountry(); ddlAgencyCountry.DataTextField = "Name"; ddlAgencyCountry.DataValueField = "Value"; ddlAgencyCountry.Filter = (RadComboBoxFilter)Convert.ToInt32(1); ddlAgencyCountry.DataBind(); ddlAgencyCountry1.Items.Clear(); ddlAgencyCountry1.Text = string.Empty; ddlAgencyCountry1.DataSource = global.GetCountry(); ddlAgencyCountry1.DataTextField = "Name"; ddlAgencyCountry1.DataValueField = "Value"; ddlAgencyCountry1.Filter = (RadComboBoxFilter)Convert.ToInt32(1); ddlAgencyCountry1.DataBind(); ddlPAgency.Items.Clear(); ddlPAgency.Text = string.Empty; ddlPAgency.DataSource = agcname.GetAgencyPName(); ddlPAgency.DataTextField = "Name"; ddlPAgency.DataValueField = "Value"; ddlPAgency.Filter = (RadComboBoxFilter)Convert.ToInt32(1); ddlPAgency.DataBind(); ddlPAgency.Items.Insert(0, new RadComboBoxItem("N/A", null)); RadComboBoxAgencyName.Items.Clear(); RadComboBoxAgencyName.Text = string.Empty; RadComboBoxAgencyName.DataSource = agcname.GetAgencyName(); RadComboBoxAgencyName.DataTextField = "Name"; RadComboBoxAgencyName.DataValueField = "Value"; RadComboBoxAgencyName.Filter = (RadComboBoxFilter)Convert.ToInt32(1); RadComboBoxAgencyName.DataBind(); RadComboBoxAgencyName.Text = ""; tbAgencyShortName.Text = ""; tbAgencyGroupName.Text = ""; tbAgencyPrintName.Text = ""; tbAgencyType.Text = ""; tbCommissionRateBasic.Text = ""; tbCommissionRateSeason.Text = ""; tbCreditLimit.Text = ""; tbContractStart.SelectedDate = null; tbContractEnd.SelectedDate = null; tbAPPayTerm.Text = ""; tbAPPayMethod.Text = ""; tbAPBillingType.Text = ""; tbAPPAymentPriority.Text = ""; tbAPPaySchedule.Text = ""; tbARCollectionTerm.Text = ""; tbARType.Text = ""; tbARCollection.Text = ""; tbARCollectionSchedule.Text = ""; tbARCollectionMethod.Text = ""; tbAgencyNo.Text = ""; tbCurrency.Text = ""; tbComment.Text = ""; RadButtonActive.Checked = true; agFname.Text = ""; agLname.Text = ""; agTitle.Text = ""; agPhone.Text = ""; agMobile.Text = ""; agFax.Text = ""; agPEmail.Text = ""; agSEmail.Text = ""; agWebsite.Text = ""; agAddress.Text = ""; agCity.Text = ""; agProvince.Text = ""; agPostal.Text = ""; agFname1.Text = ""; agLname1.Text = ""; agTitle1.Text = ""; agPhone1.Text = ""; agMobile1.Text = ""; agFax1.Text = ""; agPEmail1.Text = ""; agSEmail1.Text = ""; agWebsite1.Text = ""; agAddress1.Text = ""; agCity1.Text = ""; agProvince1.Text = ""; agPostal1.Text = ""; if (RadToolBar1.FindItemByText("New") != null) { RadToolBar1.FindItemByText("New").Enabled = false; } if (RadToolBar1.FindItemByText("Update") != null) { RadToolBar1.FindItemByText("Update").Text = @"Save"; } GetSiteLocation(); }
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) { try { ErrorManager(); if (e.CommandName.ToString() == "Modificar") { Int32 item = default(Int32); item = e.Item.ItemIndex; if (item >= 0) { CN__Comun.RemoverValidadores(Validators); this.HiddenId_Ofi.Value = this.RadGrid1.Items[item]["Id_Cd"].Text; this.HiddenId_U.Value = this.RadGrid1.Items[item]["Id_U"].Text; this.txtNombre.Text = this.RadGrid1.Items[item]["U_Nombre"].Text; rgSucursal.Rebind(); if (this.RadGrid1.Items[item]["U_FNac"].Text != "01/01/0001 12:00:00 a.m.") { this.txtFechaNac.SelectedDate = Convert.ToDateTime(Convert.ToDateTime(this.RadGrid1.Items[item]["U_FNac"].Text)); } else { this.txtFechaNac.SelectedDate = null; } this.txtCorreo.Text = this.RadGrid1.Items[item]["U_Correo"].Text; this.txtUsuario.Text = this.RadGrid1.Items[item]["Cu_User"].Text; this.HiddenU_Usuario.Value = this.RadGrid1.Items[item]["Cu_User"].Text; this.cboTipoUsuario.SelectedValue = this.RadGrid1.Items[item]["Id_Tu"].Text; this.cboTipoUsuario_SelectedIndexChanged(null, null); this.HiddenId_TU.Value = this.RadGrid1.Items[item]["Id_Tu"].Text; this.chkActivo.Checked = Convert.ToBoolean(this.RadGrid1.Items[item]["U_Activo"].Text); this.chkVerTodo.Checked = Convert.ToBoolean(this.RadGrid1.Items[item]["U_VerTodo"].Text); this.chkMultiOficina.Checked = Convert.ToBoolean(this.RadGrid1.Items[item]["U_MultiCentro"].Text); this.chkCredito.Checked = Convert.ToBoolean(this.RadGrid1.Items[item]["U_SusCredito"].Text); txtDias.Value = this.RadGrid1.Items[item]["U_DiasVencimiento"].Text == " " ? (double?)null : Convert.ToDouble(this.RadGrid1.Items[item]["U_DiasVencimiento"].Text); txtDias.Enabled = chkCredito.Checked; TrRepresentante.Visible = false; ListUen.Visible = false; lblUen.Visible = false; ListSegmento.Visible = false; lblSegmento.Visible = false; chkMultiOficina.Enabled = true; RadToolBar1.FindItemByValue("config").Visible = !(cboTipoUsuario.SelectedValue == "2" || cboTipoUsuario.SelectedValue == "0"); if (this.RadGrid1.Items[item]["Id_Tu"].Text == "2") { CargarRik(); TrRepresentante.Visible = true; this.cmbRepresentante.SelectedIndex = cmbRepresentante.FindItemIndexByValue(RadGrid1.Items[item]["Id_Rik"].Text); if (cmbRepresentante.SelectedIndex != -1) { this.cmbRepresentante.Text = cmbRepresentante.FindItemByValue(RadGrid1.Items[item]["Id_Rik"].Text).Text; } chkMultiOficina.Enabled = false; } else if (this.RadGrid1.Items[item]["Id_Tu"].Text == "8") { CargarUen(); ListUen.Visible = true; lblUen.Visible = true; } else if (this.RadGrid1.Items[item]["Id_Tu"].Text == "7") { CargarSegmentos(); ListSegmento.Visible = true; lblSegmento.Visible = true; } RadListBox1.Enabled = chkMultiOficina.Checked; if (chkMultiOficina.Checked) { SeleccionarCentros(RadGrid1.Items[item]["Id_Cd"].Text); } CargarRelGestor(Convert.ToInt32(HiddenId_U.Value)); } } } catch (Exception ex) { ErrorManager(ex, "RadGrid1_ItemCommand"); } }