public FilterParamList(MEDMDefClass dc, XmlNode xrequest) { foreach (XmlNode xparam in xrequest.SelectNodes("descendant::param")) { string[] nn = XFunc.GetAttr(xparam, "name", "").Split('.'); string n = nn[0]; string m = ""; if (nn.Length > 1) { if (nn[0].ToLower() == "filter") { n = nn[nn.Length - 1]; if (nn.Length == 3) { m = nn[1].ToLower(); } } if (nn[0].ToLower() == "paginator") { n = nn[nn.Length - 1]; if (n.ToLower() == "top") { Top = MFunc.StringToInt(XFunc.GetText(xparam, ""), 0); continue; } } } MEDMDefProperty dp = dc.Properties[n]; if (dp != null) { object v = dp.ConvertToPropertyType(XFunc.GetText(xparam, "")); Add(new FilterParam(n, m, v)); } } }
protected XmlNode Definition(string name, MEDMSql model, XmlNode xrequest, XmlNode xresponse, string sectiontype = "", bool addExpand = false, bool addToString = false, bool isReadOnly = false) { MEDMDefClass dc = MEDMDefModel.MainDef.Find(name); if (sectiontype != "") { dc = MEDMDefModel.MainDef.Find(sectiontype); } bool isdefultsection = false; if (name == "empty") { XmlNode xrowset = XFunc.AppendWithFind(xresponse, "rowset", "rowset", "empty", "datasource", "empty"); XmlNode xsection = XFunc.Append(xrowset, "section", "row.type", sectiontype); XmlNode xrequests = XFunc.Append(xsection, "requests"); XFunc.Append(xrequests, "request", "name", "refresh"); return(xsection); } else if (dc != null) { isReadOnly = isReadOnly || dc.IsReadOnly; if (sectiontype.ToLower() == "default") { isdefultsection = true; sectiontype = ""; } XmlNode xrowset = XFunc.AppendWithFind(xresponse, "rowset", "rowset", name.ToLower(), "datasource", name.ToLower(), "readonly", isReadOnly ? "1" : "0"); XmlNode xsection = XFunc.Append(xrowset, "section", "row.type", sectiontype); XmlNode xrequests = XFunc.Append(xsection, "requests"); XFunc.Append(xrequests, "request", "name", "refresh"); if (addExpand) { XFunc.Append(xrequests, "request", "name", "expand"); } if (isdefultsection) { return(xsection); } if (dc != null && dc.BaseClass == "MEDMObj" && !isReadOnly) { XFunc.Append(xrequests, "request", "name", "save"); XFunc.Append(xrequests, "request", "name", "append"); XFunc.Append(xrequests, "request", "name", "delete"); } if (dc.IsMark) { XFunc.Append(xrequests, "request", "name", "mark"); XFunc.Append(xrequests, "request", "name", "markclear"); XmlNode xparams = XFunc.AppendWithFind(xrequests, "params"); XFunc.Append(xparams, "param", "name", "markmode", "value", name.ToLower()); XFunc.Append(xparams, "param", "name", "markfield", "value", name.ToLower() + "list"); } if (dc.IsJoin && !isReadOnly) { XmlNode xr = XFunc.Append(xrequests, "request", "name", "join"); if (dc.CaptionJoin == "*") { XFunc.SetAttr(xr, "caption", "Объединить отмеченные строки..."); } else if (dc.CaptionJoin != "") { XFunc.SetAttr(xr, "caption", dc.CaptionJoin); } if (dc.ConfirmJoin == "*") { XFunc.SetAttr(xr, "confirm", "Отмеченные строки будут объединены с текущей строкой..."); } else if (dc.ConfirmJoin != "") { XFunc.SetAttr(xr, "confirm", dc.ConfirmJoin); } } if (dc.IsCopy && !isReadOnly) { XmlNode xr = XFunc.Append(xrequests, "request", "name", "copy"); if (dc.CaptionCopy == "*") { XFunc.SetAttr(xr, "caption", "Копировать отмеченные строки..."); } else if (dc.CaptionCopy != "") { XFunc.SetAttr(xr, "caption", dc.CaptionCopy); } if (dc.ConfirmCopy == "*") { XFunc.SetAttr(xr, "confirm", "Отмеченные строки будут скопированы..."); } else if (dc.ConfirmCopy != "") { XFunc.SetAttr(xr, "confirm", dc.ConfirmCopy); } } if (dc.IsMove && !isReadOnly) { XmlNode xr = XFunc.Append(xrequests, "request", "name", "move"); if (dc.CaptionMove == "*") { XFunc.SetAttr(xr, "caption", "Перенести отмеченные строки..."); } else if (dc.CaptionMove != "") { XFunc.SetAttr(xr, "caption", dc.CaptionMove); } if (dc.ConfirmMove == "*") { XFunc.SetAttr(xr, "confirm", "Отмеченные строки будут перенесены..."); } else if (dc.ConfirmMove != "") { XFunc.SetAttr(xr, "confirm", dc.ConfirmMove); } } if (dc.IsLink && !isReadOnly) { XmlNode xr = XFunc.Append(xrequests, "request", "name", "link"); if (dc.CaptionLink == "*") { XFunc.SetAttr(xr, "caption", "Присоединить отмеченные строки..."); } else if (dc.CaptionLink != "") { XFunc.SetAttr(xr, "caption", dc.CaptionLink); } if (dc.ConfirmLink == "*") { XFunc.SetAttr(xr, "confirm", "Отмеченные строки будут присоединены..."); } else if (dc.ConfirmLink != "") { XFunc.SetAttr(xr, "confirm", dc.ConfirmLink); } } if (dc.IsClone && !isReadOnly) { XmlNode xr = XFunc.Append(xrequests, "request", "name", "clone"); if (dc.CaptionClone == "*") { XFunc.SetAttr(xr, "caption", "Клонировать отмеченные строки..."); } else if (dc.CaptionClone != "") { XFunc.SetAttr(xr, "caption", dc.CaptionClone); } if (dc.ConfirmClone == "*") { XFunc.SetAttr(xr, "confirm", "Отмеченные строки будут клонированы..."); } else if (dc.ConfirmClone != "") { XFunc.SetAttr(xr, "confirm", dc.ConfirmClone); } } XmlNode xfields = XFunc.Append(xsection, "fields"); foreach (MEDMDefProperty dp in dc.Properties) { if (dp.IsVisible) { if (dp.IsInterval) { XFunc.Append(xfields, "field", "name", (dp.Name + ".Min").ToLower(), "type", dp.GetDataTypeFor740(), "caption", dp.Header + " от", "len", GetLen(dp)); XFunc.Append(xfields, "field", "name", (dp.Name + ".Max").ToLower(), "type", dp.GetDataTypeFor740(), "caption", "до", "len", GetLen(dp)); } else { string t = dp.GetDataTypeFor740(); string list = ""; if (!string.IsNullOrEmpty(dp.Items)) { foreach (string item in dp.Items.Split(itemd, StringSplitOptions.RemoveEmptyEntries)) { string item1 = item.Replace(";", ",").Trim(); if (!string.IsNullOrEmpty(item1)) { if (!string.IsNullOrEmpty(list)) { list += ";"; } list += item1; } } } if (list != "") { t = "list"; } XmlNode xfield = XFunc.Append(xfields, "field", "name", dp.Name.ToLower(), "type", t, "caption", dp.Header, "len", GetLen(dp), "list", list); if (t == "radio") { if (dp.DataType == "int" || dp.DataType == "long" || dp.DataType == "short" || dp.DataType == "byte") { XFunc.SetAttr(xfield, "basetype", "num"); XFunc.SetAttr(xfield, "default", MFunc.StringToInt(dp.DefValue, 1).ToString()); } else { } } if (!MEDMObj.IsEmptyId(dp.RefClassId)) { XFunc.Append(xfield, "ref", "datasource", dp.RefClass.Name.ToLower()); XFunc.SetAttr(xfield, "type", "ref"); XFunc.SetAttr(xfield, "visible", "0"); XmlNode xreffield = XFunc.Append(xfields, "field", "name", (dp.GetRefName() + "_tostring_").ToLower(), "type", "string", "refid", dp.Name.ToLower(), "refname", "_tostring_", "caption", dp.Header, "len", GetLen(dp)); } } } } if (addToString) { XFunc.SetAttr(xfields, "name", "_tostring_"); XFunc.Append(xfields, "field", "name", "_tostring_", "type", "string", "caption", "", "len", "255"); } return(xsection); } return(null); }
public new static object StringToIdType(string id) { return(MFunc.StringToInt(id)); }