Beispiel #1
0
    private void BindDataGrid()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add("id");
        dt.Columns.Add("key");
        dt.Columns.Add("value");
        dt.Columns.Add("description");
        dt.Columns.Add("valid");
        SystemWholeXmlConfigManager.EnsureLoaded();
        Hashtable            cache = SystemWholeXmlConfigManager.Caches;
        SystemWholeXmlConfig config;

        System.Collections.IDictionaryEnumerator enumerator = cache.GetEnumerator();
        DataRow dr = null;

        while (enumerator.MoveNext())
        {
            config            = enumerator.Value as SystemWholeXmlConfig;
            dr                = dt.NewRow();
            dr["id"]          = config.Id;
            dr["key"]         = config.Key;
            dr["value"]       = config.Value;
            dr["description"] = config.Description;
            dr["valid"]       = config.Valid;
            dt.Rows.Add(dr);
        }
        this.DataGrid1.DataSource = dt;
        this.DataGrid1.DataBind();
    }
Beispiel #2
0
        /// <summary>
        /// 创建一个对象到数据库中,成功后通过select max()来返回主键
        /// </summary>
        /// <param name="obj">实体对象</param>
        /// <returns>是否插入成功</returns>
        public static bool Create(object obj)
        {
            IDataAccess   dataAccess = CreateConn();
            Type          type       = obj.GetType();
            StringBuilder sql        = new StringBuilder(SimpleOrmCache.GetInsertSql(type));
            Hashtable     table      = SimpleOrmCache.GetInsertField(type);

            System.Collections.IDictionaryEnumerator enumerator = table.GetEnumerator();
            string field = string.Empty;
            object value = null;

            while (enumerator.MoveNext())
            {
                field = enumerator.Key.ToString();
                value = type.GetField(field, BindingFlags.IgnoreCase | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy).GetValue(obj);
                sql.Replace("#" + field + "#", value == null ? "" : DALSecurityTool.TransferInsertField(TransObjectField(value)));
            }
            bool result = dataAccess.ExecuteSql(sql.ToString());

            if (result)//执行把主键赋给对象
            {
                string pk     = SimpleOrmCache.GetPK(type);
                object objtmp = dataAccess.SelectScalar("select max(" + pk + ") from " + SimpleOrmCache.GetTableName(type));
                if (objtmp != null)
                {
                    FormHelper.SetDataToObject(obj, pk, objtmp);
                    //FormHelper.SetDataToObject(obj,pk,FormHelper.ParseFieldInfo(obj,objtmp);
                    //FieldInfo fieldtmp=type.GetField(pk);
                    //fieldtmp.SetValue(obj, FormHelper.ParseFieldInfo(fieldtmp, objtmp));
                }
            }
            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// 判断某用户是否已经登陆
        /// </summary>
        /// <param name="id">为用户ID或用户名这个必须是用户的唯一标识</param>
        /// <returns>true为没有登陆 flase为被迫下线</returns>
        public bool IsLogin(object id)
        {
            bool   flag = true;
            string uid  = id.ToString();

            System.Collections.Hashtable ht = (System.Collections.Hashtable)HttpContext.Current.Application[appKey];
            if (ht != null)
            {
                System.Collections.IDictionaryEnumerator IDE = ht.GetEnumerator();
                while (IDE.MoveNext())
                {
                    //找到自己的登陆ID
                    if (IDE.Key.ToString().Equals(HttpContext.Current.Session.SessionID))
                    {
                        //判断用户是否被注销
                        if (IDE.Value.ToString().Equals(logout))
                        {
                            ht.Remove(HttpContext.Current.Session.SessionID);
                            HttpContext.Current.Application.Lock();
                            HttpContext.Current.Application[appKey] = ht;
                            HttpContext.Current.Application.UnLock();
                            HttpContext.Current.Session.RemoveAll();
                            //HttpContext.Current.Response.Write("<script type='text/javascript'>alert('你的帐号已在别处登陆,你被强迫下线!')</script>");
                            flag = false;
                        }
                        break;
                    }
                }
            }
            return(flag);
        }
Beispiel #4
0
        /// <summary>
        /// 更新一个实体对象
        /// </summary>
        /// <param name="obj">实体对象</param>
        /// <returns>是否更新成功</returns>
        public static bool Update(object obj)
        {
            IDataAccess   dataAccess = CreateConn();
            Type          type       = obj.GetType();
            StringBuilder sql        = new StringBuilder(SimpleOrmCache.GetUpdateSql(type));
            Hashtable     table      = SimpleOrmCache.GetUpdateField(type);

            System.Collections.IDictionaryEnumerator enumerator = table.GetEnumerator();
            string field = string.Empty;
            object value = null;

            while (enumerator.MoveNext())
            {
                field = enumerator.Key.ToString();
                value = type.GetField(field, BindingFlags.IgnoreCase | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy).GetValue(obj);
                sql.Replace("#" + field + "#", value == null ? "" : DALSecurityTool.TransferInsertField(TransObjectField(value)));
            }
            FieldInfo key = type.GetField(SimpleOrmCache.GetPK(type), BindingFlags.IgnoreCase | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.FlattenHierarchy);

            if (typeof(int) == key.FieldType)
            {
                sql.Append(key.GetValue(obj).ToString());
            }
            else
            {
                sql.Append("'" + key.GetValue(obj).ToString() + "'");
            }

            return(dataAccess.ExecuteSql(sql.ToString()));
        }
Beispiel #5
0
        // This method is to show you, how to load a pre-defined named connection xml file.
        // sample_namedConnection.xml is the file that we loaded.
        //
        private void LoadNamedConnectionMenuItem_Click(object sender, System.EventArgs e)
        {
            System.Windows.Forms.OpenFileDialog openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            openFileDialog1.Multiselect     = false;
            openFileDialog1.CheckFileExists = true;
            openFileDialog1.DefaultExt      = "XML";
            openFileDialog1.Filter          = "Named Connection (*.xml)|*.xml||";
            openFileDialog1.FileName        = "sample_namedConnection.xml";
            if (openFileDialog1.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    Session.Current.Catalog.NamedConnections.Load(openFileDialog1.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
                MessageBox.Show(openFileDialog1.FileName + " is loaded.");
            }
            // code shows, how to enumerate a collection of named connections
            System.Collections.IDictionaryEnumerator eu = Session.Current.Catalog.NamedConnections.GetEnumerator();
            int i = 0;

            while (eu.MoveNext())
            {
                NamedConnectionInfo info = eu.Value as NamedConnectionInfo;
                string aline             = string.Format("named connection {0}:{1}:{2},{3},{4}",
                                                         i, eu.Key, info.DBType, info.ConnectionMethod, info.ConnectionString);
                MessageBox.Show(aline);
                ++i;
            }
        }
Beispiel #6
0
        /// <summary>
        /// 加载所有的插件,如果已经注入则不再注入,注入同时生成HashTable插件缓存
        /// </summary>
        public static void LoadAllPluginToMainForm(BaseMainForm form)
        {
            //LoadAllPlugin();
            ///TODO:需要从配置文件中加载,免得顺序不对
            LoadAllPluginCaches();
            if (!HavedEmmitPlugin)
            {
                PluginsFileConfig config = FT.Commons.Cache.StaticCacheManager.GetConfig <PluginsFileConfig>();
                if (config.PluginTypes.Count > 0)//如果配置里面插件数量大于0
                {
                    string tmp = "";
                    for (int i = 0; i < config.PluginTypes.Count; i++)
                    {
                        tmp = config.PluginTypes[i].ToString();
                        EmmitFromType(form, System.Type.GetType(tmp));
                    }
                }

                else
                {
                    System.Collections.IDictionaryEnumerator enumerator = AllCaches.GetEnumerator();
                    //ListViewItem tmp = null;
                    string att = string.Empty;
                    while (enumerator.MoveNext())
                    {
                        att = enumerator.Key.ToString();
                        if (att != null)
                        {
                            EmmitFromType(form, System.Type.GetType(att));
                        }
                    }
                }
                HavedEmmitPlugin = true;
            }
        }
Beispiel #7
0
        public void removeClient(ClientHandler ch)
        {
            lock (this._clients)
            {
                //we tell all the clients that a new client has logged on to the server
                this._clients.Remove(ch.getClientID());
                ChatBuddy newChatBuddy = new ChatBuddy(ch._client.getIP(), ch._client.getChatName(), RuntimeConstants.BUDDY_DISCONNECTING, ch._client.getID());
                if (this._clients.Count > 0)
                {
                    System.Collections.IDictionaryEnumerator ide = this._clients.GetEnumerator();
                    ide.MoveNext();
                    while (ide.Current != null)
                    {
                        //Logger.getLogger().log(Logger.DEBUG_PRIORITY, "What type of object is this: " + ide.Current.GetType());
                        ClientHandler tempCH = (ClientHandler)((DictionaryEntry)ide.Current).Value;
                        ThreadPool.QueueUserWorkItem(new WaitCallback(tempCH._responseHandler.buddyUpdate), newChatBuddy);
                        if (!ide.MoveNext())
                        {
                            break;
                        }
                    }
                }
                //  we add the client

                //we need to tell all the other clients that this person has left
            }
            ch._client._status = RuntimeConstants.DISCONNECTED;
            Logger.getLogger().log(Logger.INFO_PRIORITY, "The following client has left the chat: " + ch._client.ToString());
            //System.GC.Collect();
        }
Beispiel #8
0
    public void SetBoxingList()
    {
        BoxingViewData min = null;
        //筛选第一个
        Hashtable h = new Hashtable();

        System.Collections.IDictionaryEnumerator enumerator = UserManager.Instance.boxTable.GetEnumerator();
        while (enumerator.MoveNext())
        {
            BoxingViewData r = UserManager.Instance.boxTable[enumerator.Key] as BoxingViewData;
            r.sort = GetSort(r);
            if (min == null)
            {
                min = r;
            }
            else
            {
                if (r.sort < min.sort)
                {
                    min = r;
                }
            }
            if (r.data.comm == 2 && r.data.csv_id == pop.curRoleView.data.starData.skill_csv_id)
            {
                h.Add(r.data.csv_id, r);
            }
            else
            {
                h.Add(r.data.csv_id, r);
            }
        }
        pop.SetBoxingList(h);
        pop.curBoxView = pop.GetBoxView(min.data.csv_id);
        SetSelectBoxing(pop.curBoxView);
    }
Beispiel #9
0
        /// ****************************************************************************
        /// <summary>
        /// 流程属性帮定逻辑实现
        /// </summary>
        /// <param name="ObjectCase">帮定对象</param>
        /// <param name="ObjectType">帮定类型</param>
        /// <param name="ProcedureCase">流程对象</param>
        /// ****************************************************************************
        private static void PropertyBoundProcess(object ObjectCase, string ObjectType, Procedure ProcedureCase)
        {
            if (ObjectType == "HtmlSelect")
            {
                ListItem ListItemCase = new ListItem();
                ListItemCase.Text  = "--选择--";
                ListItemCase.Value = "";
                ((HtmlSelect)ObjectCase).Items.Add(ListItemCase);
            }
            if (ObjectType == "ValueList")
            {
                ((ValueList)ObjectCase).ValueListItems.Add("", "--选择--");
            }

            System.Collections.IDictionaryEnumerator ie = ProcedureCase.GetPropertyEnumerator();
            while (ie.MoveNext())
            {
                Property PropertyCase = (Property)ie.Value;
                string   ItemText     = PropertyCase.ProcedurePropertyName;
                string   ItemValue    = PropertyCase.WorkFlowProcedurePropertyCode;;

                if (ObjectType == "HtmlSelect")
                {
                    ListItem ListItemCase = new ListItem();
                    ListItemCase.Text  = ItemText;
                    ListItemCase.Value = ItemValue;
                    ((HtmlSelect)ObjectCase).Items.Add(ListItemCase);
                }
                if (ObjectType == "ValueList")
                {
                    ((ValueList)ObjectCase).ValueListItems.Add(ItemValue, ItemText);
                }
            }
        }
        private void FillSendCopyUserSelect(WorkCase workCase, Procedure procedure, Task CurrentTask)
        {
            string sCodes = "";
            string sNames = "";

            System.Collections.IDictionaryEnumerator ie = CurrentTask.GetTaskActorEnumerator();
            while (ie.MoveNext())
            {
                TaskActor ta = (TaskActor)ie.Value;
                if (ta.TaskActorID == "1" && ta.ActorType == 1)
                {
                    if (!(ta.TaskActorType == "All" || (workCase.GetAct(this.txtCurrentActCode.Value).Copy == 1 && CurrentTask.GetTaskActor(workCase.GetAct(this.txtCurrentActCode.Value).TaskActorID).TaskActorName == "1")))
                    {
                        Role       role   = procedure.GetRole(ta.ActorCode);
                        EntityData ed     = BLL.WorkFlowRule.GetRoleUser(workCase, CurrentTask, ta);
                        int        iCount = ed.CurrentTable.Rows.Count;
                        for (int i = 0; i < iCount; i++)
                        {
                            ed.SetCurrentRow(i);
                            string UserName = RmsPM.BLL.SystemRule.GetUserNameByProjectCode(this.ProjectCode, ed.GetString("UserName"), ed.GetString("ShortUserName"), null);

                            sCodes += ed.GetString("UserCode") + "," + ta.TaskActorCode + "," + UserName + "," + role.RoleName + ";";
                            sNames += UserName + ",";
                        }
                    }
                }
            }
            this.txtSendCopyUserCodes.Value = sCodes;
            if (sNames.Length > 0)
            {
                this.SendCopyTd.InnerHtml = "<font color='red'>系统将自动为以下人员抄送一份。</font><br/>  " + sNames.Remove(sNames.Length - 1, 1);
            }
        }
Beispiel #11
0
    /// <summary>
    /// 装备提升战斗力固定值
    /// </summary>
    /// <param name="attrtype"></param>
    /// <returns></returns>
    public float GetEquipAttrByType(int attrtype)
    {
        float num = 0;

        System.Collections.IDictionaryEnumerator enumerator = UserManager.Instance.equipTable.GetEnumerator();
        int level = 0;

        while (enumerator.MoveNext())
        {
            EquipViewData r = UserManager.Instance.equipTable[enumerator.Key] as EquipViewData;
            if (r.data.levelData != null)
            {
                num += r.data.levelData.attrArr[attrtype];
            }
            if (r.level == 0 || r.level > level)
            {
                level = r.level;
            }
        }
        EquipmentKitData ekd = GameShared.Instance.GetEquipmentKitByLevel(level);//套装效果

        if (ekd != null)
        {
            num += (int)ekd.attrArr[attrtype];
        }
        return(num);
    }
Beispiel #12
0
        private string GenerateMacroTag(string macroContent)
        {
            string macroAttr = macroContent.Substring(5, macroContent.IndexOf(">") - 5);
            string macroTag  = "<?UMBRACO_MACRO ";

            System.Collections.Hashtable             attributes = ReturnAttributes(macroAttr);
            System.Collections.IDictionaryEnumerator ide        = attributes.GetEnumerator();
            while (ide.MoveNext())
            {
                if (ide.Key.ToString().IndexOf("umb_") != -1)
                {
                    // Hack to compensate for Firefox adding all attributes as lowercase
                    string orgKey = ide.Key.ToString();
                    if (orgKey == "umb_macroalias")
                    {
                        orgKey = "umb_macroAlias";
                    }

                    macroTag += orgKey.Substring(4, orgKey.Length - 4) + "=\"" +
                                ide.Value.ToString().Replace("\\r\\n", Environment.NewLine) + "\" ";
                }
            }
            macroTag += "/>";
            return(macroTag);
        }
Beispiel #13
0
    //获得当前升级装备
    public EquipViewData GetCurEquip(ref Hashtable table)
    {
#if Lua
        LuaFunction f   = l.GetFunction("GetCurEquip");
        object[]    obj = f.Call(table);
        curEquip = obj[0];
#else
        System.Collections.IDictionaryEnumerator enumerator = table.GetEnumerator();
        curLevelEquip = null;
        while (enumerator.MoveNext())
        {
            if (curLevelEquip != null)
            {
                EquipViewData a = table[enumerator.Key] as EquipViewData;
                if (a.level < curLevelEquip.level)
                {
                    curLevelEquip = a;
                }
            }
            else
            {
                curLevelEquip = table[enumerator.Key] as EquipViewData;
            }
        }
#endif
        return(curLevelEquip);
    }
Beispiel #14
0
        /// <summary>
        /// 获取表的定义字段
        /// </summary>
        /// <returns></returns>
        public static string GetTableDDL(Type type)
        {
            if (type == null)
            {
                return(string.Empty);
            }
            InitType(type);
            StringBuilder sb        = new StringBuilder();
            string        tablename = GetTableName(type);
            string        pk        = GetPK(type);
            Hashtable     table     = GetSelectField(type);

            sb.Append("create table " + tablename + "(");
            sb.Append(pk + " autoincrement PRIMARY KEY ");
            System.Collections.IDictionaryEnumerator enumerator = table.GetEnumerator();
            string field = string.Empty;

            while (enumerator.MoveNext())
            {
                field = enumerator.Key.ToString();
                if (field != pk)
                {
                    sb.Append("," + field.ToLower() + " TEXT(50)");
                }
            }
            return(sb.ToString().TrimEnd(',') + ")");
        }
Beispiel #15
0
 public void SetBoxingList(Hashtable list)
 {
     while (boxTable.transform.childCount > 0)
     {
         DestroyImmediate(boxTable.transform.GetChild(0).gameObject);
     }
     if (list != null)
     {
         boxViewTable = new Hashtable();
         System.Collections.IDictionaryEnumerator enumerator = UserManager.Instance.RoleTable.GetEnumerator();
         while (enumerator.MoveNext())
         {
             //设置格子 roleTable
             BoxingViewData r = list[enumerator.Key] as BoxingViewData;
             if (r != null)
             {
                 GameObject obj = Instantiate(boxPrefabe);
                 obj.SetActive(true);
                 BoxingView pop = obj.GetComponent <BoxingView>();
                 pop.InitData(r, true);
                 obj.name                 = r.sort.ToString();
                 pop.transform.parent     = boxTable.transform;
                 pop.transform.position   = Vector3.zero;
                 pop.transform.localScale = Vector3.one;
                 if (!boxViewTable.Contains(r.data.csv_id))
                 {
                     boxViewTable.Add(r.data.csv_id, pop);
                 }
             }
         }
         boxScrollView.ResetPosition();
         boxTable.Reposition();
         boxTable.repositionNow = true;
     }
 }
Beispiel #16
0
        /**
         * Validates if all Objects File Paths are Valid
         */
        private static void validateObjectFilePaths()
        {
            if (objects == null || objects.Count == 0)
            {
                throw new ATLogicException("No Objects found in the Trial");
            }

            System.Collections.IDictionaryEnumerator itr = objects.GetEnumerator();
            while (itr.MoveNext())
            {
                String objName     = itr.Key.ToString();
                String objFilePath = itr.Value.ToString();
                try
                {
                    if (objFilePath == null || !File.Exists(objFilePath))
                    {
                        throw new ATLogicException("Invalid Object File path " + objFilePath + "  for Object : " + objName);
                    }
                }
                catch (Exception)
                {
                    throw new ATLogicException("Invalid Object File path +" + objFilePath + "  for Object : " + objName);
                }
            }
        }
Beispiel #17
0
    ///
    public void RestTotalNum()
    {
        System.Collections.IDictionaryEnumerator enumerator = UserManager.Instance.equipTable.GetEnumerator();
        int p = 0;
        int d = 0;
        int c = 0;
        int y = 0;

        while (enumerator.MoveNext())
        {
            EquipViewData a = UserManager.Instance.equipTable[enumerator.Key] as EquipViewData;
            p += (int)a.data.levelData.attrArr[(int)Def.AttrType.FightPower];
            d += (int)a.data.levelData.attrArr[(int)Def.AttrType.Defense];
            c += (int)a.data.levelData.attrArr[(int)Def.AttrType.Crit];
            y += (int)a.data.levelData.attrArr[(int)Def.AttrType.Pray];
        }

        EquipmentKitData ekd = GameShared.Instance.GetEquipmentKitByLevel(curLevelEquip.level);

        if (ekd != null)
        {
            p += (int)ekd.attrArr[(int)Def.AttrType.FightPower];
            d += (int)ekd.attrArr[(int)Def.AttrType.Defense];
            c += (int)ekd.attrArr[(int)Def.AttrType.Crit];
            y += (int)ekd.attrArr[(int)Def.AttrType.Pray];
        }

        pop.SetTotalNum(p.ToString(), d.ToString(), c.ToString(), y.ToString());
    }
Beispiel #18
0
/// <summary>
/// Called by the the listener.
/// </summary>
/// <param name="ch"></param>

        public void addClient(ClientHandler ch)
        {
            if (this._isrunning)
            {
                lock (this._clients)
                {
                    //we tell all the clients that a new client has logged on to the server
                    ChatBuddy newChatBuddy = new ChatBuddy(ch._client.getIP(), ch._client.getChatName(), RuntimeConstants.NEW_BUDDY, ch._client.getID());
                    if (this._clients.Count > 0)
                    {
                        System.Collections.IDictionaryEnumerator ide = this._clients.GetEnumerator();
                        ide.MoveNext();
                        while (ide.Current != null)
                        {
                            //Logger.getLogger().log(Logger.DEBUG_PRIORITY, "What type of object is this: " + ide.Current.GetType());
                            ClientHandler tempCH = (ClientHandler)((DictionaryEntry)ide.Current).Value;
                            ThreadPool.QueueUserWorkItem(new WaitCallback(tempCH._responseHandler.buddyUpdate), newChatBuddy);
                            if (!ide.MoveNext())
                            {
                                break;
                            }
                        }
                    }
                    //  we add the client
                    this._clients.Add(ch.getClientID(), ch);
                }
            }
            else
            {
                Logger.getLogger().log(Logger.INFO_PRIORITY, "Server is not running");
            }
        }
Beispiel #19
0
 private static void Loop(Hashtable table)
 {
     System.Collections.IDictionaryEnumerator enumerator = table.GetEnumerator();
     while (enumerator.MoveNext())
     {
         Console.WriteLine(enumerator.Value.ToString());
     }
 }
Beispiel #20
0
 public void SetList()
 {
     System.Collections.IDictionaryEnumerator enumerator = itemTable.GetEnumerator();
     while (enumerator.MoveNext())
     {
         ItemViewData r = itemTable[(int)enumerator.Key];// as ItemViewData;
     }
 }
Beispiel #21
0
 public static void Clear()
 {
     System.Collections.IDictionaryEnumerator enumerator = PowerCache.SystemCache.GetEnumerator();
     while (enumerator.MoveNext())
     {
         PowerCache.Remove(enumerator.Key.ToString());
     }
 }
Beispiel #22
0
        /// <summary>
        ///  执行存储过程返回得到的数据库表
        /// </summary>
        /// <param name="sp_cmd">存储过程名称</param>
        /// <param name="sp_Input_Params">哈希数据集</param>
        /// <returns>成功返回查询到的数据表, 失败返回null</returns>
        DataTable QueryInfoPro(string sp_cmd, Hashtable sp_Input_Params, out string error)
        {
            error = null;

            try
            {
                DataTable tempTable = new DataTable();

                using (SqlConnection sqlconn = new SqlConnection(_ConnetionString))
                {
                    using (SqlDataAdapter da = new SqlDataAdapter(sp_cmd, sqlconn))
                    {
                        DataSet ds = new DataSet();

                        da.SelectCommand = new SqlCommand();

                        da.SelectCommand.CommandType    = CommandType.StoredProcedure;
                        da.SelectCommand.CommandText    = sp_cmd;
                        da.SelectCommand.Connection     = sqlconn;
                        da.SelectCommand.CommandTimeout = 40000;

                        if (sp_Input_Params != null)
                        {
                            System.Collections.IDictionaryEnumerator InputEnume = sp_Input_Params.GetEnumerator();

                            while (InputEnume.MoveNext())
                            {
                                SqlParameter param = new SqlParameter();

                                param.Direction     = ParameterDirection.Input;
                                param.ParameterName = InputEnume.Key.ToString();
                                param.Value         = InputEnume.Value;

                                da.SelectCommand.Parameters.Add(param);
                            }
                        }

                        int rowcount = da.Fill(ds);

                        if (rowcount == 0 && ds != null && ds.Tables.Count == 0)
                        {
                            error = "没有找到任何数据";
                        }
                        else
                        {
                            tempTable = ds.Tables[ds.Tables.Count - 1];
                        }
                    }
                }

                return(tempTable);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(null);
            }
        }
Beispiel #23
0
    public void Put(Dictionary map)
    {
        SC.IDictionaryEnumerator it = map.GetEnumerator();

        while (it.MoveNext())
        {
            Put(it.Entry.Key as string, it.Entry.Value);
        }
    }
Beispiel #24
0
 /// <summary>
 /// 清空缓存
 /// </summary>
 public static void CacheClear()
 {
     System.Web.Caching.Cache objCache = HttpRuntime.Cache;
     System.Collections.IDictionaryEnumerator cacheEnumer = objCache.GetEnumerator();
     while (cacheEnumer.MoveNext())
     {
         objCache.Remove(cacheEnumer.Key.ToString());
     }
 }
Beispiel #25
0
        /// *******************************************************************************************
        /// <summary>
        /// 角色列表特殊字段帮定,格式化
        /// </summary>
        /// *******************************************************************************************
        private void RoleGridDataBound()
        {
            Procedure procedure = (Procedure)Session["Procedure"];

            UltraWebGrid UWGridCase3 = ((UltraWebGrid)this.UltraWebTab1.Tabs.GetTab(2).FindControl("UltraWebGrid3"));

            for (int i = 0; i < UWGridCase3.Rows.Count; i++)
            {
                if ((string)UWGridCase3.Rows[i].Cells[5].Value == "1")
                {
                    UWGridCase3.Rows[i].Cells[2].Value = true;
                }
                else if ((string)UWGridCase3.Rows[i].Cells[5].Value == "2")
                {
                    UWGridCase3.Rows[i].Cells[2].Value = true;
                    //UWGridCase3.Rows[i]. = ;
                }
                else
                {
                    UWGridCase3.Rows[i].Cells[2].Value = false;
                }
                string UserCodes    = "";
                string StationCodes = "";
                Role   RoleCase     = procedure.GetRole((string)UWGridCase3.Rows[i].Cells[0].Value);
                System.Collections.IDictionaryEnumerator ieRoleComprise = RoleCase.GetRoleCompriseEnumerator();

                while (ieRoleComprise.MoveNext())
                {
                    RoleComprise RoleCompriseCase = (RoleComprise)ieRoleComprise.Value;
                    if (RoleCompriseCase.RoleType == RoleType.Porson)
                    {
                        if (UserCodes == "")
                        {
                            UserCodes = RoleCompriseCase.RoleCompriseItem;
                        }
                        else
                        {
                            UserCodes += "," + RoleCompriseCase.RoleCompriseItem;
                        }
                    }
                    if (RoleCompriseCase.RoleType == RoleType.Station)
                    {
                        if (StationCodes == "")
                        {
                            StationCodes = RoleCompriseCase.RoleCompriseItem;
                        }
                        else
                        {
                            StationCodes += "," + RoleCompriseCase.RoleCompriseItem;
                        }
                    }
                }

                UWGridCase3.Rows[i].Cells[4].Value = "<a href='#' onclick='javascript:SelectRoleComprise(\"" + (string)UWGridCase3.Rows[i].Cells[0].Value + "\",\"" + UserCodes + "\",\"" + StationCodes + "\");return false;'>角色维护</a>";
            }
        }
Beispiel #26
0
 /// <summary>
 /// Registers the components.
 /// </summary>
 /// <param name="serviceKeyTypes">The service key types.</param>
 public void RegisterComponents(System.Collections.IDictionary serviceKeyTypes)
 {
     System.Collections.IDictionaryEnumerator en = serviceKeyTypes.GetEnumerator();
     while (en.MoveNext())
     {
         string key  = en.Key.ToString();
         Type   type = (Type)(en.Value);
         container.AddComponent(key, typeof(IService), type);
     }
 }
Beispiel #27
0
        /// <summary>
        /// Sets up the mouse cursor and status bar, according to what is current running.
        /// </summary>
        private void VisualizeProcesses()
        {
            //ascertain which cursor to display, an arrow, an arrow & hourglass, or hourglass, or an overridden (seized) cursor
            Cursor newCursor = Cursors.Arrow;

            if (_seizedCursor == null)
            {
                if (_processesDictionary.Count > 0)
                {
                    newCursor = Cursors.AppStarting;
                    foreach (DictionaryEntry entry in _processesDictionary)
                    {
                        VisualizableProcess process = entry.Value as VisualizableProcess;
                        if (process != null && process.AllowUserInteraction == false)
                        {
                            newCursor = Cursors.WaitCursor;
                        }
                    }
                }
            }
            else
            {
                //cursor has been overridden
                newCursor = _seizedCursor;
            }

            Action hack = () =>
            {
                //display the cursor
                _owner.Cursor = newCursor;

                //set the staus bar
                if (_statusBarPanel != null)
                {
                    //ascertain the new text
                    string newText = _awaitingText == null ? "" : _awaitingText;
                    System.Collections.IDictionaryEnumerator de = _processesDictionary.GetEnumerator();
                    if (de.MoveNext())
                    {
                        VisualizableProcess oldestProcess = de.Value as VisualizableProcess;
                        if (oldestProcess != null)
                        {
                            newText = oldestProcess.Description;
                        }
                    }
                    _statusBarPanel.Text = newText;
                }
            };

            if (_owner.Visible)
            {
                _owner.Invoke(hack);
            }
        }
Beispiel #28
0
    public void InitBoxingData(C2sSprotoType.user u)
    {
        System.Collections.IDictionaryEnumerator enumerator = GameShared.Instance.boxingTable.GetEnumerator();
        while (enumerator.MoveNext())
        {
            BoxingViewData v = new BoxingViewData();
            v.frag_num = 0;
            v.level    = 0;
            BoxingData r = GameShared.Instance.boxingTable[enumerator.Key] as BoxingData;
            v.data = r;
            int id = (r.csv_id * 1000) + v.level;
            r.levelData = GameShared.Instance.GetBoxingLevelById(id);

            boxTable.Add(v.data.csv_id, v);
        }

        if (u.kungfu_list != null)
        {
            for (int i = 0; i < u.kungfu_list.Count; i++)
            {
                int id = (int)u.kungfu_list[i].csv_id;
                if (id != 0)
                {
                    C2sSprotoType.kungfu_content c = u.kungfu_list[i];
                    if (UserManager.Instance.boxTable.Contains(id))
                    {
                        BoxingViewData v = new BoxingViewData();
                        v.level    = (int)c.k_level;
                        v.frag_num = (int)c.k_sp_num;
                        v.type     = (int)c.k_type;
                        v.data     = GameShared.Instance.GetBoxingById((int)c.csv_id);
                        int levelid = (1000 * v.data.csv_id) + v.level;
                        v.data.levelData = GameShared.Instance.GetBoxingLevelById(levelid);
                        UserManager.Instance.boxTable[v.data.csv_id] = v;
                    }
                    else
                    {
                        BoxingViewData v = new BoxingViewData();
                        v.level    = (int)c.k_level;
                        v.frag_num = (int)c.k_sp_num;
                        v.type     = (int)c.k_type;
                        v.data     = GameShared.Instance.GetBoxingById((int)c.csv_id);
                        int levelid = (1000 * v.data.csv_id) + v.level;
                        v.data.levelData = GameShared.Instance.GetBoxingLevelById(levelid);
                        UserManager.Instance.boxTable.Add(id, v);
                    }
                }
            }
        }
        else
        {
            Debug.Log("kungfu_list空");
        }
    }
Beispiel #29
0
    public void UseTest()
    {
        int a = 0;

        System.Collections.IDictionaryEnumerator enumerator = itemTable.GetEnumerator();
        while (enumerator.MoveNext())
        {
            ItemViewData r = itemTable[(int)enumerator.Key];// as ItemViewData;
            a += r.curCount;
        }
        Debug.Log("num" + a);
    }
Beispiel #30
0
 public void InitEquipKitTableData()
 {
     System.Collections.IDictionaryEnumerator enumerator = equipmentKitTable.GetEnumerator();
     while (enumerator.MoveNext())
     {
         EquipmentKitData r  = equipmentKitTable[enumerator.Key] as EquipmentKitData;
         BuffData         b1 = GameShared.Instance.GetBuffById(r.effect);
         b1.GetBuffAttr();
         r.attrArr     = b1.attrArr;
         r.additionArr = b1.additionArr;
     }
 }