private void DoAction(string Action) { string s = "{\"state\":false,\"msg\":\"未定义操作\"}"; int num = Globals.RequestFormNum("pageIndex"); if (num > 0) { int userid = Globals.GetCurrentMemberUserId(false); OneyuanTaoPartInQuery query = new OneyuanTaoPartInQuery { PageIndex = num, PageSize = 10, ActivityId = "", UserId = Globals.GetCurrentMemberUserId(false), state = 3, SortBy = "BuyTime", IsPay = -1 }; DbQueryResult oneyuanPartInDataTable = OneyuanTaoHelp.GetOneyuanPartInDataTable(query); DataTable data = new DataTable(); if (oneyuanPartInDataTable.Data != null) { data = (DataTable)oneyuanPartInDataTable.Data; data.Columns.Add("LuckNumList"); data.Columns.Add("PostSate"); data.Columns.Add("PostBtn"); data.Columns.Add("tabid"); foreach (DataRow dataRow in (InternalDataCollectionBase)data.Rows) { DataRow Item = dataRow; IList <LuckInfo> list1 = (IList <LuckInfo>)Enumerable.ToList <LuckInfo>(Enumerable.Where <LuckInfo>((IEnumerable <LuckInfo>)OneyuanTaoHelp.getLuckInfoList(true, Item["ActivityId"].ToString()), (Func <LuckInfo, bool>)(t => t.UserId == userid && t.Pid == Item["Pid"].ToString()))); Item["PostBtn"] = (object)"0"; Item["tabid"] = (object)"0"; if (list1 != null) { List <string> list2 = new List <string>(); foreach (LuckInfo luckInfo in (IEnumerable <LuckInfo>)list1) { list2.Add(luckInfo.PrizeNum); } Item["LuckNumList"] = (object)string.Join(",", (IEnumerable <string>)list2); DataTable dataTable2 = OneyuanTaoHelp.PrizesDeliveryRecord(Item["Pid"].ToString()); if (dataTable2 == null || dataTable2.Rows.Count == 0) { Item["PostSate"] = (object)"收货地址未确认"; } else { Item["PostSate"] = (object)OneyuanTaoHelp.GetPrizesDeliveStatus(dataTable2.Rows[0]["status"].ToString()); Item["PostBtn"] = (object)dataTable2.Rows[0]["status"].ToString(); Item["tabid"] = (object)dataTable2.Rows[0]["Id"].ToString(); } } } //using (IEnumerator enumerator = data.Rows.GetEnumerator()) //{ // while (enumerator.MoveNext()) // { // Func<LuckInfo, bool> predicate = null; // DataRow Item = (DataRow) enumerator.Current; // if (predicate == null) // { // predicate = t => (t.UserId == userid) && (t.Pid == Item["Pid"].ToString()); // } // IList<LuckInfo> list = OneyuanTaoHelp.getLuckInfoList(true, Item["ActivityId"].ToString()).Where<LuckInfo>(predicate).ToList<LuckInfo>(); // Item["PostBtn"] = "0"; // Item["tabid"] = "0"; // if (list != null) // { // List<string> values = new List<string>(); // foreach (LuckInfo info in list) // { // values.Add(info.PrizeNum); // } // Item["LuckNumList"] = string.Join(",", values); // DataTable table2 = OneyuanTaoHelp.PrizesDeliveryRecord(Item["Pid"].ToString()); // if ((table2 == null) || (table2.Rows.Count == 0)) // { // Item["PostSate"] = "收货地址未确认"; // } // else // { // Item["PostSate"] = OneyuanTaoHelp.GetPrizesDeliveStatus(table2.Rows[0]["status"].ToString()); // Item["PostBtn"] = table2.Rows[0]["status"].ToString(); // Item["tabid"] = table2.Rows[0]["Id"].ToString(); // } // } // } //} } IsoDateTimeConverter converter = new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }; string str2 = JsonConvert.SerializeObject(data, new JsonConverter[] { converter }); s = "{\"state\":true,\"msg\":\"读取成功\",\"Data\":" + str2 + "}"; } else { s = "{\"state\":false,\"msg\":\"参数不正确\"}"; } this.Page.Response.ClearContent(); this.Page.Response.ContentType = "application/json"; this.Page.Response.Write(s); this.Page.Response.End(); }
private void DoAction(string Action) { int num = Globals.RequestFormNum("pageIndex"); string s; if (num > 0) { int userid = Globals.GetCurrentMemberUserId(); DbQueryResult oneyuanPartInDataTable = OneyuanTaoHelp.GetOneyuanPartInDataTable(new OneyuanTaoPartInQuery { PageIndex = num, PageSize = 10, ActivityId = "", UserId = Globals.GetCurrentMemberUserId(), state = 3, SortBy = "BuyTime", IsPay = -1 }); DataTable dataTable = new DataTable(); if (oneyuanPartInDataTable.Data != null) { dataTable = (DataTable)oneyuanPartInDataTable.Data; dataTable.Columns.Add("LuckNumList"); dataTable.Columns.Add("PostSate"); dataTable.Columns.Add("PostBtn"); dataTable.Columns.Add("tabid"); System.Collections.IEnumerator enumerator = dataTable.Rows.GetEnumerator(); try { while (enumerator.MoveNext()) { DataRow Item = (DataRow)enumerator.Current; System.Collections.Generic.IList <LuckInfo> list = OneyuanTaoHelp.getLuckInfoList(true, Item["ActivityId"].ToString()); list = (from t in list where t.UserId == userid && t.Pid == Item["Pid"].ToString() select t).ToList <LuckInfo>(); Item["PostBtn"] = "0"; Item["tabid"] = "0"; if (list != null) { System.Collections.Generic.List <string> list2 = new System.Collections.Generic.List <string>(); foreach (LuckInfo current in list) { list2.Add(current.PrizeNum); } Item["LuckNumList"] = string.Join(",", list2); DataTable dataTable2 = OneyuanTaoHelp.PrizesDeliveryRecord(Item["Pid"].ToString()); if (dataTable2 == null || dataTable2.Rows.Count == 0) { Item["PostSate"] = "收货地址未确认"; } else { Item["PostSate"] = OneyuanTaoHelp.GetPrizesDeliveStatus(dataTable2.Rows[0]["status"].ToString()); Item["PostBtn"] = dataTable2.Rows[0]["status"].ToString(); Item["tabid"] = dataTable2.Rows[0]["Id"].ToString(); } } } } finally { System.IDisposable disposable = enumerator as System.IDisposable; if (disposable != null) { disposable.Dispose(); } } } string str = JsonConvert.SerializeObject(dataTable, new JsonConverter[] { new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" } }); s = "{\"state\":true,\"msg\":\"读取成功\",\"Data\":" + str + "}"; } else { s = "{\"state\":false,\"msg\":\"参数不正确\"}"; } this.Page.Response.ClearContent(); this.Page.Response.ContentType = "application/json"; this.Page.Response.Write(s); this.Page.Response.End(); }
private void DoAction(string Action) { string str = "{\"state\":false,\"msg\":\"未定义操作\"}"; int num = Globals.RequestFormNum("pageIndex"); if (num <= 0) { str = "{\"state\":false,\"msg\":\"参数不正确\"}"; } else { int currentMemberUserId = Globals.GetCurrentMemberUserId(false); OneyuanTaoPartInQuery oneyuanTaoPartInQuery = new OneyuanTaoPartInQuery() { PageIndex = num, PageSize = 10, ActivityId = "", UserId = Globals.GetCurrentMemberUserId(false), state = 3, SortBy = "BuyTime", IsPay = -1 }; DbQueryResult oneyuanPartInDataTable = OneyuanTaoHelp.GetOneyuanPartInDataTable(oneyuanTaoPartInQuery); DataTable dataTable = new DataTable(); if (oneyuanPartInDataTable.Data != null) { dataTable = (DataTable)oneyuanPartInDataTable.Data; dataTable.Columns.Add("LuckNumList"); dataTable.Columns.Add("PostSate"); dataTable.Columns.Add("PostBtn"); dataTable.Columns.Add("tabid"); foreach (DataRow row in dataTable.Rows) { IList <LuckInfo> luckInfoList = OneyuanTaoHelp.getLuckInfoList(true, row["ActivityId"].ToString()); luckInfoList = ( from t in luckInfoList where (t.UserId != currentMemberUserId ? false : t.Pid == row["Pid"].ToString()) select t).ToList <LuckInfo>(); row["PostBtn"] = "0"; row["tabid"] = "0"; if (luckInfoList != null) { List <string> strs = new List <string>(); foreach (LuckInfo luckInfo in luckInfoList) { strs.Add(luckInfo.PrizeNum); } row["LuckNumList"] = string.Join(",", strs); DataTable dataTable1 = OneyuanTaoHelp.PrizesDeliveryRecord(row["Pid"].ToString()); if ((dataTable1 == null ? false : dataTable1.Rows.Count != 0)) { row["PostSate"] = OneyuanTaoHelp.GetPrizesDeliveStatus(dataTable1.Rows[0]["status"].ToString()); row["PostBtn"] = dataTable1.Rows[0]["status"].ToString(); row["tabid"] = dataTable1.Rows[0]["Id"].ToString(); } else { row["PostSate"] = "收货地址未确认"; } } } } IsoDateTimeConverter isoDateTimeConverter = new IsoDateTimeConverter() { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" }; JsonConverter[] jsonConverterArray = new JsonConverter[] { isoDateTimeConverter }; string str1 = JsonConvert.SerializeObject(dataTable, jsonConverterArray); str = string.Concat("{\"state\":true,\"msg\":\"读取成功\",\"Data\":", str1, "}"); } this.Page.Response.ClearContent(); this.Page.Response.ContentType = "application/json"; this.Page.Response.Write(str); this.Page.Response.End(); }