public static string CreateCompressXml(string path, XElement result, string file, bool isCompress) { try { file = file + ".xml"; path = Path.Combine(path, file); using (FileStream fs = new FileStream(path, FileMode.Create)) { if (isCompress) { using (BinaryWriter writer = new BinaryWriter(fs)) { writer.Write(StaticFunction.Compress(result.ToString(false))); } } else { using (StreamWriter wirter = new StreamWriter(fs)) { wirter.Write(result.ToString(false)); } } } return("Build:" + file + ",Success!"); } catch (Exception ex) { log.Error("CreateCompressXml " + file + " is fail!", ex); return("Build:" + file + ",Fail!"); } }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { string key = context.Request["key"]; int id = int.Parse(context.Request["selfid"]); using (PlayerBussiness db = new PlayerBussiness()) { //DailyLogListInfo[] infos = db.GetDailyLogListById(id); XElement node = new XElement("DailyLogList", new XAttribute("UserAwardLog", "2"), new XAttribute("DayLog", "True,True,False,False,False,False,False,False,False,False,False,False,False,False")); result.Add(node); } value = true; message = "Success!"; } catch (Exception ex) { log.Error("dailyloglist", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); result.Add(new XAttribute("nowDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));//nowDate="2012-08-16 16:24:17" context.Response.ContentType = "text/plain"; //context.Response.Write(result.ToString(false)); context.Response.BinaryWrite(StaticFunction.Compress(result.ToString(false))); }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); int total = 0; try { //page=1& //level=%2D1& //ConsortiaID=4& //openApply=%2D1& //size=1& //name=& //key=f231292ae606ad5b61fafa816805f47c& //order=%2D1& //selfid=5& //rnd=0%2E6236354559659958 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))); }
public void ProcessRequest(HttpContext context) { bool value = true; string message = "Registered!";// "Login Fail!"; XElement result = new XElement("Result"); var status = 1; result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); result.Add(new XAttribute("status", status)); // result.Add(new XAttribute("style", style)); context.Response.ContentType = "text/plain"; context.Response.BinaryWrite(StaticFunction.Compress(result.ToString())); }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { int id = int.Parse(context.Request.QueryString["selfID"]); if (id != 0) { using (PlayerBussiness db = new PlayerBussiness()) { MailInfo[] sInfos = db.GetMailBySenderID(id); foreach (MailInfo info in sInfos) { result.Add(Road.Flash.FlashUtils.CreateMailInfo(info, "Item")); } } value = true; message = "Success!"; } } catch (Exception ex) { log.Error("MailSenderList", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); context.Response.ContentType = "text/plain"; //context.Response.Write(result.ToString(false)); context.Response.BinaryWrite(StaticFunction.Compress(result.ToString(false))); }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { string key = context.Request["key"]; int id = int.Parse(context.Request["selfid"]); using (ProduceBussiness db = new ProduceBussiness()) { DailyLogListInfo info = db.GetDailyLogListSingle(id); string dayLog = info.DayLog; int userAwardLog = info.UserAwardLog; DateTime lastDate = info.LastDate; int countday = dayLog.Split(',').Length; int currentMonth = DateTime.Now.Month; int curentYear = DateTime.Now.Year; int curentDay = DateTime.Now.Day; int dayofmonth = DateTime.DaysInMonth(curentYear, currentMonth); if (currentMonth != lastDate.Month || curentYear != lastDate.Year) { dayLog = ""; userAwardLog = 0; lastDate = DateTime.Now; } if (countday < dayofmonth) { if (string.IsNullOrEmpty(dayLog) && countday > 1) { dayLog = "False"; } for (int i = countday; i < curentDay - 1; i++) { dayLog += ",False"; } } info.DayLog = dayLog; info.UserAwardLog = userAwardLog; info.LastDate = lastDate; db.UpdateDailyLogList(info); XElement node = new XElement("DailyLogList", new XAttribute("UserAwardLog", userAwardLog), new XAttribute("DayLog", dayLog)); result.Add(node); } value = true; message = "Success!"; } catch (Exception ex) { log.Error("dailyloglist", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); result.Add(new XAttribute("nowDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));//nowDate="2012-08-16 16:24:17" context.Response.ContentType = "text/plain"; //context.Response.Write(result.ToString(false)); context.Response.BinaryWrite(StaticFunction.Compress(result.ToString(false))); }
public void ProcessRequest(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { int id = int.Parse(context.Request.QueryString["selfid"]); if (id != 0) { using (PlayerBussiness db = new PlayerBussiness()) { MailInfo[] infos = db.GetMailByUserID(id); foreach (MailInfo info in infos) { //TimeSpan days = DateTime.Now.Subtract(info.SendTime); XElement node = new XElement("Item", new XAttribute("ID", info.ID), new XAttribute("Title", info.Title), new XAttribute("Content", info.Content), new XAttribute("Sender", info.Sender), new XAttribute("SendTime", info.SendTime.ToString("yyyy-MM-dd HH:mm:ss")), //new XAttribute("Days", info.ValidDate/24 - days.Days ), new XAttribute("Gold", info.Gold), new XAttribute("Money", info.Money), new XAttribute("Annex1ID", info.Annex1 == null ? "" : info.Annex1), new XAttribute("Annex2ID", info.Annex2 == null ? "" : info.Annex2), new XAttribute("Annex3ID", info.Annex3 == null ? "" : info.Annex3), new XAttribute("Annex4ID", info.Annex4 == null ? "" : info.Annex4), new XAttribute("Annex5ID", info.Annex5 == null ? "" : info.Annex5), new XAttribute("Type", info.Type), new XAttribute("ValidDate", info.ValidDate), new XAttribute("IsRead", info.IsRead)); AddAnnex(node, info.Annex1); AddAnnex(node, info.Annex2); AddAnnex(node, info.Annex3); AddAnnex(node, info.Annex4); AddAnnex(node, info.Annex5); //using (PlayerBussiness pb = new PlayerBussiness()) //{ // if (!string.IsNullOrEmpty(info.Annex1)) // { // ItemInfo pr = pb.GetUserItemSingle(int.Parse(info.Annex1)); // if (pr != null) // { // node.Add(Road.Flash.FlashUtils.CreateGoodsInfo(pr)); // } // } // if (!string.IsNullOrEmpty(info.Annex2)) // { // ItemInfo pr = pb.GetUserItemSingle(int.Parse(info.Annex2)); // if (pr != null) // { // node.Add(Road.Flash.FlashUtils.CreateGoodsInfo(pr)); // } // } // if (!string.IsNullOrEmpty(info.Annex3)) // { // ItemInfo pr = pb.GetUserItemSingle(int.Parse(info.Annex3)); // if (pr != null) // { // node.Add(Road.Flash.FlashUtils.CreateGoodsInfo(pr)); // } // } // if (!string.IsNullOrEmpty(info.Annex4)) // { // ItemInfo pr = pb.GetUserItemSingle(int.Parse(info.Annex4)); // if (pr != null) // { // node.Add(Road.Flash.FlashUtils.CreateGoodsInfo(pr)); // } // } // if (!string.IsNullOrEmpty(info.Annex5)) // { // ItemInfo pr = pb.GetUserItemSingle(int.Parse(info.Annex5)); // if (pr != null) // { // node.Add(Road.Flash.FlashUtils.CreateGoodsInfo(pr)); // } // } //} result.Add(node); } //MailInfo[] sInfos = db.GetMailBySenderID(id); //foreach (MailInfo info in sInfos) //{ // result.Add(Road.Flash.FlashUtils.CreateMailInfo(info,"SendMail")); //} } value = true; message = "Success!"; } } catch (Exception ex) { log.Error("LoadUserMail", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); context.Response.ContentType = "text/plain"; //context.Response.Write(result.ToString(false)); //DDTank context.Response.BinaryWrite(StaticFunction.Compress(result.ToString(false))); }