Esempio n. 1
0
    private static void generate_bullets(string _data, BulletedList List_Director_id)
    {
        string[] List_Director = _data.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

        List_Director_id.DataSource = List_Director;
        List_Director_id.DataBind();
    }
    private void DisplayValidationMessage(Exception exception)
    {
        try
        {
            //claer the error message
            this.ClearErrorMessage(divMessage);
            // Create bullet.
            BulletedList error = new BulletedList();
            error.DataTextField = "value";
            error.DataSource    = exception.Data;
            error.DataBind();

            // Display message.
            HtmlGenericControl control = new HtmlGenericControl("span");
            control.InnerText = exception.Message;
            this.divMessage.Style.Add("Display", "block");
            this.divMessage.Controls.Add(control);
            this.divMessage.Controls.Add(error);
            this.UpdatePanel3.Update();

            System.Threading.Thread.Sleep(5000);


            // Show message control.
        }
        catch { throw; }
    }
Esempio n. 3
0
 protected void grdResourceList_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         RequestFR     req        = (RequestFR)ViewState["req"];
         int           resID      = Convert.ToInt32(grdResourceList.DataKeys[e.Row.RowIndex].Value);
         BulletedList  bltoptions = (BulletedList)e.Row.FindControl("bltResOptions");
         OptionHandler opt        = new OptionHandler();
         List <Option> optlist    = opt.GetOptionListByResID(resID);
         bltoptions.DataSource    = optlist;
         bltoptions.DataTextField = "name";
         bltoptions.DataBind();
         GridView grdApprovedRequestList = (GridView)e.Row.FindControl("grdApprovedRequestList");
         approvedreqlist = RequestBussiness.GetRequestListBySessionDate_resID_status(pcal1.Text, resID, 2);
         grdApprovedRequestList.DataSource = approvedreqlist;
         grdApprovedRequestList.DataBind();
         GridView                grdPendingRequestList = (GridView)e.Row.FindControl("grdRequestPendingList");
         List <RequestFR>        perl  = RequestBussiness.GetRequestListBySessionDate_resID_status(pcal1.Text, resID, 1);
         IEnumerable <RequestFR> perl1 = null;
         //if (perl != null)
         //{
         //    perl1 = perl.Where(item => (item.Sessionstart_time >= req.Sessionstart_time)
         //                            && (item.Sessionstart_time < req.Sessionend_time));
         //}
         grdPendingRequestList.DataSource = perl1;
         grdPendingRequestList.DataBind();
         ViewState.Add("req", req);
     }
 }
Esempio n. 4
0
    private void DisplayOrClearValidationError(Exception exception)
    {
        try
        {
            if (exception == null)
            {
                this.divErrorPanel.InnerHtml = "";
                this.ShowOrHideValidationError(false);
                return;
            }

            // Build error message.
            HtmlGenericControl span = new HtmlGenericControl("span");
            span.InnerHtml = exception.Message;

            BulletedList errors = new BulletedList();
            errors.DataTextField = "Value";
            errors.DataSource    = exception.Data;
            errors.DataBind();

            // Add to error control.
            this.divErrorPanel.Controls.Clear();
            this.divErrorPanel.Controls.Add(span);
            this.divErrorPanel.Controls.Add(errors);

            // Show the control.
            this.ShowOrHideValidationError(true);
        }
        catch { throw; }
    }
Esempio n. 5
0
        private void LoadRowsContents(GridViewRowEventArgs e)
        {
            int           resID      = Convert.ToInt32(grdResourceList.DataKeys[e.Row.RowIndex].Value);
            BulletedList  bltoptions = (BulletedList)e.Row.FindControl("bltResOptions");
            OptionHandler opt        = new OptionHandler();
            List <Option> optlist    = opt.GetOptionListByResID(resID);

            bltoptions.DataSource    = optlist;
            bltoptions.DataTextField = "name";
            bltoptions.DataBind();

            RequestHandler reqH = new RequestHandler();
            GridView       grdRequestsPerResource = (GridView)e.Row.FindControl("grdRequestsPerResource");
            //DataTable reqList = reqH.GetRequestListBySessionDateResID(pcal1.Text, resID);
            DataTable reqList1 = reqH.GetRequestListBySessionDateResID1(pcal1.Text, resID);

            if (cbNotShowEmpty.Checked == true)
            {
                if (reqList1 != null)
                {
                    grdRequestsPerResource.DataSource = reqList1;
                    grdRequestsPerResource.DataBind();
                }
                else
                {
                    e.Row.Visible = false;
                }
            }
            else
            {
                grdRequestsPerResource.DataSource = reqList1;
                grdRequestsPerResource.DataBind();
            }
        }
    private void DisplayValidationMessage(Exception exception)
    {
        try
        {
            // Create bullet.

            BulletedList error = new BulletedList();
            error.DataTextField = "value";
            error.DataSource    = exception.Data;
            error.DataBind();

            // Display message.
            HtmlGenericControl control = new HtmlGenericControl("span");
            control.InnerText = exception.Message;

            this.divMessage.Style.Add("display", "block");
            //this.divMessage.Visible = true;
            this.divMessage.InnerHtml = string.Empty;
            this.divMessage.Controls.Add(control);
            this.divMessage.Controls.Add(error);

            // Show message control.
        }
        catch { throw; }
    }
Esempio n. 7
0
 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         string       username  = GridView1.DataKeys[e.Row.RowIndex].Value.ToString();
         string[]     userRoles = Roles.GetRolesForUser(username);
         BulletedList bl        = (BulletedList)e.Row.FindControl("roleList");
         bl.DataSource = userRoles;
         bl.DataBind();
     }
 }
 public static void LlenaControl(BulletedList control, DataSet dataset, string datatext, string datavalue, bool blanco)
 {
     control.DataSource     = dataset.Tables[0].DefaultView;
     control.DataTextField  = datatext;
     control.DataValueField = datavalue;
     control.DataBind();
     if (blanco)
     {
         control.Items.Add(new ListItem("", "0"));
         control.Items[control.Items.Count - 1].Selected = true;
     }
 }
Esempio n. 9
0
    public void Page_Load()
    {
        copyrightlint.Text  = "&nbsp;&nbsp;&nbsp;Copyright© Teddy Books";
        lblDate.Text        = DateTime.Now.ToLongDateString();
        litBannerTitle.Text = "Teddy book";

        string strSQL = "SELECT ISBN+' ~ '+ book_title +' by '+ book_author AS Name FROM books WHERE book_author LIKE '%Gary Crew%' ORDER BY book_title";

        bl1.DataTextField = "Name";
        bl1.DataSource    = getData(strSQL, "books");
        bl1.DataBind();
    }
Esempio n. 10
0
    protected void gvRolesAndUsers_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            string role = (string)e.Row.DataItem;

            Label roleName = (Label)e.Row.FindControl("roleName");
            roleName.Text = role;

            BulletedList userList = (BulletedList)e.Row.FindControl("userList");
            userList.DataSource = Roles.GetUsersInRole(role);
            userList.DataBind();
        }
    }
Esempio n. 11
0
 protected void grdResourceList_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         int           resID   = Convert.ToInt32(grdResourceList.DataKeys[e.Row.RowIndex].Value);
         OptionHandler opt     = new OptionHandler();
         List <Option> optlist = opt.GetOptionListByResID(resID);
         if (optlist != null)
         {
             BulletedList bltOption = (BulletedList)e.Row.FindControl("bltOption");
             bltOption.DataSource = optlist;
             bltOption.DataBind();
         }
     }
 }
Esempio n. 12
0
        /**
         * Fill data to bulleted list
         * Example:  dataProvider.BULLETED_LIST("select * from Student", "name", "id", BulletedList1);
         */
        public void BULLETED_LIST(string query, string columnTextField, string columnValueField, BulletedList bulletedList, object[] parameter = null)
        {
            SqlConnection con       = null;
            SqlCommand    cmd       = null;
            DataTable     dataTable = new DataTable();

            try
            {
                // clear drop down list
                if (bulletedList.Items.Count > 0)
                {
                    bulletedList.Items.Clear();
                }
                con = new SqlConnection(connStr);
                con.Open();
                cmd = new SqlCommand(query, con);
                if (parameter != null)
                {
                    string[] listParam = query.Split(' ');
                    int      i         = 0;
                    foreach (string item in listParam)
                    {
                        if (item.Contains('@'))
                        {
                            cmd.Parameters.AddWithValue(item, parameter[i]);
                            i++;
                        }
                    }
                }
                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(dataTable);
                bulletedList.DataSource     = dataTable;
                bulletedList.DataTextField  = columnTextField;
                bulletedList.DataValueField = columnValueField;
                bulletedList.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Esempio n. 13
0
 protected void grdResourceList_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         int           resID      = Convert.ToInt32(grdResourceList.DataKeys[e.Row.RowIndex].Value);
         BulletedList  bltoptions = (BulletedList)e.Row.FindControl("bltResOptions");
         OptionHandler opt        = new OptionHandler();
         List <Option> optlist    = opt.GetOptionListByResID(resID);
         bltoptions.DataSource    = optlist;
         bltoptions.DataTextField = "name";
         bltoptions.DataBind();
         GridView grdApprovedRequestList = (GridView)e.Row.FindControl("grdApprovedRequestList");
         grdApprovedRequestList.DataSource = requestBussiness.GetRequestListBySessionDate_resID_status(pcal1.Text, resID, 2);
         grdApprovedRequestList.DataBind();
         GridView grdPendingRequestList = (GridView)e.Row.FindControl("grdRequestPendingList");
         grdPendingRequestList.DataSource = requestBussiness.GetRequestListBySessionDate_resID_status(pcal1.Text, resID, 1);
         grdPendingRequestList.DataBind();
     }
 }
    private void DisplayValidationErrors(Exception exception)
    {
        // Build message.
        HtmlGenericControl span = new HtmlGenericControl("span");

        span.InnerHtml = exception.Message;

        BulletedList list = new BulletedList();

        list.DataTextField = "Value";
        list.DataSource    = exception.Data;
        list.DataBind();

        // Assign to control.
        this.divErrorPanel.Controls.Clear();
        this.divErrorPanel.Controls.Add(span);
        this.divErrorPanel.Controls.Add(list);

        // Show the control.
        this.ShowHideValidationErrorPanel(true);
    }
Esempio n. 15
0
        protected void employeesGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            // For each DataRow in the GridView,
            // programmatically access the BulletedList, filter
            // the DataView based on the GridView row's
            // EmployeeID value and bind the filtered DataView
            // to the BulletedList
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                BulletedList bl = (BulletedList)e.Row.FindControl("bltTerritories");

                territoryData.RowFilter = "ID_Claim = " +
                                          ((DataRowView)e.Row.DataItem)["ID_Claim"].ToString();
                bl.DataSource = territoryData;
                bl.DataBind();
                BulletedList bl2 = (BulletedList)e.Row.FindControl("bltNgayThucHien");
                territoryData2.RowFilter = "ID_Claim = " +
                                           ((DataRowView)e.Row.DataItem)["ID_Claim"].ToString();
                bl2.DataSource = territoryData2;
                bl2.DataBind();
            }
        }
Esempio n. 16
0
 public void CargarHistorialDeUsuario(DTOUsuario user, BulletedList historial)
 {
     cnx.Open();
     try
     {
         cmd             = new SqlCommand();
         cmd.Connection  = cnx;
         cmd.CommandText = "prc_cargar_history";
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@idus", user.Id_u_logueado);
         dt = new DataTable();
         da = new SqlDataAdapter(cmd);
         da.Fill(dt);
         historial.DataTextField = "history";
         historial.DataSource    = dt;
         historial.DataBind();
     }
     catch
     {
     }
     cnx.Close();
 }
Esempio n. 17
0
        protected override void CreateChildControls()
        {
            if (this.WebPartManager.DisplayMode.Name == "Design")
            {
                //this.ChromeType = PartChromeType.TitleOnly;
                this.AllowEdit = true;
            }
            else
            {
                //this.ChromeType = PartChromeType.None;
                this.AllowEdit = false;
            }
            this.AllowHide = false;

            String sID = this.ClientID;

            PlaceHolder displayPh = new PlaceHolder();
            PlaceHolder editPh    = new PlaceHolder();

            displayPh.ID              = "displayPanel";
            displayPh.Visible         = false;
            displayPh.EnableViewState = false;

            editPh.ID              = "editPanel";
            editPh.Visible         = false;
            editPh.EnableViewState = false;

            this.Controls.Add(new LiteralControl("<div class=\"yammerActionWpWrapper\">"));

            //if in edit mode then show edit panel
            if (this.WebPartManager.DisplayMode == System.Web.UI.WebControls.WebParts.WebPartManager.EditDisplayMode ||
                this.WebPartManager.DisplayMode == System.Web.UI.WebControls.WebParts.WebPartManager.DesignDisplayMode)
            {
                /*edit panel*/
                editPh.Controls.Add(new LiteralControl(DrawEditPanel()));
                editPh.Visible = true;

                this.Controls.Add(editPh);
            }             /*end edit panel*/
            else          //display panel
            {
                displayPh.Controls.Add(new LiteralControl(DrawDisplayPanel()));
                displayPh.Visible = true;
                this.Controls.Add(displayPh);
            }             //end display panel


            //messages
            if (errorArray.Count > 0)
            {
                this.Controls.Add(new LiteralControl("<div class=\"yammerEmbedWpMessages\">"));
                BulletedList errors = new BulletedList();
                errors.ID         = "ErrorList";
                errors.DataSource = errorArray;
                errors.DataBind();
                this.Controls.Add(errors);
                this.Controls.Add(new LiteralControl("</div>"));
            }
            //end messages

            this.Controls.Add(new LiteralControl("</div>"));
        }
Esempio n. 18
0
        protected internal override void Render(HtmlTextWriter markupWriter)
        {
            WmlTextWriter writer = (WmlTextWriter)markupWriter;

            String[] errorMessages = null;
            bool     inError       = false;
            bool     enteredStyle  = false;

            if (!Control.Enabled || !Control.Visible || !Control.ShowSummary)
            {
                return;
            }

            errorMessages = Control.GetErrorMessages(out inError);
            if (!inError)
            {
                return;
            }

            if (Control.DisplayMode == ValidationSummaryDisplayMode.SingleParagraph)
            {
                singleParagraph = true;
            }

            if (Control.HeaderText.Length > 0)
            {
                writer.EnterStyle(Control.ControlStyle);
                enteredStyle = true;
                writer.WriteEncodedText(Control.HeaderText);
                WriteSeparator(writer);
            }

            if (!String.IsNullOrEmpty(errorMessages))
            {
                if (!enteredStyle)
                {
                    writer.EnterStyle(Control.ControlStyle);
                    enteredStyle = true;
                }

                if (singleParagraph)
                {
                    foreach (String errorMessage in errorMessages)
                    {
                        Debug.Assert(errorMessage != null && errorMessage.Length > 0, "Bad Error Messages");
                        writer.WriteEncodedText(errorMessage);
                        WriteSeparator(writer);
                    }
                    writer.WriteBreak();
                }
                else
                {
                    ArrayList arr = new ArrayList();
                    foreach (String errorMessage in errorMessages)
                    {
                        Debug.Assert(errorMessage != null && errorMessage.Length > 0, "Bad Error Messages");
                        arr.Add(errorMessage);
                    }

                    bulletedList.DisplayMode = BulletedListDisplayMode.Text;
                    bulletedList.DataSource  = arr;
                    bulletedList.DataBind();

                    RenderChildren(writer);
                }
            }

            if (enteredStyle)
            {
                writer.ExitStyle(Control.ControlStyle);
            }
        }
Esempio n. 19
0
    public static void GetEnumDescriptions <T>(Control ctrl)
    {
        var list = new List <KeyValuePair <Enum, string> >();

        foreach (Enum value in Enum.GetValues(typeof(T)))
        {
            string    description = value.ToString();
            FieldInfo fieldInfo   = value.GetType().GetField(description);
            var       attribute   = fieldInfo.GetCustomAttributes(typeof(DescriptionAttribute), false).First();
            if (attribute != null)
            {
                description = (attribute as DescriptionAttribute).Description;
            }
            list.Add(new KeyValuePair <Enum, string>(value, description));
        }
        if (ctrl is DropDownList)
        {
            DropDownList control = (DropDownList)ctrl;
            control.DataSource     = list;
            control.DataTextField  = "Value";
            control.DataValueField = "Key";
            control.DataBind();
            control.Items.Insert(0, new ListItem("[ Select ]", "0"));
        }
        else if (ctrl is RadioButtonList)
        {
            RadioButtonList control = (RadioButtonList)ctrl;
            control.DataSource     = list;
            control.DataTextField  = "Value";
            control.DataValueField = "Key";
            control.DataBind();
        }
        else if (ctrl is Repeater)
        {
            Repeater control = (Repeater)ctrl;
            control.DataSource = list;
            control.DataBind();
        }
        else if (ctrl is DataList)
        {
            DataList control = (DataList)ctrl;
            control.DataSource = list;
            control.DataBind();
        }
        else if (ctrl is CheckBoxList)
        {
            CheckBoxList control = (CheckBoxList)ctrl;
            control.DataSource     = list;
            control.DataTextField  = "Value";
            control.DataValueField = "Key";
            control.DataBind();
        }
        else if (ctrl is BulletedList)
        {
            BulletedList control = (BulletedList)ctrl;
            control.DataSource     = list;
            control.DataTextField  = "Value";
            control.DataValueField = "Key";
            control.DataBind();
        }
    }