protected void CMSLocationGroup_Validate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args) { if (args.Value.Length >= 1) { int cms_location_group_id = int.Parse(args.Value); //Check if country already exists int result = MappingsCMSLocations.CheckCMSLocationGroupExists(cms_location_group_id); if (result == 0) { //Does not exist continue args.IsValid = true; } else { //Does exist cancel args.IsValid = false; } } else { //Not valid args.IsValid = false; } }
protected void LoadData(string sortExpression) { MappingsCMSLocations.SelectCMSLocations(Convert.ToInt32(SessionHandler.MappingCMSLocationPageSize), Convert.ToInt32(SessionHandler.MappingCMSLocationCurrentPageNumber), sortExpression, this.PanelCMSLocations, this.PagerControlCMSLocations.PagerButtonFirst, this.PagerControlCMSLocations.PagerButtonNext, this.PagerControlCMSLocations.PagerButtonPrevious, this.PagerControlCMSLocations.PagerButtonLast, this.PagerControlCMSLocations.PagerLabelTotalPages, this.PagerControlCMSLocations.PagerDropDownListPage, this.GridviewCMSLocations, this.LabelTotalRecordsDisplay, this.EmptyDataTemplateCMSLocationGroups, SessionHandler.MappingSelectedCountry, Convert.ToInt32(SessionHandler.MappingSelectedCMSPoolId)); }
protected void ButtonSave_Click(object sender, System.EventArgs e) { if (Page.IsValid) { int cms_location_group_id = 0; string cms_location_group_code_dw = this.TextBoxLocationGroupCodeDW.Text; string cms_location_group = this.TextBoxLocationGroup.Text; int cms_pool_id = Convert.ToInt32(this.DropDownListCMSPool.SelectedValue); int result = -1; switch (SessionHandler.MappingCMSLocationDefaultMode) { case (int)App.BLL.Mappings.Mode.Insert: result = MappingsCMSLocations.InsertCMSLocationGroup(cms_location_group_code_dw, cms_location_group, cms_pool_id); break; case (int)App.BLL.Mappings.Mode.Edit: cms_location_group_id = int.Parse(TextBoxLocationGroupCode.Text); result = MappingsCMSLocations.UpdateCMSLocationGroup(cms_location_group_id, cms_location_group_code_dw, cms_location_group, cms_pool_id); break; } if (result == 0) { //Success _errorMessage = Resources.lang.MessageCMSLocationGroupCodeSaved; } else { //Failed _errorMessage = Resources.lang.ErrorMessageAdministrator; } //Raise custom event from parent page if (SaveMappingDetails != null) { SaveMappingDetails(this, EventArgs.Empty); } } else { //Keep the modal popup form show this.ModalPopupExtenderMappingDetails.Show(); } }
protected void GridviewCMSLocations_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { int rowIndex = -1; int cms_location_group_id = -1; switch (e.CommandName) { case "SelectLocations": rowIndex = Convert.ToInt32(e.CommandArgument); _cms_location_group_id = int.Parse(GridviewCMSLocations.DataKeys[rowIndex].Values[0].ToString()); _country = Convert.ToString(GridviewCMSLocations.DataKeys[rowIndex].Values[1]); _selection = (int)App.BLL.Mappings.Type.Locations; //Raise custom event from parent page if (GridviewCommand != null) { GridviewCommand(this, e); } break; case "EditCMSLocationGroup": rowIndex = Convert.ToInt32(e.CommandArgument); cms_location_group_id = int.Parse(GridviewCMSLocations.DataKeys[rowIndex].Values[0].ToString()); List <MappingsCMSLocations.CMSLocations> results = MappingsCMSLocations.SelectCMSLocationGroupByCode(cms_location_group_id); if ((results != null)) { foreach (MappingsCMSLocations.CMSLocations item in results) { this.MappingCMSLocationDetails.CMS_Location_Group_Id = item.CMS_Location_Group_Id; this.MappingCMSLocationDetails.CMS_Location_Group_Code_DW = item.CMS_Location_Group_Code_DW; this.MappingCMSLocationDetails.CMS_Location_Group = item.CMS_Location_group; this.MappingCMSLocationDetails.CMS_Pool_Id = item.CMS_Pool_Id; } SessionHandler.MappingCMSLocationDefaultMode = (int)App.BLL.Mappings.Mode.Edit; SessionHandler.MappingCMSLocationValidationGroup = "CMSLocationGroupEdit"; this.MappingCMSLocationDetails.LoadDetails(); this.MappingCMSLocationDetails.ModalExtenderMapping.Show(); this.UpdatePanelMappingGridview.Update(); } break; case "DeleteCMSLocationGroup": rowIndex = Convert.ToInt32(e.CommandArgument); cms_location_group_id = int.Parse(this.GridviewCMSLocations.DataKeys[rowIndex].Values[0].ToString()); int result = MappingsCMSLocations.DeleteCMSLocationGroup(cms_location_group_id); if (result == 0) { this.GridviewSortingAndPaging(null); this.LabelMessage.Text = Resources.lang.MessageDeleteCMSLocationGroup; } else if (result == -2) { this.LabelMessage.Text = Resources.lang.DeleteErrorMessageConstraint; } else { this.LabelMessage.Text = Resources.lang.ErrorMessageAdministrator; } this.UpdatePanelMappingGridview.Update(); break; } }