private string GetSimpleProductView() { string text = ""; string text2 = ""; string productBrand = this.GetProductBrand(); string categorys = this.GetCategorys(); string productTags = this.GetProductTags(); System.Collections.Generic.IList <ProductTypeInfo> productTypeList = this.GetProductTypeList(); System.Collections.Generic.IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(AttributeUseageMode.MultiView); if (productTypeList != null) { text = JavaScriptConvert.SerializeObject(productTypeList); } if (attributes.Count > 0) { text2 = JavaScriptConvert.SerializeObject(attributes); } return(string.Concat(new string[] { "{\"Categorys\":", categorys, ",\"Brands\":", productBrand, ",\"Tags\":", productTags, ",\"ProductTypes\":", text, ",\"Attributes\":", text2, "}" })); }
public void getDefDtl() { try { string record = this.Request["record"]; Hashtable ht = JavaScriptConvert.DeserializeObject <Hashtable>(record); List <ColumnInfo> list = JavaScriptConvert.DeserializeObject <List <ColumnInfo> >(ht["params"].ToString()); int start = Convert.ToInt32(this.Request["start"]); int limit = Convert.ToInt32(this.Request["limit"]); lvdfbyotBll bll = new lvdfbyotBll(); int total = 0; List <object> dataList = bll.GetDefDetails(list, true, start, start + limit, ref total); string json = JavaScriptConvert.SerializeObject(dataList); Response.Write("{results:" + total + ",rows:" + json + "}"); } catch (Exception ex) { string message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_QueryFail, ex, true) + "'}"; Response.Output.Write(message); } }
public void TypedObjectDeserialization() { Product product = new Product(); product.Name = "Apple"; product.Expiry = new DateTime(2008, 12, 28); product.Price = 3.99M; product.Sizes = new string[] { "Small", "Medium", "Large" }; string output = JavaScriptConvert.SerializeObject(product); //{ // "Name": "Apple", // "Expiry": new Date(1230422400000), // "Price": 3.99, // "Sizes": [ // "Small", // "Medium", // "Large" // ] //} Product deserializedProduct = (Product)JavaScriptConvert.DeserializeObject(output, typeof(Product)); Assert.AreEqual("Apple", deserializedProduct.Name); Assert.AreEqual(new DateTime(2008, 12, 28), deserializedProduct.Expiry); Assert.AreEqual(3.99, deserializedProduct.Price); Assert.AreEqual("Small", deserializedProduct.Sizes[0]); Assert.AreEqual("Medium", deserializedProduct.Sizes[1]); Assert.AreEqual("Large", deserializedProduct.Sizes[2]); }
public override void ProcessRequest(HttpContext context) { base.ProcessRequest(context); Model.Member memberModel = (TModel == null ? BllModel.TModel : TModel); string strWhere = " IsDeleted=0 "; if (!string.IsNullOrEmpty(context.Request["txtKey"])) { strWhere += " and Name like '%" + context.Request["txtKey"] + "%'"; } int count; List <Model.GoodCategory> List = BLL.GoodCategory.GetList(strWhere, pageIndex, pageSize, out count); StringBuilder sb = new StringBuilder(); for (int i = 0; i < List.Count; i++) { sb.Append(List[i].Id + "~"); //sb.Append((i + 1) + (pageIndex - 1) * pageSize + "~"); sb.Append(List[i].Code + "~"); sb.Append(List[i].Name); sb.Append("≌"); } var info = new { PageData = Traditionalized(sb), TotalCount = count }; context.Response.Write(JavaScriptConvert.SerializeObject(info)); }
public override void ProcessRequest(HttpContext context) { base.ProcessRequest(context); string strWhere = "'1'='1'"; //if (!string.IsNullOrEmpty(context.Request["tState"])) //{ // strWhere += " and State='" + context.Request["tState"] + "'"; //} //if (!string.IsNullOrEmpty(context.Request["nTitle"])) //{ // strWhere += " and Name like '%" + HttpUtility.UrlDecode(context.Request["nTitle"]) + "%'"; //} int count; List <Model.ImpType> ListNotice = BLL.ImpType.GetList(strWhere, pageIndex, pageSize, out count); StringBuilder sb = new StringBuilder(); for (int i = 0; i < ListNotice.Count; i++) { sb.Append(ListNotice[i].ID + "~"); sb.Append((i + 1) + (pageIndex - 1) * pageSize + "~"); sb.Append(ListNotice[i].Name + "~"); sb.Append(ListNotice[i].Remark + ""); sb.Append("≌"); } var info = new { PageData = Traditionalized(sb), TotalCount = count }; //var json = new { PageData = sb.ToString(), TotalCount = count };匿名类 context.Response.Write(JavaScriptConvert.SerializeObject(info)); }
public override void ProcessRequest(HttpContext context) { base.ProcessRequest(context); string strWhere = "'1'='1' and mid='" + TModel.MID + "' "; if (!string.IsNullOrEmpty(context.Request["startDate"])) { strWhere += " and Time>'" + context.Request["startDate"] + "'"; } if (!string.IsNullOrEmpty(context.Request["endDate"])) { strWhere += " and Time<'" + context.Request["endDate"] + "'"; } int count; List <Model.Member_OperationRecord> ListO = BLL.OperationRecordBLL.GetList(strWhere, pageIndex, pageSize, out count); StringBuilder sb = new StringBuilder(); for (int i = 0; i < ListO.Count; i++) { sb.Append(ListO[i].ID + "~"); sb.Append((i + 1) + (pageIndex - 1) * pageSize + "~"); sb.Append(ListO[i].MID + "~"); sb.Append(BLL.Roles.RolsList[ListO[i].RoleCode].RName + "~"); sb.Append(ListO[i].Time.ToString("yyyy-MM-dd HH:mm:ss") + "~"); sb.Append(ListO[i].TypeCode + "~"); sb.Append(ListO[i].Operation); sb.Append("≌"); } var info = new { PageData = Traditionalized(sb), TotalCount = count }; //var json = new { PageData = sb.ToString(), TotalCount = count };匿名类 context.Response.Write(JavaScriptConvert.SerializeObject(info)); }
private string GetCategorys() { string result = ""; string[] propertyName = new string[] { "CategoryId", "Name", "Depth" }; System.Data.DataTable dataTable; if (Hidistro.Membership.Context.HiContext.Current.SiteSettings.IsDistributorSettings) { dataTable = this.ConvertListToDataTable <CategoryInfo>(SubsiteCatalogHelper.GetSequenceCategories(), propertyName); } else { dataTable = this.ConvertListToDataTable <CategoryInfo>(CatalogHelper.GetSequenceCategories(), propertyName); } if (dataTable != null) { result = JavaScriptConvert.SerializeObject(dataTable, new JsonConverter[] { new ConvertTojson() }); } return(result); }
/// <summary> /// 加载公司分组 /// </summary> /// <param name="context"></param> /// <returns></returns> private string LoadGroup(HttpContext context) { string strcName = GlobalObject.unescape(context.Request.QueryString["cname"]); List <GroupJsonModel> lstGroupModel = PlatFormBusiness.GetGroupList(strcName); return(JavaScriptConvert.SerializeObject(lstGroupModel)); }
public override void ProcessRequest(HttpContext context) { base.ProcessRequest(context); string strWhere = " '1'='1' and Type=1 "; if (!string.IsNullOrEmpty(context.Request["nTitle"])) { strWhere += " and CarCode like '%" + HttpUtility.UrlDecode(context.Request["nTitle"]) + "%' "; } int count; List <Model.C_Mileage> ListNotice = BLL.C_Mileage.GetList(strWhere, pageIndex, pageSize, out count); StringBuilder sb = new StringBuilder(); for (int i = 0; i < ListNotice.Count; i++) { sb.Append(ListNotice[i].ID + "~"); sb.Append((i + 1) + (pageIndex - 1) * pageSize + "~"); sb.Append(ListNotice[i].CarCode + "~"); sb.Append(ListNotice[i].SIJI1 + "~"); //sb.Append((ListNotice[i].ImpUnit.ToString())+ "~"); sb.Append(ListNotice[i].SIJI2 + "~"); sb.Append((ListNotice[i].Mileage - ListNotice[i].DiffCount) + "~"); sb.Append(ListNotice[i].Mileage + "~"); sb.Append(ListNotice[i].DiffCount + "~"); sb.Append((ListNotice[i].CreateDate) + ""); sb.Append("≌"); } var info = new { PageData = Traditionalized(sb), TotalCount = count }; //var json = new { PageData = sb.ToString(), TotalCount = count };匿名类 context.Response.Write(JavaScriptConvert.SerializeObject(info)); }
public string LoadFirstHtml() { string result = ""; HtmlDocument htmlDocument = this.GetHtmlDocument(DesigAttribute.DesigPagePath); HtmlDocument webHtmlDocument = this.GetWebHtmlDocument(DesigAttribute.SourcePagePath); HtmlNodeCollection htmlNodeCollection = htmlDocument.DocumentNode.SelectNodes("//div[@rel=\"desig\"]"); System.Collections.Generic.IList <DesignTempleteInfo> list = new System.Collections.Generic.List <DesignTempleteInfo>(); foreach (HtmlNode current in htmlNodeCollection) { HtmlNode elementbyId = webHtmlDocument.GetElementbyId(current.Id); if (elementbyId != null) { list.Add(new DesignTempleteInfo { TempleteID = current.Id, TempleteContent = elementbyId.InnerHtml }); } } if (list.Count > 0) { result = JavaScriptConvert.SerializeObject(list); } return(result); }
public void UpdateCustomFields(string customFieldKey, List <string> options, bool keepExistingOptions) { HttpHelper.Put(string.Format("/lists/{0}/customfields/{1}/options.json", _listID, customFieldKey), null, JavaScriptConvert.SerializeObject( new { KeepExistingOptions = keepExistingOptions, Options = options }) ); }
protected void GetShop() { //检查商城的ShopService是否可用 bool isShopServiceAvailable = base.IsShopServicesCanWork(); if (isShopServiceAvailable) { List <We7.CMS.ShopService.StoreModel> list = base.GetRecommendStore(5); if (list != null && list.Count > 0) { List <JsonShopModel> listResult = new List <JsonShopModel>(); for (int i = 0; i < list.Count; i++) { JsonShopModel model = new JsonShopModel(); model.Url = list[i].Url; model.NameHtml = GetChopString(list[i].StoreName, 10, "..."); model.LevelHtml = GetLevelString(list[i].Level.ToString()); model.StoreIntro = GetClearHtml(list[i].StoreIntro); model.Face = list[i].Face; model.TechnicalLevel = list[i].TechnicalLevel; listResult.Add(model); } string result = JavaScriptConvert.SerializeObject(listResult); Response.Clear(); Response.Write(result); Response.Flush(); Response.End(); } } }
protected void GetProducts() { //检查商城的ShopService是否可用 bool isShopServiceAvailable = base.IsShopServicesCanWork(); if (isShopServiceAvailable) { List <We7.CMS.ShopService.ProductInfo> list = base.GetRecommendProduct(5); if (list != null && list.Count > 0) { List <JsonProductModel> listResult = new List <JsonProductModel>(); for (int i = 0; i < list.Count; i++) { JsonProductModel model = new JsonProductModel(); model.Name = list[i].Name; model.NameHtml = GetChopString(model.Name, 8, "..."); model.LevelHtml = GetLevelString(list[i].Level.ToString()); model.PageUrl = list[i].PageUrl; model.Thumbnail = list[i].Thumbnail; model.Point = list[i].Point.ToString(); model.Price = list[i].Price.ToString(); model.Sales = list[i].Sales.ToString(); listResult.Add(model); } string result = JavaScriptConvert.SerializeObject(listResult); Response.Clear(); Response.Write(result); Response.Flush(); Response.End(); } } }
public String GetBidJson(BookRequest b, Operator op) { String resp = ""; IList <OperatorBid> bidlist = BookRequestDAO.GetBidsForRequest(b); ListSet opbids = new ListSet(); OperatorBid minbid = null; Currency targetcurr = AdminDAO.GetCurrencyByID("USD"); Double minval = double.PositiveInfinity; foreach (OperatorBid ob in bidlist) { if (ob.Operator.Equals(op)) { opbids.Add(ob); } Double temp = ob.Currency.ConvertTo(ob.BidAmount, targetcurr); if (temp < minval) { minval = temp; minbid = ob; } } resp += "{\"TotalBids\":" + bidlist.Count + ",\"OperatorBids\":" + JavaScriptConvert.SerializeObject(opbids) + ",\"MinBid\":" + JavaScriptConvert.SerializeObject(minbid) + "}"; return(resp); }
public string GetWaterUserHasQuotasById(string loginIdentifer, string waterUserId) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("WaterUser", new JavaScriptObject()); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, true); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } if ((waterUserId == null) || (waterUserId.Trim() == "")) { obj2["Message"] = "用水户ID不能为空"; return(JavaScriptConvert.SerializeObject(obj2)); } WaterUser wui = WaterUserModule.GetWaterUserById(long.Parse(waterUserId)); if (wui == null) { obj2["Message"] = "ID为" + waterUserId + "用水户不存在"; return(JavaScriptConvert.SerializeObject(obj2)); } obj2["Result"] = true; obj2["WaterUser"] = WaterUserModule.WaterUserToJson(wui); } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public string GetResult <T>(T obj) { GetResponse <T> response = new GetResponse <T>(); response.Result = obj; return(JavaScriptConvert.SerializeObject(response)); }
public string GetWaterUserQuotaById(string loginIdentifer, string waterUserQuotaId) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); obj2.Add("WaterUserQuota", new JavaScriptObject()); try { ResMsg msg = CommonUtil.CheckLoginState(loginIdentifer, false); if (!msg.Result) { obj2["Message"] = msg.Message; return(JavaScriptConvert.SerializeObject(obj2)); } /* * WaterUserQuota waterUserQuotaById = SaleWaterModule.GetWaterUserQuotaById(waterUserQuotaId); * if (waterUserQuotaById == null) * { * obj2["Message"] = "ID为" + waterUserQuotaId + "用水定额不存在"; * return JavaScriptConvert.SerializeObject(obj2); * } * obj2["WaterUser"] = SaleWaterModule.WaterUserQuotaToJson(waterUserQuotaById); * */ obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
private void ProcessRequest(TextReader input, TextWriter output) { ValidationUtils.ArgumentNotNull(input, "input"); ValidationUtils.ArgumentNotNull(output, "output"); IDictionary response; try { IDictionary request = JavaScriptConvert.DeserializeObject(input) as IDictionary; response = Invoke(request); } catch (MissingMethodException e) { response = CreateResponse(null, null, FromException(e)); } catch (JsonReaderException e) { response = CreateResponse(null, null, FromException(e)); } catch (JsonWriterException e) { response = CreateResponse(null, null, FromException(e)); } string result = JavaScriptConvert.SerializeObject(response); output.Write(result); }
public override void ProcessRequest(HttpContext context) { base.ProcessRequest(context); string strWhere = "IsDeleted=0 and MID='" + TModel.MID + "' "; string state = string.Empty; if (!string.IsNullOrEmpty(context.Request["mKey"])) { strWhere += " and Receiver like '%" + context.Request["mKey"] + "%'"; } int count; List <Model.ReceiveInfo> List = BLL.ReceiveInfo.GetList(strWhere, pageIndex, pageSize, out count); StringBuilder sb = new StringBuilder(); for (int i = 0; i < List.Count; i++) { sb.Append(List[i].Id + "~"); sb.Append((i + 1) + (pageIndex - 1) * pageSize + "~"); sb.Append(List[i].Receiver + "~"); sb.Append(List[i].Phone + "~"); sb.Append(List[i].Province + List[i].City + List[i].Zone + List[i].Address + "~"); sb.Append(List[i].IsMain?"是":"否"); sb.Append("≌"); } var info = new { PageData = Traditionalized(sb), TotalCount = count }; context.Response.Write(JavaScriptConvert.SerializeObject(info)); }
public string PublishTemplatizedAction() { try { //JsonParams = "{\"uId\":\"1\",\"appId\":1048438,\"titleTemplate\":\"{actor} \u6dfb\u52a0\u4e86 {app} \u5e94\u7528\",\"titleData\":{},\"bodyTemplate\":null,\"bodyData\":[],\"bodyGeneral\":null,\"image1\":null,\"image1Link\":null,\"image2\":null,\"image2Link\":null,\"image3\":null,\"image3Link\":null,\"image4\":null,\"image4Link\":null,\"targetIds\":null,\"privacy\":\"public\",\"hashTemplate\":null,\"hashData\":null}"; PublishTemplatizedActionParams actionParams = JavaScriptConvert.DeserializeObject <PublishTemplatizedActionParams>(UnicodeToString(JsonParams).Replace("[]", "{}"));//将PHP的空keyvalue数组格式json转换为.net的空keyvalue数组格式 MiniFeedInfo feedInfo = new MiniFeedInfo(); feedInfo.Uid = actionParams.Uid; feedInfo.UserName = Forum.Users.GetShortUserInfo(actionParams.Uid).Username; feedInfo.AppId = actionParams.AppId; feedInfo.FeedType = FeedTypeEnum.Application; feedInfo.BodyGeneral = actionParams.BodyGeneral ?? string.Empty; feedInfo.BodyTemplate = actionParams.BodyTemplate ?? string.Empty; feedInfo.TitleTemplate = actionParams.TitleTemplate ?? string.Empty; feedInfo.BodyData = actionParams.BodyData.Count == 0 ? "" : JavaScriptConvert.SerializeObject(actionParams.BodyData); feedInfo.TitleData = actionParams.TitleData.Count == 0 ? "" : JavaScriptConvert.SerializeObject(actionParams.TitleData); feedInfo.Image1Link = actionParams.Image1Link ?? string.Empty; feedInfo.Image1Url = actionParams.Image1Url ?? string.Empty; feedInfo.Image2Link = actionParams.Image2Link ?? string.Empty; feedInfo.Image2Url = actionParams.Image2Url ?? string.Empty; feedInfo.Image3Link = actionParams.Image3Link ?? string.Empty; feedInfo.Image3Url = actionParams.Image3Url ?? string.Empty; feedInfo.Image4Link = actionParams.Image4Link ?? string.Empty; feedInfo.Image4Url = actionParams.Image4Url ?? string.Empty; return(GetResult(MiniFeeds.PublishFeed(feedInfo) > 0)); } catch (Exception e) { return(e.ToString()); } }
public string GetDeviceTypeCode(string loginIdentifer) { JavaScriptObject obj2 = new JavaScriptObject(); obj2["Result"] = false; obj2["Message"] = ""; LoginUser loginUser = GlobalAppModule.GetLoginUser(loginIdentifer); if (loginUser == null) { obj2["Message"] = "未登录"; return(JavaScriptConvert.SerializeObject(obj2)); } if (loginUser.LoginTimeout) { obj2["Message"] = "登录超时"; return(JavaScriptConvert.SerializeObject(obj2)); } loginUser.LastOperateTime = DateTime.Now; CommonUtil.WaitMainLibInit(); List <DeviceTypeCode> deviceTypeCodeList = DeviceTypeCodeModule.GetAll(); JavaScriptArray array = new JavaScriptArray(); foreach (DeviceTypeCode info in deviceTypeCodeList) { JavaScriptObject item = this.DeviceTypeCodeInfoToJson(info); array.Add(item); } obj2["Result"] = true; obj2["DeviceTypeCode"] = array; return(JavaScriptConvert.SerializeObject(obj2)); }
public override void ProcessRequest(HttpContext context) { base.ProcessRequest(context); string strWhere = "'1'='1'"; if (!string.IsNullOrEmpty(context.Request["nTitle"])) { strWhere += " and ObjName like '%" + HttpUtility.UrlDecode(context.Request["nTitle"]) + "%'"; } int count; List <Model.OObject> ListO = BLL.OObject.GetList(strWhere, pageIndex, pageSize, out count); StringBuilder sb = new StringBuilder(); for (int i = 0; i < ListO.Count; i++) { sb.Append(ListO[i].ID + "~"); sb.Append((i + 1) + (pageIndex - 1) * pageSize + "~"); sb.Append(ListO[i].ObjOID + "~"); sb.Append(ListO[i].ObjName + "~"); sb.Append(ListO[i].BMDate + "~"); sb.Append(ListO[i].CreateDate + "~"); sb.Append(ListO[i].JGDate + "~"); var bmcount = BLL.CommonBase.GetSingle("select COUNT(*) from ObjUserApply where objid=" + ListO[i].ID + ";"); var sjcount = BLL.CommonBase.GetSingle("select COUNT(*) from ObjUserApply where sstate=3 and objid=" + ListO[i].ID + ";"); sb.Append(bmcount + "~"); sb.Append(sjcount + ""); sb.Append("≌"); } var info = new { PageData = Traditionalized(sb), TotalCount = count }; //var json = new { PageData = sb.ToString(), TotalCount = count };匿名类 context.Response.Write(JavaScriptConvert.SerializeObject(info)); }
internal static string CreateErrorMessage(ErrorType error, List <DNTParam> paramList) { if (error == ErrorType.API_EC_NONE) { return(string.Empty); } Error errorObj = new Error(); errorObj.ErrorCode = (int)error; errorObj.ErrorMsg = _errorDetails[errorObj.ErrorCode].ToString(); ArrayList list = new ArrayList(); foreach (DNTParam param in paramList) { list.Add(new Arg(param.Name, param.Value)); } if (list.Count > 0) { ArgResponse ar = new ArgResponse(); ar.Args = (Arg[])list.ToArray(typeof(Arg)); ar.List = true; errorObj.Args = ar; } return(DNTRequest.GetString("format").Trim().ToLower() == "json" ? JavaScriptConvert.SerializeObject(errorObj) : SerializationHelper.Serialize(errorObj)); }
public override void ProcessRequest(HttpContext context) { base.ProcessRequest(context); string strWhere = " VState='1' "; pageSize = 200; List <Model.Roles> List = BLL.Roles.GetList(strWhere); StringBuilder sb = new StringBuilder(); for (int i = 0; i < List.Count; i++) { sb.Append(List[i].RType + "~"); sb.Append((i + 1) + (pageIndex - 1) * pageSize + "~"); sb.Append(List[i].RType + "~"); sb.Append(List[i].RName + "~"); sb.Append((List[i].IsAdmin ? "<span style='color:Red;'>是</span>" : "否") + "~"); sb.Append((List[i].Super ? "<span style='color:Red;'>是</span>" : "否") + "~"); sb.Append((List[i].CanSH ? "<span style='color:Red;'>是</span>" : "否") + "~"); sb.Append((List[i].CanLogin ? "<span style='color:Red;'>是</span>" : "否") + "~"); sb.Append((List[i].CMessage ? "<span style='color:Red;'>是</span>" : "否") + "~"); sb.Append((List[i].RColor)); sb.Append("≌"); } var info = new { PageData = Traditionalized(sb), TotalCount = List.Count }; context.Response.Write(JavaScriptConvert.SerializeObject(info)); }
public void listBoardMessage() { try { string record = this.Request["record"]; //Hashtable ht = JavaScriptConvert.DeserializeObject<Hashtable>(record); //List<ColumnInfo> list = JavaScriptConvert.DeserializeObject<List<ColumnInfo>>(ht["params"].ToString()); List <ColumnInfo> list = new List <ColumnInfo>() { new ColumnInfo() { ColumnName = "reci", ColumnValue = Function.GetCurrentStaff() } }; int start = Convert.ToInt32(this.Request["start"]); int limit = Convert.ToInt32(this.Request["limit"]); int total = 0; staldlybBll bll = new staldlybBll(); List <tstaldlyb> dataList = bll.GetSelectedRecords <tstaldlyb>(list, true, start, start + limit, ref total); string json = JavaScriptConvert.SerializeObject(dataList); Response.Write("{results:" + total + ",rows:" + json + "}"); } catch (Exception ex) { string message = "{status:'failure',msg:'" + ExceptionPaser.Parse(HRMSRes.Public_Message_QueryFail, ex, true) + "'}"; Response.Output.Write(message); } }
public string Logout(string loginIdentifer) { JavaScriptObject obj2 = new JavaScriptObject(); obj2.Add("Result", false); obj2.Add("Message", ""); try { LoginUser loginUser = GlobalAppModule.GetLoginUser(loginIdentifer); if (loginUser != null) { GlobalAppModule.RemoveLoginUser(loginIdentifer); } try { SysLog log = new SysLog(); log.LogUserId = loginUser.UserId; log.LogUserName = loginUser.LoginName; log.LogAddress = ToolsWeb.GetIP(context.Request); log.LogTime = DateTime.Now; log.LogType = "退出登录"; log.LogContent = ""; SysLogModule.Add(log); } catch { } obj2["Result"] = true; } catch (Exception exception) { obj2["Message"] = exception.Message; } return(JavaScriptConvert.SerializeObject(obj2)); }
public override void ProcessRequest(HttpContext context) { base.ProcessRequest(context); Model.Member memberModel = (TModel == null ? BllModel.TModel : TModel); string strWhere = " IsDeleted=0 and MID='" + memberModel.MID + "' and Status=1"; int count; List <Model.ShopCar> List = BLL.ShopCar.GetList(strWhere, pageIndex, pageSize, out count); StringBuilder sb = new StringBuilder(); for (int i = 0; i < List.Count; i++) { sb.Append(List[i].Id + "~"); sb.Append((i + 1) + (pageIndex - 1) * pageSize + "~"); Model.Goods good = BLL.Goods.GetModel(List[i].GId); if (good != null) { sb.Append("<img class='appImg' alt=\"" + good.GName + "\" src='" + good.ImageAddr + "'/>"); sb.Append(good.GName + "<input type='hidden' value='" + List[i].Id + "' class='hidCId'/> ~"); sb.Append("<span class='spSprice'>" + good.CostPrice + "</span>/" + good.Unit + "~"); string str = @"<span class='goodNum numDesc' onclick='numDesc(this)'> - </span><input type='text' class='numVal' readonly='readonly' value='" + List[i].GCount + "'/> <span class='goodNum numAsc' onclick='numAsc(this)'> + </span>"; sb.Append(str + "~"); sb.Append("<span class='spTotal'>" + (List[i].GCount * good.CostPrice).ToFixedString() + "</span>~"); //sb.Append("<span class='spTotalDis'>" + (List[i].GCount * good.CostPrice /** BLL.Configuration.Model.E_GWDiscount*/).ToFixedString() + "</span>~"); sb.Append(good.SellingCount); sb.Append("≌"); } } var info = new { PageData = Traditionalized(sb), TotalCount = count }; context.Response.Write(JavaScriptConvert.SerializeObject(info)); }
// 绑定岗位列表 private void BindAllGroup() { IList groups = this.groupService.FindByOU(rootOUUnid, false, groupType, true); HtmlOption[] groupOptions = new HtmlOption[groups.Count]; Group group; for (int i = 0; i < groups.Count; i++) { group = groups[i] as Group; groupOptions[i] = new HtmlOption(group.Name + " [" + group.OUFullName + "]", group.Unid); } this.Options.DataSource = groupOptions; this.Options.DataTextField = "OptionName"; this.Options.DataValueField = "OptionValue"; this.Options.DataBind(); // 创建岗位列表的json字符串 JavaScriptArray jsonArray = new JavaScriptArray(); JavaScriptObject jsonObject; foreach (Group group1 in groups) { jsonObject = JsonUtils.CreateJsonObject(group1); jsonArray.Add(jsonObject); } this.groupsJson = JavaScriptConvert.SerializeObject(jsonArray); }
public override void ProcessRequest(HttpContext context) { base.ProcessRequest(context); string strWhere = " '1'='1' "; if (!string.IsNullOrEmpty(context.Request["mKey"]))//按照英文查询 { strWhere += " and Name like '%" + context.Request["mKey"] + "%'"; } if (!string.IsNullOrEmpty(context.Request["txtKey"]))//按照中文查询 { strWhere += " and Code like '%" + context.Request["txtKey"] + "%'"; } int count = 0; StringBuilder sb = new StringBuilder(); List <CommonModel.Sys_LanguageType> ListChangeMoney; ListChangeMoney = Sys_LanguageTypeBLL.GetList(strWhere, pageIndex, pageSize, out count); for (int i = 0; i < ListChangeMoney.Count; i++) { sb.Append(ListChangeMoney[i].ID + "~"); sb.Append((i + 1) + (pageIndex - 1) * pageSize + "~"); sb.Append(ListChangeMoney[i].Code + "~"); sb.Append(ListChangeMoney[i].Name + "~"); sb.AppendFormat("<img alt=\"{0}\" src=\"{1}\" style=\"width:38px; height:24px;\" />~", ListChangeMoney[i].Name, ListChangeMoney[i].ImgUrl); sb.Append((ListChangeMoney[i].Status ? "已生效" : "未生效")); sb.Append("≌"); } var info = new { PageData = sb.ToString(), TotalCount = count }; context.Response.Write(JavaScriptConvert.SerializeObject(info)); }
public static string serialise(object obj) { //JsonSerializerSettings setting = new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }; //return JsonConvert.SerializeObject(obj, setting); return(JavaScriptConvert.SerializeObject(obj)); //for Newtonsoft 2.0 }