Beispiel #1
0
        protected void GridviewCountries_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            string country = null;

            switch (e.CommandName)
            {
            case "SelectAreaCodes":

                _country   = Convert.ToString(e.CommandArgument);
                _selection = (int)App.BLL.Mappings.Type.AreaCode;

                //Raise custom event from parent page
                if (GridviewCommand != null)
                {
                    GridviewCommand(this, e);
                }


                break;

            case "SelectCMSPools":
                _country   = Convert.ToString(e.CommandArgument);
                _selection = (int)App.BLL.Mappings.Type.CMSPools;

                //Raise custom event from parent page
                if (GridviewCommand != null)
                {
                    GridviewCommand(this, e);
                }


                break;

            case "SelectOPSRegions":
                _country   = Convert.ToString(e.CommandArgument);
                _selection = (int)App.BLL.Mappings.Type.OPSRegions;

                //Raise custom event from parent page
                if (GridviewCommand != null)
                {
                    GridviewCommand(this, e);
                }


                break;

            case "SelectCarSegments":
                _country   = Convert.ToString(e.CommandArgument);
                _selection = (int)App.BLL.Mappings.Type.CarSegment;

                //Raise custom event from parent page
                if (GridviewCommand != null)
                {
                    GridviewCommand(this, e);
                }


                break;

            case "SelectModelCodes":
                _country   = Convert.ToString(e.CommandArgument);
                _selection = (int)App.BLL.Mappings.Type.ModelCodes;

                //Raise custom event from parent page
                if (GridviewCommand != null)
                {
                    GridviewCommand(this, e);
                }


                break;

            case "EditCountry":
                country = Convert.ToString(e.CommandArgument);
                List <MappingsCountry.CountryList> results = MappingsCountry.SelectCountryByCountry(country);

                if ((results != null))
                {
                    foreach (MappingsCountry.CountryList item in results)
                    {
                        this.MappingCountryDetails.Country             = item.Country;
                        this.MappingCountryDetails.Country_Description = item.Country_Description;
                        this.MappingCountryDetails.Country_DW          = item.Country_DW;
                        this.MappingCountryDetails.Active = item.Active;
                    }
                    SessionHandler.MappingCountryDefaultMode     = (int)App.BLL.Mappings.Mode.Edit;
                    SessionHandler.MappingCountryValidationGroup = "CountryEdit";
                    this.MappingCountryDetails.LoadDetails();
                    this.MappingCountryDetails.ModalExtenderMapping.Show();
                    this.UpdatePanelMappingGridview.Update();
                }

                break;

            case "DeleteCountry":
                country = Convert.ToString(e.CommandArgument);

                int result = MappingsCountry.DeleteCountry(country);

                if (result == 0)
                {
                    this.GridviewSortingAndPaging(null);
                    this.LabelMessage.Text = Resources.lang.MessageDeleteCountry;
                }
                else if (result == -2)
                {
                    this.LabelMessage.Text = Resources.lang.DeleteErrorMessageConstraint;
                }
                else
                {
                    this.LabelMessage.Text = Resources.lang.ErrorMessageAdministrator;
                }

                this.UpdatePanelMappingGridview.Update();

                break;
            }
        }