Beispiel #1
0
    public void Page_Load()
    {
        try
        {
            if (!IsPostBack)
            {
                ListItemCollection c = new ListItemCollection();
                c.Add(new ListItem("Total Posts", TransitStats.PostsCount.ToString()));
                c.Add(new ListItem("Total Images", TransitStats.ImagesCount.ToString()));
                if (!DisqusEnabled)
                {
                    c.Add(new ListItem("Total Comments", TransitStats.CommentsCount.ToString()));
                }
                if (SessionManager.CountersEnabled)
                {
                    c.Add(new ListItem("Rss Hits", string.Format("{0} since {1}",
                        TransitStats.RssCount.Count, TransitStats.RssCount.Created.ToString("d"))));
                    c.Add(new ListItem("Atom Hits", string.Format("{0} since {1}",
                        TransitStats.AtomCount.Count, TransitStats.AtomCount.Created.ToString("d"))));
                }
                grid.DataSource = c;
                grid.DataBind();

                summaryLinks.Visible = SessionManager.CountersEnabled;
            }
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
Beispiel #2
0
 ComboBoxCell MyDropDown()
 {
     var combo = new ComboBoxCell ();
     var items = new ListItemCollection ();
     items.Add (new ListItem{ Text = "Item 1" });
     items.Add (new ListItem{ Text = "Item 2" });
     items.Add (new ListItem{ Text = "Item 3" });
     items.Add (new ListItem{ Text = "Item 4" });
     combo.DataStore = items;
     return combo;
 }
Beispiel #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                SetDefaultButton(save);

                ListItemCollection intervals = new ListItemCollection();
                intervals.Add(new ListItem("Never", Convert.ToString(-1)));
                intervals.Add(new ListItem("Every Request", Convert.ToString(0)));
                intervals.Add(new ListItem("One Minute", Convert.ToString(60)));
                intervals.Add(new ListItem("Five Minutes", Convert.ToString(5 * 60)));
                intervals.Add(new ListItem("Ten Minutes", Convert.ToString(10 * 60)));
                intervals.Add(new ListItem("Half Hour", Convert.ToString(30 * 60)));
                intervals.Add(new ListItem("One Hour", Convert.ToString(60 * 60)));
                intervals.Add(new ListItem("Twelve Hours", Convert.ToString(12 * 60 * 60)));
                intervals.Add(new ListItem("One Day", Convert.ToString(24 * 60 * 60)));

                inputInterval.DataSource = intervals;
                inputInterval.DataBind();

                inputType.DataSource = Enum.GetValues(typeof(TransitFeedType));
                inputType.DataBind();

                if (RequestId > 0)
                {
                    inputName.Text = Feed.Name;
                    inputUrl.Text = Feed.Url;
                    inputDescription.Text = Feed.Description;
                    inputXsl.PostedFile = new UploadControl.HttpPostedFile(string.IsNullOrEmpty(Feed.Xsl) ? "None" : string.Format("{0} bytes", Feed.Xsl.Length));

                    ListItem li = inputInterval.Items.FindByValue(Feed.Interval.ToString());
                    if (li == null)
                    {
                        li = new ListItem(string.Format("{0} Seconds", Feed.Interval), Feed.Interval.ToString());
                        inputInterval.Items.Add(li);
                    }

                    inputInterval.ClearSelection();
                    li.Selected = true;

                    inputUsername.Text = Feed.Username;
                    inputPassword.Attributes["value"] = Feed.Password;

                    inputType.Items.FindByValue(Feed.Type.ToString()).Selected = true;
                }
            }
        }
        catch (Exception ex)
        {
            ReportException(ex);
        }
    }
 void OnEnable()
 {
     mCollection = new ListItemCollection();
     for (int i = 0; i < 20; i++) {
         mCollection.Add(new LabelListItem("Item " + i.ToString() + " example"));
     }
 }
Beispiel #5
0
    public static ListItemCollection ExecuteSQL(string sql = "", string text = "", string value = "",
        List<SqlParameter> parameters = null)
    {
        ListItemCollection lic = new ListItemCollection(); 
        using (SqlConnection conn = new SqlConnection(Connection))
        {
            conn.Open();
            using (SqlCommand cmd = new SqlCommand(sql, conn))
            {
                if (parameters != null)
                {
                    cmd.Parameters.AddRange(parameters.ToArray());
                }

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        while (reader.Read()) 
                        {
                            lic.Add(new ListItem(reader[text].ToString(),
                                reader[value].ToString()));
                        }
                    }
                }
            }
        }

        return lic; 
    }
Beispiel #6
0
    protected void Add_Click(object sender, EventArgs e)
    {
        ListItemCollection removeList = new ListItemCollection();
        // deselect all items
        foreach (ListItem item in SelectedMembers.Items)
        {
            item.Selected = false;
        }

        for (int i = 0; i < AvailableMembers.Items.Count; i++)
        {
            ListItem li = AvailableMembers.Items[i];
            if (!li.Selected) continue;

            // check to see if user is already selected
            IUserActivity attendee = Activity.Attendees.FindAttendee(li.Value);
            if (attendee != null) continue;

            li.Attributes.Add("style", "color:lightgrey");
            li.Attributes.Add("status", "unconfirmed");
            SelectedMembers.Items.Add(li);
            Activity.Attendees.Add(li.Value);
            removeList.Add(li);
        }

        foreach (ListItem li in removeList)
        {
            AvailableMembers.Items.Remove(li);
        }
    }
Beispiel #7
0
    /// <summary>
    /// Previews the event info entered by the user in a new window.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnPreview_Click(object sender, EventArgs e)
    {
        if (this.IsValid)
        {
            string WebinarRecordingID = CareerCruisingWeb.CCLib.Common.Strings.GetQueryString("WebinarRecordingID");

            // if showing criteria for an existing event
            if (WebinarRecordingID != "")
            {
                ClientScript.RegisterStartupScript(this.Page.GetType(), "New Window", "window.open('../../../Public/Webinars/VideoDetails.aspx?WebinarRecordingID=" + WebinarRecordingID + "','','height=580,width=600,scrollbars=1,resizable=1');", true);
            }
            else
            {
                Session["WebinarVideoDisplayTitle"] = lblDisplayTitle.Text;

                Session["WebinarVideoRegistrationURL"] = CareerCruisingWeb.CCLib.Common.Strings.GenerateHttpLink(txtRegistrationUrl.Text.Trim());

                string commandText = "SELECT Description FROM Webinar_DescriptionsLookup WHERE WebinarDescriptionID = " + ddlListTitle.SelectedValue;
                string webinarDescription = CareerCruisingWeb.CCLib.Common.DataAccess.GetValue(commandText).ToString();
                Session["WebinarVideoDescription"] = webinarDescription;

                Session["WebinarVideoPresenterFullName"] = ddlPresenter.SelectedItem.Text;

                commandText = "SELECT Title, Bio, PhotoImagePath FROM Webinar_PresenterLookup  WHERE WebinarPresenterID = " + ddlPresenter.SelectedValue;
                DataRow presenterInfo = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(commandText).Rows[0];
                Session["WebinarVideoPresenterTitle"] = presenterInfo["Title"].ToString();
                Session["WebinarVideoPresenterBio"] = presenterInfo["Bio"].ToString();
                Session["WebinarVideoPresenterPhotoImagePath"] = presenterInfo["PhotoImagePath"].ToString();
                Session["WebinarVideoRecordingDate"] = DateTime.Parse(txtSessionDates.Text.Trim()).ToString("MM/dd/yyyy");
                commandText = "SELECT wal.WebinarAudienceID, wal.AudienceDescription_EN ";
                commandText += "FROM Webinar_AudienceLookup wal ";
                commandText += "INNER JOIN Webinar_DescriptionsAudience wda ON wal.WebinarAudienceID = wda.WebinarAudienceID ";
                commandText += "WHERE wda.WebinarDescriptionID = " + ddlListTitle.SelectedValue;
                commandText += "GROUP BY wal.AudienceDescription_EN, wal.WebinarAudienceID ";
                commandText += "ORDER BY wal.AudienceDescription_EN";

                DataTable webinarAudience = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(commandText);

                if (webinarAudience.Rows.Count > 0)
                {
                    ListItemCollection collection = new ListItemCollection();

                    foreach (DataRow row in webinarAudience.Rows)
                    {
                        collection.Add(new ListItem(row["AudienceDescription_EN"].ToString()));
                    }

                    Session["WebinarVideoAudienceDescriptionList"] = collection;
                }
                else
                {
                    Session["WebinarVideoAudienceDescriptionList"] = null;
                }

                ClientScript.RegisterStartupScript(this.Page.GetType(), "New Window", "window.open('../../../Public/Webinars/VideoDetails.aspx','','height=580,width=600,scrollbars=1,resizable=1');", true);
            }
        }
    }
        public void AddAddsToExistingGroupIfGroupDoesExist()
        {
            var list = new ListItemCollection<string>();
            list.AddGroup("Hello", new List<string> { "Foo" });

            list.Add("Hello", "Bar");

            list.Should().HaveCount(1);
            list.Should().Contain(g => g.Title == "Hello" && g.Count == 2 &&
                g.Contains("Foo") && g.Contains("Bar"));
        }
        public void AddAddsToNewGroupIfGroupDoesntExist()
        {
            var list = new ListItemCollection<string>();
            list.AddGroup("Hello", new List<string> { "Foo" });

            list.Add("World", "Bar");

            list.Should().HaveCount(2);
            list.Should().Contain(g => g.Title == "Hello" && g.Count == 1 && g[0] == "Foo");
            list.Should().Contain(g => g.Title == "World" && g.Count == 1 && g[0] == "Bar");
        }
    protected void AdAll_Click(object sender, EventArgs e)
    {
        ListItemCollection liC = new ListItemCollection();

        foreach (ListItem li in AvForumsList.Items)
            {
                MdForumsList.Items.Add(li);
                li.Selected = false;
                liC.Add(li);
            }

        foreach (ListItem li in liC)
            AvForumsList.Items.Remove(li);
    }
Beispiel #11
0
 protected void RemoveSelectedFromBasket_ButtonClick(object sender, EventArgs e)
 {
     ListItemCollection ItemsForRemoveActionInBasketListBox = new ListItemCollection();
     foreach (ListItem CurrentItem in this.ListBoxSelectedProducts.Items)
     {
         if (CurrentItem.Selected)
         {
             this.ListBoxProducts.Items.Add(CurrentItem);
             ItemsForRemoveActionInBasketListBox.Add(CurrentItem);
         }
     }
     foreach (ListItem CurrentItem in ItemsForRemoveActionInBasketListBox)
     {
         this.ListBoxSelectedProducts.Items.Remove(CurrentItem);
     }  
 }
    protected void AdAll_Click(object sender, EventArgs e)
    {
        ListItemCollection liC = new ListItemCollection();

        foreach (ListItem li in AvForumsList.Items)
        {
            ArchiveForumsList.Items.Add(li);
            li.Selected = false;
            liC.Add(li);
        }

        foreach (ListItem li in liC)
            AvForumsList.Items.Remove(li);

        ArchiveBtn.Enabled = true;
        Panel2.Visible = false;
    }
    protected void Ad2_Click(object sender, EventArgs e)
    {
        if (AvModsList.SelectedItem != null)
        {
            ListItemCollection liC = new ListItemCollection();

            foreach (ListItem li in AvModsList.Items)
                if (li.Selected)
                {
                    CurModsList.Items.Add(li);
                    li.Selected = false;
                    liC.Add(li);
                }

            foreach (ListItem li in liC)
                AvModsList.Items.Remove(li);

        }
    }
        ObservableCollection<ListItemCollection> SetupList()
        {
            var allListItemGroups = new ObservableCollection<ListItemCollection>();

            foreach (var item in ListItemCollection.GetSortedData())
            {
                // Attempt to find any existing groups where theg group title matches the first char of our ListItem's name.
                var listItemGroup = allListItemGroups.FirstOrDefault(g => g.Title == item.Label);

                // If the list group does not exist, we create it.
                if (listItemGroup == null)
                {
                    listItemGroup = new ListItemCollection(item.Label);
                    listItemGroup.Add(item);
                    allListItemGroups.Add(listItemGroup);
                }
                else
                { // If the group does exist, we simply add the demo to the existing group.
                    listItemGroup.Add(item);
                }
            }
            return allListItemGroups;
        }
Beispiel #15
0
    /// <summary>
    /// Previews the event details entered by the user in a new window.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnPreview_Click(object sender, EventArgs e)
    {
        if (this.IsValid)
        {
            Session["WebinarDisplayTitle"] = txtDisplayTitle.Text.Trim();
            Session["WebinarStartDateTime"] = null;
            Session["WebinarEndDateTime"] = null;
            Session["WebinarRegistrationURL"] = null;
            Session["WebinarDescription"] = txtDescription.Value.Trim().Replace("\n", "<br />");
            Session["WebinarPresenterFullName"] = null;
            Session["WebinarPresenterTitle"] = null;
            Session["WebinarPresenterBio"] = null;
            Session["PresenterPhotoImagePath"] = null;

            if (chkAudiences.SelectedIndex != -1)
            {
                ListItemCollection collection = new ListItemCollection();

                foreach (ListItem item in chkAudiences.Items)
                {
                    if (item.Selected)
                    {
                        collection.Add(item);
                    }
                }

                Session["WebinarAudienceDescriptionList"] = collection;
            }
            else
            {
                Session["WebinarAudienceDescriptionList"] = null;
            }

            // display event details in a new window
            ClientScript.RegisterStartupScript(this.Page.GetType(), "New Window", "window.open('../../../Public/Webinars/SessionDetails.aspx','','height=580,width=600,scrollbars=1,resizable=1');", true);
        }
    }
Beispiel #16
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        var from = Convert.ToSingle(tbPriceFrom.Text);
        var to = Convert.ToSingle(tbPriceTo.Text);
        _products = ProductController.GetByPrice(from, to);

        var options = new ListItemCollection();
        foreach (var productModel in _products)
            options.Add(new ListItem {Text = productModel.Name, Value = productModel.Name});

        ProductDropdown.DataValueField = "Value";
        ProductDropdown.DataTextField = "Text";

        ProductDropdown.DataSource = options;
        ProductDropdown.DataBind();

        // set new variables
        if (_products.Count <= 0) {
            image.ImageUrl = tbPrice.Text = "";
        } else {
            image.ImageUrl = _products[0].ImageName;
            tbPrice.Text = _products[0].Price.ToString();
        }
    }
    protected void Rem1_Click(object sender, EventArgs e)
    {
        ListItemCollection liC = new ListItemCollection();

        foreach (ListItem li in ArchiveForumsList.Items)
            if (li.Selected)
            {
                AvForumsList.Items.Add(li);
                li.Selected = false;
                liC.Add(li);
            }

        foreach (ListItem li in liC)
            ArchiveForumsList.Items.Remove(li);

        if (ArchiveForumsList.Items.Count == 0)
            ArchiveBtn.Enabled = false;

        Panel2.Visible = false;
    }
Beispiel #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DrvQueryHelper.BindDropDownListBustype(this.cbBustype);
            DrvQueryHelper.BindDropDownListSfzmmc(this.cbSfzmmcValue);
            DrvQueryHelper.BindDropDownListHospital(this.cbTjyy);
            ListItemCollection tjyys = new ListItemCollection();
            lbJxmc.Text   = this.Operator.Desp4;
            hidJxdm.Value = this.Operator.Desp3;
            foreach (ListItem li in this.cbTjyy.Items)
            {
                if (li.Value.StartsWith(getDefaultCityCode()))
                {
                    tjyys.Add(li);
                }
            }


            this.cbTjyy.Items.Clear();
            foreach (ListItem li in tjyys)
            {
                this.cbTjyy.Items.Add(li);
            }
            this.cbTjyy.Items.Add(new ListItem("深圳恒生龙安医院", "440300000037"));
            this.cbTjyy.Items.Add(new ListItem("深圳市职业病防治院", "440300000038"));

            DrvQueryHelper.BindDropDownListLocalArea2(this.cbLxzsxzqhValue);
            ListItemCollection xzqhs = new ListItemCollection();
            foreach (ListItem li in this.cbLxzsxzqhValue.Items)
            {
                if (li.Value.StartsWith(getDefaultCityCode()) && li.Value != getDefaultCityCode() + "00")
                {
                    xzqhs.Add(li);
                }
            }
            this.cbXzqhValue.Items.Clear();
            this.cbLxzsxzqhValue.Items.Clear();
            this.cbDjzsxzqhValue.Items.Clear();

            foreach (ListItem li in xzqhs)
            {
                //this.cbXzqhValue.Items.Add(new ListItem(li.Text,li.Value));
                this.cbLxzsxzqhValue.Items.Add(new ListItem(li.Text, li.Value));
                this.cbXzqhValue.Items.Add(new ListItem(li.Text, li.Value));
                this.cbDjzsxzqhValue.Items.Add(new ListItem(li.Text, li.Value));
            }


            DrvQueryHelper.BindDropDownListLy(this.cbLyValue);
            DrvQueryHelper.BindDropDownListZkcx(this.cbZkcxValue);
            DrvQueryHelper.BindDropDownListNational(this.cbGjValue);
            //DrvQueryHelper.BindDropDownListLocalArea(this.cbDjzsxzqhValue);
            //DrvQueryHelper.BindDropDownListLocalArea(this.cbLxzsxzqhValue);
            this.cbGjValue.SelectedValue = "156";
            this.cbDjzsxzqhValue.Items.Add(new ListItem("外地", "000000"));
            if (!string.IsNullOrEmpty(Request.Params["id"]))
            {
                StudentApplyInfo entity = SimpleOrmOperator.Query <StudentApplyInfo>(Convert.ToInt32(Request.Params["id"]));
                WebFormHelper.SetDataToForm(this, entity);
                this.txtTjrq.Value = entity.Tjrq;
                this.txtCsrq.Value = entity.Csrq;
                //this.cbDjzsxzqhValue.Items.Clear();
                //this.cbDjzsxzqhValue.Items.Add(new ListItem(entity.Djzsxzqh, entity.Djzsxzqh));
                //this.cbDjzsxzqhValue.Items.Clear();
                //this.cbDjzsxzqhValue.Text = entity.Djzsxzqh;
                this.imgPhoto.ImageUrl       = "ApplyInfoPhoto.aspx?idcard=" + entity.Sfzmhm;
                this.cbBustype.SelectedValue = entity.PhotoSrc;
                if (this.cbDjzsxzqhValue.Items.FindByValue(entity.Djzsxzqh) == null)
                {
                    //this.cbDjzsxzqhValue.Items.Add(new ListItem("外地", entity.Lxzsxzqh));
                    this.cbDjzsxzqhValue.SelectedValue = entity.Djzsxzqh;
                }
                else
                {
                }
                this.hidDjzsxzqh.Value = entity.Djzsxzqh;
            }
            else
            {
                this.imgPhoto.ImageUrl = "~/images/no_photo.jpg";
                //this.cbLxzsxzqhValue.SelectedValue = "440500";
                //this.cbXzqhValue.SelectedValue = "440500";
                //this.cbDjzsxzqhValue.SelectedValue = "440500";
                this.txtYsl.Text = "5.0";
                this.txtZsl.Text = "5.0";
                this.cbZkcxValue.SelectedValue = "C1";
                this.txtLxzsyzbm.Text          = "510000";
            }

            if (string.IsNullOrEmpty(Request.Params["allowcheck"]))
            {
                this.btnCheck.Visible      = false;
                this.btnCheckImage.Visible = false;
            }
            else
            {
                this.btnSure.Visible   = false;
                this.cbBustype.Enabled = false;
            }
        }
    }
Beispiel #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (EnableSef)
        {
            MapVariable(Parameters.Get<string>("SEFFolder"), Parameters.Get<string>("SEF_PhotoEdit"), Results);
        }
        else
        {
            BXParamsBag<string> variableAlias = new BXParamsBag<string>();

            variableAlias["PhotoId"] = Parameters.Get<string>("ParamPhoto");

            MapVariable(variableAlias, Results);
        }

        if (PhotoId > 0)
        {
            Photo = BXInfoBlockElementManagerOld.GetById(PhotoId);

            if (BXInfoBlockManagerOld.GetById(Photo.IBlockId).IsUserCanOperate("IBlockModifyElements"))
                CanModify = true;
            else
            {
                IncludeComponentTemplate();
                return;
            }

            Page.Title = Photo.NameRaw;
            int parentSection = Photo.Sections.Count > 0 ? Photo.Sections[0] : 0;
            Albums = new ListItemCollection();
            foreach (BXInfoBlockSectionOld album in BXInfoBlockSectionManagerOld.GetTree(Photo.IBlockId, 0))
            {
                StringBuilder sb = new StringBuilder();
                for (int i = 1; i < album.DepthLevel; i++)
                    sb.Append(" . ");
                sb.Append(album.NameRaw);
                ListItem item = new ListItem(sb.ToString(), album.SectionId.ToString());
                item.Selected = album.SectionId == parentSection;
                Albums.Add(item);
            }

            BackUrl = MakeLink(Parameters.Get<string>("UrlTemplatePhoto", BXConfigurationUtility.Constants.ErrorHref), Results);
        }


        IncludeComponentTemplate();
    }
Beispiel #20
0
        protected override void OnInit(EventArgs e)
        {
            fieldDropdown = new DataField(DataFieldType.DropdownList);
            plhControls.Controls.Add(fieldDropdown);
            fieldDropdown.ID            = "Drop1";
            fieldDropdown.ValueChanged += new EventHandler(fieldDropdown_ValueChanged);

            if (!IsPostBack)
            {
                fieldDropdown.Label = "Drop1";
                ListItemCollection lst = new ListItemCollection();
                lst.Add(new ListItem("texto", "valor"));
                lst.Add(new ListItem("texto", "valor"));
                lst.Add(new ListItem("texto", "valor"));
                fieldDropdown.DataSource     = lst;
                fieldDropdown.AutoPostBack   = true;
                fieldDropdown.DataTextField  = "Text";
                fieldDropdown.DataValueField = "Value";
                fieldDropdown.DataBind();
                fieldDropdown.Value = "Leo3";
            }

            fieldDropdown2 = new DataField(DataFieldType.DropdownList);
            plhControls.Controls.Add(fieldDropdown2);
            fieldDropdown2.ID = "Drop2";

            if (!IsPostBack)
            {
                fieldDropdown2.Label      = "Drop2";
                fieldDropdown2.IsRequired = true;
                ArrayList lst = new ArrayList();
                lst.Add("Vera1");
                lst.Add("Vera2");
                lst.Add("Vera3");
                fieldDropdown2.DataSource = lst;
                fieldDropdown2.DataBind();
            }

            fieldRadiobuttonList = new DataField(DataFieldType.RadioButtonList);
            plhControls.Controls.Add(fieldRadiobuttonList);
            fieldRadiobuttonList.ID = "Rad1";

            if (!IsPostBack)
            {
                fieldRadiobuttonList.Label      = "Rad1";
                fieldRadiobuttonList.IsRequired = true;
                ArrayList lst = new ArrayList();
                lst.Add("Vera1");
                lst.Add("Vera2");
                lst.Add("Vera3");
                fieldRadiobuttonList.DataSource = lst;
                fieldRadiobuttonList.DataBind();
            }

            fieldCheckBoxList = new DataField(DataFieldType.CheckBoxList);
            plhControls.Controls.Add(fieldCheckBoxList);
            fieldCheckBoxList.ID = "Check1";

            if (!IsPostBack)
            {
                fieldCheckBoxList.Label      = "Check1";
                fieldCheckBoxList.IsRequired = true;
                ArrayList lst = new ArrayList();
                lst.Add("Vera1");
                lst.Add("Vera2");
                lst.Add("Vera3");
                fieldCheckBoxList.DataSource = lst;
                fieldCheckBoxList.DataBind();
            }

            fieldLabel = new DataField(DataFieldType.Label);
            plhControls.Controls.Add(fieldLabel);
            fieldLabel.ID = "Label1";

            if (!IsPostBack)
            {
                fieldLabel.Label = "Label1";
                fieldLabel.Value = "This is the label value";
            }

            fieldLink = new DataField(DataFieldType.HyperLink);
            plhControls.Controls.Add(fieldLink);

            fieldLink.Label = "Link1";
            fieldLink.Text  = "This is the link text";
            fieldLink.Value = "http://www.google.com";

            fieldCheckBox = new DataField(DataFieldType.CheckBox);
            plhControls.Controls.Add(fieldCheckBox);
            fieldCheckBox.Label = "CheckBox1";
            fieldCheckBox.Value = true;

            fieldDate = new DataField(DataFieldType.Date);
            plhControls.Controls.Add(fieldDate);
            fieldDate.Label = "Date1";
            fieldDate.Value = DateTime.Today;

            fieldRange = new DataField(DataFieldType.DateRange);
            plhControls.Controls.Add(fieldRange);
            fieldRange.Label     = "DateRange1";
            fieldRange.ValueFrom = DateTime.Today;
            fieldRange.ValueTo   = DateTime.Today.AddDays(123);

            fieldInteger = new DataField(DataFieldType.Number);
            plhControls.Controls.Add(fieldInteger);
            fieldInteger.Label = "Integer1";
            if (!IsPostBack)
            {
                fieldInteger.Value = 20;
            }

            CompareValidator cmp = new CompareValidator();

            cmp.Operator        = ValidationCompareOperator.Equal;
            cmp.ValueToCompare  = "20";
            cmp.ErrorMessage    = "LEO";
            cmp.Text            = "LEO";
            cmp.ValidationGroup = "form";
            fieldInteger.AddValidator(cmp);

            CustomValidator cval = new CustomValidator();

            cval.ID              = "AAAAAAA";
            cval.ServerValidate += new ServerValidateEventHandler(cval_ServerValidate);
            cval.ErrorMessage    = "LEO";
            cval.Text            = "LEO";
            cval.ValidationGroup = "form";
            fieldInteger.AddValidator(cval);

            //CompareValidator cmp = new CompareValidator();
            //cmp.Operator = ValidationCompareOperator.Equal;
            //cmp.ValueToCompare = "20";
            //cmp.ErrorMessage = "LEO";
            //cmp.Text = "LEO";
            //fieldInteger.AddValidator(cmp);

            fieldCurrency = new DataField(DataFieldType.Number);
            plhControls.Controls.Add(fieldCurrency);

            fieldCurrency.NumberType     = DataNumberType.Currency;
            fieldCurrency.CurrencySymbol = "$";
            fieldCurrency.Label          = "Decimal1";
            fieldCurrency.IsRequired     = true;
            fieldCurrency.ReadOnly       = true;
            fieldCurrency.Value          = 19.33;

            fieldEmail = new DataField(DataFieldType.Email);
            plhControls.Controls.Add(fieldEmail);
            fieldEmail.Label   = "Text1";
            fieldEmail.Enabled = false;
            fieldEmail.Value   = "*****@*****.**";

            fieldText = new DataField(DataFieldType.Text);
            plhControls.Controls.Add(fieldText);

            fieldText.ID = "Text1";
            if (!IsPostBack)
            {
                fieldText.Label = "Text1";
                fieldText.Value = "This is a common text field.";
            }

            fieldDropdown3 = new DataField(DataFieldType.DropdownList);
            plhControls.Controls.Add(fieldDropdown3);
            fieldDropdown3.ID            = "Drop2M";
            fieldDropdown3.ValueChanged += new EventHandler(fieldDropdown_ValueChanged);

            if (!IsPostBack)
            {
                fieldDropdown3.Label      = "Drop2M";
                fieldDropdown3.IsRequired = true;
                ListItemCollection lst = new ListItemCollection();
                lst.Add(new ListItem("texto", "valor"));
                lst.Add(new ListItem("texto", "valor"));
                lst.Add(new ListItem("texto", "valor"));
                fieldDropdown3.DataSource     = lst;
                fieldDropdown3.AutoPostBack   = true;
                fieldDropdown3.DataTextField  = "Text";
                fieldDropdown3.DataValueField = "Value";
                fieldDropdown3.DataBind();
                //fieldDropdown.Value = "Leo3";
            }

            fieldLongText = new DataField(DataFieldType.LongText);
            plhControls.Controls.Add(fieldLongText);
            fieldLongText.Label = "Text1";
            fieldLongText.Value = "This is a common text area field.";

            fieldHtml = new DataField(DataFieldType.HtmlEditor);
            plhControls.Controls.Add(fieldHtml);
            fieldHtml.Label = "Text1";
            fieldHtml.Value = "This is a HTML <b>enabled</b> field common text area field. Requeries tinyMce installed.";

            base.OnInit(e);
        }
    /// <summary>
    /// Loads control.
    /// </summary>
    private void LoadControl()
    {
        // Get all product categories with options which are already in variants
        if (VariantCategoriesOptions.Count == 0)
        {
            DataSet variantCategoriesDS = VariantHelper.GetProductVariantsCategories(ProductID);
            FillCategoriesOptionsDictionary(VariantCategoriesOptions, variantCategoriesDS);
        }

        // Get all product attribute categories with options
        if (AllCategoriesOptions.Count == 0)
        {
            DataSet allCategoriesDS = OptionCategoryInfoProvider.GetProductOptionCategories(ProductID, true, OptionCategoryTypeEnum.Attribute);
            FillCategoriesOptionsDictionary(AllCategoriesOptions, allCategoriesDS);
        }

        foreach (KeyValuePair <OptionCategoryInfo, List <SKUInfo> > keyValuePair in AllCategoriesOptions)
        {
            if (keyValuePair.Value.Count > 0)
            {
                OptionCategoryInfo optionCategory = keyValuePair.Key;

                // Create new instance of CheckBoxWithDropDown control and prefill all necessary values
                CheckBoxWithDropDown checkBoxWithDropDown = new CheckBoxWithDropDown();
                checkBoxWithDropDown.ID    = ValidationHelper.GetString(optionCategory.CategoryID, string.Empty);
                checkBoxWithDropDown.Value = optionCategory.CategoryID;
                // Use live site display name instead of category display name in case it is available
                checkBoxWithDropDown.CheckboxText = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(optionCategory.CategoryTitle));

                // Attach listeners
                checkBoxWithDropDown.OnCheckBoxSelectionChanged += checkBoxWithDropDown_OnCheckBoxSelectionChanged;
                checkBoxWithDropDown.OnDropDownSelectionChanged += checkBoxWithDropDown_OnDropDownSelectionChanged;

                // Option category is in variants too
                if (VariantCategoriesOptions.Keys.Any(c => ValidationHelper.GetInteger(c["categoryId"], 0) == optionCategory.CategoryID))
                {
                    // Check and disable checkbox
                    checkBoxWithDropDown.CheckboxChecked = true;
                    checkBoxWithDropDown.Enabled         = false;

                    // Already existing variants add to selected categories too
                    if (!SelectedCategories.ContainsKey(optionCategory.CategoryID))
                    {
                        SelectedCategories.Add(optionCategory.CategoryID, VariantOptionInfo.ExistingSelectedOption);
                    }
                }
                // Option category is not in variant, but some categories in variants already exists
                else if (VariantCategoriesOptions.Count > 0)
                {
                    // Set prompt message and visibility
                    checkBoxWithDropDown.DropDownPrompt  = GetString("general.pleaseselect");
                    checkBoxWithDropDown.DropDownLabel   = GetString("com.variants.dropdownlabel");
                    checkBoxWithDropDown.DropDownVisible = true;

                    // Get all product options and bind them to dropdownlist
                    var options       = SKUInfoProvider.GetSKUOptionsForProduct(ProductID, optionCategory.CategoryID, true).OrderBy("SKUOrder");
                    var dropDownItems = new ListItemCollection();

                    foreach (var option in options)
                    {
                        dropDownItems.Add(new ListItem(option.SKUName, option.SKUID.ToString()));
                    }

                    checkBoxWithDropDown.DropDownItems = dropDownItems;
                }

                // Finally bind this control to parent
                chboxPanel.Controls.Add(checkBoxWithDropDown);
            }
        }
    }
Beispiel #22
0
    protected void PreviewEvent(object sender, EventArgs e)
    {
        string webinarID = ((LinkButton)sender).CommandArgument;

        string commandText = "SELECT wdl.WebinarDescriptionID, wdl.DisplayTitle, ww.StartDateTime, ww.EndDateTime, ww.URL, wdl.Description, wpl.FullName, wpl.Title, wpl.Bio, wpl.PhotoImagePath ";
        commandText += "FROM Webinar_DescriptionsLookup wdl ";
        commandText += "INNER JOIN Webinar_Webinars ww ON wdl.WebinarDescriptionID = ww.WebinarDescriptionID ";
        commandText += "INNER JOIN Webinar_SessionTypeLookup wsl ON wdl.WebinarSessionTypeID = wsl.WebinarSessionTypeID ";
        commandText += "INNER JOIN Webinar_PresenterLookup wpl ON ww.WebinarPresenterID = wpl.WebinarPresenterID ";
        commandText += "WHERE ww.WebinarID = " + webinarID;

        DataRow webinarPreviewInfo = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(commandText).Rows[0];

        Session["WebinarDisplayTitle"] = webinarPreviewInfo["DisplayTitle"].ToString();
        Session["WebinarStartDateTime"] = DateTime.Parse(webinarPreviewInfo["StartDateTime"].ToString());
        Session["WebinarEndDateTime"] = DateTime.Parse(webinarPreviewInfo["EndDateTime"].ToString());
        Session["WebinarRegistrationURL"] = webinarPreviewInfo["URL"].ToString();
        Session["WebinarDescription"] = webinarPreviewInfo["Description"].ToString();
        Session["WebinarPresenterFullName"] = webinarPreviewInfo["FullName"].ToString();
        Session["WebinarPresenterTitle"] = webinarPreviewInfo["Title"].ToString();
        Session["WebinarPresenterBio"] = webinarPreviewInfo["Bio"].ToString();
        Session["PresenterPhotoImagePath"] = webinarPreviewInfo["PhotoImagePath"].ToString();

        commandText = "SELECT wal.WebinarAudienceID, wal.AudienceDescription_EN ";
        commandText += "FROM Webinar_AudienceLookup wal ";
        commandText += "INNER JOIN Webinar_DescriptionsAudience wda ON wal.WebinarAudienceID = wda.WebinarAudienceID ";
        commandText += "WHERE wda.WebinarDescriptionID = " + webinarPreviewInfo["WebinarDescriptionID"].ToString();
        commandText += "GROUP BY wal.AudienceDescription_EN, wal.WebinarAudienceID ";
        commandText += "ORDER BY wal.AudienceDescription_EN";

        DataTable webinarAudience = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(commandText);

        if (webinarAudience.Rows.Count > 0)
        {
            ListItemCollection collection = new ListItemCollection();

            foreach (DataRow row in webinarAudience.Rows)
            {
                collection.Add(new ListItem(row["AudienceDescription_EN"].ToString()));
            }

            Session["WebinarAudienceDescriptionList"] = collection;
        }
        else
        {
            Session["WebinarAudienceDescriptionList"] = null;
        }

        ClientScript.RegisterStartupScript(this.Page.GetType(), "New Window", "window.open('../../../Public/Webinars/SessionDetails.aspx','','height=580,width=600,scrollbars=1,resizable=1');", true);
    }
Beispiel #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Button1.Visible = true;
            //SistemKayit.Visible = true;
            //FaturaAdresEkleme.Visible = true;
            //KayitEdilme.Visible = true;
            //FaturaAdresKayit.Visible = true;
            //Guncelle.Visible = false;
            if (Session["mail"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                WebSitem.Business.Adres gonder = new Business.Adres();
                int id   = int.Parse(Session["musteriid"].ToString());
                var veri = gonder.GetBygonderimadres(id);
                if (!Page.IsPostBack)
                {
                    if (veri != null)
                    {
                        WebSitem.Business.Adres nesne = new WebSitem.Business.Adres();

                        ListItemCollection options = new ListItemCollection();
                        this.dropdownil.DataSource = options;
                        options.Add(new ListItem("Seçiniz", "Seçiniz"));
                        var ilYaz = nesne.IlGetir();
                        for (int i = 0; i < ilYaz.Count; i++)
                        {
                            options.Add(new ListItem(ilYaz[i].ilad, ilYaz[i].ilid.ToString()));
                            this.dropdownil.DataSource = options;
                        }
                        this.dropdownil.DataBind();

                        var gelenil = gonder.iladGetir(int.Parse(veri.ilfkid.ToString()));
                        first_name.Text   = veri.alıcıadı;
                        last_name.Text    = veri.alıcısoyadı;
                        phone_number.Text = veri.alıcıtelefon;
                        address.Text      = veri.gonderimadres1;
                        dropdownil.Items.FindByValue(gelenil.ToString()).Selected = true;
                        dropdownil_SelectedIndexChanged(gelenil, e);
                        Button1.Visible           = false;
                        Guncelle.Visible          = true;
                        FaturaAdres.Visible       = true;
                        FaturaAdresEkleme.Visible = false;
                        FaturaAdresKayit.Visible  = false;
                    }
                    else
                    {
                        WebSitem.Business.Adres nesne = new WebSitem.Business.Adres();

                        ListItemCollection options = new ListItemCollection();
                        this.dropdownil.DataSource = options;
                        options.Add(new ListItem("Seçiniz", "Seçiniz"));
                        var ilYaz = nesne.IlGetir();
                        for (int i = 0; i < ilYaz.Count; i++)
                        {
                            options.Add(new ListItem(ilYaz[i].ilad, ilYaz[i].ilid.ToString()));
                            this.dropdownil.DataSource = options;
                        }
                        this.dropdownil.DataBind();
                    }
                }
            }
        }
Beispiel #24
0
        /// <summary>
        /// Method will loop through the literal controls inside the repeater.
        /// Assign the id value if found the duplicate items
        /// </summary>
        /// <param name="ids">Name of the literal controls who has duplicate values</param>
        public virtual void InitializeDuplicateItems(ArrayList ids)
        {
            if (ids.Count == 0)
            {
                return;
            }

            ArrayList          listOfDups = new ArrayList();
            ListItemCollection itemsList  = new ListItemCollection();
            int index = 0;

            if (ids.Count == 1)
            {
                System.Web.UI.WebControls.Repeater rep = (System.Web.UI.WebControls.Repeater)(BaseClasses.Utils.MiscUtils.FindControlRecursively(this as BaseApplicationTableControl, this.RepeaterName));
                foreach (System.Web.UI.WebControls.RepeaterItem repItem in rep.Items)
                {
                    PrimaryKeyRecord             pkRecord   = ((PrimaryKeyRecord)(this._DataSource[index]));
                    BaseApplicationRecordControl recControl = (BaseApplicationRecordControl)(repItem.FindControl(this.RowName));
                    foreach (System.Web.UI.Control ctrlItem in recControl.Controls)
                    {
                        Literal    ltlCtrl;
                        Label      lblCtrl;
                        LinkButton lbtnCtrl;
                        string     txtValue = "";
                        if (ctrlItem.ID == ids[0].ToString())
                        {
                            if (ctrlItem is System.Web.UI.WebControls.Literal)
                            {
                                ltlCtrl  = (System.Web.UI.WebControls.Literal)(ctrlItem);
                                txtValue = ltlCtrl.Text;
                            }
                            else if (ctrlItem is System.Web.UI.WebControls.Label)
                            {
                                lblCtrl  = (System.Web.UI.WebControls.Label)(ctrlItem);
                                txtValue = lblCtrl.Text;
                            }
                            else if (ctrlItem is System.Web.UI.WebControls.LinkButton)
                            {
                                lbtnCtrl = (System.Web.UI.WebControls.LinkButton)(ctrlItem);
                                txtValue = lbtnCtrl.Text;
                            }

                            if (txtValue != "")
                            {
                                ListItem dupItem = itemsList.FindByText(txtValue);
                                if (dupItem != null)
                                {
                                    listOfDups.Add(dupItem.Text);
                                    dupItem.Text = dupItem.Text + " (ID " + dupItem.Value + ")";
                                }

                                ListItem newItem = new ListItem(txtValue, pkRecord.GetID().ToDisplayString());
                                itemsList.Add(newItem);

                                if (listOfDups.Contains(newItem.Text))
                                {
                                    newItem.Text = newItem.Text + " (ID " + newItem.Value + ")";
                                }
                                break;
                            }
                        }
                    }
                    index++;
                }

                index = 0;
                foreach (System.Web.UI.WebControls.RepeaterItem repItem in rep.Items)
                {
                    BaseApplicationRecordControl recControl = (BaseApplicationRecordControl)(repItem.FindControl(this.RowName));
                    foreach (System.Web.UI.Control ctrlItem in recControl.Controls)
                    {
                        if (ctrlItem.ID == ids[0].ToString())
                        {
                            if (ctrlItem is System.Web.UI.WebControls.Literal && itemsList.Count != 0)
                            {
                                Literal ltCtrl = (System.Web.UI.WebControls.Literal)(ctrlItem);
                                ltCtrl.Text = itemsList[index].Text;
                            }
                            else if (ctrlItem is System.Web.UI.WebControls.Label && itemsList.Count != 0)
                            {
                                Label ltCtrl = (System.Web.UI.WebControls.Label)(ctrlItem);
                                ltCtrl.Text = itemsList[index].Text;
                            }
                            else if (ctrlItem is System.Web.UI.WebControls.LinkButton && itemsList.Count != 0)
                            {
                                LinkButton ltCtrl = (System.Web.UI.WebControls.LinkButton)(ctrlItem);
                                ltCtrl.Text = itemsList[index].Text;
                            }
                        }
                    }
                    index++;
                }
            }
            else if (ids.Count == 2)
            {
                System.Web.UI.WebControls.Repeater rep = (System.Web.UI.WebControls.Repeater)(BaseClasses.Utils.MiscUtils.FindControlRecursively(this as BaseApplicationTableControl, this.RepeaterName));
                foreach (System.Web.UI.WebControls.RepeaterItem repItem in rep.Items)
                {
                    int                          count      = 0;
                    string                       ltText     = "";
                    PrimaryKeyRecord             pkRecord   = ((PrimaryKeyRecord)(this._DataSource[index]));
                    BaseApplicationRecordControl recControl = (BaseApplicationRecordControl)(repItem.FindControl(this.RowName));
                    foreach (System.Web.UI.Control ctrlItem in recControl.Controls)
                    {
                        if (ctrlItem.ID == ids[0].ToString() || ctrlItem.ID == ids[1].ToString())
                        {
                            if (ctrlItem is System.Web.UI.WebControls.Literal)
                            {
                                Literal ltCtrl = (System.Web.UI.WebControls.Literal)(ctrlItem);
                                ltText += ltCtrl.Text;

                                count++;
                            }
                            else if (ctrlItem is System.Web.UI.WebControls.Label)
                            {
                                Label ltCtrl = (System.Web.UI.WebControls.Label)(ctrlItem);
                                ltText += ltCtrl.Text;

                                count++;
                            }
                            else if (ctrlItem is System.Web.UI.WebControls.LinkButton)
                            {
                                LinkButton ltCtrl = (System.Web.UI.WebControls.LinkButton)(ctrlItem);
                                ltText += ltCtrl.Text;

                                count++;
                            }
                        }

                        if (count == ids.Count)
                        {
                            ListItem dupItem = itemsList.FindByText(ltText);
                            if (dupItem != null)
                            {
                                listOfDups.Add(dupItem.Text);
                                dupItem.Text = " (ID " + dupItem.Value + ")";
                            }

                            ListItem newItem = new ListItem(ltText, pkRecord.GetID().ToDisplayString());
                            itemsList.Add(newItem);

                            if (listOfDups.Contains(newItem.Text))
                            {
                                newItem.Text = " (ID " + newItem.Value + ")";
                            }
                            break;
                        }
                    }
                    index++;
                }

                index = 0;
                foreach (System.Web.UI.WebControls.RepeaterItem repItem in rep.Items)
                {
                    BaseApplicationRecordControl recControl = (BaseApplicationRecordControl)(repItem.FindControl(this.RowName));
                    foreach (System.Web.UI.Control ctrlItem in recControl.Controls)
                    {
                        if ((ctrlItem.ID == ids[0].ToString() || ctrlItem.ID == ids[1].ToString()) && itemsList.Count != 0)
                        {
                            if (ctrlItem is System.Web.UI.WebControls.Literal && itemsList[index].Text.Contains(" (ID "))
                            {
                                Literal ltCtrl = (System.Web.UI.WebControls.Literal)(ctrlItem);
                                ltCtrl.Text = ltCtrl.Text + itemsList[index].Text;
                            }
                            else if (ctrlItem is System.Web.UI.WebControls.Label && itemsList[index].Text.Contains(" (ID "))
                            {
                                Label ltCtrl = (System.Web.UI.WebControls.Label)(ctrlItem);
                                ltCtrl.Text = ltCtrl.Text + itemsList[index].Text;
                            }
                            else if (ctrlItem is System.Web.UI.WebControls.LinkButton && itemsList[index].Text.Contains(" (ID "))
                            {
                                LinkButton ltCtrl = (System.Web.UI.WebControls.LinkButton)(ctrlItem);
                                ltCtrl.Text = ltCtrl.Text + itemsList[index].Text;
                            }
                        }
                    }
                    index++;
                }
            }
        }
Beispiel #25
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        if (Page.IsPostBack == false)
        {
            LabelTitre.Text = "Edition d'un StyleWeb";
            if (Request.QueryString["Style"] != null && Request.QueryString["Type"] != null)
            {
                string styleNom = Request.QueryString["Style"].ToString();
                string type     = Request.QueryString["Type"].ToString();
                if (type == TypeStyleWeb.Table)
                {
                    PanelTypeTable.Visible = true;
                }
                string membre = HttpContext.Current.User.Identity.Name;
                styleWebObjet           = XmlStyleWebProvider.GetStyleWeb(membre, styleNom, type);
                primaryStyle            = StyleWeb.StyleWebToStyle(styleWebObjet);
                LabelTitre.Text        += " : " + styleNom + "&nbsp;: " + type;
                LabelApplicable.Visible = styleWebObjet.Applicable == false;
            }

            if (Request.QueryString["ReturnUrl"] != null)
            {
                returnUrl = Request.QueryString["ReturnUrl"].ToString();
            }

            TextBoxPadding.Text     = styleWebObjet.Padding.ToString();
            TextBoxSpacing.Text     = styleWebObjet.Spacing.ToString();
            TextBoxWidth.Text       = /*styleWebObjet.Width == 0 ? "" :*/ styleWebObjet.Width.ToString();
            TextBoxHeight.Text      = /*styleWebObjet.Height == 0 ? "" :*/ styleWebObjet.Height.ToString();
            TextBoxBorderWidth.Text = styleWebObjet.BorderWidth == 0 ? "" : styleWebObjet.BorderWidth.ToString();
            TextBoxFontSize.Text    = styleWebObjet.FontSize.ToString();

            ColorsList colors = new ColorsList();

            DropDownListBorderColor.DataSource = colors;
            DropDownListBorderColor.DataBind();
            if (styleWebObjet.BorderColor != "none")
            {
                TextBoxBorderColor.Text = styleWebObjet.BorderColor;
                DropDownListBorderColor.SelectedValue = ColorTranslator.FromHtml(styleWebObjet.BorderColor).Name;
                ColorPickerBorderColor.SelectedColor  = ColorTranslator.FromHtml(styleWebObjet.BorderColor);
            }

            DropDownListBackColor.DataSource = colors;
            DropDownListBackColor.DataBind();
            if (styleWebObjet.BackColor != "none")
            {
                TextBoxBackColor.Text = styleWebObjet.BackColor;
                DropDownListBackColor.SelectedValue = ColorTranslator.FromHtml(styleWebObjet.BackColor).Name;
                ColorPickerBackColor.SelectedColor  = ColorTranslator.FromHtml(styleWebObjet.BackColor);
            }

            DropDownListForegroundColor.DataSource = colors;
            DropDownListForegroundColor.DataBind();
            if (styleWebObjet.ForeColor != "none")
            {
                TextBoxForegroundColor.Text = styleWebObjet.ForeColor;
                DropDownListForegroundColor.SelectedValue = ColorTranslator.FromHtml(styleWebObjet.ForeColor).Name;
                ColorPickerForegroundColor.SelectedColor  = ColorTranslator.FromHtml(styleWebObjet.ForeColor);
            }

            // Add data to the borderStyleList control.
            ListItemCollection styles = new ListItemCollection();
            Type styleType            = typeof(BorderStyle);
            foreach (string s in Enum.GetNames(styleType))
            {
                styles.Add(s);
            }
            DropDownListBorderStyle.DataSource = styles;
            DropDownListBorderStyle.DataBind();
            DropDownListBorderStyle.SelectedIndex = styleWebObjet.BorderStyle;

            // Add data to the borderWidthList control.
            ListItemCollection widths = new ListItemCollection();
            for (int i = 0; i < 46; i++)
            {
                widths.Add(i.ToString() + "px");
            }
            DropDownListBorderWidthList.DataSource = widths;
            DropDownListBorderWidthList.DataBind();

            // Add data to the fontNameList control.
            ListItemCollection names = new ListItemCollection();
            foreach (FontFamily oneFontFamily in FontFamily.Families)
            {
                names.Add(oneFontFamily.Name);
            }
            DropDownListFontName.DataSource = names;
            DropDownListFontName.DataBind();

            // ca ne marche surement pas
            ListItem li = new ListItem(styleWebObjet.FontName);
            if (DropDownListFontName.Items.Contains(li))
            {
                DropDownListFontName.SelectedValue = styleWebObjet.FontName;
            }

            // Add data to the fontSizeList control.
            ListItemCollection fontSizes = new ListItemCollection();
            fontSizes.Add("Small");
            fontSizes.Add("Medium");
            fontSizes.Add("Large");
            fontSizes.Add("8pt");
            fontSizes.Add("10pt");
            fontSizes.Add("12pt");
            fontSizes.Add("14pt");
            fontSizes.Add("16pt");
            fontSizes.Add("18pt");
            fontSizes.Add("20pt");
            fontSizes.Add("24pt");
            fontSizes.Add("48pt");
            DropDownListFontSize.DataSource = fontSizes;
            DropDownListFontSize.DataBind();

            // Font Style
            ListItemCollection stylesF = new ListItemCollection();
            Type styleTypeF            = typeof(FontStyle);
            foreach (string s in Enum.GetNames(styleTypeF))
            {
                stylesF.Add(s);
            }
            stylesF.Add("Overline");   // qui n'est pas dans FontStyle ???!!
            CheckBoxListFontStyle.DataSource = stylesF;
            CheckBoxListFontStyle.DataBind();

            CheckBoxListFontStyle.Items[1].Selected = styleWebObjet.Bold;
            CheckBoxListFontStyle.Items[2].Selected = styleWebObjet.Italic;
            CheckBoxListFontStyle.Items[3].Selected = styleWebObjet.Underline;
            CheckBoxListFontStyle.Items[4].Selected = styleWebObjet.Strikeout;
            CheckBoxListFontStyle.Items[5].Selected = styleWebObjet.Overline;
        }

        // Construire l'objet a chaque fois
        switch (styleWebObjet.Type)
        {
        case "Label":
            Label lbl = new Label();
            lbl.ID   = "ObjetID";
            lbl.Text = Texte;
            PanelObjet.Controls.Add(lbl);
            break;

        case "TextBox":
            TextBox txb = new TextBox();
            txb.ID   = "ObjetID";
            txb.Text = Texte;
            PanelObjet.Controls.Add(txb);
            break;

        case "RadioButtonList":
            RadioButtonListStyle rbl = new RadioButtonListStyle();
            rbl.ID = "ObjetID";
            rbl.Items.Add("article 1");
            rbl.Items.Add("article 2");
            rbl.Items.Add("article 3");
            PanelObjet.Controls.Add(rbl);
            break;

        case "CheckBoxList":
            CheckBoxListStyle cbl = new CheckBoxListStyle();
            cbl.ID = "ObjetID";
            cbl.Items.Add("article 1");
            cbl.Items.Add("article 2");
            cbl.Items.Add("article 3");
            PanelObjet.Controls.Add(cbl);
            break;

        case "Table":
            Table tbl = new Table();
            if (IsPostBack == false)
            {
                int padding = 0;
                try
                {
                    padding         = int.Parse(styleWebObjet.Padding);
                    tbl.CellPadding = padding;
                }
                catch
                {
                }
                int spacing = 0;
                try
                {
                    spacing         = int.Parse(styleWebObjet.Padding);
                    tbl.CellSpacing = spacing;
                }
                catch
                {
                }
            }
            else
            {
                int padding = 0;
                try
                {
                    padding         = int.Parse(TextBoxPadding.Text);
                    tbl.CellPadding = padding;
                }
                catch
                {
                }
                int spacing = 0;
                try
                {
                    spacing         = int.Parse(TextBoxSpacing.Text);
                    tbl.CellSpacing = spacing;
                }
                catch
                {
                }
            }
            TableRow  row  = new TableRow();
            TableCell cell = new TableCell();
            cell.Controls.Add(new LiteralControl(Texte));
            row.Cells.Add(cell);
            tbl.Rows.Add(row);
            this.Controls.Add(tbl);
            tbl.ID = "ObjetID";
            PanelObjet.Controls.Add(tbl);
            break;
        }

        Page.Form.DefaultButton = ButtonWidthOk.UniqueID; // Pour donner le focus
    }
        public static void LoadForCurItemChuaDuocGiao(ListItemCollection lstItems, ListItem curItem, int idTrungTam, int idPhongBan, int loai, int idDotDanhGia)
        {
            string[] arr      = curItem.Value.Split('_');
            int      curId    = ConvertUtility.ToInt32(arr[0]);
            int      hasChild = ConvertUtility.ToInt32(arr[1]);

            int level = ConvertUtility.ToInt32(curItem.Attributes["Level"]);

            level++;
            DataTable dtCongViec = GetAllByParentIDNew(curId, idTrungTam, idPhongBan, loai, idDotDanhGia);

            if (dtCongViec == null)
            {
                return;
            }
            foreach (DataRow row in dtCongViec.Rows)
            {
                DataTable dtChildLevel = GetAllByParentIDNew(ConvertUtility.ToInt32(row["ID"].ToString()), idTrungTam, idPhongBan, loai, idDotDanhGia);

                //DataTable dt = DotDanhGiaController.GetAllNhanVienTheoCongViec(ConvertUtility.ToInt32(row["ID"].ToString()), idDotDanhGia);
                ListItem item;
                //if (dt != null && dt.Rows.Count > 0 && ConvertUtility.ToInt32(dt.Rows[0][0]) > 0)
                //{

                //    if (dtChildLevel.Rows.Count > 0)
                //    {
                //        //item = new ListItem(MiscUtility.StringIndent(level) + "(" + Math.Round(ConvertUtility.ToDouble(row["TyTrong"].ToString()), 3) + "%) " + row["Ten"].ToString(), row["ID"].ToString() + "_1");
                //        item = new ListItem(MiscUtility.StringIndent(level) + row["Ten"].ToString(), row["ID"].ToString() + "_1");
                //        item.Attributes.Add("Level", level.ToString());
                //        item.Attributes.Add("HasChild", "1");
                //    }
                //    else
                //    {
                //        //item = new ListItem(MiscUtility.StringIndent(level) + "(" + Math.Round(ConvertUtility.ToDouble(row["TyTrong"].ToString()), 3) + "%) " + row["Ten"].ToString(), row["ID"].ToString() + "_0");
                //        item = new ListItem(MiscUtility.StringIndent(level) + row["Ten"].ToString(), row["ID"].ToString() + "_0");
                //        item.Attributes.Add("Level", level.ToString());
                //        item.Attributes.Add("HasChild", "0");
                //    }
                //    lstItems.Add(item);
                //}
                //else
                //{
                if (dtChildLevel.Rows.Count > 0)
                {
                    //item = new ListItem(MiscUtility.StringIndent(level) + "(" + Math.Round(ConvertUtility.ToDouble(row["TyTrong"].ToString()), 3) + "%) " + row["Ten"].ToString(), row["ID"].ToString() + "_1");
                    item = new ListItem(MiscUtility.StringIndent(level) + row["Ten"].ToString(), row["ID"].ToString() + "_1");
                    item.Attributes.Add("Level", level.ToString());
                    item.Attributes.Add("style", "color:red");
                    item.Attributes.Add("HasChild", "1");
                }
                else
                {
                    //item = new ListItem(MiscUtility.StringIndent(level) + "(" + Math.Round(ConvertUtility.ToDouble(row["TyTrong"].ToString()), 3) + "%) " + row["Ten"].ToString(), row["ID"].ToString() + "_0");
                    item = new ListItem(MiscUtility.StringIndent(level) + row["Ten"].ToString(), row["ID"].ToString() + "_0");
                    item.Attributes.Add("Level", level.ToString());
                    //item.Attributes.Add("style", "color:red");
                    item.Attributes.Add("HasChild", "0");
                }
                lstItems.Add(item);
                //}
                LoadForCurItemChuaDuocGiao(lstItems, item, idTrungTam, idPhongBan, loai, idDotDanhGia);
            }
        }
Beispiel #27
0
        private Table BuildItemTemplate(IConfigurationSection section, IBinder binder, FormViewMode mode)
        {
            Table table = new Table();

            table.ID = "table";
            foreach (IConfigurationElement rowElement in section.Elements.Values)
            {
                string[] span = null;
                if (rowElement.Attributes.ContainsKey("span"))
                {
                    span = rowElement.GetAttributeReference("span").Value.ToString().Split(new char[] { ',' });
                }

                string[] rowspan = null;
                if (rowElement.Attributes.ContainsKey("rowspan"))
                {
                    rowspan = rowElement.GetAttributeReference("rowspan").Value.ToString().Split(new char[] { ',' });
                }

                TableRow tr = new TableRow();
                tr.ID = "tr" + table.Rows.Count.ToString();
                int count = 0;
                foreach (IConfigurationElement controlElement in rowElement.Elements.Values)
                {
                    TableCell tc = new TableCell();
                    tc.ID = tr.ID + "tc" + tr.Cells.Count;
                    if (span != null && span.Length > count)
                    {
                        int columnSpan = 1;
                        int.TryParse(span[count], out columnSpan);
                        tc.ColumnSpan = columnSpan;

                        if (rowspan != null && rowspan.Length > count)
                        {
                            int rowSpan = 1;
                            int.TryParse(rowspan[count], out rowSpan);
                            tc.RowSpan = rowSpan;
                        }
                        count++;
                    }
                    string type = null;
                    if (controlElement.Attributes.ContainsKey("type"))
                    {
                        type = controlElement.GetAttributeReference("type").Value.ToString();
                    }
                    if (!String.IsNullOrEmpty(type))
                    {
                        Control cellControl = this.CreateControl(type, mode);
                        cellControl.ID = tc.ID + controlElement.ConfigKey;
                        foreach (IConfigurationElement controlPropertyElement in controlElement.Elements.Values)
                        {
                            string propertyName = controlPropertyElement.GetAttributeReference("member").Value.ToString();
                            if (controlPropertyElement.Attributes.ContainsKey("value"))
                            {
                                ReflectionServices.SetValue(cellControl, propertyName, controlPropertyElement.GetAttributeReference("value").Value);
                            }
                            if (controlPropertyElement.Attributes.ContainsKey("isList") && (bool)controlPropertyElement.GetAttributeReference("isList").Value)
                            {
                                ListItemCollection list = ReflectionServices.ExtractValue(cellControl, propertyName) as ListItemCollection;
                                if (null == list)
                                {
                                    throw new InvalidOperationException(string.Format("Member '{0}' is not a ListItemCollection", propertyName));
                                }
                                if (controlPropertyElement.Attributes.ContainsKey("hasEmpty") && (bool)controlPropertyElement.GetAttributeReference("hasEmpty").Value)
                                {
                                    if (list is ListItemCollection)
                                    {
                                        ((ListItemCollection)list).Add("");
                                    }
                                }
                                foreach (IConfigurationElement listItemElement in controlPropertyElement.Elements.Values)
                                {
                                    list.Add(new ListItem(listItemElement.GetAttributeReference("text").Value.ToString(), listItemElement.GetAttributeReference("value").Value.ToString()));
                                }
                            }
                            if (controlPropertyElement.Attributes.ContainsKey("pull"))
                            {
                                string       pull        = controlPropertyElement.GetAttributeReference("pull").Value.ToString();
                                IBindingItem bindingItem = binder.NewBindingItemInstance();
                                bindingItem.Source         = null;
                                bindingItem.SourceProperty = pull;
                                bindingItem.Target         = cellControl;
                                bindingItem.TargetProperty = propertyName;
                                binder.BindingItems.Add(bindingItem);
                                if (cellControl is BaseDataBoundControl)
                                {
                                    this._boundControls.Add(pull, cellControl);
                                    if (!this._dataSources.ContainsKey(pull))
                                    {
                                        this._dataSources.Add(pull, null);
                                    }
                                }
                            }
                        }
                        tc.Controls.Add(cellControl);
                    }
                    tr.Cells.Add(tc);
                }
                table.Rows.Add(tr);
            }
            return(table);
        }
        protected UIClick Click(UIClick ui)
        {
            String type = this.AsyncDialog("Click", g =>
            {
                UIRadioDialog di = new UIRadioDialog();
                di.Title         = ("关联功能");
                ListItemCollection listItemCollection = di.Options;//new ListItemCollection();
                listItemCollection.Add("连接扫一扫", "Scanning");
                listItemCollection.Add("连接指令", "Setting");
                listItemCollection.Add("连接拨号", "Tel");
                listItemCollection.Add("连接网址", "Url");

                return(di);
            });

            switch (type)
            {
            case "Scanning":
                return(UIClick.Scanning());

            case "Tel":
                return(UIClick.Tel(this.AsyncDialog("Tel", g =>
                {
                    UITextDialog di = new UITextDialog();
                    di.Title = ("拨号号码");
                    return di;
                })));

            case "Url":
                return(UIClick.Url(new Uri(this.AsyncDialog("Url", g =>
                {
                    UITextDialog di = new UITextDialog();
                    di.Title = ("网址地址");
                    return di;
                }))));


            default:
            case "Setting":

                var     c        = UMC.Data.JSON.Deserialize(UMC.Data.JSON.Serialize(ui)) as Hashtable;
                WebMeta settings = this.AsyncDialog(g =>
                {
                    UIFormDialog di = new UIFormDialog();
                    di.Title        = ("功能指令");
                    di.AddText("模块代码", "Model", (String)c["model"]);
                    di.AddText("指令代码", "Command", (String)c["cmd"]);
                    di.AddPrompt("此块内容为专业内容,请由工程师设置");

                    if (c.ContainsKey("send"))
                    {
                        Object send = c["send"];
                        if (send is String)
                        {
                            di.AddText("参数", "Send", (String)send).PlaceHolder("如果没参数,则用none");
                        }
                        else
                        {
                            di.AddText("参数", "Send", UMC.Data.JSON.Serialize(send)).PlaceHolder("如果没参数,则用none");
                        }
                    }
                    else
                    {
                        di.AddText("参数", "Send").PlaceHolder("如果没参数,则用none").NotRequired();
                    }

                    return(di);
                }, "Send");
                UIClick click   = new UIClick();
                String  Model   = settings.Get("Model");
                String  Command = settings.Get("Command");
                String  Send    = settings.Get("Send");
                click.Send(Model, Command);

                if ("none".Equals(Send, StringComparison.CurrentCultureIgnoreCase) == false)
                {
                    if (String.IsNullOrEmpty(Send) == false)
                    {
                        if (Send.StartsWith("{"))
                        {
                            click.Send(UMC.Data.JSON.Deserialize <WebMeta>(Send));
                        }
                        else
                        {
                            click.Send(Send);
                        }
                    }
                }
                return(click);
            }
        }
Beispiel #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        foreach (string colorName in Enum.GetNames(ColorCollection))
        {
            Colors.Add(colorName);
        }

        if (!IsPostBack)
        {
            setdl_item_name();
        }

        div_addnewdata.Visible = false;
        if (Request.QueryString["user"] != null)
        {
            user = Request.QueryString["user"].ToString();
            if (user.Equals("administrator"))
            {
                div_addnewdata.Visible = true;
            }
        }

        string ChartData = "";
        string OneData   = "";

        DateTime toDay      = DateTime.Today;
        DateTime AMonthsAgo = toDay.AddMonths(-1);
        DateTime datecal;

        x_axis = "['";
        for (int a = 1; a <= DateTime.DaysInMonth(AMonthsAgo.Year, AMonthsAgo.Month); a++)
        {
            x_axis += AMonthsAgo.AddDays(a).ToString("yyyy/MM/dd") + "','";
        }
        x_axis = x_axis.Substring(0, x_axis.Length - 3) + "']";

        /* checkBoxList = new CheckBox[]{ cb_1_1_01, cb_1_1_02, cb_1_1_03, cb_1_1_04, cb_1_1_05, cb_1_1_06, cb_1_1_07, cb_1_1_08, cb_1_1_09, cb_1_1_10
         *                           ,cb_1_1_11, cb_1_1_12, cb_1_1_13, cb_1_1_14, cb_1_1_15, cb_1_1_16, cb_1_1_17, cb_1_1_18, cb_1_1_19, cb_1_1_20
         *                           ,cb_1_1_21, cb_1_1_22, cb_1_1_23, cb_1_1_24, cb_1_1_25, cb_1_1_26, cb_1_1_27, cb_1_1_28, cb_1_1_29, cb_1_1_30
         *                           ,cb_1_1_31, cb_1_1_32, cb_1_1_33, cb_1_1_34, cb_1_1_35, cb_1_1_36, cb_1_1_37, cb_1_1_38, cb_1_1_39, cb_1_1_40
         *                           ,cb_1_1_41, cb_1_1_42, cb_1_1_43, cb_1_1_44, cb_1_1_45, cb_1_1_46, cb_1_1_47, cb_1_1_48, cb_1_1_49, cb_1_1_50
         *                           ,cb_1_1_51, cb_1_1_52, cb_1_1_53, cb_1_1_54, cb_1_1_55, cb_1_1_56, cb_1_1_57, cb_1_1_58, cb_1_1_59, cb_1_1_60
         *                           ,cb_1_1_61, cb_1_1_62, cb_1_1_63, cb_1_1_64, cb_1_1_65, cb_1_1_66, cb_1_1_67, cb_1_1_68, cb_1_1_69, cb_1_1_70
         *                           ,cb_1_1_70, cb_1_1_71, cb_1_1_72, 聖光精靈卡};
         * for (int a = 0; a < checkBoxList.Length; a++)
         * {
         *   int average = 0;
         *   if (checkBoxList[a].Checked)
         *   {
         *       DataTable dt_oneData = getOneData_test(checkBoxList[a].Text);
         *       if (dt_oneData.Rows.Count > 0)
         *       {
         *           average = getaverage(dt_oneData);
         *
         *           int rndnum = new Random().Next(0, Colors.Count);
         *           ChartData += "{label: '" + dt_oneData.Rows[0]["item_name"] + "',backgroundColor: '" + Colors[rndnum] + "',borderColor: '" + Colors[rndnum] + "',data:";
         *           OneData = "['";
         *           int dayofmonth = DateTime.DaysInMonth(AMonthsAgo.Year, AMonthsAgo.Month);
         *           for (int b = 0; b < dayofmonth; b++)
         *           {
         *               datecal = AMonthsAgo;
         *               datecal = datecal.AddDays(b);
         *               if (dt_oneData.Rows[0][Int32.Parse(datecal.ToString("dd")) % 31 + 4].ToString().Equals(""))
         *               {
         *                   OneData += average + "','";
         *               }
         *               else
         *               {
         *                   OneData += dt_oneData.Rows[0][Int32.Parse(datecal.ToString("dd")) % 31 + 4] + "','";
         *               }
         *           }
         *           OneData = OneData.Substring(0, OneData.Length - 3) + "']";
         *       }
         *       ChartData += OneData + ",fill: false},";
         *   }
         * }
         * Main_ChartData = ChartData;*/
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DrvQueryHelper.BindDropDownListBustype(this.cbBustype);
            DrvQueryHelper.BindDropDownListSfzmmc(this.cbSfzmmcValue);
            DrvQueryHelper.BindDropDownListHospital(this.cbTjyy);
            ListItemCollection tjyys = new ListItemCollection();
            lbJxmc.Text = this.Operator.Desp4;
            foreach (ListItem li in this.cbTjyy.Items) {
                if (li.Value.StartsWith(getDefaultCityCode())) {
                    tjyys.Add(li);
                }
            }
            this.cbTjyy.Items.Clear();
            foreach (ListItem li in tjyys) {
                this.cbTjyy.Items.Add(li);
            }

            DrvQueryHelper.BindDropDownListLocalArea2(this.cbLxzsxzqhValue);
            ListItemCollection xzqhs = new ListItemCollection();
            foreach (ListItem li in this.cbLxzsxzqhValue.Items)
            {
                if (li.Value.StartsWith(getDefaultCityCode())&&li.Value!=getDefaultCityCode()+"00")
                {
                    xzqhs.Add(li);
                }
            }
            this.cbXzqhValue.Items.Clear();
            this.cbLxzsxzqhValue.Items.Clear();
            foreach (ListItem li in xzqhs)
            {
                //this.cbXzqhValue.Items.Add(new ListItem(li.Text,li.Value));
                this.cbLxzsxzqhValue.Items.Add(new ListItem(li.Text, li.Value));
                this.cbXzqhValue.Items.Add(new ListItem(li.Text, li.Value));
            }
            this.cbXzqhValue.Items.Add(new ListItem("其它(外地)", "440907"));

            DrvQueryHelper.BindDropDownListLy(this.cbLyValue);
            DrvQueryHelper.BindDropDownListZkcx(this.cbZkcxValue);
            DrvQueryHelper.BindDropDownListNational(this.cbGjValue);
            DrvQueryHelper.BindDropDownListLocalArea(this.cbDjzsxzqhValue);
            //DrvQueryHelper.BindDropDownListLocalArea(this.cbLxzsxzqhValue);
            DrvQueryHelper.BindDDLProvince(this.cbLxzsxzqhP);
            DrvQueryHelper.BindDDLProvince(this.cbDjzsxzqhP);
            this.cbGjValue.SelectedValue = "156";

            if (Request.Params["id"] != null)
            {
                StudentApplyInfo entity = SimpleOrmOperator.Query<StudentApplyInfo>(Convert.ToInt32(Request.Params["id"]));
                WebFormHelper.SetDataToForm(this, entity);
                this.txtTjrq.Value = entity.Tjrq;
                this.txtCsrq.Value = entity.Csrq;
                this.cbDjzsxzqhValue.Items.Clear();
                //this.cbDjzsxzqhValue.Items.Add(new ListItem(entity.Djzsxzqh, entity.Djzsxzqh));
                //this.cbDjzsxzqhValue.Items.Clear();
                //this.cbDjzsxzqhValue.Text = entity.Djzsxzqh;
                this.imgPhoto.ImageUrl = "ApplyInfoPhoto.aspx?idcard=" + entity.Sfzmhm;
                this.cbBustype.SelectedValue = entity.PhotoSrc;
                if (!string.IsNullOrEmpty(entity.Lxzsxzqh)) {
                    this.cbLxzsxzqhP.SelectedValue = string.Format("{0}0000",entity.Lxzsxzqh.Substring(0,2));
                    DrvQueryHelper.BindDDLCity(cbLxzsxzqhC, this.cbLxzsxzqhP.SelectedValue);
                    this.cbLxzsxzqhC.SelectedValue = string.Format("{0}00", entity.Lxzsxzqh.Substring(0,4));
                    DrvQueryHelper.BindDDLArea(cbLxzsxzqhValue, this.cbLxzsxzqhC.SelectedValue);
                    this.cbLxzsxzqhValue.SelectedValue = entity.Lxzsxzqh;
                }
                if (!string.IsNullOrEmpty(entity.Djzsxzqh))
                {
                    this.cbDjzsxzqhP.SelectedValue = string.Format("{0}0000", entity.Djzsxzqh.Substring(0, 2));
                    DrvQueryHelper.BindDDLCity(cbDjzsxzqhC, this.cbDjzsxzqhP.SelectedValue);
                    this.cbDjzsxzqhC.SelectedValue = string.Format("{0}00", entity.Djzsxzqh.Substring(0, 4));
                    DrvQueryHelper.BindDDLArea(cbDjzsxzqhValue, this.cbDjzsxzqhC.SelectedValue);
                    this.cbDjzsxzqhValue.SelectedValue = entity.Djzsxzqh;
                }
            }
            else {
                this.imgPhoto.ImageUrl = "~/images/no_photo.jpg";
                //this.cbLxzsxzqhValue.SelectedValue = "440500";
                //this.cbXzqhValue.SelectedValue = "440500";
                //this.cbDjzsxzqhValue.SelectedValue = "440500";

                this.cbLxzsxzqhP.SelectedValue = string.Format("{0}0000",this.getDefaultCityCode().Substring(0, 2));
                DrvQueryHelper.BindDDLCity(cbLxzsxzqhC, this.cbLxzsxzqhP.SelectedValue);
                this.cbLxzsxzqhC.SelectedValue = string.Format("{0}00", this.getDefaultCityCode());
                DrvQueryHelper.BindDDLArea(cbLxzsxzqhValue, this.cbLxzsxzqhC.SelectedValue);

                this.cbDjzsxzqhP.SelectedValue = string.Format("{0}0000", this.getDefaultCityCode().Substring(0, 2));
                DrvQueryHelper.BindDDLCity(cbDjzsxzqhC, this.cbDjzsxzqhP.SelectedValue);
                this.cbDjzsxzqhC.SelectedValue = string.Format("{0}00", this.getDefaultCityCode().Substring(0, 4));
                DrvQueryHelper.BindDDLArea(cbDjzsxzqhValue, this.cbDjzsxzqhC.SelectedValue);

                this.txtYsl.Text="5.0";
                this.txtZsl.Text = "5.0";
                this.cbZkcxValue.SelectedValue = "C1";
                this.txtLxzsyzbm.Text = "510000";
            }

            if (Request.Params["allowcheck"] == null)
            {
                this.btnCheck.Visible = false;
                this.btnCheckImage.Visible = false;
            }
            else {
                this.btnSure.Visible = false;
                this.cbBustype.Enabled = false;
            }

        }
    }
    /// <summary>
    /// Loads control.
    /// </summary>
    private void LoadControl()
    {
        // Get all product categories with options which are already in variants
        if (VariantCategoriesOptions.Count == 0)
        {
            DataSet variantCategoriesDS = VariantHelper.GetProductVariantsCategories(ProductID, false);
            FillCategoriesOptionsDictionary(VariantCategoriesOptions, variantCategoriesDS);
        }

        // Get all product attribute categories with options
        if (AllCategoriesOptions.Count == 0)
        {
            DataSet allCategoriesDS = OptionCategoryInfoProvider.GetProductOptionCategories(ProductID, true, OptionCategoryTypeEnum.Attribute);
            FillCategoriesOptionsDictionary(AllCategoriesOptions, allCategoriesDS);
        }

        foreach (KeyValuePair<OptionCategoryInfo, List<SKUInfo>> keyValuePair in AllCategoriesOptions)
        {
            if (keyValuePair.Value.Count > 0)
            {
                OptionCategoryInfo optionCategory = keyValuePair.Key;

                // Create new instance of CheckBoxWithDropDown control and prefill all necessary values
                CheckBoxWithDropDown checkBoxWithDropDown = new CheckBoxWithDropDown();
                checkBoxWithDropDown.ID = ValidationHelper.GetString(optionCategory.CategoryID, string.Empty);
                checkBoxWithDropDown.Value = optionCategory.CategoryID;
                // Use live site display name instead of category display name in case it is available
                checkBoxWithDropDown.CheckboxText = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(optionCategory.CategoryTitle));

                // Attach listeners
                checkBoxWithDropDown.OnCheckBoxSelectionChanged += checkBoxWithDropDown_OnCheckBoxSelectionChanged;
                checkBoxWithDropDown.OnDropDownSelectionChanged += checkBoxWithDropDown_OnDropDownSelectionChanged;

                // Option category is in variants too
                if (VariantCategoriesOptions.Keys.Any(c => ValidationHelper.GetInteger(c["categoryId"], 0) == optionCategory.CategoryID))
                {
                    // Check and disable checkbox
                    checkBoxWithDropDown.CheckboxChecked = true;
                    checkBoxWithDropDown.Enabled = false;

                    // Already existing variants add to selected categories too
                    if (!SelectedCategories.ContainsKey(optionCategory.CategoryID))
                    {
                        SelectedCategories.Add(optionCategory.CategoryID, VariantOptionInfo.ExistingSelectedOption);
                    }

                }
                // Option category is not in variant, but some categories in variants already exists
                else if (VariantCategoriesOptions.Count > 0)
                {
                    // Set prompt message and visibility
                    checkBoxWithDropDown.DropDownPrompt = GetString("general.pleaseselect");
                    checkBoxWithDropDown.DropDownLabel = GetString("com.variants.dropdownlabel");
                    checkBoxWithDropDown.DropDownVisible = true;

                    // Get all product options and bind them to dropdownlist
                    var options = SKUInfoProvider.GetSKUOptionsForProduct(ProductID, optionCategory.CategoryID, true).OrderBy("SKUOrder");
                    var dropDownItems = new ListItemCollection();

                    foreach (var option in options)
                    {
                        dropDownItems.Add(new ListItem(option.SKUName, option.SKUID.ToString()));
                    }

                    checkBoxWithDropDown.DropDownItems = dropDownItems;
                }

                // Finally bind this control to parent
                chboxPanel.Controls.Add(checkBoxWithDropDown);
            }
        }
    }
Beispiel #32
0
    protected void btnCalPeril_Click(object sender, EventArgs e)
    {
        //  grid1.DataSource = null;
        //   grid1.DataBind();

        grid1.Columns[4].Visible = true;
        grid1.Columns[5].Visible = true;
        grid1.Columns[6].Visible = true;


        if (txtSumInsured.Text != "")
        {
            perilCalculation();

            gettaxrates();
            /****/
            btnCalRatio.Visible = true;


            //disable textboxes for last textboxes
            foreach (GridViewRow grow in grid1.Rows)
            {
                ddlratio = (DropDownList)grow.FindControl("ddlratio");
                ListItemCollection item = new ListItemCollection();
                int val = getpercentage();

                if (val < 0)
                {
                    val = val * (-1);
                }

                for (int i = 0; i <= val; i += 5)
                {
                    //item.Add(new ListItem("10", "10"));
                    item.Add(new ListItem(i.ToString(), i.ToString()));
                }
                foreach (ListItem items in item)
                {
                    ddlratio.Items.Add(items);
                }


                TextBox txtRaito = (TextBox)grow.FindControl("txtratio");


                DropDownList ddlratioMR = (DropDownList)grow.FindControl("ddlratioMR");

                string prdcode = grow.Cells[4].Text; //get product code
                string status  = grow.Cells[5].Text; //get status
                if (status.Equals("Y"))
                {
                    ddlratioMR.Enabled = false;
                    ddlratio.Enabled   = false;
                    txtRaito.Enabled   = false;
                }

                if (prdcode.Equals("NC"))
                {
                    ddlratio.Visible   = true;
                    txtRaito.Visible   = false;
                    ddlratioMR.Visible = false;
                }
                else if (prdcode.Equals("MR"))
                {
                    ddlratio.Visible   = false;
                    txtRaito.Visible   = false;
                    ddlratioMR.Visible = true;
                }
                else
                {
                    ddlratio.Visible   = false;
                    txtRaito.Visible   = true;
                    ddlratioMR.Visible = false;
                }
            }

            grid1.Columns[4].Visible = false;
            grid1.Columns[5].Visible = false;
            grid1.Columns[6].Visible = false;

            btnExportPDF.Visible = true;
            /****/
        }
        else
        {
            //Response.Write("<script>alert('Sum Insured Cannot be Empty');</script>");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Notify", "alert('Sum Insured Cannot be Empty');", true);

            btnExportPDF.Visible = false;
            btnCalRatio.Visible  = false;
        }
    }
    private ListItemCollection GetUnitClassList()
    {
        UnitClassList list = UnitClassList.GetUnitClassList();

        // prepare a collection containing an empty value signifying that no unit class is selected
        ListItemCollection collection = new ListItemCollection();
        foreach (UnitClass item in list)
            collection.Add( new ListItem( item.Name, item.ID.ToString() ) );

        collection.Insert( 0, new ListItem( "DOES NOT APPLY", "0" ) );

        return collection;
    }
Beispiel #34
0
    private void FillLocations(int activityId, int projectId, int locationId)
    {
        ILocationService service = null;

        try
        {
            // Create the service.
            service            = AppService.Create <ILocationService>();
            service.AppManager = this.AppManager;
            // Get all locations (both active and inactive).
            this.mLocation = service.RetrieveByProject(projectId);

            // Filter only active location.
            IEnumerable <Location> list = from item in mLocation
                                          where item.CustomData["IsActive"].ToString() == "True"
                                          select item;

            List <Location> projectLocations = list.ToList <Location>();

            if (activityId != 0)
            {
                // When editing the activity.
                // If current activity location is removed from project location list then
                // we need to show that location also. Otherwise location will not populate in the drop down list.
                // Check whether current activity location is exists in the list.
                Location projectLocation = projectLocations.Where(item => item.Id == locationId).FirstOrDefault();
                // If it is not found then add to list.
                if (projectLocation == null)
                {
                    projectLocations.Add(this.mLocation.Where(item => item.Id == locationId).FirstOrDefault());
                }
            }

            // Bind.
            this.ddlLocationList.Items.Clear();

            // Iterate each location.
            ListItemCollection items = this.ddlLocationList.Items;
            //ddlLocationList.DataValueField="id";
            //ddlLocationList.DataTextField = "City";
            //ddlLocationList.DataSource = projectLocations;
            //ddlLocationList.DataBind();
            foreach (Location item in projectLocations)
            {
                if (item != null)
                {
                    items.Add(new ListItem(item.ToString(), item.Id.ToString()));
                }
            }

            // Add default item.
            this.ddlLocationList.Items.Insert(0, new ListItem("-- Select --", "0"));

            if (activityId == 0)
            {
                // Select first item as default.
                if (this.ddlLocationList.Items.Count > 0)
                {
                    this.ddlLocationList.SelectedIndex = 0;
                }
                if (this.ddlLocationList.Items.Count == 2)
                {
                    this.ddlLocationList.SelectedIndex = 1;
                    ChangeLocation();
                }
            }
            else
            {
                ddlLocationList.SelectedValue = locationId.ToString();
            }
        }
        catch { throw; }
        finally
        {
            if (service != null)
            {
                service.Dispose();
            }
        }
    }
Beispiel #35
0
    protected void OnItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            string ide;
            ide = (e.Item.FindControl("hfCustomerId") as HiddenField).Value;

            if (string.IsNullOrWhiteSpace(ide))
            {
                ide = (e.Item.FindControl("hfCustomerId1") as HiddenField).Value;
            }
            Session["ide"] = ide;
            DataTable          ds         = new DataTable();
            DataTable          ds1        = new DataTable();
            Panel              panel1     = e.Item.FindControl("Panel1") as Panel;
            DropDownList       ddl_select = e.Item.FindControl("ddl_select") as DropDownList;
            ListItemCollection collection = new ListItemCollection();

            collection.Add(new ListItem("Select"));

            ds1 = db.GetGrid(Convert.ToInt16(ide));
            if (ds1.Rows[0]["neck"].ToString() == "neck")
            {
                try
                {
                    string name = "neck";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvneck = e.Item.FindControl("gvneck") as GridView;
                    gvneck.BorderWidth = 2;
                    gvneck.DataSource  = ds;
                    gvneck.Font.Size   = 8;
                    gvneck.Visible     = false;
                    gvneck.DataBind();
                    collection.Add(new ListItem("Neck"));
                    bindedit(gvneck);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["MidBack"].ToString() == "MidBack")
            {
                try
                {
                    string name = "MidBack";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvmidback = e.Item.FindControl("gvmidback") as GridView;
                    gvmidback.BorderWidth = 2;
                    gvmidback.DataSource  = ds;
                    gvmidback.Font.Size   = 8;
                    gvmidback.Visible     = false;
                    gvmidback.DataBind();
                    collection.Add(new ListItem("Midback"));
                    bindedit(gvmidback);
                    ds.Clear();
                }
                catch (Exception ex)
                {
                }
            }
            if (ds1.Rows[0]["LowBack"].ToString() == "LowBack")
            {
                try
                {
                    string name = "LowBack";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvlowback = e.Item.FindControl("gvlowback") as GridView;
                    gvlowback.BorderWidth = 2;
                    gvlowback.DataSource  = ds;
                    gvlowback.Font.Size   = 8;
                    gvlowback.Visible     = false;
                    gvlowback.DataBind();
                    collection.Add(new ListItem("LowBack"));
                    bindedit(gvlowback);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["Shoulder"].ToString() == "Shoulder")
            {
                try
                {
                    string name = "Shoulder";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvshoulder = e.Item.FindControl("gvshoulder") as GridView;
                    gvshoulder.BorderWidth = 2;
                    gvshoulder.DataSource  = ds;
                    gvshoulder.Font.Size   = 8;
                    gvshoulder.Visible     = false;
                    gvshoulder.DataBind();
                    collection.Add(new ListItem("Shoulder"));
                    bindedit(gvshoulder);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["knee"].ToString() == "knee")
            {
                try
                {
                    string name = "knee";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvknee = e.Item.FindControl("gvknee") as GridView;
                    gvknee.BorderWidth = 2;
                    gvknee.DataSource  = ds;
                    gvknee.Font.Size   = 8;
                    gvknee.Visible     = false;
                    gvknee.DataBind();
                    collection.Add(new ListItem("knee"));
                    bindedit(gvknee);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["elbow"].ToString() == "elbow")
            {
                try
                {
                    string name = "elbow";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvelbow = e.Item.FindControl("gvelbow") as GridView;
                    gvelbow.BorderWidth = 2;
                    gvelbow.DataSource  = ds;
                    gvelbow.Font.Size   = 8;
                    gvelbow.DataBind();
                    gvelbow.Visible = false;
                    collection.Add(new ListItem("elbow"));
                    bindedit(gvelbow);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["wrist"].ToString() == "wrist")
            {
                try
                {
                    string name = "wrist";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvwrist = e.Item.FindControl("gvwrist") as GridView;
                    gvwrist.BorderWidth = 2;
                    gvwrist.DataSource  = ds;
                    gvwrist.Font.Size   = 8;
                    gvwrist.Visible     = false;
                    gvwrist.DataBind();
                    collection.Add(new ListItem("wrist"));
                    bindedit(gvwrist);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["hip"].ToString() == "hip")
            {
                try
                {
                    string name = "hip";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvhip = e.Item.FindControl("gvhip") as GridView;
                    gvhip.BorderWidth = 2;
                    gvhip.DataSource  = ds;
                    gvhip.Font.Size   = 8;
                    gvhip.Visible     = false;
                    gvhip.DataBind();
                    collection.Add(new ListItem("hip"));
                    bindedit(gvhip);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            if (ds1.Rows[0]["ankle"].ToString() == "ankle")
            {
                try
                {
                    string name = "ankle";
                    string id   = Convert.ToString(ide);
                    ds = db.GetGriddata(name);
                    GridView gvankle = e.Item.FindControl("gvankle") as GridView;
                    gvankle.BorderWidth = 2;
                    gvankle.DataSource  = ds;
                    gvankle.Font.Size   = 8;
                    gvankle.Visible     = false;
                    gvankle.DataBind();
                    collection.Add(new ListItem("ankle"));
                    bindedit(gvankle);
                    ds.Clear();
                }
                catch (Exception ex)
                { }
            }
            ddl_select.DataSource = collection;
            ddl_select.DataBind();
        }
    }
Beispiel #36
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _connString       = ConfigurationManager.ConnectionStrings["SSSDbConnDev"].ConnectionString;
        Common.ConnString = _connString;

        if (!string.IsNullOrEmpty(Common.Show_Entry_Class_ID))
        {
            Show_Entry_Class_ID = Common.Show_Entry_Class_ID;
        }

        if (!string.IsNullOrEmpty(Common.Club_ID))
        {
            Club_ID                = Common.Club_ID;
            divGetClub.Visible     = false;
            divClubDetails.Visible = true;
        }
        else
        {
            divGetClub.Visible     = true;
            divClubDetails.Visible = false;
        }

        if (!string.IsNullOrEmpty(Common.Show_ID))
        {
            Show_ID                = Common.Show_ID;
            divGetShow.Visible     = false;
            divShowDetails.Visible = true;
        }
        else
        {
            divGetShow.Visible     = true;
            divShowDetails.Visible = false;
        }

        if (!string.IsNullOrEmpty(Common.Class_Name_ID))
        {
            Class_Name_ID = Common.Class_Name_ID;
            lstClassNames.SelectedValue = Class_Name_ID;
        }
        if (!string.IsNullOrEmpty(Common.Class_No))
        {
            Class_No        = Common.Class_No;
            txtClassNo.Text = Class_No;
        }
        if (string.IsNullOrEmpty(Common.Class_Gender))
        {
            Class_Gender = Common.Class_Gender;
            lstClassGender.SelectedValue = Class_Gender;
        }

        if (!string.IsNullOrEmpty(Club_ID))
        {
            PopulateClub(Club_ID);
        }
        if (!string.IsNullOrEmpty(Show_ID))
        {
            PopulateShow(Show_ID);
            PopulateClassGridview(Show_ID);
        }
        if (!Page.IsPostBack)
        {
            string returnChars = Request.QueryString["return"];
            btnReturn.PostBackUrl = Common.ReturnPath(Request.QueryString, returnChars, null);

            // Populate the ShowType listbox
            ClassNames        classNames = new ClassNames(_connString);
            List <ClassNames> lkpClassNames;
            lkpClassNames            = classNames.GetClass_Names();
            lstClassNames.DataSource = lkpClassNames;
            lstClassNames.DataBind();
            // Populate the ClassGender ListBox
            ListItemCollection classGenderList = new ListItemCollection();
            ListItem           classGenderNS   = new ListItem("Please Select...", Constants.CLASS_GENDER_NS.ToString());
            classGenderList.Add(classGenderNS);
            ListItem classGenderDB = new ListItem("Dog & Bitch", Constants.CLASS_GENDER_DB.ToString());
            classGenderList.Add(classGenderDB);
            ListItem classGenderD = new ListItem("Dog", Constants.CLASS_GENDER_D.ToString());
            classGenderList.Add(classGenderD);
            ListItem classGenderB = new ListItem("Bitch", Constants.CLASS_GENDER_B.ToString());
            classGenderList.Add(classGenderB);
            lstClassGender.DataSource = classGenderList;
            lstClassGender.DataBind();
        }
    }
        public new void DataBind()
        {
            string text = this.OrderGateWay.ToNullString().ToLower();

            base.ClientIDMode = ClientIDMode.Static;
            this.Items.Clear();
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (this.AllowNull)
            {
                base.Items.Add(new ListItem(this.NullToDisplay, string.Empty));
            }
            bool flag = false;

            if (TradeHelper.AllowRefundGateway.Contains(text) && this.BalanceAmount <= decimal.Zero)
            {
                flag = true;
                if ((text == "hishop.plugins.payment.wxqrcode.wxqrcoderequest" || text == "hishop.plugins.payment.weixinrequest") && (string.IsNullOrEmpty(masterSettings.WeixinCertPath) || string.IsNullOrEmpty(masterSettings.WeixinCertPassword)))
                {
                    flag = false;
                }
                if (text == "hishop.plugins.payment.wxappletpay" && (string.IsNullOrEmpty(masterSettings.WxApplectPayCert) || string.IsNullOrEmpty(masterSettings.WxApplectPayCertPassword)))
                {
                    flag = false;
                }
                if (text == "hishop.plugins.payment.appwxrequest")
                {
                    string appWxMchId = masterSettings.AppWxMchId;
                    string b          = string.IsNullOrEmpty(masterSettings.Main_Mch_ID) ? masterSettings.WeixinPartnerID : masterSettings.Main_Mch_ID;
                    if (string.IsNullOrEmpty(masterSettings.AppWxCertPath) || string.IsNullOrEmpty(masterSettings.AppWxCertPass) || (appWxMchId == b && (string.IsNullOrEmpty(masterSettings.WeixinCertPath) || string.IsNullOrEmpty(masterSettings.WeixinCertPassword))))
                    {
                        flag = false;
                    }
                }
            }
            int num;

            if (text.ToLower() == "hishop.plugins.payment.cashreceipts")
            {
                ListItemCollection items           = base.Items;
                string             enumDescription = EnumDescription.GetEnumDescription((Enum)(object)RefundTypes.ReturnOnStore, 0);
                num = 4;
                items.Add(new ListItem(enumDescription, num.ToString()));
            }
            else
            {
                foreach (RefundTypes value in Enum.GetValues(typeof(RefundTypes)))
                {
                    if (value != RefundTypes.BackReturn && value != RefundTypes.ReturnOnStore)
                    {
                        ListItemCollection items2           = base.Items;
                        string             enumDescription2 = EnumDescription.GetEnumDescription((Enum)(object)value, 0);
                        num = (int)value;
                        items2.Add(new ListItem(enumDescription2, num.ToString()));
                    }
                    else
                    {
                        int num2;
                        switch (value)
                        {
                        case RefundTypes.BackReturn:
                            if (flag)
                            {
                                ListItemCollection items4           = base.Items;
                                string             enumDescription4 = EnumDescription.GetEnumDescription((Enum)(object)value, 0);
                                num = (int)value;
                                items4.Add(new ListItem(enumDescription4, num.ToString()));
                            }
                            break;

                        case RefundTypes.InBankCard:
                            num2 = ((this.BalanceAmount <= decimal.Zero) ? 1 : 0);
                            goto IL_028b;

                        default:
                        {
                            num2 = 0;
                            goto IL_028b;
                        }
IL_028b:
                            if (num2 != 0)
                            {
                                ListItemCollection items3           = base.Items;
                                string             enumDescription3 = EnumDescription.GetEnumDescription((Enum)(object)value, 0);
                                num = (int)value;
                                items3.Add(new ListItem(enumDescription3, num.ToString()));
                            }
                            break;
                        }
                    }
                }
            }
        }
Beispiel #38
0
        protected override void OnDataBinding(EventArgs e)
        {
            base.OnDataBinding(e);

            /* Make sure Items has been initialised */
            ListItemCollection listitems = Items;

            listitems.Clear();

            IEnumerable list = GetData();

            if (list == null)
            {
                return;
            }

            foreach (object container in list)
            {
                string text  = null;
                string value = null;

                if (DataTextField == String.Empty &&
                    DataValueField == String.Empty)
                {
                    text  = container.ToString();
                    value = text;
                }
                else
                {
                    if (DataTextField != String.Empty)
                    {
                        text = DataBinder.Eval(container, DataTextField).ToString();
                    }

                    if (DataValueField != String.Empty)
                    {
                        value = DataBinder.Eval(container, DataValueField).ToString();
                    }
                    else
                    {
                        value = text;
                    }

                    if (text == null &&
                        value != null)
                    {
                        text = value;
                    }
                }

                if (text == null)
                {
                    text = String.Empty;
                }
                if (value == null)
                {
                    value = String.Empty;
                }

                ListItem item = new ListItem(text, value);
                listitems.Add(item);
            }
            RequiresDataBinding = false;
            IsDataBound         = true;
        }
Beispiel #39
0
        /// <summary>
        ///
        ///
        /// </summary>
        private void BindInstructorNavigation()
        {
            //Notes: Set up collection of list items for links

            ListItemCollection navigationList = new ListItemCollection();

            //Notes: set array containing enum of instructor navigation values

            Array navigationValues = Enum.GetValues(typeof(InstructorNavigation));

            //Notes: set local variables

            string instructorIdQueryString = "InstructorId=" + this.InstructorId.ToString();

            if (InstructorId > 0)
            {
                foreach (InstructorNavigation item in navigationValues)
                {
                    if (item != InstructorNavigation.None)
                    {
                        string displayValue = item.ToString().Replace("_", " ");
                        string urlValue     = item.ToString().Replace("_", " ");

                        if (item == this.CurrentNavigationLink)
                        {
                            navigationList.Add(new ListItem {
                                Text = displayValue, Value = "", Enabled = false
                            });
                        }
                        else
                        {
                            navigationList.Add(new ListItem
                            {
                                Text    = displayValue,
                                Value   = "/Admin/InstructorFolder/" + item.ToString() + ".aspx?" + instructorIdQueryString,
                                Enabled = true
                            });
                        }
                    }
                }
            }
            else
            {
                //notes: No InstructorId exists-set all links to inactive iterate over enum
                foreach (InstructorNavigation item in navigationValues)
                {
                    if (item != InstructorNavigation.None)
                    {
                        string displayValue = item.ToString().Replace("_", " ");
                        string urlValue     = item.ToString().Replace("_", " ");

                        switch (item)
                        {
                        case InstructorNavigation.InstructorList:
                        case InstructorNavigation.InstructorForm:

                            navigationList.Add(new ListItem
                            {
                                Text    = displayValue,
                                Value   = "/Admin/InstructorFolder/" + urlValue + ".aspx",
                                Enabled = true
                            });
                            break;

                        default:

                            navigationList.Add(new ListItem
                            {
                                Text    = displayValue,
                                Value   = "/Admin/InstructorFolder/" + urlValue + ".aspx?" + instructorIdQueryString,
                                Enabled = false
                            });
                            break;
                        }
                    }
                }
            }

            //Bind the list objects to front end control

            InstructionNavigationList.DataSource = navigationList;
            InstructionNavigationList.DataBind();
        }
Beispiel #40
0
    protected void Remove_Click(object sender, EventArgs e)
    {
        ListItemCollection removeList = new ListItemCollection();

        // deselect all items
        foreach (ListItem item in AvailableMembers.Items)
        {
            item.Selected = false;
        }

        for (int i = 0; i < SelectedMembers.Items.Count; i++)
        {
            ListItem li = SelectedMembers.Items[i];
            if (!li.Selected) continue;

            UserActivity attendee = Activity.Attendees.FindAttendee(li.Value);
            if (attendee == null) continue;

            foreach (UserActivity ua in Activity.Attendees)
            {
                if (ua.UserId != attendee.UserId) continue;

                Activity.Attendees.Remove(ua.UserId);
                break;
            }
            removeList.Add(li);
            li.Attributes.Clear();
            AvailableMembers.Items.Add(li);
        }

        foreach (ListItem li in removeList)
        {
            SelectedMembers.Items.Remove(li);
        }
    }
Beispiel #41
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            var fields = new ListItemCollection();

            fields = cblAutomatic.Items;

            // Read selected fields
            // Quirk Alert: if we have disabled an item from javascript, it can't be read here on postback.
            // Instead we have to cycle a hidden checkboxlist that contains resource fileds IF chkResource is checked
            foreach (ListItem field in cblFields.Items)
            {
                if (field.Selected && fields.FindByText(field.Text) == null)
                {
                    fields.Add(field);
                }
            }

            // Add all resource fields if chkResource is checked.
            // (Only add if not already in the list)
            if (chkResource.Checked)
            {
                foreach (ListItem resourceField in cblResources.Items)
                {
                    if (fields.FindByText(resourceField.Text) == null)
                    {
                        fields.Add(resourceField);
                    }
                }
            }

            var rb = new EPMLiveCore.ReportHelper.ReportBiz(SPContext.Current.Site.ID);

            if (_existing)
            {
                EPMLiveCore.ReportHelper.ListBiz lb = rb.GetListBiz(_existingListId);
                lb.UpdateListMapping(fields);
            }
            else
            {
                var listId = new Guid(ddlLists.SelectedValue);
                rb.CreateListBiz(listId, fields);
            }

            try
            {
                //FOREIGN IMPLEMENTATION -- START
                var DAO = new EPMLiveCore.ReportHelper.EPMData(SPContext.Current.Site.ID);
                rb.UpdateForeignKeys(DAO);
                DAO.Dispose();
                // -- END
            }
            catch (Exception ex)
            {
                SPSecurity.RunWithElevatedPrivileges(delegate
                {
                    if (!EventLog.SourceExists("EPMLive Reporting - UpdateForeignKeys"))
                    {
                        EventLog.CreateEventSource("EPMLive Reporting - UpdateForeignKeys", "EPM Live");
                    }

                    var myLog = new EventLog("EPM Live", ".", "EPMLive Reporting - UpdateForeignKeys");
                    myLog.MaximumKilobytes = 32768;
                    myLog.WriteEntry(ex.Message + ex.StackTrace, EventLogEntryType.Error, 4001);
                });
            }

            SPUtility.Redirect("epmlive/ListMappings.aspx", SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current);
        }
 /// <summary>
 /// Populates the Status list, adds missing items if not contained in the Target Status picklist, and set the selected value.
 /// </summary>
 /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewRowEventArgs"/> instance containing the event data.</param>
 private void LoadTargetStatusItems(GridViewRowEventArgs e, TargetView target)
 {
     DropDownList statusList = e.Row.FindControl("ddlTargetStatus") as DropDownList;
     statusList.Attributes.Add("onChange", string.Format("javascript:onStatusChange('{0}', '{1}', '{2}', '{3}');",
         statusList.ClientID, txtNewStatusValue.ClientID, cmdStatusChange.ClientID, target.TargetId));
     ListItemCollection listItems = new ListItemCollection();
     foreach (ListItem item in lbxStatus.Items)
         listItems.Add(item);
     if (target != null)
     {
         String value = target.Status;
         ListItem item = listItems.FindByText(value);
         if (item == null)
         {
             item = new ListItem {Text = value};
             listItems.Add(item);
         }
         statusList.DataSource = listItems;
         statusList.SelectedValue = value;
     }
 }
    private ListItemCollection GetParentList()
    {
        CodexRecordList list;
        object businessObject = Session["CurrentObject"];
        if ( businessObject == null || !( businessObject is CodexRecordList ) )
        {
            businessObject = CodexRecordList.GetCodexRecordList();
            Session["CurrentObject"] = businessObject;
        }
        list = (CodexRecordList)businessObject;

        // prepare a collection containing an empty value signifying that no unit class is selected
        ListItemCollection collection = new ListItemCollection();
        foreach ( CodexRecord item in list )
            collection.Add( new ListItem( item.Title, item.ID.ToString() ) );

        collection.Insert( 0, new ListItem( "***ROOT***", "0" ) );

        return collection;
    }
Beispiel #44
0
 public static void Add(this ListItemCollection items, string text, string id)
 {
     items.Add(new ListItem(text, id));
 }
Beispiel #45
0
	public void buildListBox(ListItemCollection Items,string[] values, string CustomInitialDisplayValue,string CustomInitialSubmitValue)
	{	
		Items.Clear();
		if(CustomInitialDisplayValue!=null) Items.Add(new ListItem(CustomInitialDisplayValue,CustomInitialSubmitValue));
		for(int i=0;i<values.Length;i+=2)Items.Add(new ListItem(values[i+1],values[i]));
	}
Beispiel #46
0
        public ListItemCollection GetHour()
        {
            ListItemCollection lst     = new ListItemCollection();
            ListItem           lstitem = new ListItem();

            lstitem.Value = "";
            lstitem.Text  = "";
            lst.Add(lstitem);
            ListItem lstitem1 = new ListItem();

            lstitem1.Value = "1";
            lstitem1.Text  = "01";
            lst.Add(lstitem1);
            ListItem lstitem2 = new ListItem();

            lstitem2.Value = "2";
            lstitem2.Text  = "02";
            lst.Add(lstitem2);
            ListItem lstitem3 = new ListItem();

            lstitem3.Value = "3";
            lstitem3.Text  = "03";
            lst.Add(lstitem3);
            ListItem lstitem4 = new ListItem();

            lstitem4.Value = "4";
            lstitem4.Text  = "04";
            lst.Add(lstitem4);
            ListItem lstitem5 = new ListItem();

            lstitem5.Value = "5";
            lstitem5.Text  = "05";
            lst.Add(lstitem5);
            ListItem lstitem6 = new ListItem();

            lstitem6.Value = "6";
            lstitem6.Text  = "06";
            lst.Add(lstitem6);
            ListItem lstitem7 = new ListItem();

            lstitem7.Value = "7";
            lstitem7.Text  = "07";
            lst.Add(lstitem7);
            ListItem lstitem8 = new ListItem();

            lstitem8.Value = "8";
            lstitem8.Text  = "08";
            lst.Add(lstitem8);
            ListItem lstitem9 = new ListItem();

            lstitem9.Value = "9";
            lstitem9.Text  = "09";
            lst.Add(lstitem9);
            ListItem lstitem10 = new ListItem();

            lstitem10.Value = "10";
            lstitem10.Text  = "10";
            lst.Add(lstitem10);
            ListItem lstitem11 = new ListItem();

            lstitem11.Value = "11";
            lstitem11.Text  = "11";
            lst.Add(lstitem11);
            ListItem lstitem12 = new ListItem();

            lstitem12.Value = "12";
            lstitem12.Text  = "12";
            lst.Add(lstitem12);

            return(lst);
        }
    ListItemCollection GetPageHierarchy()
    {
        TerritorySite.BL.CMS.PageCollection pages = TerritorySite.BL.CMS.ContentService.GetHierarchicalPageCollection();

        if (pageHierarchy == null)
        {
            pageHierarchy = new ListItemCollection();
            lstHierarchy.Items.Clear();
            ListItem item;
            foreach (TerritorySite.BL.CMS.Page page in pages)
            {

                string lvlIndicator = string.Empty;
                for (int i = 0; i < page.Level; i++)
                    lvlIndicator += " - ";

                item = new ListItem(lvlIndicator + page.Title, page.PageID.ToString());

                pageHierarchy.Add(item);
            }
        }
        return pageHierarchy;
    }
Beispiel #48
0
        public ListItemCollection GetCurrency()
        {
            ListItemCollection lst     = new ListItemCollection();
            ListItem           lstitem = new ListItem();

            lstitem.Value = "";
            lstitem.Text  = "(Select a Currency from the List)";
            lst.Add(lstitem);
            ListItem lstitem1 = new ListItem();

            lstitem1.Value = "THB";
            lstitem1.Text  = "baht: Thai";
            lst.Add(lstitem1);
            ListItem lstitem2 = new ListItem();

            lstitem2.Value = "PAB";
            lstitem2.Text  = "balboa: Panamanian";
            lst.Add(lstitem2);
            ListItem lstitem3 = new ListItem();

            lstitem3.Value = "VEB";
            lstitem3.Text  = "bolivar: Venezuelan";
            lst.Add(lstitem3);
            ListItem lstitem4 = new ListItem();

            lstitem4.Value = "GHC";
            lstitem4.Text  = "cedi: Ghanaian";
            lst.Add(lstitem4);
            ListItem lstitem5 = new ListItem();

            lstitem5.Value = "TND";
            lstitem5.Text  = "dinar: Tunisian";
            lst.Add(lstitem5);
            ListItem lstitem6 = new ListItem();

            lstitem6.Value = "MAD";
            lstitem6.Text  = "dirham: Moroccan";
            lst.Add(lstitem6);
            ListItem lstitem7 = new ListItem();

            lstitem7.Value = "AUD";
            lstitem7.Text  = "dollar: Australian";
            lst.Add(lstitem7);
            ListItem lstitem8 = new ListItem();

            lstitem8.Value = "BSD";
            lstitem8.Text  = "dollar: Bahamian";
            lst.Add(lstitem8);
            ListItem lstitem9 = new ListItem();

            lstitem9.Value = "BBD";
            lstitem9.Text  = "dollar: Barbadian";
            lst.Add(lstitem9);
            ListItem lstitem10 = new ListItem();

            lstitem10.Value = "BZD";
            lstitem10.Text  = "dollar: Belizean";
            lst.Add(lstitem10);
            ListItem lstitem11 = new ListItem();

            lstitem11.Value = "BMD";
            lstitem11.Text  = "dollar: Bermudian";
            lst.Add(lstitem11);
            ListItem lstitem12 = new ListItem();

            lstitem12.Value = "BND";
            lstitem12.Text  = "dollar: Bruneian";
            lst.Add(lstitem12);
            ListItem lstitem13 = new ListItem();

            lstitem13.Value = "CAD";
            lstitem13.Text  = "dollar: Canadian";
            lst.Add(lstitem13);
            ListItem lstitem14 = new ListItem();

            lstitem14.Value = "XCD";
            lstitem14.Text  = "dollar: East Caribbean";
            lst.Add(lstitem14);
            ListItem lstitem15 = new ListItem();

            lstitem15.Value = "FJD";
            lstitem15.Text  = "dollar: Fijian";
            lst.Add(lstitem15);
            ListItem lstitem16 = new ListItem();

            lstitem16.Value = "HKD";
            lstitem16.Text  = "dollar: Hong Kong";
            lst.Add(lstitem16);
            ListItem lstitem17 = new ListItem();

            lstitem17.Value = "JMD";
            lstitem17.Text  = "dollar: Jamaican";
            lst.Add(lstitem17);
            ListItem lstitem18 = new ListItem();

            lstitem18.Value = "NAD";
            lstitem18.Text  = "dollar: Namibian";
            lst.Add(lstitem18);
            ListItem lstitem19 = new ListItem();

            lstitem19.Value = "NZD";
            lstitem19.Text  = "dollar: New Zealand";
            lst.Add(lstitem19);
            ListItem lstitem20 = new ListItem();

            lstitem20.Value = "SGD";
            lstitem20.Text  = "dollar: Singapore";
            lst.Add(lstitem20);
            ListItem lstitem21 = new ListItem();

            lstitem21.Value = "TTD";
            lstitem21.Text  = "dollar: Trin. and Tobag.";
            lst.Add(lstitem21);
            ListItem lstitem22 = new ListItem();

            lstitem22.Value = "USD";
            lstitem22.Text  = "dollar: United States";
            lst.Add(lstitem22);
            ListItem lstitem23 = new ListItem();

            lstitem23.Value = "PTE";
            lstitem23.Text  = "escudo: Portuguese";
            lst.Add(lstitem23);
            ListItem lstitem24 = new ListItem();

            lstitem24.Value = "EUR";
            lstitem24.Text  = "euro: European Union";
            lst.Add(lstitem24);
            ListItem lstitem25 = new ListItem();

            lstitem25.Value = "HUF";
            lstitem25.Text  = "forint: Hungarian";
            lst.Add(lstitem25);
            ListItem lstitem26 = new ListItem();

            lstitem26.Value = "XOF";
            lstitem26.Text  = "franc BCEAO: CFA";
            lst.Add(lstitem26);
            ListItem lstitem27 = new ListItem();

            lstitem27.Value = "XAF";
            lstitem27.Text  = "franc BEAC: CFA";
            lst.Add(lstitem27);
            ListItem lstitem28 = new ListItem();

            lstitem28.Value = "BEF";
            lstitem28.Text  = "franc: Belgian";
            lst.Add(lstitem28);
            ListItem lstitem29 = new ListItem();

            lstitem29.Value = "XPF";
            lstitem29.Text  = "franc: CFP";
            lst.Add(lstitem29);
            ListItem lstitem30 = new ListItem();

            lstitem30.Value = "DJF";
            lstitem30.Text  = "franc: Djiboutian";
            lst.Add(lstitem30);
            ListItem lstitem31 = new ListItem();

            lstitem31.Value = "FRF";
            lstitem31.Text  = "franc: French";
            lst.Add(lstitem31);
            ListItem lstitem32 = new ListItem();

            lstitem32.Value = "LUF";
            lstitem32.Text  = "franc: Luxembourg";
            lst.Add(lstitem32);
            ListItem lstitem33 = new ListItem();

            lstitem33.Value = "CHF";
            lstitem33.Text  = "franc: Swiss";
            lst.Add(lstitem33);
            ListItem lstitem34 = new ListItem();

            lstitem34.Value = "AWG";
            lstitem34.Text  = "guilder: Aruban";
            lst.Add(lstitem34);
            ListItem lstitem35 = new ListItem();

            lstitem35.Value = "ANG";
            lstitem35.Text  = "guilder: Neth. Antillian";
            lst.Add(lstitem35);
            ListItem lstitem36 = new ListItem();

            lstitem36.Value = "NLG";
            lstitem36.Text  = "guilder: Netherlands";
            lst.Add(lstitem36);
            ListItem lstitem37 = new ListItem();

            lstitem37.Value = "CZK";
            lstitem37.Text  = "koruna: Czech";
            lst.Add(lstitem37);
            ListItem lstitem38 = new ListItem();

            lstitem38.Value = "SKK";
            lstitem38.Text  = "koruna: Slovak";
            lst.Add(lstitem38);
            ListItem lstitem39 = new ListItem();

            lstitem39.Value = "ISK";
            lstitem39.Text  = "krona: Icelandic";
            lst.Add(lstitem39);
            ListItem lstitem40 = new ListItem();

            lstitem40.Value = "SEK";
            lstitem40.Text  = "krona: Swedish";
            lst.Add(lstitem40);
            ListItem lstitem41 = new ListItem();

            lstitem41.Value = "DKK";
            lstitem41.Text  = "krone: Danish";
            lst.Add(lstitem41);
            ListItem lstitem42 = new ListItem();

            lstitem42.Value = "NOK";
            lstitem42.Text  = "krone: Norwegian";
            lst.Add(lstitem42);
            ListItem lstitem43 = new ListItem();

            lstitem43.Value = "EEK";
            lstitem43.Text  = "kroon: Estonian";
            lst.Add(lstitem43);
            ListItem lstitem44 = new ListItem();

            lstitem44.Value = "HRK";
            lstitem44.Text  = "kuna: Croatian";
            lst.Add(lstitem44);
            ListItem lstitem45 = new ListItem();

            lstitem45.Value = "MMK";
            lstitem45.Text  = "kyat: Burmese";
            lst.Add(lstitem45);
            ListItem lstitem46 = new ListItem();

            lstitem46.Value = "HNL";
            lstitem46.Text  = "lempira: Honduran";
            lst.Add(lstitem46);
            ListItem lstitem47 = new ListItem();

            lstitem47.Value = "SZL";
            lstitem47.Text  = "lilangeni: Swazi";
            lst.Add(lstitem47);
            ListItem lstitem48 = new ListItem();

            lstitem48.Value = "ITL";
            lstitem48.Text  = "lira: Italian";
            lst.Add(lstitem48);
            ListItem lstitem49 = new ListItem();

            lstitem49.Value = "LTL";
            lstitem49.Text  = "litas: Lithuanian";
            lst.Add(lstitem49);
            ListItem lstitem50 = new ListItem();

            lstitem50.Value = "LSL";
            lstitem50.Text  = "loti: Lesotho";
            lst.Add(lstitem50);
            ListItem lstitem51 = new ListItem();

            lstitem51.Value = "DEM";
            lstitem51.Text  = "mark: German";
            lst.Add(lstitem51);
            ListItem lstitem52 = new ListItem();

            lstitem52.Value = "FIM";
            lstitem52.Text  = "markka: Finnish";
            lst.Add(lstitem52);
            ListItem lstitem53 = new ListItem();

            lstitem53.Value = "BAM";
            lstitem53.Text  = "marks: Bos. and Herz.";
            lst.Add(lstitem53);
            ListItem lstitem54 = new ListItem();

            lstitem54.Value = "TWD";
            lstitem54.Text  = "new dollar: Taiwanese";
            lst.Add(lstitem54);
            ListItem lstitem55 = new ListItem();

            lstitem55.Value = "ILS";
            lstitem55.Text  = "new shekel: Israeli";
            lst.Add(lstitem55);
            ListItem lstitem56 = new ListItem();

            lstitem56.Value = "BTN";
            lstitem56.Text  = "ngultrum: Bhutanese";
            lst.Add(lstitem56);
            ListItem lstitem57 = new ListItem();

            lstitem57.Value = "PEN";
            lstitem57.Text  = "nuevo sol: Peruvian";
            lst.Add(lstitem57);
            ListItem lstitem58 = new ListItem();

            lstitem58.Value = "ADP";
            lstitem58.Text  = "peseta: Andorran";
            lst.Add(lstitem58);
            ListItem lstitem59 = new ListItem();

            lstitem59.Value = "ESP";
            lstitem59.Text  = "peseta: Spanish";
            lst.Add(lstitem59);
            ListItem lstitem60 = new ListItem();

            lstitem60.Value = "ARS";
            lstitem60.Text  = "peso: Argentine";
            lst.Add(lstitem60);
            ListItem lstitem61 = new ListItem();

            lstitem61.Value = "CLP";
            lstitem61.Text  = "peso: Chilean";
            lst.Add(lstitem61);
            ListItem lstitem62 = new ListItem();

            lstitem62.Value = "COP";
            lstitem62.Text  = "peso: Colombian";
            lst.Add(lstitem62);
            ListItem lstitem63 = new ListItem();

            lstitem63.Value = "CUP";
            lstitem63.Text  = "peso: Cuban";
            lst.Add(lstitem63);
            ListItem lstitem65 = new ListItem();

            lstitem65.Value = "MXN";
            lstitem65.Text  = "peso: Mexican";
            lst.Add(lstitem65);
            ListItem lstitem66 = new ListItem();

            lstitem66.Value = "PHP";
            lstitem66.Text  = "peso: Philippine";
            lst.Add(lstitem66);
            ListItem lstitem67 = new ListItem();

            lstitem67.Value = "GBP";
            lstitem67.Text  = "pound sterling: British";
            lst.Add(lstitem67);
            ListItem lstitem68 = new ListItem();

            lstitem68.Value = "FKP";
            lstitem68.Text  = "pound: Falkland";
            lst.Add(lstitem68);
            ListItem lstitem69 = new ListItem();

            lstitem69.Value = "GIP";
            lstitem69.Text  = "pound: Gibraltar";
            lst.Add(lstitem69);
            ListItem lstitem70 = new ListItem();

            lstitem70.Value = "IEP";
            lstitem70.Text  = "pound: Irish";
            lst.Add(lstitem70);
            ListItem lstitem71 = new ListItem();

            lstitem71.Value = "SHP";
            lstitem71.Text  = "pound: Saint Helenian";
            lst.Add(lstitem71);
            ListItem lstitem72 = new ListItem();

            lstitem72.Value = "GTQ";
            lstitem72.Text  = "quetzal: Guatemalan";
            lst.Add(lstitem72);
            ListItem lstitem73 = new ListItem();

            lstitem73.Value = "ZAR";
            lstitem73.Text  = "rand: South African";
            lst.Add(lstitem73);
            ListItem lstitem74 = new ListItem();

            lstitem74.Value = "BRL";
            lstitem74.Text  = "real: Brazilian";
            lst.Add(lstitem74);
            ListItem lstitem75 = new ListItem();

            lstitem75.Value = "OMR";
            lstitem75.Text  = "rial: Omani";
            lst.Add(lstitem75);
            ListItem lstitem76 = new ListItem();

            lstitem76.Value = "MYR";
            lstitem76.Text  = "ringgit: Malaysian";
            lst.Add(lstitem76);
            ListItem lstitem77 = new ListItem();

            lstitem77.Value = "RUR";
            lstitem77.Text  = "ruble: Russian";
            lst.Add(lstitem77);
            ListItem lstitem78 = new ListItem();

            lstitem78.Value = "INR";
            lstitem78.Text  = "rupee: Indian";
            lst.Add(lstitem78);
            ListItem lstitem79 = new ListItem();

            lstitem79.Value = "PKR";
            lstitem79.Text  = "rupee: Pakistani";
            lst.Add(lstitem79);
            ListItem lstitem80 = new ListItem();

            lstitem80.Value = "LKR";
            lstitem80.Text  = "rupee: Sri Lankan";
            lst.Add(lstitem80);
            ListItem lstitem81 = new ListItem();

            lstitem81.Value = "IDR";
            lstitem81.Text  = "rupiah: Indonesian";
            lst.Add(lstitem81);
            ListItem lstitem82 = new ListItem();

            lstitem82.Value = "ATS";
            lstitem82.Text  = "schilling: Austrian";
            lst.Add(lstitem82);
            ListItem lstitem83 = new ListItem();

            lstitem83.Value = "SIT";
            lstitem83.Text  = "tolar: Slovenian";
            lst.Add(lstitem83);
            ListItem lstitem84 = new ListItem();

            lstitem84.Value = "KRW";
            lstitem84.Text  = "won: South Korean";
            lst.Add(lstitem84);
            ListItem lstitem85 = new ListItem();

            lstitem85.Value = "JPY";
            lstitem85.Text  = "yen: Japanese";
            lst.Add(lstitem85);
            ListItem lstitem86 = new ListItem();

            lstitem86.Value = "CNY";
            lstitem86.Text  = "yuan renminbi: Chinese";
            lst.Add(lstitem86);
            ListItem lstitem87 = new ListItem();

            lstitem87.Value = "PLN";
            lstitem87.Text  = "zloty: Polish";
            lst.Add(lstitem87);
            return(lst);
        }
    protected void ClearFeatured()
    {
        ListItemCollection col = new ListItemCollection();

        foreach (ListItem item in FeatureDatesListBox.Items)
        {
            col.Add(item);
        }

        int a = col.Count;
        for (int i = 0; i < a; i++)
        {
            if (col[i].Value != "Disabled")
            {
                FeatureDatesListBox.Items.Remove(col[i]);
            }
        }

        col = new ListItemCollection();

        foreach (ListItem item in SearchTermsListBox.Items)
        {
            col.Add(item);
        }

        a = col.Count;
        for (int i = 0; i < a; i++)
        {
            SearchTermsListBox.Items.Remove(col[i]);
        }
    }
Beispiel #50
0
        public ListItemCollection GetMonth()
        {
            ListItemCollection lst     = new ListItemCollection();
            ListItem           lstitem = new ListItem();

            lstitem.Value = "";
            lstitem.Text  = "";
            lst.Add(lstitem);
            ListItem lstitem1 = new ListItem();

            lstitem1.Value = "1";
            lstitem1.Text  = "Jan";
            lst.Add(lstitem1);
            ListItem lstitem2 = new ListItem();

            lstitem2.Value = "2";
            lstitem2.Text  = "Feb";
            lst.Add(lstitem2);
            ListItem lstitem3 = new ListItem();

            lstitem3.Value = "3";
            lstitem3.Text  = "Mar";
            lst.Add(lstitem3);
            ListItem lstitem4 = new ListItem();

            lstitem4.Value = "4";
            lstitem4.Text  = "Apr";
            lst.Add(lstitem4);
            ListItem lstitem5 = new ListItem();

            lstitem5.Value = "5";
            lstitem5.Text  = "May";
            lst.Add(lstitem5);
            ListItem lstitem6 = new ListItem();

            lstitem6.Value = "6";
            lstitem6.Text  = "Jun";
            lst.Add(lstitem6);
            ListItem lstitem7 = new ListItem();

            lstitem7.Value = "7";
            lstitem7.Text  = "Jul";
            lst.Add(lstitem7);
            ListItem lstitem8 = new ListItem();

            lstitem8.Value = "8";
            lstitem8.Text  = "Aug";
            lst.Add(lstitem8);
            ListItem lstitem9 = new ListItem();

            lstitem9.Value = "9";
            lstitem9.Text  = "Sep";
            lst.Add(lstitem9);
            ListItem lstitem10 = new ListItem();

            lstitem10.Value = "10";
            lstitem10.Text  = "Oct";
            lst.Add(lstitem10);
            ListItem lstitem11 = new ListItem();

            lstitem11.Value = "11";
            lstitem11.Text  = "Nov";
            lst.Add(lstitem11);
            ListItem lstitem12 = new ListItem();

            lstitem12.Value = "12";
            lstitem12.Text  = "Dec";
            lst.Add(lstitem12);

            return(lst);
        }
    private ListItemCollection GetFactionList()
    {
        FactionList list = FactionList.GetFactionList();

        // prepare a collection containing an empty value signifying that no unit class is selected
        ListItemCollection collection = new ListItemCollection();
        foreach (Faction item in list)
            collection.Add( new ListItem( item.Name, item.ID.ToString() ) );

        collection.Insert( 0, new ListItem( "UNSELECTED", "0" ) );

        return collection;
    }
    protected void Rem2_Click(object sender, EventArgs e)
    {
        ListItemCollection liC = new ListItemCollection();

        foreach (ListItem li in CurModsList.Items)
            if (li.Selected)
            {
                AvModsList.Items.Add(li);
                li.Selected = false;
                liC.Add(li);
            }

        foreach (ListItem li in liC)
            CurModsList.Items.Remove(li);
    }
Beispiel #53
0
 public static void Add(this ListItemCollection items, string text, Guid id)
 {
     items.Add(new ListItem(text, id.ToString()));
 }
Beispiel #54
0
    private void LlenarCampos(string catalog)
    {
        int    dropindex = 0;
        string vlquery = string.Format("SELECT * FROM CONFIG_CATALOGOS WHERE Mostrar=1 AND Catalogo='{0}' ORDER BY ID", catalog);
        string vlcampo, vlvalor;

        Operaciones.Seleccionar Query = new Operaciones.Seleccionar();
        DataTable vldata = Query.Obtener(vlquery);

        Session["datacols"] = vldata;
        int datacount = vldata.Rows.Count;
        int i         = 0;
        ListItemCollection itemfields = new ListItemCollection();

        foreach (DataRow row in vldata.Rows)
        {
            if (row["Campo"].ToString() != "ID")
            {
                vlcampo = row["Campo"].ToString();
                vlvalor = row["Valor"].ToString();
                itemfields.Add(new ListItem(vlcampo, vlvalor));
                switch (catalog)
                {
                case "Articulos":
                    if (vlcampo == "Nombre")
                    {
                        dropindex = i;
                    }
                    ViewState["sortExpression"] = "Nombre";
                    break;

                case "Proveedores":
                    if (vlcampo == "Proveedor")
                    {
                        dropindex = i;
                    }
                    break;

                case "Clientes":
                    if (vlcampo == "Nombre")
                    {
                        dropindex = i;
                    }
                    //ViewState["sortExpression"] = "Nombre";
                    break;

                case "Personal":
                    if (vlcampo == "Apellidos")
                    {
                        dropindex = i;
                    }
                    break;

                case "Comisiones":
                    if (vlcampo == "Concepto")
                    {
                        dropindex = i;
                    }
                    break;

                case "Rutas":
                    if (vlcampo == "Ruta")
                    {
                        dropindex = i;
                    }
                    break;

                case "Precios":
                    if (vlcampo == "Lista")
                    {
                        dropindex = i;
                    }
                    break;

                default:
                    dropindex = i;
                    break;
                }
                i++;
            }
        }
        Session["QFields"] = itemfields;
        foreach (ListItem item1 in itemfields)
        {
            if (item1.Text != "Imagen")
            {
                lblCampo.Items.Add(item1);
            }
        }

        ViewState["dropindex"] = dropindex.ToString();
        lblCampo.SelectedIndex = dropindex;
    }
Beispiel #55
0
        private ListItemCollection DateSelection()
        {
            ListItemCollection listBoxData = new ListItemCollection();

            switch (MaxDateRange)
            {
            case MaximumDateRange.None:
                listBoxData.Add(new ListItem("-Date Range-", ""));
                listBoxData.Add(new ListItem("Today", "Today"));
                listBoxData.Add(new ListItem("Yesterday", "Yesterday"));
                listBoxData.Add(new ListItem("This Week", "ThisWeek"));
                listBoxData.Add(new ListItem("This Month", "ThisMonth"));
                listBoxData.Add(new ListItem("This Year", "ThisYear"));
                break;

            case MaximumDateRange.OneWeek:
                listBoxData.Add(new ListItem("-Date Range-", ""));
                listBoxData.Add(new ListItem("Yesterday", "Yesterday"));
                listBoxData.Add(new ListItem("Today", "Today"));
                listBoxData.Add(new ListItem("Tomorrow", "Tomorrow"));
                listBoxData.Add(new ListItem("Last Week", "LastWeek"));
                listBoxData.Add(new ListItem("Next Week", "NextWeek"));
                listBoxData.Add(new ListItem("Last 7 Days", "Last7"));
                listBoxData.Add(new ListItem("Next 7 Days", "Next7"));
                break;
            }

            return(listBoxData);
        }
Beispiel #56
0
        private void _Iniciar()
        {
            this.pnlConsulta.Visible = true;
            this.pnlData.Visible     = false;
            this.xQueryParameters.Clear();
            this.xQueryValues.Clear();
            this.xQueryParameters.Add((object)"@NOMBRE");
            this.xQueryValues.Add((object)"%");
            this.xQueryParameters.Add((object)"@ROWSGXID");
            this.xQueryValues.Add((object)this.ROWSGXID);
            this.cmbPaciente.Items.Clear();
            this.cmbPaciente.Items.Add(new ListItem("-- SELECCIONE --", string.Empty));
            foreach (DataRow row in (InternalDataCollectionBase)DB.ExecuteAdapter("PAX00000S1", this.xQueryParameters, this.xQueryValues, CommandType.StoredProcedure).Rows)
            {
                this.cmbPaciente.Items.Add(new ListItem(row["FULLNAME"].ToString(), row["ROWGUID"].ToString()));
            }
            this.xQueryParameters.Clear();
            this.xQueryValues.Clear();
            this.xQueryParameters.Add((object)"@NOMBRE");
            this.xQueryValues.Add((object)"%");
            this.xQueryParameters.Add((object)"@ROWSGXID");
            this.xQueryValues.Add((object)this.ROWSGXID);
            this.cmbHorario.Items.Clear();
            this.cmbHorario.Items.Add(new ListItem("-- SELECCIONE --", string.Empty));
            string str1 = this.Request.QueryString["X"];

            if (str1 == null)
            {
                this.xGUID.Value         = Guid.NewGuid().ToString().ToUpper();
                this.pnlConsulta.Visible = true;
                this.pnlData.Visible     = false;
                this._Show((object)null, (EventArgs)null);
                this._IniciarControles();
            }
            else
            {
                this.xGUID.Value = str1;
                this.xQueryParameters.Clear();
                this.xQueryValues.Clear();
                this.xQueryParameters.Add((object)"@GUID");
                this.xQueryValues.Add((object)this.ROWGUID);
                this.xQueryParameters.Add((object)"@ROWSGXID");
                this.xQueryValues.Add((object)this.ROWSGXID);
                this.xQuery = this.xBase + "S2";
                DataTable dataTable = DB.ExecuteAdapter(this.xQuery, this.xQueryParameters, this.xQueryValues, CommandType.StoredProcedure);
                DataRow   dataRow   = dataTable.Rows.Count != 0 ? dataTable.Rows[0] : (DataRow)null;
                if (dataRow == null)
                {
                    return;
                }
                this.txtDescripcion.Value = dataRow["DESCRIPCION"].ToString();
                HtmlInputText txtFechaIni = this.txtFechaIni;
                DateTime      dateTime1   = Convert.ToDateTime(dataRow["FECHAINI"].ToString());
                string        str2        = dateTime1.ToString("MM/dd/yyyy");
                txtFechaIni.Value        = str2;
                this.txtObservacion.Text = dataRow["OBSERVACION"].ToString();
                this.cmbHorario.Items.Clear();
                ListItemCollection items = this.cmbHorario.Items;
                dateTime1 = Convert.ToDateTime(dataRow["HORAINI"]);
                string str3 = dateTime1.ToString("hh:mm tt");
                string str4 = " - ";
                dateTime1 = Convert.ToDateTime(dataRow["HORAFIN"]);
                string   str5     = dateTime1.ToString("hh:mm tt");
                ListItem listItem = new ListItem(str3 + str4 + str5, string.Empty);
                items.Add(listItem);
                this.btnSave.Disabled        = true;
                this.txtDescripcion.Disabled = true;
                this.txtFechaIni.Disabled    = true;
                this.cmbHorario.Disabled     = true;
                this.btnFindHorario.Disabled = true;
                this.txtObservacion.Enabled  = false;
                dateTime1 = DateTime.Now;
                DateTime dateTime2 = Convert.ToDateTime(dateTime1.ToString("MM/dd/yyyy"));
                dateTime1 = Convert.ToDateTime(dataRow["FECHAINI"].ToString());
                DateTime dateTime3 = Convert.ToDateTime(dateTime1.ToString("MM/dd/yyyy"));
                if (DateTime.Compare(dateTime2, dateTime3) > 0)
                {
                    this.btnAdd.Disabled = true;
                }
                this._CagarDetalles();
                this.pnlConsulta.Visible = false;
                this.pnlData.Visible     = true;
            }
        }
Beispiel #57
0
    private void BindBorrower()
    {
        DataTable dt                 = null;
        string    borrowerName       = string.Empty;
        int       iBorrowerContactId = iContactID;

        if (iFileID <= 0 && iContactID <= 0)
        {
            GetBorrowerListFromSctach();
            return;
        }
        try
        {
            if (iFileID > 0)
            {
                // loan officer name
                LoanTeam lt = new LoanTeam();
                sProspectLoanOfficer = lt.GetLoanOfficer(iFileID);

                #region Get Loan Officer ID

                string sSql            = "select isnull(dbo.lpfn_GetLoanOfficerID(" + iFileID + "),0)";
                string sLoanOfficerIDx = LPWeb.DAL.DbHelperSQL.ExecuteScalar(sSql).ToString();

                #endregion


                if (!string.IsNullOrEmpty(sProspectLoanOfficer))
                {
                    if (ddlLoanOfficer.Items != null && ddlLoanOfficer.Items.Count > 0)
                    {
                        //ddlLoanOfficer.SelectedItem.Text = sProspectLoanOfficer;

                        ddlLoanOfficer.SelectedValue = sLoanOfficerIDx;

                        if (ddlLoanOfficer.SelectedValue == "-1")
                        {
                            //var s = sLoanOfficerIDx;
                            ddlLoanOfficer.Items.Add(new ListItem()
                            {
                                Text = sProspectLoanOfficer, Value = sLoanOfficerIDx
                            });
                            ddlLoanOfficer.SelectedValue = sLoanOfficerIDx;
                        }

                        hfLoanOfficer.Value = ddlLoanOfficer.SelectedItem.Text;
                    }
                }
                dt = loan.GetBorrowerInfo(iFileID);
                if (dt != null && dt.Rows.Count > 0)
                {
                    if (dt.Rows[0]["LastName"] == DBNull.Value || dt.Rows[0]["ContactId"] == DBNull.Value || dt.Rows[0]["FirstName"] == DBNull.Value)
                    {
                        iBorrowerContactId = iContactID;
                    }
                    else
                    {
                        iBorrowerContactId = (int)dt.Rows[0]["ContactId"];
                        if (iContactID <= 0)
                        {
                            iContactID = iBorrowerContactId;
                        }
                    }
                }

                borrowerName = contact.GetContactName(iBorrowerContactId);
                if (dt != null)
                {
                    dt.Clear();
                }
            }
            if (borrowerName == string.Empty)
            {
                borrowerName       = contact.GetContactName(iContactID);
                iBorrowerContactId = iContactID;
            }
            if (iBorrowerContactId > 0)
            {
                ddlBorrower.Items.Add(new ListItem(borrowerName, iBorrowerContactId.ToString()));
                ddlBorrower.SelectedValue = iBorrowerContactId.ToString();
            }
            else
            {
                ddlBorrower.Items.Add(new ListItem("-- select --", "0"));
                ddlBorrower.SelectedValue = "0";
            }

            if (relatedContactsTable == null || relatedContactsTable.Rows.Count <= 0)
            {
                relatedContactsTable = contact.GetRelatedContacts(iContactID);
            }

            if (relatedContactsTable != null && relatedContactsTable.Rows.Count > 0)
            {
                lc.Clear();
                foreach (DataRow dr in relatedContactsTable.Rows)
                {
                    if (dr["ContactName"] == DBNull.Value || dr["RelContactID"] == null)
                    {
                        continue;
                    }
                    lc.Add(new ListItem(dr["ContactName"].ToString(), dr["RelContactID"].ToString()));
                }
            }
            if (lc.Count > 0)
            {
                foreach (ListItem item in lc)
                {
                    ddlBorrower.Items.Add(item);
                }
            }
        }
        catch
        { }
    }
Beispiel #58
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            int count = this.EgvBankList.Rows.Count;

            string[]           strArray = new string[count];
            ListItemCollection items    = new ListItemCollection();

            for (int i = 1; i <= count; i++)
            {
                ListItem item = new ListItem(i.ToString(), i.ToString());
                items.Add(item);
            }
            foreach (GridViewRow row in this.EgvBankList.Rows)
            {
                DropDownList list = (DropDownList)row.FindControl("DropOrderId");
                list.DataSource = items;
                list.DataBind();
                list.SelectedIndex     = row.RowIndex;
                strArray[row.RowIndex] = list.ClientID;
                list.Attributes.Add("onchange", "Reorder(this, " + row.RowIndex.ToString() + "," + count.ToString() + ")");
            }
            StringBuilder builder = new StringBuilder();

            builder.Append("<script language=\"JavaScript\" type=\"text/JavaScript\">");
            builder.Append("var arrId = new Array(");
            for (int j = 0; j < count; j++)
            {
                builder.Append("\"" + strArray[j] + "\",");
            }
            if (count > 0)
            {
                builder.Remove(builder.Length - 1, 1);
            }
            builder.Append(");\n");
            builder.Append("function Reorder(eSelect, iCurrentField, numSelects)\n");
            builder.Append("{\n");
            builder.Append("    var eForm = eSelect.form;\n");
            builder.Append("    var iNewOrder = eSelect.selectedIndex + 1;\n");
            builder.Append("    var iPrevOrder;\n");
            builder.Append("    var positions = new Array(numSelects);\n");
            builder.Append("    var ix;\n");
            builder.Append("    for (ix = 0; ix < numSelects; ix++)\n");
            builder.Append("    {\n");
            builder.Append("            positions[ix] = 0;\n");
            builder.Append("    }\n");
            builder.Append("    for (ix = 0; ix < numSelects; ix++)\n");
            builder.Append("    {\n");
            builder.Append("            positions[eSelect.form[arrId[ix].toString()].selectedIndex] = 1;\n");
            builder.Append("    }\n");
            builder.Append("    for (ix = 0; ix < numSelects; ix++)\n");
            builder.Append("    {\n");
            builder.Append("            if (positions[ix] == 0)\n");
            builder.Append("            {\n");
            builder.Append("                    iPrevOrder = ix + 1;\n");
            builder.Append("                    break;\n");
            builder.Append("            }\n");
            builder.Append("    }\n");
            builder.Append("    if (iNewOrder != iPrevOrder)\n");
            builder.Append("    {\n");
            builder.Append("            var iInc = iNewOrder > iPrevOrder? -1:1\n");
            builder.Append("            var iMin = Math.min(iNewOrder, iPrevOrder);\n");
            builder.Append("            var iMax = Math.max(iNewOrder, iPrevOrder);\n");
            builder.Append("            for (var iField = 0; iField < numSelects; iField++)\n");
            builder.Append("            {\n");
            builder.Append("                    if (iField != iCurrentField)\n");
            builder.Append("                    {\n");
            builder.Append("                            if (eSelect.form[arrId[iField].toString()].selectedIndex + 1 >= iMin && eSelect.form[arrId[iField].toString()].selectedIndex + 1<= iMax)\n");
            builder.Append("                            {\n");
            builder.Append("                                    eSelect.form[arrId[iField].toString()].selectedIndex += iInc;\n");
            builder.Append("                            }\n");
            builder.Append("                    }\n");
            builder.Append("            }\n");
            builder.Append("    }\n");
            builder.Append("}\n");
            builder.Append("</script>\n");
            this.Page.ClientScript.RegisterClientScriptBlock(base.GetType(), "Order", builder.ToString());
        }
    //protected void LoadPeriods2DDL(){
    //    ArrayList array_data = new ArrayList();
    //    DateTime dt = DateTime.Now;
    //    DateTime wkStDt = DateTime.MinValue;
    //    DateTime wkEndDt = DateTime.MinValue;
    //    DateTime lastDayOfMonth = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1);

    //    wkStDt = dt.AddDays(1 - Convert.ToDouble(dt.DayOfWeek));
    //    wkEndDt = dt.AddDays(7 - Convert.ToDouble(dt.DayOfWeek));
    //    //String.Format("{0:yyyy/MM/dddd}",current_date);
    //    string format = "yyyy-MM-dd";

    //    string current_date = dt.ToString(format);
    //    string current_week = dt.ToString(format);
    //    string current_month = dt.Month.ToString(format);
    //    string last_day_of_month = lastDayOfMonth.ToString(format);
    //    string yesterday = DateTime.Today.AddDays(-1).ToString(format);
    //    string tommorrow = DateTime.Today.AddDays(1).ToString(format);

    //    array_data.Add(new ListItem("Ngày hiện tại", current_date));
    //    array_data.Add(new ListItem("Ngày hôm qua", yesterday));
    //    array_data.Add(new ListItem("Trong tuần này", current_week));
    //    array_data.Add(new ListItem("Trong tháng này", last_day_of_month)); 

    //    // Get an ArrayList with Periods, and bind to dropdownlist
    //    ddlPeriod.DataSource = array_data;
    //    ddlPeriod.DataValueField = "Value";
    //    ddlPeriod.DataTextField = "Text";
    //    ddlPeriod.DataBind();
    //    ddlPeriod.AutoPostBack = true;
    //    ddlPeriod.Items.Insert(0, new ListItem("Chọn thời điểm"));
    //}
    #endregion =======================================================

    #region status ==================================================
    protected void LoadStatus2DDL()
    {
        //Load list item to dropdownlist
        ListItemCollection lstColl = new ListItemCollection();
        lstColl.Add(new ListItem("Publish", "2"));
        lstColl.Add(new ListItem("Active", "1"));
        lstColl.Add(new ListItem("InActive", "0"));

        ddlStatus.DataSource = lstColl;
        ddlStatus.DataTextField = "Text";
        ddlStatus.DataValueField = "Value";
        ddlStatus.DataBind();
        ddlStatus.Items.Insert(0, new ListItem("Chọn trạng thái", "")); // add the new item at the top of the list
        ddlStatus.SelectedIndex = 0; // Select the first item
        ddlStatus.AutoPostBack = true;
    }
Beispiel #60
0
 public static void Add(this ListItemCollection items, IEntity entity)
 {
     items.Add(new ListItem(entity.ToString(), entity.GetId().ToString()));
 }