Exemple #1
0
    public T Create(GetObj creatAction)
    {
        T newObj = creatAction();

        _Instance.m_pool.Add(newObj);
        return(newObj);
    }
        GetObj IObjectCreate.GetObj(string obj_code, string Language)
        {
            try
            {
                GetObj getObj = ObjectCreateDataAccess.GetObj(obj_code, Language);

                return(getObj);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
 public AjaxRspJson GetObj(string Language, string obj_code)
 {
     try
     {
         GetObj getObj = _objectCreate.GetObj(obj_code, Language);
         return(new AjaxRspJson {
             RspCode = RspStatus.Successed, ObjectData = getObj, RspMsg = ""
         });
     }
     catch (Exception ex)
     {
         return(new AjaxRspJson {
             RspCode = RspStatus.Failed, ObjectData = null, RspMsg = ex.Message
         });
     }
 }
        public static T GetAndSave <T> (string key, GetObj <T> getter)
        {
            object o = HttpContext.Current.Items[key];

            if (o == null)
            {
                o = getter( );
                HttpContext.Current.Items[key] = o;
            }

            if (o == null)
            {
                return(default(T));
            }

            return(( T )o);
        }
        public static GetObj GetObj(string obj_code, string Language)
        {
            try
            {
                GetObj getObj = new GetObj();

                #region 对应UserControl 的编辑对象名
                string is_enable = "select is_enable from flc_object where obj_code='{0}'";
                string zn_CN1    = "select value from flc_lang where key='{0}' and lan='zn_CN'";
                string en_US1    = "select value from flc_lang where key='{0}' and lan='en_US'";

                is_enable = AppDataBase.ExecuteScalar(string.Format(is_enable, obj_code)).ToString();
                is_enable = (is_enable == "1" ? "是" : "否");
                zn_CN1    = AppDataBase.ExecuteScalar(string.Format(zn_CN1, obj_code)).ToString();
                en_US1    = AppDataBase.ExecuteScalar(string.Format(en_US1, obj_code)).ToString();

                Obj_Name obj_Name = new Obj_Name();
                obj_Name.Obj_Code  = obj_code;
                obj_Name.zn_CN     = zn_CN1;
                obj_Name.en_US     = en_US1;
                obj_Name.Is_Enable = is_enable;

                getObj.obj_name = obj_Name;
                #endregion

                #region 对应UserControl 的对象表关系

                string getdata_objects = "Select * from FLC_OBJECTS where obj_code = :obj_code";
                var    param           = new DynamicParameters();
                param.Add(":obj_code", obj_code);
                IEnumerable <Flc_Objects> obj_relations = AppDataBase.Query <Flc_Objects>(getdata_objects, param);
                List <Obj_Relation>       obj_Relations = new List <Obj_Relation>();

                foreach (Flc_Objects item in obj_relations)
                {
                    Obj_Relation obj_Relation = new Obj_Relation();

                    obj_Relation.是否删除 = false;
                    obj_Relation.对象名  = item.Obj_Code;
                    obj_Relation.对象表名 = item.Obj_Table;

                    string code   = obj_code + "." + item.Obj_Table;
                    string zn_CN2 = "select value from flc_lang where key='{0}' and lan='zn_CN'";
                    string en_US2 = "select value from flc_lang where key='{0}' and lan='en_US'";

                    zn_CN2 = AppDataBase.ExecuteScalar(string.Format(zn_CN2, code)).ToString();
                    en_US2 = AppDataBase.ExecuteScalar(string.Format(en_US2, code)).ToString();

                    obj_Relation.中文语言 = zn_CN2;
                    obj_Relation.英文语言 = en_US2;
                    string is_main = item.Is_Main.ToString();
                    is_main = (is_main == "1" ? "是" : "否");

                    obj_Relation.是否主表 = is_main;

                    obj_Relations.Add(obj_Relation);
                }

                getObj.obj_relation = obj_Relations;
                #endregion

                #region 对应UserControl 的对象属性

                string getdata_ObjTabProperty = "Select * from FLC_OBJECT_PROPERTY where obj_code = :obj_code";

                IEnumerable <Flc_Object_Property> obj_propertys = AppDataBase.Query <Flc_Object_Property>(getdata_ObjTabProperty, param);
                foreach (Flc_Object_Property item in obj_propertys)
                {
                    string code   = obj_code + "." + item.Obj_Table + "." + item.Obj_Pro_Code.ToString().ToUpper();
                    string zn_CN2 = "select value from flc_lang where key='{0}' and lan='zn_CN'";
                    string en_US2 = "select value from flc_lang where key='{0}' and lan='en_US'";

                    zn_CN2 = AppDataBase.ExecuteScalar(string.Format(zn_CN2, code)).ToString();
                    en_US2 = AppDataBase.ExecuteScalar(string.Format(en_US2, code)).ToString();

                    item.Zn_Cn  = zn_CN2;
                    item.en_Us  = en_US2;
                    item.Is_Del = false;
                }

                getObj.obj_property = obj_propertys;
                #endregion

                #region 获得所有对象名称
                string all_object            = @"select obj_code,value from flc_object t left join flc_lang e on 
                                           t.obj_code=e.key and e.lan='" + Language + "'";
                IEnumerable <Allobj> allobjs = AppDataBase.Query <Allobj>(all_object);

                foreach (Allobj item in allobjs)
                {
                    if (item.Value == "")
                    {
                        item.Value = item.Obj_Code;
                    }
                }
                getObj.allobj = allobjs;
                #endregion

                #region 获得所有对象表
                string all_objecttab = "select obj_table from flc_objects where obj_code='" + obj_code + "'";
                IEnumerable <Allobjtab> allobjtab = AppDataBase.Query <Allobjtab>(all_objecttab);

                getObj.allobjtab = allobjtab;
                #endregion

                return(getObj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #6
0
 private PushbackQueue(GetObj getObj, TokWrap tokWrap)
 {
     this.getObj  = getObj;
     this.tokWrap = tokWrap;
 }
Exemple #7
0
 /// <summary>
 /// Create a new pushback queue which enqueues token information
 /// from the host scanner. This should be called once per scanner
 /// instance, at scanner initialization.
 /// </summary>
 /// <param name="getObj">A delegate that constructs an Obj from a call to scanner.yylex</param>
 /// <param name="tokWrap">A delegate that constructs an Obj from the given integer token</param>
 /// <returns>A reference to the queue object</returns>
 public static PushbackQueue <Obj> NewPushbackQueue(GetObj getObj, TokWrap tokWrap)
 {
     return(new PushbackQueue <Obj>(getObj, tokWrap));
 }