Ejemplo n.º 1
0
    private void ProcessUserlist()
    {
        string           search     = Request.Form["Tb_SearchKeys"].ToSafeString();
        int              num        = StringHelper.ConvertToInt(Request.QueryString["pages"], 1);
        INVelocityEngine arg_13D_0  = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["Path"], false);
        IDictionary      dictionary = new Hashtable();

        using (var x = new WebHelperClient())
        {
            List <UserInfo> list        = x.GetAllUserInfo().ToList();
            var             onlinecount = list.Where((a) => (a.State != 0)).Count();
            list.Sort(new Comparison <UserInfo>(CompareByID));
            if (search != "")
            {
                list = list.FindAll((UserInfo a) => a.UserName.IndexOf(search, 0) != -1 || a.NickName.IndexOf(search, 0) != -1);
            }
            int count = list.Count;
            int num2  = 1;
            if (search == "")
            {
                num2 = Convert.ToInt32(Math.Ceiling(count / 20m));
                list = list.Skip((num - 1) * 20).Take(20).ToList <UserInfo>();
            }
            dictionary.Add("Result", list);
            dictionary.Add("OnlineCount", onlinecount);
            dictionary.Add("Search", search);
            dictionary.Add("Count", count);
            dictionary.Add("Page", num);
            dictionary.Add("TocalPage", num2);
            string text = arg_13D_0.Process(dictionary, "UserList.vm");
            Response.Write(text);
        }
    }
Ejemplo n.º 2
0
    private void ProcessMail()
    {
        if (!(this.usertype > 2))
        {
            Response.Write("对不起,你的权限不足");
            return;
        }
        using (var xx = new WebHelperClient())
        {
            if (Request["sub_searchUserId"].ToSafeString() != "")
            {
                string userMsg      = Request["userMsg"].ToSafeString();
                string getAllUserId = "";
                if (userMsg != "")
                {
                    string[] strUsersg = userMsg.Split(new char[]
                    {
                        ','
                    });
                    List <UserInfo> result = xx.GetAllUserInfo().ToList();
                    for (int i = 0; i < strUsersg.Count <string>(); i++)
                    {
                        foreach (var a in result.FindAll((t) =>
                        {
                            if (t.UserName.IndexOf(strUsersg[i]) != -1 || t.NickName.IndexOf(strUsersg[i]) != -1)
                            {
                                return(true);
                            }

                            else
                            {
                                return(false);
                            }
                        }))
                        {
                            getAllUserId += string.Concat(new string[]
                            {
                                "ID:[",
                                a.UserID.ToString(),
                                "],用户名:[",
                                a.UserName.ToString(),
                                "],昵称:[",
                                a.NickName.ToString(),
                                "]\n"
                            });
                        }
                    }
                    Response.Write(getAllUserId);
                    return;
                }
            }
            else if (Request.Form["txt_userID"].ToSafeString() != "" && Request.Form["txt_Title"].ToSafeString() != "" && Request.Form["txt_Content"].ToSafeString() != "")
            {
                if (SendMail())
                {
                    Response.Write("成功");
                }
                else
                {
                    Response.Write("失败");
                }
            }
            else
            {
                INVelocityEngine FileEngine = NVelocityEngineFactory.CreateNVelocityFileEngine(AppConfig.AppSettings["Path"], false);
                IDictionary      context    = new Hashtable();
                if (Request["btn_wq"].ToSafeString() != "")
                {
                    List <ItemTemplateInfo> GoodsWeapons = xx.GetSingleCategoryItemTemplates(7).ToList();
                    context.Add("GoodsWeapons", GoodsWeapons);
                }
                if (Request["btn_zb"].ToSafeString() != "")
                {
                    List <ItemTemplateInfo> GoodsEquipment = xx.GetSingleCategoryItemTemplates(1).ToList();
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(2).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(3).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(4).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(5).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(6).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(8).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(9).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(13).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(14).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(15).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(16).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(17).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(18).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(19).ToList());
                    GoodsEquipment.AddRange(xx.GetSingleCategoryItemTemplates(20).ToList());
                    context.Add("GoodsEquipment", GoodsEquipment);
                }

                if (Request["btn_dj"].ToSafeString() != "")
                {
                    List <ItemTemplateInfo> GoodsProps = xx.GetSingleCategoryItemTemplates(11).ToList();
                    context.Add("GoodsProps", GoodsProps);
                }

                string hindGoodId = Request["hindGoodId"].ToSafeString();
                if (Request["getGoodId"].ToSafeString() != "")
                {
                    hindGoodId = Request["getGoodId"].ToSafeString();
                    ;
                }
                string changParames = Request["changParames"].ToSafeString();
                if (Request["params"].ToSafeString() != "")
                {
                    changParames = Request["params"].ToSafeString();
                }

                if (hindGoodId != "" && changParames != "")
                {
                    string[] paraStr = changParames.Split(new char[]
                    {
                        ','
                    });
                    DataTable tabGoods = Context.Session["goodsTable"] as DataTable ?? InitNewGoodTable();
                    int       rowNum   = Convert.ToInt32(hindGoodId);
                    DataRow[] rowArray = tabGoods.Select("id=" + hindGoodId);


                    DataRow[] array = rowArray;
                    for (int j = 0; j < array.Length; j++)
                    {
                        DataRow rows = array[j];
                        rows.BeginEdit();
                        rows["GoodId"]          = hindGoodId.ToString();
                        rows["GoodNumber"]      = paraStr[0].ToString();
                        rows["GoodName"]        = paraStr[16].ToString();
                        rows["TemplateID"]      = paraStr[12].ToString();
                        rows["ValidDate"]       = paraStr[1].ToString();
                        rows["Gold"]            = paraStr[10].ToString();
                        rows["Money"]           = paraStr[9].ToString();
                        rows["LiJuan"]          = paraStr[11].ToString();
                        rows["StrengthenLevel"] = paraStr[4].ToString();
                        rows["AttackCompose"]   = paraStr[5].ToString();
                        rows["DefendCompose"]   = paraStr[6].ToString();
                        rows["AgilityCompose"]  = paraStr[7].ToString();
                        rows["LuckCompose"]     = paraStr[8].ToString();
                        rows["IsBind"]          = paraStr[2].ToString();
                        rows["Sex"]             = paraStr[3].ToString();
                        rows["CategoryID"]      = paraStr[13].ToString();
                        rows["CanStrengthen"]   = paraStr[14].ToString();
                        rows["CanCompose"]      = paraStr[15].ToString();
                        rows.EndEdit();
                    }
                    Context.Session["goodsTable"] = tabGoods;
                }
                string delete = Request["deletegoodid"].ToSafeString();
                if (delete != "")
                {
                    DataTable dt = Context.Session["goodsTable"] as DataTable ?? InitNewGoodTable();
                    dt.Rows.Remove(dt.Select("id=" + delete)[0]);
                }



                string idArray = Request["ids"].ToSafeString();

                if (idArray != "")
                {
                    var   a = idArray.Substring(0, idArray.Length - 1);
                    int[] b = a.Split(',').ConvertToIntArray();
                    List <ItemTemplateInfo> selectGoods = new List <ItemTemplateInfo>();
                    foreach (var c in b)
                    {
                        selectGoods.Add(xx.GetSingleItemTemplate(c));
                    }

                    if (Context.Session["goodsTable"] == null)
                    {
                        goodsTable = InitNewGoodTable();
                    }
                    else
                    {
                        goodsTable = Context.Session["goodsTable"] as DataTable;
                    }
                    foreach (var item in selectGoods)
                    {
                        DataRow newRow = goodsTable.NewRow();
                        newRow["GoodId"]          = item.TemplateID;
                        newRow["GoodNumber"]      = 1;
                        newRow["GoodName"]        = item.Name;
                        newRow["TemplateID"]      = item.TemplateID;
                        newRow["ValidDate"]       = 1;
                        newRow["StrengthenLevel"] = 0;
                        newRow["AttackCompose"]   = 0;
                        newRow["DefendCompose"]   = 0;
                        newRow["AgilityCompose"]  = 0;
                        newRow["LuckCompose"]     = 0;
                        newRow["IsBind"]          = "True";
                        newRow["Sex"]             = 0;
                        newRow["CategoryID"]      = item.CategoryID;
                        newRow["CanStrengthen"]   = item.CanStrengthen;
                        newRow["CanCompose"]      = item.CanCompose;
                        goodsTable.Rows.Add(newRow);
                    }
                    Context.Session["goodsTable"] = goodsTable;
                }
                if (Context.Session["goodsTable"] != null)
                {
                    context.Add("ResultGoods", Context.Session["goodsTable"] as DataTable);
                    if (!string.IsNullOrEmpty(idArray))
                    {
                        context.Add("isSelect", idArray.Substring(0, idArray.Length - 1));
                    }
                    else
                    {
                        context.Add("isSelect", "false");
                    }
                    idArray = "";
                }

                context.Add("this", this);
                Response.Write(FileEngine.Process(context, "Mail.vm"));
            }
        }
    }