Ejemplo n.º 1
0
        public static string BuildCelebConsortia(string file, int order, string fileNotCompress)
        {
            bool value = false;
            string message = "Fail!";
            XElement result = new XElement("Result");
            int total = 0;

            try
            {
                int page = 1;
                int size = 50;
                //int order = 10;
                int consortiaID = -1;
                string name = "";
                int level = -1;

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaInfo[] infos = db.GetConsortiaPage(page, size, ref total, order, name, consortiaID, level,-1);
                    foreach (ConsortiaInfo info in infos)
                    {
                        XElement node = FlashUtils.CreateConsortiaInfo(info);

                        if (info.ChairmanID != 0)
                        {
                            using (PlayerBussiness pb = new PlayerBussiness())
                            {
                                PlayerInfo player = pb.GetUserSingleByUserID(info.ChairmanID);
                                if (player != null)
                                {
                                    node.Add(FlashUtils.CreateCelebInfo(player));
                                }
                            }
                        }
                        result.Add(node);
                    }

                    value = true;
                    message = "Success!";
                }
            }
            catch (Exception ex)
            {
                log.Error(file + " is fail!", ex);
            }

            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));
            result.Add(new XAttribute("date", System.DateTime.Today.ToString("yyyy-MM-dd")));

            if (!string.IsNullOrEmpty(fileNotCompress))
            {
                csFunction.CreateCompressXml(result, fileNotCompress, false);
            }

            return csFunction.CreateCompressXml(result, file, true);
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            bool value = false;
            string message = "Fail!";
            XElement result = new XElement("Result");
            int total = 0;

            try
            {
                int page = int.Parse(context.Request["page"]);
                int size = int.Parse(context.Request["size"]);
                int order = int.Parse(context.Request["order"]);
                int consortiaID = int.Parse(context.Request["consortiaID"]);
                string name = csFunction.ConvertSql(HttpUtility.UrlDecode(context.Request["name"]));
                int level = int.Parse(context.Request["level"]);
                //-1表示全部,1开启的,0关闭的。
                int openApply = int.Parse(context.Request["openApply"]);

                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    ConsortiaInfo[] infos = db.GetConsortiaPage(page,size,ref total,order, name, consortiaID, level,openApply);
                    foreach (ConsortiaInfo info in infos)
                    {
                        result.Add(FlashUtils.CreateConsortiaInfo(info));
                    }

                    value = true;
                    message = "Success!";
                    
                }
            }
            catch (Exception ex)
            {
                log.Error("ConsortiaList", ex);
            }

            result.Add(new XAttribute("total", total));
            result.Add(new XAttribute("value", value));
            result.Add(new XAttribute("message", message));

            context.Response.ContentType = "text/plain";
            context.Response.BinaryWrite(StaticFunction.Compress(result.ToString(false)));
        }