Remove() public méthode

public Remove ( int index ) : void
index int
Résultat void
    protected void btnRemove_Click(object sender, EventArgs e)
    {
        try
        {
            int    id  = -1;
            string _id = Request.QueryString["id"].ToString();
            int.TryParse(_id, out id);
            int userId = CurrentEnvironment.LoggedUser.Id;

            int i = Language.Remove(id);

            if (i > 0)
            {
                lblSuccess.Visible = true;
                lblWarning.Visible = false;
                lblError.Visible   = false;
                gridview_Databind();
                //ClearControls(this);
            }
            else
            {
                lblSuccess.Visible = false;
                lblWarning.Visible = true;
                lblError.Visible   = false;
            }
        }
        catch (Exception ex)
        {
            lblSuccess.Visible = false;
            lblWarning.Visible = false;
            lblError.Visible   = true;
        }
    }
Exemple #2
0
 protected override Task AddParametersToRequest(IRestRequest request)
 {
     request.AddParameter("key", ApiKey, ParameterType.QueryString);
     request.AddParameter("lang", Language.Remove(2), ParameterType.QueryString);
     request.AddParameter("lat", _coordinates.Latitude.ToString(CultureInfo.InvariantCulture), ParameterType.QueryString);
     request.AddParameter("lon", _coordinates.Longitude.ToString(CultureInfo.InvariantCulture), ParameterType.QueryString);
     return(Task.FromResult(request));
 }
Exemple #3
0
        public ContentFilter(int brief, string[] filterString)
        {
            Brief      = brief;
            Language   = string.Empty;
            MediaType  = string.Empty;
            MediaTitle = string.Empty;
            Company    = string.Empty;
            Brand      = string.Empty;
            SubBrand   = string.Empty;

            if (filterString == null || filterString.Length < 1)
            {
                return;
            }

            //if (string.IsNullOrEmpty(filterString)) return;

            //string[] splitString = filterString.Split(new char[] { ',' });
            foreach (string s in filterString)
            {
                switch (s[0])
                {
                case 'l':
                    Language += s.Remove(0, 1) + ",";
                    break;

                case 'm':
                    MediaType += s.Remove(0, 1) + ",";
                    break;

                case 'n':
                    MediaTitle += s.Remove(0, 1) + ",";
                    break;

                case 'c':
                    Company += s.Remove(0, 1) + ",";
                    break;

                case 'b':
                    Brand += s.Remove(0, 1) + ",";
                    break;

                case 's':
                    SubBrand += s.Remove(0, 1) + ",";
                    break;
                }
            }

            if (HasLanguage)
            {
                Language = Language.Remove(Language.Length - 1);
            }
            if (HasMediaType)
            {
                MediaType = MediaType.Remove(MediaType.Length - 1);
            }
            if (HasMediaTitle)
            {
                MediaTitle = MediaTitle.Remove(MediaTitle.Length - 1);
            }
            if (HasCompany)
            {
                Company = Company.Remove(Company.Length - 1);
            }
            if (HasBrand)
            {
                Brand = Brand.Remove(Brand.Length - 1);
            }
            if (HasSubBrand)
            {
                SubBrand = SubBrand.Remove(SubBrand.Length - 1);
            }
        }