private List <SkuMap> GetSkumapDetail(string html) { string subMap = GetSubString(html, "skuMap", ",propertyMemoMap").Trim().TrimStart(':'); JavaScriptSerializer serializer = JavaScriptSerializer.CreateInstance(); HashObject hash = serializer.Deserialize <HashObject>(subMap); List <SkuMap> listSkuMap = new List <SkuMap>(); Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (string key in hash.Keys) { SkuMap map = new SkuMap(); map.Key = key; HashObject temp = (HashObject)hash[key]; map.PromotionPrice = map.OriginalPrice = temp.GetValue <decimal>("price"); map.SkuId = temp.GetValue <string>("skuId"); string[] keyItems = key.Trim(';').Split(';'); StringBuilder sbuilder = new StringBuilder(); for (var i = 0; i < keyItems.Length; i++) { string item = keyItems[i]; string itemName; if (!dictionary.TryGetValue(item, out itemName)) { itemName = GetItemName(item, html); dictionary.Add(item, itemName); } sbuilder.AppendFormat("{0},", itemName); } map.Title = sbuilder.ToString().Substring(0, sbuilder.Length - 1); listSkuMap.Add(map); } return(listSkuMap); }
internal void GetGoodMsg(string name, Action <object> callBack) { IHashObjectList list = new HashObjectList(); JavaScriptSerializer serializer = JavaScriptSerializer.CreateInstance(); string value = Net.GetNetDataPost(taodaxingUrl, string.Format("pattern=0&{0}&goodid=&page=1", name), contentType); HashObject hash = serializer.Deserialize <HashObject>(value); int code = hash.GetValue <int>("code"); if (code == 1) { throw new Exception(string.Format("没有查询到网店信息")); } callBack((object)GetDataList(hash)); while (code == 0) { var post = hash.GetValue <HashObject>("post"); value = Net.GetNetDataPost(taodaxingUrl, string.Format("pattern={0}&id={1}&page={2}&nt={3}", post["pattern"], post["id"], post["page"], post["nt"]), contentType); hash = serializer.Deserialize <HashObject>(value); code = hash.GetValue <int>("code"); if (code != 0) { break; } callBack(GetDataList(hash)); } }
public static void Init() { JavaScriptSerializer serializer = JavaScriptSerializer.CreateInstance(); socket.On(Socket.EVENT_CONNECT, () => { IsConnected = true; Data data = new Data("server"); data.comefrom = "net"; socket.Emit("login", serializer.Serialize(data)); }); socket.On("postDataRequest", (data) => { HashObject hash = serializer.Deserialize <HashObject>(data.ToString()); SendMsg nmsg = new SendMsg("server"); nmsg.comefrom = "net"; nmsg.touid = hash.GetValue <string>("fuid"); ulong key = Cuid.NewCuid(); Counter counter = new Counter(); counter.All = hash.GetValue <ulong>("msg"); counter.Doned = 0; PostDataRequestList.Add(key, counter); nmsg.msg = key.ToString();//回传一个唯一标记 socket.Emit("postDataSure", serializer.Serialize(nmsg)); }); IsConnected = false; }
private static List <GoodsInfo> GetSubOrderSkuList(ArrayList subOrders) { List <GoodsInfo> gList = new List <GoodsInfo>(); string[] subOrderKeys = { "itemInfo/skuText", "itemInfo/title", "quantity", "priceInfo" }; foreach (HashObject subOrder in subOrders) { GoodsInfo info = new GoodsInfo(); IHashObjectList subOrderSkuList = new HashObjectList(); var subList = subOrder.GetHashValue(subOrderKeys); ArrayList skuText = subList.GetDataEx <ArrayList>("skuText"); HashObject thash = new HashObject(); info.Amount = ((HashObject)subList[2]).GetValue <string>("quantity"); subOrderSkuList.Add(thash); foreach (HashObject skuTextItem in skuText) { ArrayList skuTextItemContent = skuTextItem.GetValue <ArrayList>("content"); IHashObject data = new HashObject(); foreach (HashObject skuTextItemContentDetial in skuTextItemContent) { if (!"namevalue".Equals(skuTextItemContentDetial.GetValue <string>("type"))) { continue; } HashObject tHash = skuTextItemContentDetial.GetValue <HashObject>("value"); if ("颜色分类:".Equals(tHash.GetValue <string>("name"))) { info.Color = tHash.GetValue <string>("value"); } if ("尺寸:".Equals(tHash.GetValue <string>("name"))) { info.Size = tHash.GetValue <string>("value"); } } if (data.Keys.Count == 0) { continue; } subOrderSkuList.Add(data); } if (subOrderSkuList.Count == 0) { continue; } info.PriceInfo = decimal.Parse(subList.GetDataEx <string>("priceInfo")); info.Title = subList.GetDataEx <string>("title"); gList.Add(info); } return(gList); }
private static List <string> DeleteOldData(Plug plug, DbHelper db, HashObject hash) { List <string> rtlist = new List <string>(); if (plug.PId == 0) { plug.PId = Cuid.NewCuid(); return(rtlist); } db.AddParameter("pid", plug.PId); IHashObject item = db.SelectSingleRow("select pdownpath,pvideo,picon,ppics,pcreatedate,ptotal from plugs where pid=@pid"); foreach (string key in item.Keys) { string path = item.GetValue <string>(key); if (string.IsNullOrEmpty(path)) { continue; } if (key == "ppics") { foreach (string item1 in path.Split(',')) { if (string.IsNullOrEmpty(item1) || item1.StartsWith(saveFileFolder)) { continue; } rtlist.Add(string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, item1)); } } else { if (hash.GetValue <string>(key) == item.GetValue <string>(key)) { continue; } if (string.IsNullOrEmpty(hash.GetValue <string>(key))) { hash[key] = item[key]; } rtlist.Add(string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, item[key])); } } hash["pcreatedate"] = item["pcreatedate"]; hash["ptotal"] = item["ptotal"]; db.Delete("plugs", "pid", plug.PId); return(rtlist); }
private static string GetSaleMessage(object obj) { if (obj == null || !(obj is ArrayList)) { return(""); } ArrayList list = (ArrayList)obj; foreach (HashObject hash in list) { if (!"div".Equals(hash.GetValue <string>("layout"))) { continue; } ArrayList lines = hash.GetValue <ArrayList>("lines"); foreach (HashObject lhash in lines) { if (!"block".Equals(lhash.GetValue <string>("display"))) { continue; } ArrayList clist = lhash.GetValue <ArrayList>("content"); if (clist.Count >= 2) { HashObject value = clist[1] as HashObject; return(value.GetValue <string>("value")); } return(""); } } return(""); }
/// <summary> /// 基础数据普通分页 /// </summary> /// <param name="TotalCount">输出查询条件查出来的总记录数</param> /// <param name="PageSize">分页大小</param> /// <param name="PageIndex">当前页</param> /// <param name="Fileds">筛选字段 默认*表示所有字段</param> /// <param name="strWhere">查询条件</param> /// <param name="OrderStr">排序字符串 如[a desc]</param> /// <returns></returns> public List <T> GetBasePager(out int TotalCount, int PageSize, int PageIndex, string Fileds, string strWhere, string OrderStr) { List <T> list = null; TotalCount = 0; IHashObject InputParam = new HashObject(); IHashObject outputParam = new HashObject(); if (string.IsNullOrEmpty(OrderStr)) { OrderStr = string.Format(" {0} desc", this.m_PrimaryFiledKey); } else { if (OrderStr != "" && !OrderStr.Trim().ToLower().StartsWith("order by")) { OrderStr = OrderStr.ToLower().Replace("order by", " "); } } InputParam.Add("PageIndex", PageIndex); InputParam.Add("pageSize", PageSize); InputParam.Add("tableName", typeof(T).Name); InputParam.Add("selFields", string.IsNullOrEmpty(Fileds) ? "*" : Fileds); InputParam.Add("SqlWhere", string.IsNullOrEmpty(strWhere) ? "" : strWhere); InputParam.Add("SortOrder", OrderStr); InputParam.Add("PageTotal", 0); using (DbHelper db = new DbHelper(DbControl.GetDbConnStringBasic(DbHandleBehaviorDefine.SELECT, 0))) { DataTable dt = db.ExecuteProcedureAndOutputParameter("Proc_Page", out outputParam, InputParam); TotalCount = outputParam.GetValue <int>("PageTotal"); list = MappingHelper <T> .FillModelList(dt); } return(list); }
/// <summary> /// 分页 /// </summary> /// <param name="TotalCount">输出查询条件查出来的总记录数</param> /// <param name="PageSize">分页大小</param> /// <param name="PageIndex">当前页</param> /// <param name="Fileds">筛选字段 默认*表示所有字段</param> /// <param name="strWhere">查询条件</param> /// <param name="OrderStr">排序字符串 如[a desc]</param> /// <returns></returns> public DataTable GetBasePagerDataTable(string tableName, out int num, int PageSize, int PageIndex, string Fileds, string strWhere, string OrderStr) { DataTable dt = null; IHashObject InputParam = new HashObject(); IHashObject outputParam = new HashObject(); if (string.IsNullOrEmpty(OrderStr)) { OrderStr = string.Format(" {0} desc", "id"); } else { if (OrderStr != "" && !OrderStr.Trim().ToLower().StartsWith("order by")) { OrderStr = OrderStr.ToLower().Replace("order by", " "); } } InputParam.Add("PageIndex", PageIndex); InputParam.Add("pageSize", PageSize); InputParam.Add("tableName", tableName); InputParam.Add("selFields", string.IsNullOrEmpty(Fileds) ? "*" : Fileds); InputParam.Add("SqlWhere", string.IsNullOrEmpty(strWhere) ? "" : strWhere); InputParam.Add("SortOrder", OrderStr); InputParam.Add("PageTotal", 0); using (DbHelper db = new DbHelper(DbControl.GetDbConnStringBasic(DbHandleBehaviorDefine.SELECT, 0))) { dt = db.ExecuteProcedureAndOutputParameter("Proc_Page", out outputParam, InputParam); num = outputParam.GetValue <int>("PageTotal"); } return(dt); }
/// <summary> /// 绑定数据 /// </summary> private void PageDataBind() { try { int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <Tb_Ticket_Order> list = baseDataManage.CallMethod("Tb_Ticket_Order", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*", Con, ViewState["orderBy"].ToString() }) as List <Tb_Ticket_Order>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; repList.DataSource = list; repList.DataBind(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "", "showdialog('页面出错,请从新点击链接!');", true); } }
public void BindData() { //条件 Con = Query(); //分页 int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); List <User_Flyer> list = baseDataManage.CallMethod("User_Flyer", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*", Con, " id " }) as List <User_Flyer>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; //不用分页 // List<User_Flyer> list = baseDataManage.CallMethod("User_Flyer", "GetList", null, new object[] { Con }) as List<User_Flyer>; gvflyer.DataSource = list; gvflyer.DataBind(); //设置隐藏域数据 SetHidVal(list); }
/// <summary> /// 绑定 /// </summary> private void PageDataBind() { try { int TotalCount = 0; IHashObject outParams = new HashObject(); string sqlWhere = "OrderId in(select OrderId from Tb_Ticket_Passenger where IsBack=0 and OrderId in(select OrderId from Tb_Ticket_Order where " + Con + "))"; //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <Tb_Ticket_Order> list = baseDataManage.CallMethod("Tb_Ticket_Order", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*", sqlWhere, ViewState["orderBy"].ToString() }) as List <Tb_Ticket_Order>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; repList.DataSource = list; repList.DataBind(); } catch (Exception ex) { repList.DataSource = null; repList.DataBind(); } }
/// <summary> /// 数据绑定 /// </summary> protected void BindTemplateInfo() { try { int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); List <Tb_Sms_Template> list = baseDataManage.CallMethod("Tb_Sms_Template", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*", Con, ViewState["orderBy"].ToString() }) as List <Tb_Sms_Template>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; if (AspNetPager1.RecordCount == 0) { this.Panel1.Visible = false; this.Show.Visible = true; } else { this.Panel1.Visible = true; this.Show.Visible = false; } this.RepTempLate.DataSource = list; this.RepTempLate.DataBind(); } catch (Exception) { throw; } }
/// <summary> /// 查询订单 /// </summary> /// <param name="writer"></param> /// <param name="parames"></param> public override void Query(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames) { var pager = parames["pager"].Split(';'); int pageSize = int.Parse(pager[0]); int currPage = int.Parse(pager[1]); string con = SelWhere(parames); string orderby = " CreateTime desc"; int totalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <Tb_Ticket_Order> list = baseDataManage.CallMethod("Tb_Ticket_Order", "GetBasePager", outParams, new object[] { totalCount, pageSize, currPage, "*,dbo.GetCpyName(CPCpyNo) NewCpCpyName ", con, orderby }) as List <Tb_Ticket_Order>; totalCount = outParams.GetValue <int>("1"); writer.Write(new { TotalCount = totalCount, PageSize = pageSize, List = list }); }
/// <summary> /// 订单绑定 /// </summary> private void OrderListDataBind() { try { int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); PbProject.Logic.ControlBase.BaseDataManage baseDataManage = new PbProject.Logic.ControlBase.BaseDataManage(); List <Tb_Ticket_Order> list = baseDataManage.CallMethod("Tb_Ticket_Order", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*,dbo.GetCpyName(CPCpyNo) NewCpCpyName ", Con, ViewState["orderBy"].ToString() }) as List <Tb_Ticket_Order>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; repOrderList.DataSource = list; repOrderList.DataBind(); } catch (Exception) { } }
/// <summary> /// 获取当前最大ID /// </summary> /// <param name="dbName"></param> /// <param name="tableName"></param> /// <returns></returns> public static long GetMaxIdentity(string dbName, string tableName) { ConnectionConfig config = ConnectionManager.GetConnectionString(dbName + "_inc", DBrwType.Write); DbHelper dbHelper = DbHelper.Create(DBType.MySql, config.ConnectionString);; HashObject data = dbHelper.GetData("select id from " + tableName + " order by id desc limit 1"); long max = data.GetValue <long>("id", 0);//当前最大值 return(max); }
private static long[] Get(string dbName, string tableName, int count) { long[] result = new long[count]; if (count == 0) { return(result); } ConnectionConfig config = ConnectionManager.GetConnectionString(dbName + "_inc", DBrwType.Write); DbHelper dbHelper = DbHelper.Create(DBType.MySql, config.ConnectionString);; if (count > 20)//超过30条时,锁定表,只插入一次(用于批量导入) { using (TransScope trans = new TransScope(TransScopeOption.RequiresNew)) { dbHelper.ExecuteNonQuery("LOCK TABLES " + tableName + " WRITE"); HashObject data = dbHelper.GetData("select id from " + tableName + " order by id desc limit 1"); long max = data.GetValue <long>("id", 0);//当前最大值 long newmax = max + count; dbHelper.ExecuteNonQuery("insert into " + tableName + " values (" + newmax + ");UNLOCK TABLES;"); trans.Complete(); for (int i = 0; i < count; i++) { result[i] = max + i + 1; } } } else { StringBuilder sb = new StringBuilder(); sb.AppendFormat("insert into {0} values ", tableName); for (int i = 0; i < count; i++) { sb.Append("(null),"); } sb.Remove(sb.Length - 1, 1); sb.Append(";Select LAST_INSERT_ID() As ID;"); string sql = sb.ToString(); long firstId = 0; using (TransScope trans = new TransScope(TransScopeOption.RequiresNew)) { object temp = dbHelper.ExecuteScalar(sql); firstId = Convert.ToInt64(temp); trans.Complete(); } for (int i = 0; i < count; i++) { result[i] = firstId + i; } } return(result); }
public static void Init() { JavaScriptSerializer serializer = JavaScriptSerializer.CreateInstance(); socket.On(Socket.EVENT_CONNECT, () => { Data data = new Data("tools"); data.comefrom = "net"; socket.Emit("login", serializer.Serialize(data)); }); socket.On("getGoodMsg", (data) => { Console.Write(string.Format("接入查询数据,{0}", data)); HashObject hash = serializer.Deserialize <HashObject>(data.ToString()); HashObject hashData = serializer.Deserialize <HashObject>(hash.GetValue <string>("msg")); SendMsg msg = new SendMsg("tools"); msg.comefrom = "net"; msg.touid = hashData.GetValue <string>("fid"); try { MilitaryInvestigationTool military = new MilitaryInvestigationTool(); string condition = hashData.GetValue <string>("url"); if (condition.StartsWith("wwid=")) { military.GetGoodMsg(condition, (obj) => { msg.msg = serializer.Serialize(obj); var imsg = serializer.Serialize(msg); Console.Write(string.Format("输出数据,{0}", imsg)); ToolsIOUtils.Emit("goodMsg", imsg); }); return; } msg.msg = serializer.Serialize(military.GetSingleGoodMsg(condition)); } catch (Exception e1) { msg.msg = e1.Message; } var tmsg = serializer.Serialize(msg); Console.Write(string.Format("输出数据,{0}", tmsg)); ToolsIOUtils.Emit("goodMsg", tmsg); }); }
internal object GetSingleGoodMsg(string id) { IHashObjectList list = new HashObjectList(); string value = Net.GetNetDataPost(taodaxingUrl, string.Format("pattern=1&wwid=2&{0}&page=1", id), contentType); JavaScriptSerializer serializer = JavaScriptSerializer.CreateInstance(); HashObject hash = serializer.Deserialize <HashObject>(value); if (hash.GetValue <int>("code") == 0) { return(GetDataList(hash)[0]); } return("没有找到对应的数据"); }
private void CopyDataToList(HashObject data, IHashObjectList list) { foreach (HashObject item in data.GetValue <ArrayList>("data")) { HashObject copy = new HashObject(); copy.Add("gid", item["goodid"]); copy.Add("title", item["title"]); copy.Add("url", item["url"]); copy.Add("startDate", string.Format("{0}000", item["start"])); copy.Add("endDate", string.Format("{0}000", item["end"])); copy.Add("create", string.Format("{0}000", item["create"])); list.Add(copy); } }
private void PageDataBind() { int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); List <Tb_TripDistribution> list = baseDataManage.CallMethod("Tb_TripDistribution", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*", Con, OrderBy }) as List <Tb_TripDistribution>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; repList.DataSource = list; repList.DataBind(); }
/// <summary> /// 绑定补点信息 /// </summary> protected void BindPolicyShareTakeoffInfo() { int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); List <Tb_ShareInterface_TakeOff> list = baseDataManage.CallMethod("Tb_ShareInterface_TakeOff", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*", Con, ViewState["orderBy"].ToString() }) as List <Tb_ShareInterface_TakeOff>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; repPosList.DataSource = list; repPosList.DataBind(); }
private void PageDataBind() { int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); List <Bd_Base_Parameters> list = baseDataManage.CallMethod("Bd_Base_Parameters", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*", Con, ViewState["orderBy"].ToString() }) as List <Bd_Base_Parameters>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; Repeater.DataSource = list; Repeater.DataBind(); }
private IHashObjectList GetDataList(HashObject data) { IHashObjectList list = new HashObjectList(); foreach (HashObject item in data.GetValue <ArrayList>("data")) { HashObject copy = new HashObject(); copy.Add("gid", item["goodid"]); copy.Add("title", item["title"]); copy.Add("url", item["url"]); copy.Add("startDate", Utils.ConvertUnixDate(item.GetValue <long>("start"))); copy.Add("endDate", Utils.ConvertUnixDate(item.GetValue <long>("end"))); long temp = item.GetValue <long>("create"); copy.Add("create", temp == 0 ? "" : Utils.ConvertUnixDate(temp)); list.Add(copy); } return(list); }
/// <summary> /// 分页 /// </summary> /// <param name="ProcName">存储过程名</param> /// <param name="PageIndex">分页当前索引 </param> /// <param name="PageSize">分页大小</param> /// <param name="TableSQL">SQL语句 查询出来的的一张表</param> /// <param name="strWhere">过滤条件</param> /// <param name="Sort">排序字段</param> /// <param name="TotalCount">返回数据总条数</param> /// <returns></returns> public DataTable ExecProcPager(string ProcName, int PageIndex, int PageSize, string TableSQL, string strWhere, string Sort, out int TotalCount) { DataTable dt = null; TotalCount = 0; IHashObject InputParam = new HashObject(); IHashObject outputParam = new HashObject(); InputParam.Add("PageIndex", PageIndex); InputParam.Add("pageSize", PageSize); InputParam.Add("tableSQL", TableSQL); InputParam.Add("SqlWhere", string.IsNullOrEmpty(strWhere) ? "" : strWhere); InputParam.Add("SortOrder", Sort); InputParam.Add("PageTotal", 0); using (DbHelper db = new DbHelper(DbControl.GetDbConnStringBasic(DbHandleBehaviorDefine.SELECT, 0))) { dt = db.ExecuteProcedureAndOutputParameter(ProcName, out outputParam, InputParam); TotalCount = outputParam.GetValue <int>("PageTotal"); } return(dt); }
public object GetTianMaoRealPrice(string url, string refer, List <SkuMap> skuMaps) { string html = GetHtml(url, refer).ToString().Trim(); string[] keys = { "defaultModel/deliveryDO/deliveryAddress", "defaultModel/itemPriceResultDO/priceInfo", "defaultModel/servicePromise/servicePromiseList", "defaultModel/detailPageTipsDO/coupon", "defaultModel/sellCountDO/sellCount" }; JavaScriptSerializer seralizer = JavaScriptSerializer.CreateInstance(); var hash = seralizer.Deserialize <HashObject>(html); var temp = hash.GetHashValue(keys); HashObject priceInfo = temp.GetDataEx <HashObject>("priceInfo"); foreach (SkuMap map in skuMaps) { var items = priceInfo.GetValue <HashObject>(map.SkuId); var promotionList = items.ContainsKey("promotionList") ? items.GetValue <ArrayList>("promotionList") : items.GetValue <ArrayList>("suggestivePromotionList"); decimal min = map.OriginalPrice; foreach (HashObject item in promotionList) { min = Math.Min(min, item.GetValue <decimal>("price")); } map.PromotionPrice = min; } Goods goods = new Goods(); goods.SendCity = temp.GetDataEx <string>("deliveryAddress"); goods.Skus = skuMaps; goods.Service = GetGoodsServiceToTmall(temp.GetDataEx <ArrayList>("servicePromiseList")); goods.ConfirmGoodsCount = goods.SoldTotalCount = decimal.Parse(temp.GetDataEx <int>("sellCount").ToString()); //goods.Pays = GetGoodsPayWay(temp.GetDataEx<ArrayList>("pay")); //goods.Coupon = GetGoodsCoupon(temp.GetDataEx<ArrayList>("couponList")); return(goods); }
/// <summary> /// 绑定列表 /// </summary> private void PageDataBind() { try { int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); List <Tb_TripNumApply> list = baseDataManage.CallMethod("Tb_TripNumApply", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, PageIndex, "*", Con, OrderBy }) as List <Tb_TripNumApply>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = PageIndex; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + PageIndex + "</font> / " + AspNetPager1.PageCount; repApplyList.DataSource = list; repApplyList.DataBind(); } catch (Exception ex) { DataBase.LogCommon.Log.Error("ApplyTravel.aspx:PageDataBind()", ex); } }
public object GetData(SearchArea area, SearchKind method) { HashObject areaData = Utils.GetAreaData(area); List <string> xAxisData; Dictionary <string, Dictionary <string, decimal> > data = GetChatData(areaData.GetValue <string>("startDate"), areaData.GetValue <string>("endDate"), out xAxisData); if (method == SearchKind.ComeFrom) { return(GetPieData(data, xAxisData)); } switch (area) { case SearchArea.Today: return(GetBarData(data, xAxisData)); case SearchArea.Month: case SearchArea.Week: case SearchArea.DaysOf30: return(GetLineData(data, xAxisData)); } return(GetLineData(data, xAxisData)); }
private void InitSocket(string user) { socket = IO.Socket(socketUrl); JavaScriptSerializer serializer = JavaScriptSerializer.CreateInstance(); socket.On(Socket.EVENT_CONNECT, () => { if (socket == null) { socket = IO.Socket(socketUrl); } socketConnected = true; Data data = new Data(user); data.needAsk = false; socket.Emit("login", serializer.Serialize(data)); SendMsgToNode("已接入抓取接口,准备发起抓取请求"); }); socket.On("postDataSure", (data) => { try { HashObject hash = serializer.Deserialize <HashObject>(data.ToString()); postDataCuid = hash.GetValue <ulong>("msg"); SendMessage("服务器验证通过,准备接收数据"); } catch (Exception e) { postDataCuid = 0; SendMessage(e.Message); } finally { postDataCuid = 0; //listData = null; } }); }
/// <summary> /// 页面数据信息绑定 /// </summary> private void PageDataBind() { try { int TotalCount = 0; IHashObject outParams = new HashObject(); //指定参数类型 第一个参数为out输出类型 //key 为参数索引从1开始 value为引用类型 out ref outParams.Add("1", "out"); List <Tb_Ticket_Order> OrderList = this.baseDataManage.CallMethod("Tb_Ticket_Order", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "dbo.GetPasSuppendStatus(OrderId,'###') SuppendStatus,*", Con, " CreateTime desc" }) as List <Tb_Ticket_Order>; TotalCount = outParams.GetValue <int>("1"); AspNetPager1.RecordCount = TotalCount; AspNetPager1.CurrentPageIndex = Curr; AspNetPager1.CustomInfoHTML = " 页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount; if (OrderList.Count == 0) { Show.Visible = true; repList.Visible = false; AspNetPager1.Visible = false; } else { Show.Visible = false; repList.Visible = true; AspNetPager1.Visible = true; } repList.DataSource = OrderList; repList.DataBind(); } catch { ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "showdialog('页面出错,请从新点击链接!');", true); } }
public void SavePlugData(Plug plug) { HashObject hash = new HashObject(); long fileLength = 0; //数据搬移 plug.PDownpath = MoveFile(plug.PDownpath, out fileLength); plug.PTotal = fileLength; plug.PVideo = MoveFile(plug.PVideo, out fileLength); plug.PIcon = MoveFile(plug.PIcon, out fileLength); plug.PPic1 = MoveFile(plug.PPic1, out fileLength); plug.PPic2 = MoveFile(plug.PPic2, out fileLength); plug.PPic3 = MoveFile(plug.PPic3, out fileLength); hash.Add("pdownpath", plug.PDownpath); hash.Add("pvideo", plug.PVideo); hash.Add("picon", plug.PIcon); hash.Add("ppics", plug.PPics); hash.Add("pcreatedate", DateTime.Now); //数据保存 using (DbHelper db = AppUtils.CreateDbHelper()) { try { db.BeginTransaction(); List <string> needToDeleteFiles = DeleteOldData(plug, db, hash); if (plug.PTotal == 0) { plug.PTotal = hash.GetValue <int>("ptotal", 0); } string sql = "insert into plugs (pid,pname,pversion,pkind,plabel,picon,pdes,pvideo,pvideoweb,pcost,plevel,pdownpath,pdownpathweb,ptotal,pext,ppics,pcreatedate,pupdatedate,pshowway,pstorename,pwindowname) values(@pid,@pname,@pversion,@pkind,@plabel,@picon,@pdes,@pvideo,@pvideoweb,@pcost,@plevel,@pdownpath,@pdownpathweb,@ptotal,@pext,@ppics,@pcreatedate,@pupdatedate,@pshowway,@pstorename,@pwindowname)"; db.AddParameter("pid", plug.PId); db.AddParameter("pname", plug.PName); db.AddParameter("pversion", plug.PVersion); db.AddParameter("pkind", plug.PKind); db.AddParameter("plabel", plug.PLabel); db.AddParameter("picon", hash.GetValue <string>("picon")); db.AddParameter("pdes", plug.PDes); db.AddParameter("pvideo", hash.GetValue <string>("pvideo")); db.AddParameter("pcost", plug.PCost); db.AddParameter("plevel", plug.PLevel); db.AddParameter("pdownpath", hash.GetValue <string>("pdownpath")); db.AddParameter("ptotal", plug.PTotal); db.AddParameter("pext", plug.PExt); db.AddParameter("ppics", hash.GetValue <string>("ppics")); db.AddParameter("pcreatedate", hash.GetValue <DateTime>("pcreatedate")); db.AddParameter("pupdatedate", plug.PUpdatedate); db.AddParameter("pshowway", plug.PShowway); db.AddParameter("pstorename", plug.PStorename); db.AddParameter("pwindowname", plug.PWindowname); db.AddParameter("pvideoweb", GetWebUri()); db.AddParameter("pdownpathweb", GetWebUri()); db.ExecuteScalerSQL(sql); foreach (string file in needToDeleteFiles) { File.Delete(file); } db.CommitTransaction(); } catch (Exception e) { if (db.HasBegunTransaction) { db.RollbackTransaction(); } throw e; } } }