Ejemplo n.º 1
0
        private void M0005_ReadingHistory()
        {
            XRegistry XReg = new XRegistry("<n/>", FileLinks.ROOT_SETTING + "ReadingHistory.xml");

            XParameter[] XParams = XReg.Parameters();
            foreach (XParameter XParam  in XParams)
            {
                string Id   = XParam.Id;
                string Name = XParam.GetValue("name");
                string Date = XParam.GetValue("date");

                if (int.TryParse(Id, out int aid))
                {
                    BookItem Bk = X.Instance <BookItem>(XProto.BookItemEx, Id);
                    Bk.Title = Name;

                    if (DateTime.TryParse(Date, out DateTime dt))
                    {
                        Bk.Entry.LastAccess = dt;
                    }
                }
            }

            Shared.BooksDb.SaveChanges();
        }
Ejemplo n.º 2
0
        public static XParam CreateConfigurationParam(this XModuleAttribute moduleAttribute)
        {
            var xp = XParam.Create();

            xp.ParamType = XParam.ParamTypeE.Configuration;
            moduleAttribute.Properties.Add(xp);
            return(xp);
        }
Ejemplo n.º 3
0
        public static XParam CreateTechnicalIDParam(this XModuleAttribute moduleAttribute)
        {
            var xp = XParam.Create();

            xp.ParamType = XParam.ParamTypeE.TechnicalID;
            moduleAttribute.Properties.Add(xp);
            return(xp);
        }
Ejemplo n.º 4
0
        public static void AddXParamToModuleAttribute(this XModuleAttribute moduleAttribute,
                                                      string name,
                                                      string value,
                                                      ParamTypeE xParamType)
        {
            XParam newXParam = moduleAttribute.CreateConfigurationParam();

            newXParam.Name      = name;
            newXParam.Value     = value;
            newXParam.ParamType = xParamType;
        }
        /// <summary>
        /// Creates configuration param
        /// </summary>
        /// <param name="module">API Module</param>
        /// <param name="name">Name of the configuration parameter</param>
        /// <param name="value">Value of the configuration parameter</param>
        public static void AddConfigurationParam(this ApiModule module, string name, string value)
        {
            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(value))
            {
                return;
            }
            XParam newXParam = module.CreateConfigurationParam();

            newXParam.Name      = name;
            newXParam.Value     = value;
            newXParam.ParamType = ParamTypeE.Configuration;
            if (name == "Password")
            {
                newXParam.Visible = false;
            }
        }
Ejemplo n.º 6
0
        public static void AddXParamToModuleAttribute(this ApiModule module,
                                                      string name,
                                                      string value,
                                                      ParamTypeE xParamType)
        {
            var xparam = module.XParams.Where(x => x.Name == name);

            if (xparam == null || !xparam.Any())
            {
                XParam newXParam = module.CreateConfigurationParam();
                newXParam.Name      = name;
                newXParam.Value     = value;
                newXParam.ParamType = xParamType;
                if (name == "Password")
                {
                    newXParam.Visible = false;
                }
            }
        }
        /// <summary>
        /// Creates technical param in the property section of module
        /// </summary>
        /// <param name="module">API Module</param>
        /// <param name="name">Name of the Technical parameter</param>
        /// <param name="value">Value of the Technical parameter</param>
        /// <param name="visibility">if the param will be visible in the property section</param>
        public static void AddTechnicalIdParam(this ApiModule module,
                                               string name,
                                               string value,
                                               bool visibility = true)
        {
            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(value))
            {
                return;
            }
            XParam newXParam = module.CreateConfigurationParam();

            newXParam.Name      = name;
            newXParam.Value     = value;
            newXParam.ParamType = ParamTypeE.TechnicalID;
            if (!visibility)
            {
                newXParam.Visible = false;
            }
            if (name == "Password")
            {
                newXParam.Visible = false;
            }
        }
Ejemplo n.º 8
0
 public void AddBusinessParam(XParam param, string name, string value)
 {
     param.Name  = name;
     param.Value = value;
 }
Ejemplo n.º 9
0
 public override string ToString()
 {
     return(XParam.ToString() + ", " + YParam.ToString());
 }
Ejemplo n.º 10
0
        private static XNamespace GetNamespace(XModuleAttribute xdoc)
        {
            XParam namespaceXparam = xdoc.XParams.FirstOrDefault(x => x.Name == "NamespaceURI");

            return(namespaceXparam?.Value);
        }