public async Task <List <DeliveryInfos> > GetRestaurantDeliveryInforAsync(Restaurant restaurant) { //Get function APIDetail api = apisJson.GetRestaurantDeliveryInfor; //Set Fields api.AvailableBodys.Where(a => a.FieldName == "restaurant_ids").FirstOrDefault().ValueDefault = "[" + restaurant.restaurant_id.ToString() + "]";// 217 is id of HCM city //Call API RequestMethodFactory method = new RequestMethodFactory(api); var response = await method.CallApiAsync(); var result = response.Content.ReadAsStringAsync().Result; return(ConvertJson.ConvertString2ListDeliveryInfos(result)); }
public async Task <DeliveryDetail> GetRestaurantDetailAsync(Restaurant restaurant) { //Get function APIDetail api = apisJson.GetRestaurantDetail; //Set Fields api.AvailableParams.Where(a => a.FieldName == "request_id").FirstOrDefault().ValueDefault = restaurant.delivery_id.ToString(); //Call API RequestMethodFactory method = new RequestMethodFactory(api); var response = await method.CallApiAsync(); var result = response.Content.ReadAsStringAsync().Result; return(ConvertJson.ConvertString2DeliveryInfos(result)); }
public void getCply() { DataSet dsCply = new Cms.BLL.C_article().GetList(2, "parentId=125", "orderNumber desc,articleId desc"); if (dsCply != null && dsCply.Tables[0].Rows.Count > 0) { string strJson = ConvertJson.ToJson(dsCply); Response.Write(strJson); Response.End(); } else { Response.Write(""); Response.End(); } }
public ActionResult DepartList(int pageIndex, int pageSize, string departName) { DepartProvider provider = new DepartProvider(); List <SysDepartEntity> list = provider.GetList(); List <SysDepartEntity> listResult = new List <SysDepartEntity>(); List <SysDepartEntity> returnList = new List <SysDepartEntity>(); if (!list.IsNullOrEmpty()) { listResult = list.Where(a => a.DepartName.Contains(departName) || a.DepartNum.Contains(departName)).ToList(); returnList = listResult.Skip((pageIndex - 1) * pageSize).Take(pageSize).OrderByDescending(a => a.ID).ToList(); } this.ReturnJson.AddProperty("Data", ConvertJson.ListToJson <SysDepartEntity>(returnList, "List")); this.ReturnJson.AddProperty("RowCount", listResult.Count); return(Content(this.ReturnJson.ToString())); }
public async Task <List <FoodCategory> > GetFoodCataloguesAsync(DeliveryInfos delivery) { //Get function APIDetail api = apisJson.GetDeliveryDishes; //Set Fields api.AvailableParams.Where(a => a.FieldName == "request_id").FirstOrDefault().ValueDefault = delivery.delivery_id.ToString(); //Call API RequestMethodFactory method = new RequestMethodFactory(api); var response = await method.CallApiAsync(); var result = response.Content.ReadAsStringAsync().Result; return(ConvertJson.ConvertString2ListFoodCatalogue(result)); }
public void getBanner() { DataSet ds = new Cms.BLL.C_ad().GetList(3, "adtype=1", "id desc"); if (ds != null && ds.Tables[0].Rows.Count > 0) { string strJson = ConvertJson.ToJson(ds); Response.Write(strJson); Response.End(); } else { Response.Write(""); Response.End(); } }
public string UpdateCache(Admin admin, IMemoryCache _cache) { var key = this.TokenKey(admin.Id); string value = ConvertJson.ObjToJsonString(admin); //查询token是否存在 if (string.IsNullOrEmpty(_cache.Get <string>(key))) { MemoryCacheEntryOptions options = new MemoryCacheEntryOptions(); options.AbsoluteExpiration = DateTime.Now.AddMinutes(1); options.SlidingExpiration = TimeSpan.FromMinutes(1); _cache.Set <string>(key, value, options); } //string token = _cache.Get<string>("token"); return(key); }
public ActionResult GetList() { int Status = WebUtil.GetFormValue <int>("Status", 0); string OrderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty); string BadType = WebUtil.GetFormValue <string>("BadType", string.Empty); string ProductType = WebUtil.GetFormValue <string>("ProductType", string.Empty); string beginTime = WebUtil.GetFormValue <string>("beginTime", string.Empty); string endTime = WebUtil.GetFormValue <string>("endTime", string.Empty); int pageSize = WebUtil.GetFormValue <int>("PageSize", 10); int pageIndex = WebUtil.GetFormValue <int>("PageIndex", 1); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; BadReportEntity entity = new BadReportEntity(); if (Status > 0) { entity.Where(a => a.Status == Status); } if (!OrderNum.IsEmpty()) { entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%"); } if (!ProductType.IsEmpty()) { entity.Where("ProductType", ECondition.Eth, ProductType); } if (!BadType.IsEmpty()) { entity.Where("BadType", ECondition.Eth, BadType); } if (!beginTime.IsEmpty() && !endTime.IsEmpty()) { entity.Where("CreateTime", ECondition.Between, ConvertHelper.ToType <DateTime>(beginTime), ConvertHelper.ToType <DateTime>(endTime)); } entity.And(a => a.StorageNum == this.DefaultStore); Bill <BadReportEntity, BadReportDetailEntity> bill = new BadOrder(); List <BadReportEntity> listResult = bill.GetList(entity, ref pageInfo); listResult = listResult == null ? new List <BadReportEntity>() : listResult; string json = ConvertJson.ListToJson <BadReportEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", json); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return(Content(this.ReturnJson.ToString())); }
public void getProductDe() { string id = Request["id"]; DataSet ds = new Cms.BLL.C_article_product().GetList(1, "article_id=" + id, "id desc"); if (ds != null && ds.Tables[0].Rows.Count > 0) { string strJson = ConvertJson.ToJson(ds); Response.Write(strJson); Response.End(); } else { Response.Write(""); Response.End(); } }
public void getProxy() { string tearname = new Cms.BLL.C_Column().GetModel(103).name.ToString(); DataSet ds = Cms.DBUtility.DbHelperSQL.Query("SELECT * FROM ( SELECT ROW_NUMBER() OVER (order by T.orderNumber desc, T.articleId desc )AS Row, T.* from C_article T WHERE parentId in (97,117,118,119,120,121) ) TT WHERE TT.Row between 0 and 3 order by orderNumber desc,articleId desc"); if (ds != null && ds.Tables[0].Rows.Count > 0) { string strJson = ConvertJson.ToJson(ds); Response.Write(strJson); Response.End(); } else { Response.Write(""); Response.End(); } }
public async Task <IActionResult> Create() { AppIdentityUser _user = await _userManager.FindByNameAsync(User.Identity.Name); ViewData["UserName"] = _user.UserName; ViewData["Branch"] = _user.Branch; var belongToId = _context.FncBranch.SingleOrDefault(x => x.BranchName == _user.Branch).BranchId; var list_paymentType = _context.FncPaymentType.ToList(); ViewData["PaymentType"] = new SelectList(list_paymentType, "PaymentType", "PaymentType"); ViewData["StewardAccountsId"] = belongToId.ToString() + ConvertJson.DateTimeToStamp(DateTime.Now).ToString(); return(PartialView("~/Areas/Branch/Views/BrhStewardAccount/Create.cshtml")); }
public ActionResult GetAddList() { //string CusNum = WebUtil.GetFormValue<string>("CusNum", string.Empty); //List<CusAddressEntity> list = null; //if (!CusNum.IsEmpty()) //{ // CustomerProvider provider = new CustomerProvider(); // list = provider.GetAddressList(CusNum); //} List <CusAddressEntity> list = Session[CacheKey.JOOSHOW_CUSADDRESS_CACHE] as List <CusAddressEntity>; list = list == null ? new List <CusAddressEntity>() : list; string json = ConvertJson.ListToJson <CusAddressEntity>(list, "List"); this.ReturnJson.AddProperty("Data", new JsonObject(json)); return(Content(this.ReturnJson.ToString())); }
public ActionResult GetContact() { string snNum = WebUtil.GetFormValue <string>("SnNum", string.Empty); CustomerProvider provider = new CustomerProvider(); CusAddressEntity entity = new CusAddressEntity(); entity = provider.GetSingleAddress(snNum); if (entity.IsNotNull()) { StringBuilder sb = new StringBuilder(); List <CusAddressEntity> listResult = new List <CusAddressEntity>(); listResult.Add(entity); string json = ConvertJson.ListToJson(listResult, "List"); this.ReturnJson.AddProperty("Data", new JsonObject(json)); } return(Content(this.ReturnJson.ToString())); }
public override async Task OnActionExecutionAsync(ActionExecutingContext actionContext, ActionExecutionDelegate next) { var isAuthHeader = actionContext.HttpContext.Request.Headers.TryGetValue("Authorization", out _authorizationToken); if (!isAuthHeader) { actionContext.Result = new ContentResult { Content = "UnAuthorized - Bạn không có quyền truy cập chức năng này", StatusCode = ApiStatusCode.UnAuthorized }; return; } string token = _authorizationToken.ToString().Substring("Bearer ".Length); JwtSecurityToken secToken = new JwtSecurityToken(token); var user = new UserProfile(); try { string userInfoJson = secToken.Claims.First(claim => claim.Type == JwtClaimTypes.Subject)?.Value; if (!string.IsNullOrEmpty(userInfoJson)) { user = ConvertJson.Deserialize <UserProfile>(userInfoJson); } } catch { } if (string.IsNullOrEmpty(user?.FullName)) { actionContext.Result = new ContentResult { Content = "UnAuthorized - Bạn không có quyền truy cập chức năng này", StatusCode = ApiStatusCode.UnAuthorized }; return; } actionContext.HttpContext.Items[Constant.USER_INFO] = user; await next(); }
/// <summary> /// 代理商选择商品 /// </summary> /// <returns></returns> public string disBing(string compid, string disid) { StringBuilder strwhere = new StringBuilder(); //商品是否启用库存 IsInve = OrderInfoType.rdoOrderAudit("商品是否启用库存", compid.ToInt(0)).ToInt(0); if (IsInve == 0) { strwhere.AppendFormat("and info.Inventory>0"); } DataTable dt = SqlHelper.Query(SqlHelper.LocalSqlServer, SelectGoodsInfo.Returnsql(compid, disid, strwhere.ToString(), "2")).Tables[0]; List <int> infoidl = new List <int>(); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { int id = item["ID"].ToString().ToInt(0);//BD_goodsInfo表的ID infoidl.Add(id); } } //获取商品价格 List <BLL.gDprice> l = BLL.Common.GetPrice(Convert.ToInt32(compid), Convert.ToInt32(disid), infoidl); if (l != null && l.Count > 0) { foreach (var item in l) { DataRow[] dr = dt.Select(" ID=" + item.goodsInfoId); if (dr.Length > 0) { //获取的价格大于促销价时、取促销价 dr[0]["pr"] = item.FinalPrice; dr[0]["typeTinkerPrice"] = item.typePrice; dr[0]["disTinkerPrice"] = item.disPrice; dr[0]["disProPr"] = item.bpPrice; } } } return(ConvertJson.ToJson2(dt)); }
public void SerialisationIsNotAffectedByChangeToGlobalSettings() { var existingDefaults = JsonConvert.DefaultSettings; try { JsonConvert.DefaultSettings = ADifferentJsonSerializerSettings; var data = MakeTestData(); var result = ConvertJson.Serialize(data); Assert.That(result, Is.EqualTo(ExpectedOutput)); } finally { JsonConvert.DefaultSettings = existingDefaults; } }
public void getNext() { string id = Request["id"]; int parentId = new Cms.BLL.C_article().GetModel(Convert.ToInt32(id)).parentId.Value; DataSet ds = new Cms.BLL.C_article().GetList(1, "parentId='" + parentId + "' and articleId<" + id, "articleId desc"); if (ds != null && ds.Tables[0].Rows.Count > 0) { string strJson = ConvertJson.ToJson(ds); Response.Write(strJson); Response.End(); } else { Response.Write(""); Response.End(); } }
public ActionResult LoadDetail() { int pageIndex = WebUtil.GetFormValue <int>("PageIndex", 1); int pageSize = WebUtil.GetFormValue <int>("PageSize", 10); List <ProductEntity> ListProducts = Session[CacheKey.JOOSHOW_CHECKDETAIL_CACHE] as List <ProductEntity>; ListProducts = ListProducts.IsNull() ? new List <ProductEntity>() : ListProducts; int rowCount = ListProducts.Count; ListProducts = ListProducts.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); string json = ConvertJson.ListToJson(ListProducts, "List"); this.ReturnJson.AddProperty("Data", json); this.ReturnJson.AddProperty("RowCount", rowCount); return(Content(this.ReturnJson.ToString())); }
/// <summary> /// 选择商品 /// </summary> /// <returns></returns> public string disBing(string goodsinfoid = "", string disid = "", string str = "") { StringBuilder strwhere = new StringBuilder(); StringBuilder strwhere1 = new StringBuilder(); //启用库存 // strwhere.AppendFormat(" and a.compid=" + this.CompID ); if (!Util.IsEmpty(goodsinfoid)) { strwhere.AppendFormat(" and a.id in(" + goodsinfoid + ")"); strwhere1.AppendFormat(" and c.GoodsID in(" + goodsinfoid + ")"); } if (!Util.IsEmpty(disid)) { //if (str == "CM") //{ strwhere1.AppendFormat(" and f.DisID=" + disid); //} } DataTable dt = new Hi.BLL.BD_GoodsInfo().getGoodsModels(strwhere.ToString()).Tables[0]; if (dt != null && dt.Rows.Count > 0) { DataTable fcdt = new Hi.BLL.BD_GoodsInfo().getGoodsCMerchants(strwhere1.ToString()).Tables[0]; if (fcdt != null && fcdt.Rows.Count > 0) { foreach (DataRow item in fcdt.Rows) { DataRow[] dr = dt.Select(" Id=" + item["GoodsID"]); if (dr.Length > 0) { dr[0]["FirstCampID"] = item["FirstCampID"]; dr[0]["htid"] = item["htid"]; dr[0]["HospitalName"] = item["HospitalName"]; dr[0]["AreaID"] = item["AreaID"]; dr[0]["AreaName"] = item["AreaName"]; } } } } return(ConvertJson.ToJson(dt)); }
public ActionResult GetSupplierList() { int pageIndex = WebUtil.GetFormValue <int>("pageIndex", 1); int pageSize = WebUtil.GetFormValue <int>("pageSize", 15); string SupNum = WebUtil.GetFormValue <string>("SupNum", string.Empty); SupplierProvider provider = new SupplierProvider(); SupplierEntity entity = new SupplierEntity(); List <SupplierEntity> list = provider.GetList(); if (!list.IsNullOrEmpty()) { List <SupplierEntity> listResult = list.Where(a => a.SupNum.Contains(SupNum) || a.SupName.Contains(SupNum)).ToList(); List <SupplierEntity> returnList = listResult.Skip((pageIndex - 1) * pageSize).Take(pageSize).OrderByDescending(a => a.ID).ToList(); string json = ConvertJson.ListToJson <SupplierEntity>(returnList, "List"); this.ReturnJson.AddProperty("Data", new JsonObject(json)); this.ReturnJson.AddProperty("RowCount", listResult.Count); } return(Content(this.ReturnJson.ToString())); }
public string disBings(string OrderOutDetailID = "", string inindex = "") { string strwhere = " DisID=" + DisID + " "; if (!Util.IsEmpty(OrderOutDetailID)) { strwhere += " and id in(" + OrderOutDetailID + ")"; } if (inindex == "-1") { List <Hi.Model.YZT_LibraryDetail> DetailList1 = new Hi.BLL.YZT_LibraryDetail().GetList("", strwhere, ""); DataTable dt2 = Common.FillDataTable(DetailList1); return(ConvertJson.ToJson(dt2)); } List <Hi.Model.YZT_GoodsStock> DetailList2 = new Hi.BLL.YZT_GoodsStock().GetList("", strwhere, ""); DataTable dt = Common.FillDataTable(DetailList2); return(ConvertJson.ToJson(dt)); }
public ActionResult GetList() { int pageIndex = WebUtil.GetFormValue <int>("pageIndex", 1); int pageSize = WebUtil.GetFormValue <int>("pageSize", 15); string LocalName = WebUtil.GetFormValue <string>("LocalName", string.Empty); string LocalType = WebUtil.GetFormValue <string>("LocalType", string.Empty); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; LocationProvider provider = new LocationProvider(); LocationEntity entity = new LocationEntity(); StorageEntity SEntity = new StorageEntity(); SEntity.Include(a => new { StorageName = a.StorageName }); entity.Left <StorageEntity>(SEntity, new Params <string, string>() { Item1 = "StorageNum", Item2 = "StorageNum" }); string StorageNum = this.DefaultStore; entity.Where <LocationEntity>("StorageNum", ECondition.Eth, StorageNum); if (!LocalName.IsEmpty()) { entity.Begin <LocationEntity>() .Where <LocationEntity>("LocalName", ECondition.Like, "%" + LocalName + "%") .Or <LocationEntity>("LocalNum", ECondition.Like, "%" + LocalName + "%") .Or <LocationEntity>("LocalBarCode", ECondition.Like, "%" + LocalName + "%") .End <LocationEntity>() ; } if (!LocalType.IsEmpty()) { entity.Where <LocationEntity>("LocalType", ECondition.Eth, LocalType); } List <LocationEntity> listResult = provider.GetList(entity, ref pageInfo); string json = ConvertJson.ListToJson <LocationEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", new JsonObject(json)); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return(Content(this.ReturnJson.ToString())); }
public ActionResult GetTreeSource() { string RoleNum = WebUtil.GetFormValue <string>("RoleNum", this.LoginUser.RoleNum); PowerProvider provider = new PowerProvider(); Params <List <SysResourceEntity>, List <SysResourceEntity>, List <SysResourceEntity> > param = provider.GetRole(RoleNum); List <SysResourceEntity> listAlloted = null; List <SysResourceEntity> listNotAlloted = null; List <SysResourceEntity> listSource = null; listSource = param.Item1; listAlloted = param.Item2; listNotAlloted = param.Item3; listSource = listSource.IsNull() ? new List <SysResourceEntity>() : listSource; listAlloted = listAlloted.IsNull() ? new List <SysResourceEntity>() : listAlloted; listNotAlloted = listNotAlloted.IsNull() ? new List <SysResourceEntity>() : listNotAlloted; this.ReturnJson.AddProperty("ListNotAlloted", ConvertJson.ListToJson <SysResourceEntity>(listNotAlloted)); this.ReturnJson.AddProperty("ListAlloted", ConvertJson.ListToJson <SysResourceEntity>(listAlloted)); return(Content(this.ReturnJson.ToString())); }
protected override string GetFormattedMessage(LogEventInfo logEvent) { var dictionary = Mapper.ToDictionary(logEvent); foreach (var property in Properties) { if (dictionary.ContainsKey(property.Name)) { dictionary.Add(PropertyNamePrefix + property.Name, property.Layout.Render(logEvent)); } else { dictionary.Add(property.Name, property.Layout.Render(logEvent)); } } var json = ConvertJson.Serialize(dictionary); return(json); }
public void AChangeToGlobalSetttingGivesDifferentOutput() { var existingDefaults = JsonConvert.DefaultSettings; try { JsonConvert.DefaultSettings = ADifferentJsonSerializerSettings; var data = MakeTestData(); var result = ConvertJson.Serialize(data); var dataAffectedBySetttings = JsonConvert.SerializeObject(data); Assert.That(result, Is.Not.EqualTo(dataAffectedBySetttings)); } finally { JsonConvert.DefaultSettings = existingDefaults; } }
public static string ForTable(DataTable Datas, string ParentKeyValue, string ParentKey, string ChildKey, string Json) { DataRow[] drs = Datas.Select(string.Format("{0}='{1}'", ParentKey, ParentKeyValue)); foreach (DataRow dr in drs) { if (Datas.Select(string.Format("{0}='{1}'", ParentKey, dr[ChildKey].ToString())).Length > 0) { Json += ConvertJson.ToParentJson(dr, Datas); string jsons = string.Empty; Json += ForTable(Datas, dr[ChildKey].ToString(), ParentKey, ChildKey, jsons); Json = Json.TrimEnd(','); Json += "]},"; } else { Json += ConvertJson.ToNoParentJson(dr, Datas); } } return(Json); }
//周计划统计数据 public ActionResult GetData(string year, string semester, int page, int limit, string search) { string anywhere = string.Empty; if (!string.IsNullOrEmpty(search)) { anywhere += "where u.ri_realname like '%" + search + "%' or u.ri_tel='" + search + "'"; } int[] sarr = GetMonthBySemester(semester); List <CalendarManag> list = _xwBll.GetList(anywhere); var query = from g in list group g by new { t1 = g.ri_realname } into companys select new { DeptNo = companys.Key.t1, StallInfo = companys }; List <CalendarManagView> vlist = new List <CalendarManagView>(); foreach (var userInfo in query.Take(limit * page).Skip(limit * (page - 1)).ToList()) { List <CalendarManag> list1 = userInfo.StallInfo.ToList(); List <CalendarManag> cmlist = new List <CalendarManag>(); CalendarManagView cmv = new CalendarManagView(); cmv.ri_id = list1[0].ri_id; cmv.ri_realname = list1[0].ri_realname; cmv.jw_content = list1[0].jw_content; for (int i = 0; i < sarr.Length; i++) { for (int j = 0; j < 4; j++) { cmlist.Add(GetCalendar(list1, sarr[i], j + 1, year, semester)); } } cmv.cmlist = cmlist; vlist.Add(cmv); } var data = JsonConvert.SerializeObject(vlist); string json = ConvertJson.ToJson("200", "", query.Count().ToString(), data); return(Content(json)); }
public async Task <IActionResult> InsertList() { List <VMLesson> lessonList = new List <VMLesson>() { new VMLesson() { Subject = "CO" }, new VMLesson() { Subject = "SE" }, }; apiSettings.Action = "addlist"; apiSettings.Id = 0; apiSettings.Obj = ConvertJson.Serialize(lessonList); await _apiHelper.PostRequest(apiPath, apiSettings); return(View()); }
/// <summary> /// 商品列表 /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <returns></returns> public string GetGoodsList(string id, string name) { string where = string.Empty; name = name.Replace("'", "''");//商品名称 if (name != "") { where += " and goodsname like '%" + name + "%'"; } string cateID = Common.CategoryId(Convert.ToInt32(id), this.CompID);//商品分类递归 List <Hi.Model.BD_Goods> l = new Hi.BLL.BD_Goods().GetList("", "isnull(dr,0)=0 and isenabled=1 and compid=" + this.CompID + " and categoryID in(" + cateID + ")" + where, ""); if (l.Count > 0) { DataTable dt2 = Common.FillDataTable <Hi.Model.BD_Goods>(l); if (dt2.Rows.Count != 0) { return(ConvertJson.ToJson(dt2)); } } return("[{}]"); }
/// <summary> /// 绑定 /// </summary> /// <param name="id"></param> public string Bind2(string id) { DataTable dt = new Hi.BLL.BD_Attribute().GetAttributrList(id, this.CompID.ToString());//获取属性以及属性值 if (dt.Rows.Count != 0) { return(ConvertJson.ToJson(dt)); } else { Hi.Model.BD_Attribute model = new Hi.BLL.BD_Attribute().GetModel(Convert.ToInt32(id)); List <Hi.Model.BD_Attribute> lsit = new List <Hi.Model.BD_Attribute>(); lsit.Add(model); DataTable dt2 = Common.FillDataTable <Hi.Model.BD_Attribute>(lsit); if (dt2.Rows.Count != 0) { return(ConvertJson.ToJson(dt2)); } return("[{}]"); } }