Exemplo n.º 1
0
        private static object GetPropertyValue(string menuNo, DataRow[] drs)
        {
            if (drs.Length == 0)
            {
                return(null);
            }
            Sys_Property      prop     = (Sys_Property)drs[0];
            Sys_Property_Sets propsets = Sys_Property_Sets.EP;

            if (prop.IsSystem)
            {
                string sql       = string.Format("select Value from sys_Property_Set where PropertyID={0} and iUserID=-1", prop.ID);
                object valuetext = YueMES.Base.Dal.DAO.Default.ExecuteScalar(sql).Value;
                if (valuetext == null)
                {
                    return(prop.GetValue().Value);
                }
                if (valuetext == DBNull.Value)
                {
                    return(prop.GetValue().Value);
                }
                DataRow drold = propsets.FindRow("PropertyID", prop.ID);
                if (drold != null)
                {
                    lock (_lock)
                    {
                        drold["Value"] = valuetext;
                        drold.AcceptChanges();
                    }
                }


                return(prop.GetValue((string)valuetext).Value);
            }
            else
            {
                propsets = Sys_Users.GetItem(HttpContextExt.UserNo).GetProperties(menuNo);
                drs      = propsets.Select(string.Format("PropertyID={0}", prop.ID));
                if (drs.Length == 0)
                {
                    return(prop.GetValue().Value);
                }
                string valueText = (string)drs[0]["Value"];
                object value     = prop.GetValue(valueText).Value;
                if (value == null)
                {
                    value = prop.GetValue().Value;
                }
                return(value);
            }
        }
Exemplo n.º 2
0
        public static Sys_Property GetItem(int id)
        {
            Sys_Property result = (Sys_Property)Default.FindRow("ID", id);

            return(result);
        }