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();
        }
Example #5
0
        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;
        }
Example #6
0
 private void SetRadToolbarTooltip(string buttonID, string text)
 {
     Telerik.Web.UI.RadToolBarItem item = RadToolBar1.FindItemByValue(buttonID);
     if (item == null)
     {
         return;
     }
     item.ToolTip = text;
 }
Example #7
0
 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;
        }
Example #9
0
        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;
                 * }*/
            }
        }
Example #10
0
        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 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
     }
 }
Example #12
0
        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;
            }
        }
        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;
            }
        }
Example #14
0
        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();
        }
Example #17
0
        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 == "&nbsp;" ? (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");
            }
        }