protected void ValidateEditVariant_Click(object sender, System.Web.UI.ImageClickEventArgs e) { if (SessionState.User.HasCapability(Business.CapabilitiesEnum.MANAGE_RESOURCES)) { if (SessionState.User.IsReadOnly) { variantsGrid.EditItemIndex = -1; return; } DataGridItem item = (DataGridItem)((System.Web.UI.WebControls.ImageButton)sender).Parent.Parent; if (item != null && variantsGrid.EditItemIndex == item.ItemIndex) { Variant variant = CurrentResource.Variants[(int)variantsGrid.DataKeys[item.ItemIndex]]; if (variant != null) { DropDownList editVariantCulture = (DropDownList)item.FindControl("editVariantCulture"); DataGrid editVariantAttributes = (DataGrid)item.FindControl("editVariantAttributes"); HtmlInputFile editVariantFileValue = (HtmlInputFile)item.FindControl("editVariantFileValue"); WebDateChooser editVariantBOPValue = (WebDateChooser)item.FindControl("editVariantBOPValue"); WebDateChooser editVariantEOPValue = (WebDateChooser)item.FindControl("editVariantEOPValue"); if (editVariantCulture != null) { variant.CultureCode = editVariantCulture.SelectedValue; } if (editVariantAttributes != null) #region variant attributes { foreach (DataGridItem paramItem in editVariantAttributes.Items) { Label editVariantAttributeName = (Label)paramItem.FindControl("editVariantAttributeName"); if (editVariantAttributeName != null) { string attrName = editVariantAttributeName.Text; VariantAttribute attrDef = variant.Attributes.GetAttributeDefinition(attrName); if (attrDef.UserDefined) { TextBox editVariantAttributeBox = (TextBox)paramItem.FindControl("editVariantAttributeBox"); DropDownList editVariantAttributeList = (DropDownList)paramItem.FindControl("editVariantAttributeList"); if (attrDef.PossibleValues.Count > 0 && editVariantAttributeList != null) { variant.Attributes[attrName] = editVariantAttributeList.SelectedValue; } else if (editVariantAttributeBox != null) { variant.Attributes[attrName] = editVariantAttributeBox.Text; } } } } } #endregion if (editVariantFileValue != null && editVariantFileValue.PostedFile != null && editVariantFileValue.PostedFile.ContentLength > 0) { if (editVariantBOPValue != null && editVariantEOPValue != null) { variant.AddFile(editVariantFileValue.PostedFile.InputStream, Path.GetExtension(editVariantFileValue.PostedFile.FileName)); } //,editVariantBOPValue.Value!=null?(DateTime)editVariantBOPValue.Value:DateTime.MinValue,editVariantEOPValue.Value!=null?(DateTime)editVariantEOPValue.Value:DateTime.MaxValue); else { variant.AddFile(editVariantFileValue.PostedFile.InputStream, Path.GetExtension(editVariantFileValue.PostedFile.FileName)); } } if (variant.Save()) { variantsGrid.EditItemIndex = -1; BindVariantGrid(); } } } } }