protected void Page_Init(object sender, EventArgs e)
 {
     if (!IsPostBack && !IsCallback)
     {
         Guid newId = Guid.NewGuid();
         ASPxHiddenField1.Add("PageID", newId);
     }
 }
    protected void Page_Init(object sender, EventArgs e)
    {
        object parameters;

        if (ASPxHiddenField1.TryGet("hintContent", out parameters))
        {
            getCreateHintContent(parameters.ToString());
        }
    }
Example #3
0
    public int GetCurrentItemTypeID()
    {
        object typeID;

        if (ASPxHiddenField1.TryGet("currentTypeID", out typeID))
        {
            return(Convert.ToInt32(typeID));
        }
        return(-1);
    }
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ASPxHiddenField1.Add(ASPxDockPanel1.ID, true);
         ASPxHiddenField1.Add(ASPxDockPanel2.ID, true);
         ASPxHiddenField1.Add(ASPxDockPanel3.ID, true);
     }
     RestoreDockPanelsVisibility();
 }
Example #5
0
    protected void ASPxButton1_Click(object sender, EventArgs e)
    {
        foreach (var item in ASPxHiddenField1)
        {
            string[] parts = item.Key.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
            bool     value = (bool)item.Value;

            OleDbConnection connection    = new OleDbConnection(WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            OleDbCommand    updateCommand = new OleDbCommand(string.Format("UPDATE Settings SET {0} = {1} WHERE Id = {2}", parts[0], value, parts[1]), connection);

            connection.Open();
            updateCommand.ExecuteScalar();
            connection.Close();
        }

        ASPxHiddenField1.Clear();
    }
Example #6
0
        protected void ASPxButton1_Click(object sender, EventArgs e)
        {
            if (ASPxHiddenField1.Get("dashboardState") != null && ASPxHiddenField1.Get("filterItems") != null)
            {
                string   dashboardStateJson = ASPxHiddenField1.Get("dashboardState").ToString();
                string[] parameters         = ASPxHiddenField1.Get("filterItems").ToString().Split('|');

                MemoryStream resultStream = new MemoryStream();
                using (PdfDocumentProcessor documentProcessor = new PdfDocumentProcessor()) {
                    documentProcessor.CreateEmptyDocument(resultStream);
                    for (int i = 0; i < parameters.Length; i++)
                    {
                        DashboardState dashboardState = new DashboardState();
                        dashboardState.LoadFromJson(dashboardStateJson);
                        var filterItemState = dashboardState.Items.Where(item => item.ItemName == "comboBoxDashboardItem1").FirstOrDefault();
                        if (filterItemState != null)
                        {
                            filterItemState.MasterFilterValues.Clear();
                            filterItemState.MasterFilterValues.Add(new object[] { parameters[i] });
                        }
                        DashboardPdfExportOptions pdfOptions = new DashboardPdfExportOptions();
                        pdfOptions.ShowTitle = DevExpress.Utils.DefaultBoolean.False;
                        ASPxDashboardExporter exporter = new ASPxDashboardExporter(ASPxDashboard1);
                        using (MemoryStream stream = new MemoryStream())
                        {
                            exporter.ExportToPdf("Dashboard1", stream, new System.Drawing.Size(1024, 768), dashboardState, pdfOptions);
                            documentProcessor.AppendDocument(stream);
                        }
                    }
                }

                resultStream.Seek(0, SeekOrigin.Begin);
                Page.Response.Clear();
                Page.Response.ContentType = "application/pdf";
                Response.BinaryWrite(resultStream.ToArray());
                Page.Response.End();
            }
        }
Example #7
0
    protected void ASPxGridView1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
    {
        ASPxGridView1.ClearSort();
        for (int i = 0; i < ((ASPxGridView)sender).Columns.Count; i++)
        {
            if (((ASPxGridView)sender).Columns[i] is GridViewDataColumn)
            {
                GridViewDataColumn col = ((ASPxGridView)sender).Columns[i] as GridViewDataColumn;
                if (ASPxHiddenField1.Contains("clientColumnNamesunit" + col.FieldName))
                {
                    Dictionary <string, object> dict = ASPxHiddenField1.Get("clientColumnNamesunit" + col.FieldName) as Dictionary <string, object>;
                    string sortOrder = dict["Order"] as string;
                    string FieldName = dict["FieldName"] as string;

                    if (sortOrder == null || FieldName == null)
                    {
                        object previousField;
                        if (dict.TryGetValue("ClearSort", out previousField))
                        {
                            ((GridViewDataColumn)((ASPxGridView)sender).Columns[(string)previousField]).UnSort();
                        }
                        continue;
                    }

                    if (sortOrder == "A")
                    {
                        ((GridViewDataColumn)((ASPxGridView)sender).Columns[FieldName]).SortAscending();
                    }
                    else
                    {
                        ((GridViewDataColumn)((ASPxGridView)sender).Columns[FieldName]).SortDescending();
                    }
                }
            }
        }
    }
Example #8
0
    protected void ASPxCallbackPanel1_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
    {
        if (e.Parameter.Trim() == "quick")
        {
            if (tbQuick.Text.Trim() != "")
            {
                ObjectDataSource1.SelectParameters["strWhere"].DefaultValue = " and H_CONTENT like '%" + tbQuick.Text.Trim() + "%'";
            }
            else
            {
                ObjectDataSource1.SelectParameters["strWhere"].DefaultValue = " and 1=1";
            }
            ASPxGridView1.DataSourceID = "ObjectDataSource1";
            ObjectDataSource1.DataBind();
        }
        if (e.Parameter.Trim() == "base")
        {
            string strwhere = "";
            if (deBegin.Date <= deEnd.Date)
            {
                strwhere += " and to_char(HAZARDS.OPENINGTIME,'yyyy-mm-dd') between '" + deBegin.Date.ToString("yyyy-MM-dd") + "' and '" + deEnd.Date.ToString("yyyy-MM-dd") + "'";
            }
            if (cbbZY.Text.Trim() != "")
            {
                strwhere += " and a.infoid=" + ASPxHiddenField1.Get("ZYkey").ToString();
            }
            if (cbbDW.SelectedIndex > -1)
            {
                //strwhere+=" and "
            }
            if (cbbFXkind.SelectedIndex > -1)
            {
                strwhere += " and HAZARDS.Risk_Typesnumber=" + cbbFXkind.SelectedItem.Value.ToString();
            }
            if (cbbFXlevel.SelectedIndex > -1)
            {
                strwhere += " and c.infoid=" + cbbFXlevel.SelectedItem.Value.ToString();
            }
            if (cbbSG.SelectedIndex > -1)
            {
                strwhere += " and HAZARDS.Accident_Typenumber=" + cbbSG.SelectedItem.Value.ToString();
            }
            if (tbGZ.Text.Trim() != "")
            {
                strwhere += " and b.WORKTASK" + (cbbGZway.SelectedIndex == 0 ? "='" : " like '%") + tbGZ.Text.Trim() + (cbbGZway.SelectedIndex == 0 ? "'" : "%'");
            }
            if (tbGX.Text.Trim() != "")
            {
                strwhere += " and PROCESS.NAME" + (cbbGXway.SelectedIndex == 0 ? "='" : " like '%") + tbGX.Text.Trim() + (cbbGXway.SelectedIndex == 0 ? "'" : "%'");
            }
            if (tbBM.Text.Trim() != "" && tbBMchild.Text.Trim() != "")
            {
                strwhere += " and (HAZARDS.H_NUMBER like '%" + tbBM.Text.Trim() + "%'" + (cbbBMchild.SelectedIndex == 0 ? " and" : " or") + " HAZARDS.H_NUMBER like '%" + tbBMchild.Text.Trim() + "%')";
            }
            if (tbBM.Text.Trim() != "" && tbBMchild.Text.Trim() == "")
            {
                strwhere += " and HAZARDS.H_NUMBER like '%" + tbBM.Text.Trim() + "%'";
            }
            if (tbBM.Text.Trim() == "" && tbBMchild.Text.Trim() != "")
            {
                strwhere += " and HAZARDS.H_NUMBER like '%" + tbBMchild.Text.Trim() + "%'";
            }

            if (tbWXY.Text.Trim() != "" && tbWXYchild.Text.Trim() != "")
            {
                strwhere += " and (H_CONTENT like '%" + tbWXY.Text.Trim() + "%'" + (cbbWXYchild.SelectedIndex == 0 ? " and" : " or") + " H_CONTENT like '%" + tbWXYchild.Text.Trim() + "%')";
            }
            if (tbWXY.Text.Trim() != "" && tbWXYchild.Text.Trim() == "")
            {
                strwhere += " and H_CONTENT like '%" + tbWXY.Text.Trim() + "%'";
            }
            if (tbWXY.Text.Trim() == "" && tbWXYchild.Text.Trim() != "")
            {
                strwhere += " and H_CONTENT like '%" + tbWXYchild.Text.Trim() + "%'";
            }

            if (tbHG.Text.Trim() != "" && tbHGchild.Text.Trim() != "")
            {
                strwhere += " and (H_CONSEQUENCES like '%" + tbHG.Text.Trim() + "%'" + (cbbHGchild.SelectedIndex == 0 ? " and" : " or") + " H_CONSEQUENCES like '%" + tbHGchild.Text.Trim() + "%')";
            }
            if (tbHG.Text.Trim() != "" && tbHGchild.Text.Trim() == "")
            {
                strwhere += " and H_CONSEQUENCES like '%" + tbHG.Text.Trim() + "%'";
            }
            if (tbHG.Text.Trim() == "" && tbHGchild.Text.Trim() != "")
            {
                strwhere += " and H_CONSEQUENCES like '%" + tbHGchild.Text.Trim() + "%'";
            }

            ObjectDataSource1.SelectParameters["strWhere"].DefaultValue = strwhere;
            ASPxGridView1.DataSourceID = "ObjectDataSource1";
            ObjectDataSource1.DataBind();
        }
        if (e.Parameter.Trim() == "cs")
        {
            ObjectDataSource1.SelectParameters["strWhere"].DefaultValue = " and M_STANDARDS like '%" + tbCSsearch.Text.Trim() + "%' or M_MEASURES like '%" + tbCSsearch.Text.Trim() + "%'";
            ASPxGridView1.DataSourceID = "ObjectDataSource1";
            ObjectDataSource1.DataBind();
        }
    }
Example #9
0
 protected void cpPopup_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
 {
     ASPxHiddenField1.Set("ID", e.Parameter);
     litText.Text = GetNotes(e.Parameter);
 }