Esempio n. 1
0
        protected virtual void RunMark(string name, MEDMSql model, XmlNode xrequest, XmlNode xresponse)
        {
            string rowtype   = XFunc.GetAttr(xrequest, "row.type", "");
            string marktypes = M740.GetParam(xrequest, "marktypes");

            if (marktypes == "" || marktypes.Contains(rowtype))
            {
                string id = XFunc.GetAttr(xrequest, "id", "");

                string key = MarkKey(xrequest);
                string s   = Session.GetString(key);
                if (s == null)
                {
                    s = "";
                }

                if (rowtype != "")
                {
                    id = rowtype + "." + id;
                }
                if (s.Contains(id))
                {
                    s = s.Replace(id + ";", "");
                    XFunc.Append(xresponse, "row", "row.mark", "0");
                }
                else
                {
                    s += id + ";";
                    XFunc.Append(xresponse, "row", "row.mark", "1");
                }

                Session.SetString(key, s);
                MarkSetCount(s, xresponse);
            }
        }
Esempio n. 2
0
        protected virtual void RunMarkSet(string name, MEDMSql model, XmlNode xrequest, XmlNode xresponse)
        {
            string key    = MarkKey(xrequest);
            string result = M740.GetParam(xrequest, "result");

            if (result == "OK")
            {
                string r = Session.GetString(key);
                if (string.IsNullOrEmpty(r))
                {
                    Session.Remove("~" + key);
                }
                else
                {
                    Session.SetString("~" + key, r);
                }
            }
            else
            {
                string r = Session.GetString("~" + key);
                if (string.IsNullOrEmpty(r))
                {
                    Session.Remove(key);
                }
                else
                {
                    Session.SetString(key, r);
                }
            }
        }
Esempio n. 3
0
        protected override void RunJoin(string name, MEDMSql model, XmlNode xrequest, XmlNode xresponse)
        {
            MEDMDefClass dc = MEDMDefModel.MainDef.Find(name);

            if (dc == null)
            {
                throw new Exception($"Нет описателя класса соответстующго имени {name}");
            }
            MEDMDefProperty dp = dc.GetIdPropery();
            List <Guid>     l  = MarkId <Guid>(Session.GetString(MarkKey(xrequest)), name.ToLower());

            if (l.Count > 0)
            {
                object id = M740.GetParam(dp.GetPropertyType(), xrequest, "id", "");
                if (id != dp.GetDefaultValue())
                {
                    string sql = "";
                    foreach (MEDMDefClass dc1 in MEDMDefModel.MainDef.AllClasses)
                    {
                        foreach (MEDMDefProperty dp1 in dc1.Properties)
                        {
                            if (dp1.RefClass == dc)
                            {
                                sql += $"update [{dc1.Name}] set [{dp1.Name}]=@p0 where CountryPresentingDemandId=@p1\r\n";
                            }
                        }
                    }
                    sql += $"delete [{name}] where Id=@p1\r\n";

                    foreach (object joinid in l)
                    {
                        if (joinid != dp.GetDefaultValue() && joinid != id)
                        {
                            model.Exec(sql, "p0", id, "p1", joinid);
                        }
                    }
                    RunMarkClear(name, model, xrequest, xresponse);
                    XFunc.SetAttr(xresponse, "exec", "refresh");
                }
            }
            else
            {
                throw new Exception($"Нет омеченных элементов");
            }
        }
Esempio n. 4
0
 public static string MarkKey(XmlNode xrequest, string datasource = "", string mode = "")
 {
     if (mode == "")
     {
         mode = M740.GetParam(xrequest, "markmode");
     }
     if (datasource == "")
     {
         datasource = M740.GetParam(xrequest, "markfield");
     }
     if (datasource == "")
     {
         datasource = M740.GetParam(xrequest, "rowset");
     }
     if (datasource == "")
     {
         M740.GetParam(xrequest, "datasource");
     }
     if (datasource == "")
     {
         datasource = XFunc.GetAttr(xrequest, "datasource", "");
     }
     return($"mark.{datasource}.{mode}");
 }