Ejemplo n.º 1
0
 void btnNew_Click(object sender, EventArgs e)
 {
     MemDefEnumeration r = new MemDefEnumeration();
     string nameSpace = null;
     foreach (MemDefEnumeration c in tempDef.Enumeration.Values) {
         if (!c.IsChangeDef) { nameSpace = c.Namespace; break; }
     }
     if (nameSpace == null) {
         foreach (MemDefContentClass c in tempDef.ContentClass.Values) {
             if (!c.IsChangeDef) { nameSpace = c.Namespace; break; }
         }
     }
     if (nameSpace == null) nameSpace = "MySite";
     r.CodeName = "NewEnumeration";
     r.Namespace = nameSpace;
     r.Id = tempDef.GetNewEnumerationId();
     tempDef.Enumeration.Add(r.Id, r);
     list.SetSelected((r.IsChangeDef ? "c" : "") + r.Id);
     _editForm.DefinitionType = DefinitionType.Local;
     _editForm.Id = r.Id;
     _editForm.Refresh();
     setQuery();
 }
Ejemplo n.º 2
0
 public WMEditEnumAsTextFile(MemDefEnumeration defEnum, string onCompleteScript)
 {
     _defEnum = defEnum;
     _onCompleteScript = onCompleteScript;
     StringBuilder sb = new StringBuilder();
     UniqueList<int> lcids = new UniqueList<int>();
     foreach (var v in _defEnum.Values.Values) {
         foreach (var i in v.NameByLCID.Keys) lcids.AddIfNew(i);
         foreach (var i in v.DescriptionByLCID.Keys) lcids.AddIfNew(i);
     }
     sb.Append("CODENAME\tVALUE");
     foreach (var v in lcids) {
         sb.Append("\t");
         sb.Append("NAME");
         sb.Append(v);
         sb.Append("\t");
         sb.Append("DESC");
         sb.Append(v);
     }
     sb.AppendLine();
     foreach (var v in _defEnum.Values.Values) {
         sb.Append(v.CodeName);
         sb.Append("\t");
         sb.Append(v.Value);
         foreach (var i in lcids) {
             sb.Append("\t");
             sb.Append(v.NameByLCID.ContainsKey(i) ? v.NameByLCID[i].Trim() : " ");
             sb.Append("\t");
             sb.Append(v.DescriptionByLCID.ContainsKey(i) ? v.DescriptionByLCID[i].Trim() : " ");
         }
         sb.AppendLine();
     }
     _text = sb.ToString();
 }
Ejemplo n.º 3
0
 void btnNewChangeEnumeration_Click(object sender, EventArgs e)
 {
     ContentDefinition def = tempDef;
     if (def.Enumeration.ContainsKey(currentDef.Id) && def.Enumeration[currentDef.Id].IsChangeDef) {
         // open existing change def
     } else {
         // create new change def
         MemDefEnumeration c = new MemDefEnumeration();
         c.Id = def.GetNewEnumerationId();
         c.ChangeGuid = currentDef.ChangeGuid;
         tempDef.Enumeration.Add(c.Id, c);
         tempDef.RegisterChange(c.Guid);
         WAFContext.FlagChangeInTemporaryDefinition();
         WAFContext.UpdateTemporaryLocalDefinitionFile();
     }
     string url = HttpContext.Current.Request.RawUrl;
     if (url.Contains("?")) url = url.Substring(0, url.IndexOf("?"));
     HttpContext.Current.Response.Redirect(url + ("?OpenEnumeration=c" + currentDef.Id.ToString()));
 }