Example #1
0
        private void BindSavedValues()
        {
            using (IDataReader rdr = WebStubs.GetStub(StubID))
            {
                if (rdr.Read())
                {
                    txtTitle.Text = (string)rdr["ToolTip"];
                    txtUrl.Text   = (string)rdr["Url"];
                    txtShort.Text = ((string)rdr["Abbreviation"]).Trim();
                    if ((int)rdr["HasIcon"] != 0)
                    {
                        imgIcon.Src = Page.ResolveUrl("~/Common/WebStub.aspx") + "?StubId=" + StubID;
                        imgIcon.Style["display"]   = "";
                        DeleteIconCheckBox.Visible = true;
                    }
                    else
                    {
                        lblShort.Text              = (string)rdr["Abbreviation"];
                        lblShort.Style["display"]  = "";
                        DeleteIconCheckBox.Visible = false;
                    }

                    if ((bool)rdr["OpenInBrowser"])
                    {
                        lstOpenWindow.SelectedIndex = 0;
                        txtWidth.Enabled            = false;
                        txtHeight.Enabled           = false;
                    }
                    else
                    {
                        lstOpenWindow.SelectedIndex = 1;
                        txtWidth.Enabled            = true;
                        txtHeight.Enabled           = true;
                    }
                    txtWidth.Text  = rdr["Width"].ToString();
                    txtHeight.Text = rdr["Height"].ToString();
                }
            }

            using (IDataReader reader = WebStubs.GetListGroupsByStub(StubID))
            {
                while (reader.Read())
                {
                    lbSelectedGroups.Items.Add(new ListItem(CommonHelper.GetResFileString(reader["GroupName"].ToString()), reader["GroupId"].ToString()));
                }
            }

            for (int i = 0; i < lbSelectedGroups.Items.Count; i++)
            {
                if (lbAvailableGroups.Items.FindByValue(lbSelectedGroups.Items[i].Value) != null)
                {
                    lbAvailableGroups.Items.Remove(lbAvailableGroups.Items.FindByValue(lbSelectedGroups.Items[i].Value));
                }
                iGroups.Value += lbSelectedGroups.Items[i].Value + ",";
            }
        }
Example #2
0
        protected string GetGroups(int StubId)
        {
            StringBuilder sb = new StringBuilder();

            using (IDataReader rdr = WebStubs.GetListGroupsByStub(StubId))
            {
                while (rdr.Read())
                {
                    sb.Append(CommonHelper.GetGroupLink((int)rdr["GroupId"], CommonHelper.GetResFileString((string)rdr["GroupName"])));
                    sb.Append("<br>");
                }
            }
            return(sb.ToString());
        }