public async Task <dynamic> GetResult(string monthEnding) { var now = StringUtil.GetMonthEnding(monthEnding); var agencyQuery = new AgencyQuery(_connectionString); var agencyData = await agencyQuery.GetAggregationsAsync(); var briefResponseQuery = new BriefResponseQuery(now, _connectionString); var briefResponseData = await briefResponseQuery.GetAggregationsAsync(); var briefQuery = new BriefQuery(now, _connectionString); var briefData = await briefQuery.GetAggregationsAsync(); var austenderQuery = new AustenderQuery(now, _connectionString); var austenderData = await austenderQuery.GetAggregationsAsync(); var supplierQuery = new SupplierQuery(now, _connectionString); var supplierData = await supplierQuery.GetAggregationsAsync(); return(new { agencyData, austenderData, briefResponseData, briefData, supplierData, thisMonth = now.ToString("MMMM yyyy") }); }
public IList <SupplierExportModel> GetSupplierExportData(SupplierQuery query) { IList <SupplierExportModel> result = new List <SupplierExportModel>(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(" 1=1 "); if (!string.IsNullOrEmpty(query.UserName)) { stringBuilder.AppendFormat(" And UserName LIKE '%{0}%'", DataHelper.CleanSearchString(query.UserName)); } if (!string.IsNullOrEmpty(query.SupplierName)) { stringBuilder.AppendFormat(" And SupplierName LIKE '%{0}%'", DataHelper.CleanSearchString(query.SupplierName)); } if (query.Status > 0) { stringBuilder.AppendFormat(" And SupplierStatus = {0}", query.Status); } string query2 = "SELECT UserName,SupplierName,ContactMan,ProductNums,Tel,SupplierStatus AS Status,OrderNums,Address,RegionId,SupplierId FROM vw_SupplierAdmin WHERE " + stringBuilder.ToString() + "ORDER BY ManagerId DESC"; DbCommand sqlStringCommand = base.database.GetSqlStringCommand(query2); using (IDataReader objReader = base.database.ExecuteReader(sqlStringCommand)) { result = DataHelper.ReaderToList <SupplierExportModel>(objReader); } return(result); }
public ActionResult List(SupplierQuery query) { var list = this.SupplierRepository.GetList(query); var data = list.Data.Select(c => SupplierModel.From(c)).ToList(); var result = new { total = list.RecordCount, rows = data }; return(Json(result)); }
public void GetList(HttpContext context) { SupplierQuery dataQuery = this.GetDataQuery(context); DataGridViewModel <Dictionary <string, object> > dataList = this.GetDataList(dataQuery); string s = base.SerializeObjectToJson(dataList); context.Response.Write(s); context.Response.End(); }
private SupplierQuery GetDataQuery(HttpContext context) { SupplierQuery supplierQuery = new SupplierQuery(); supplierQuery.UserName = base.GetParameter(context, "UserName", true); supplierQuery.SupplierName = base.GetParameter(context, "SupplierName", true); supplierQuery.Status = base.GetIntParam(context, "Status", true); supplierQuery.PageIndex = base.CurrentPageIndex; supplierQuery.PageSize = base.CurrentPageSize; return(supplierQuery); }
private DataGridViewModel <Dictionary <string, object> > GetDataList(SupplierQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { DbQueryResult supplierManagers = SupplierHelper.GetSupplierManagers(query); dataGridViewModel.rows = DataHelper.DataTableToDictionary(supplierManagers.Data); dataGridViewModel.total = supplierManagers.TotalRecords; } return(dataGridViewModel); }
public async Task <ActionResult <SupplierResource> > GetSupplier( Guid supplierIdentity, [FromServices] SupplierQuery supplierQuery) { SupplierResource supplier = await supplierQuery .GetSupplierAsync(supplierIdentity); if (supplier is null) { return(NotFound()); } return(supplier); }
public IActionResult SupplierSave([FromBody] Supplier model) { SupplierQuery _lQuery = new SupplierQuery(); if (model != null) { _lQuery.SupplierAdd(model); return(Ok()); } else { return(BadRequest()); } }
public IActionResult GetSupplierCombo() { SupplierQuery _lQuery = new SupplierQuery(); var list = _lQuery.GetCombo(); if (list != null) { return(Ok(list)); } else { return(BadRequest()); } }
public async Task <ActionResult <ContainerResource> > GetLoadedContainer( Guid supplierIdentity, Guid containerIdentity, [FromServices] SupplierQuery supplierQuery) { ContainerResource container = await supplierQuery .GetLoadedContainerAsync(supplierIdentity, containerIdentity); if (container is null) { return(NotFound()); } return(container); }
public async Task <ActionResult <List <ContainerResource> > > GetLoadedContainers( Guid supplierIdentity, [FromQuery] ContainerParams queryParams, [FromServices] SupplierQuery supplierQuery) { List <ContainerResource> containers = await supplierQuery .GetLoadedContainersAsync(supplierIdentity, queryParams); if (containers is null) { return(NotFound()); } return(containers); }
public IActionResult SupplierUpdate(int id, [FromBody] Supplier model) { SupplierQuery _lQuery = new SupplierQuery(); if (model != null) { string message = _lQuery.SupplierUpdate(model); //if(message=="Success") return(Ok()); } else { return(BadRequest()); } }
public IActionResult SupplierDelete(int id) { SupplierQuery _lQuery = new SupplierQuery(); if (id != null) { string message = _lQuery.SupplierDelete(id); //if(message=="Success") return(Ok()); } else { return(BadRequest()); } }
public async Task <ActionResult <List <CargoResource> > > GetCargosOfLoadedContainer( Guid supplierIdentity, Guid containerIdentity, [FromQuery] CargoParams queryParams, [FromServices] SupplierQuery supplierQuery) { List <CargoResource> cargos = await supplierQuery .GetCargosOfLoadedContainerAsync(supplierIdentity, containerIdentity, queryParams); if (cargos is null) { return(NotFound()); } return(cargos); }
protected override void AttachChildControls() { PageTitle.AddSiteNameTitle("店铺列表"); this.txtTotal = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtTotal"); this.rptSupplierList = (VshopTemplatedRepeater)this.FindControl("rptSupplierList"); this.rpthistorysearch = (VshopTemplatedRepeater)this.FindControl("rpthistorysearch"); int pageIndex; if (!int.TryParse(this.Page.Request.QueryString["page"], out pageIndex)) { pageIndex = 1; } int pageSize; if (!int.TryParse(this.Page.Request.QueryString["size"], out pageSize)) { pageSize = 10; } string supplierName = this.Page.Request.QueryString["keyWord"]; SupplierQuery query = new SupplierQuery(); query.SupplierName = supplierName; query.PageIndex = pageIndex; query.PageSize = pageSize; query.UserId = HiContext.Current.User.UserId; DbQueryResult dt = SupplierHelper.GetAppSupplier(query); this.rptSupplierList.DataSource = dt.Data; this.rptSupplierList.DataBind(); this.txtTotal.SetWhenIsNotNull(dt.TotalRecords.ToString()); int userId = HiContext.Current.User.UserId; if (userId > 0 && this.rpthistorysearch != null) { this.rpthistorysearch.DataSource = HistorySearchHelp.GetSearchHistory(userId, ClientType.VShop, 6); this.rpthistorysearch.DataBind(); } }
public DbQueryResult GetSupplierAdmin(SupplierQuery query) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(" 1=1 "); if (!string.IsNullOrEmpty(query.UserName)) { stringBuilder.AppendFormat(" And UserName LIKE '%{0}%'", DataHelper.CleanSearchString(query.UserName)); } if (!string.IsNullOrEmpty(query.SupplierName)) { stringBuilder.AppendFormat(" And SupplierName LIKE '%{0}%'", DataHelper.CleanSearchString(query.SupplierName)); } if (query.Status > 0) { stringBuilder.AppendFormat(" And SupplierStatus = {0}", query.Status); } return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_SupplierAdmin", "ManagerId", stringBuilder.ToString(), "*")); }
public DbQueryResult GetWMSSupplier(SupplierQuery query) { StringBuilder strtable = new StringBuilder(); strtable.Append("( SELECT SupplierId,SupplierName,Phone,Mobile,Province,City,County,[Address],[Status],[Description],CreateUser,CreateDate,ApproveKey,SupplierCode,ShipWarehouseName,ShopOwner,Logo,PCImage,MobileImage,ShopName,CAST(DataVersion as bigint) AS DataVersion FROM Ecshop_Supplier ) as strtable"); StringBuilder stringBuilder = new StringBuilder(); // if (query.DateContrastType.HasValue) { if (query.DateContrastType.Value == 1) { if (query.DateContrastValue.HasValue) { stringBuilder.AppendFormat(" CreateDate BETWEEN DATEADD(hour,-{0},GETDATE()) AND GETDATE() ", query.DateContrastValue.Value); } } else if (query.DateContrastType.Value == 2) { if (query.DateContrastValue.HasValue) { stringBuilder.AppendFormat(" CreateDate BETWEEN DATEADD(day,-{0},GETDATE()) AND GETDATE() ", query.DateContrastValue.Value); } } else if (query.DateContrastType.Value == 2) { if (query.DateContrastValue.HasValue) { stringBuilder.AppendFormat(" CreateDate BETWEEN DATEADD(month,-{0},GETDATE()) AND GETDATE() ", query.DateContrastValue.Value); } } } // if (query.DataVersion != "") { stringBuilder.AppendFormat(" DataVersion > cast({0} as timestamp) ", query.DataVersion); } return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, strtable.ToString(), "SupplierId", stringBuilder.ToString(), "*")); }
public void ExportToExcel(HttpContext context) { SupplierQuery dataQuery = this.GetDataQuery(context); IList <SupplierExportModel> supplierExportData = SupplierHelper.GetSupplierExportData(dataQuery); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<table border='1'>"); stringBuilder.Append("<thead><tr>"); stringBuilder.Append("<th>用户名</th>"); stringBuilder.Append("<th>供应商名称</th>"); stringBuilder.Append("<th>联系人</th>"); stringBuilder.Append("<th>联系电话</th>"); stringBuilder.Append("<th>上架商品数</th>"); stringBuilder.Append("<th>订单数</th>"); stringBuilder.Append("<th>状态</th>"); stringBuilder.Append("<th>详细地址</th>"); stringBuilder.Append("</tr></thead>"); StringBuilder stringBuilder2 = new StringBuilder(); foreach (SupplierExportModel item in supplierExportData) { stringBuilder2.Append("<tr>"); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.UserName, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.SupplierName, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.ContactMan, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.Tel, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.ProductNums, false)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.OrderNums, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(item.StatusText, true)); stringBuilder2.Append(ExcelHelper.GetXLSFieldsTD(RegionHelper.GetFullRegion(item.RegionId, " ", true, 0) + " " + item.Address, true)); stringBuilder2.Append("</tr>"); } stringBuilder.AppendFormat("<tbody>{0}</tbody></table>", stringBuilder2.ToString()); StringWriter stringWriter = new StringWriter(); stringWriter.Write(stringBuilder); DownloadHelper.DownloadFile(context.Response, stringWriter.GetStringBuilder(), "SupplierList" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls"); stringWriter.Close(); context.Response.End(); }
public static async Task Run( [TimerTrigger("0 5 20 * * *")] TimerInfo timer, ILogger log, ExecutionContext context) { var config = new ConfigurationBuilder() .SetBasePath(context.FunctionAppDirectory) .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); var connectionString = config.GetConnectionString("DevProcurementConnectionString"); var dmApiUrl = Environment.GetEnvironmentVariable("dmApiUrl"); var dmApiKey = Environment.GetEnvironmentVariable("dmApiKey"); using (var dmClient = new HttpClient()) { dmClient.DefaultRequestHeaders.Add("X-Api-Key", dmApiKey); var response = await dmClient.GetStringAsync($"{dmApiUrl}/reports/supplier/all"); var supplierQuery = new SupplierQuery(DateTime.Now, connectionString); log.LogInformation($"rows updated: {await supplierQuery.UpdateImpMarketplaceSupplier(response)}"); } }
public DbQueryResult GetAppSupplier(SupplierQuery query) { StringBuilder strtable = new StringBuilder(); strtable.Append("("); strtable.Append("select A.*,"); strtable.Append("(select count(C1.Id) from Ecshop_SupplierCollect C1 where C1.SupplierId=A.SupplierId) as CollectCount,"); strtable.AppendFormat("case when (select count(C2.SupplierId) from Ecshop_SupplierCollect C2 where C2.SupplierId=A.SupplierId and C2.Userid={0})>0 then 1 else 0 end as IsCollect", query.UserId); strtable.Append(" from Ecshop_Supplier A inner join Ecshop_SupplierConfig B on B.SupplierId=A.SupplierId where B.Client=3"); strtable.Append(") as strtable "); StringBuilder stringBuilder = new StringBuilder(); if (!string.IsNullOrWhiteSpace(query.SupplierName)) { stringBuilder.AppendFormat(" ShopName LIKE '%{0}%'", DataHelper.CleanSearchString(query.SupplierName)); } return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, strtable.ToString(), "SupplierId", stringBuilder.ToString(), "*")); }
public static IList <SupplierExportModel> GetSupplierExportData(SupplierQuery query) { return(new SupplierDao().GetSupplierExportData(query)); }
public static DbQueryResult GetSupplier(SupplierQuery query) { return(new SupplierDao().GetSupplier(query)); }
public DbQueryResult GetSupplier(SupplierQuery query) { return(DataHelper.PagingByTopsort(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "Ecshop_Supplier", "SupplierId", string.IsNullOrEmpty(query.SupplierName) ? string.Empty : string.Format("SupplierName LIKE '%{0}%'", DataHelper.CleanSearchString(query.SupplierName)), "*")); }
public async Task <List <SupplierResource> > GetSuppliers( [FromQuery] SupplierParams queryParams, [FromServices] SupplierQuery supplierQuery) => await supplierQuery.GetSuppliersAsync(queryParams);
private void SendSupplierData() { ErrorLog.Write("执行了SupplierJobs -> SendSupplierData"); try { string setdate = this.GetOrderSendCoupontime(); SupplierQuery query = new SupplierQuery(); query.PageIndex = pageIndex; query.PageSize = 100; query.DateContrastType = dateContrastType; query.DateContrastValue = dateContrastValue; query.DataVersion = setdate; query.SortBy = "DataVersion"; ErrorLog.Write("执行了SupplierJobs -> GetWMSSupplier"); DataTable dt = (DataTable)SupplierHelper.GetWMSSupplier(query).Data; ErrorLog.Write("执行了SupplierJobs -> GetWMSSupplier 查询完成"); if (dt != null && dt.Rows.Count > 0) { ErrorLog.Write("执行了SupplierJobs -> GetWMSSupplier 查询结果:" + dt.Rows.Count); pageIndex++; flag = true; string skuData = CreateSupplierData(dt); //WMS 无法正常接收部分字符 skuData = skuData.Replace("\n", "").Replace("\t", "").Replace("\r", "").Replace("+", "+"); string tempdata = appSecret + skuData + appSecret; string md5tempdata = WMSHelper.MD5(tempdata); string basetempdata = WMSHelper.EncodingString(md5tempdata.ToLower(), System.Text.Encoding.UTF8); sign = System.Web.HttpUtility.UrlEncode(basetempdata.ToUpper(), System.Text.Encoding.UTF8); // timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//YYYY-MM-DD HH:MM:SS string postData = "method=putCustData&client_customerid=" + customerid + "&client_db=" + client_db + "&messageid=CUSTOMER&apptoken=" + apptoken + "&appkey=" + appkey + "&sign=" + sign + "×tamp=" + timestamp; //.NET和java UrlEncode处理机制不一样,加号"+"在java里面会被替换成空格,需要转换2次 skuData = System.Web.HttpUtility.UrlEncode(skuData); //skuData = System.Web.HttpUtility.UrlEncode(skuData); //文本日志 ErrorLogs("url=" + url + ";postData=" + postData + "&data=" + tempdata); //数据库日志 WMSHelper.SaveLog("putCustData", tempdata, "调用方法", "info", "out"); string sendResult = WMSHelper.PostData(url, postData + "&data=" + skuData); string tempResult = System.Web.HttpUtility.UrlDecode(sendResult); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(tempResult); XmlNode node = xmlDocument.SelectSingleNode("Response/return/returnCode"); if (node.InnerText != "0000") { ErrorLogs("调用WMS推送商家失败:" + tempResult + "\n"); WMSHelper.SaveLog("putCustData", "", "返回结果:" + tempResult, "error", "in"); SmsHelper.QueueSMS(mobiles, "系统在" + DateTime.Now.ToString("yyyy年MM月HH点mm分ss秒") + "调用WMS推送商家(putCustData)接口失败,详情请查询推送日志", 3); } else { //更新最后一个推送WMS客户档案时间戳 this.UpdateOrderSendCoupontime(dt.Rows[dt.Rows.Count - 1]["DataVersion"].ToString()); } } else { flag = false; } } catch (Exception ex) { ErrorLogs("出现异常:" + ex.Message); SmsHelper.QueueSMS(mobiles, "系统在" + DateTime.Now.ToString("yyyy年MM月HH点mm分ss秒") + "调用WMS推送商家(putCustData)接口发生异常,详情请查询推送日志", 3); } if (flag) { SendSupplierData(); } }
public static DbQueryResult GetSupplierManagers(SupplierQuery query) { return(new SupplierDao().GetSupplierAdmin(query)); }
public IHttpActionResult GetSupplierList(string userId, string accessToken, int channel, int platform, string ver, int pageIndex, int pageSize, string supplierName) { Logger.WriterLogger("Supplier.GetSupplierList, Params: " + string.Format("userId={0}&accessToken={1}&channel={2}&platform={3}&ver={4}&pageIndex={5}&pageSize={6}&supplierName={7}", userId, accessToken, channel, platform, ver, pageIndex, pageSize, supplierName), LoggerType.Info); // 保存访问信息 base.SaveVisitInfo(userId, channel, platform, ver); // 验证令牌 int accessTookenCode = VerifyAccessToken(accessToken); if (accessTookenCode > 0) { return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), "Supplier.GetRecommendSupplier")); } Member member = GetMember(userId.ToSeesionId()); int referUserId; if (member != null) { referUserId = member.UserId; } else { referUserId = 0; } List <SupplierListItem> items = new List <SupplierListItem>(); SupplierQuery query = new SupplierQuery(); query.UserId = referUserId; query.SupplierName = supplierName; query.PageIndex = pageIndex; query.PageSize = pageSize; DbQueryResult dr = SupplierHelper.GetAppSupplier(query); DataTable dt = dr.Data as DataTable; if (dt != null) { SupplierListItem item = null; foreach (DataRow current in dt.Rows) { item = new SupplierListItem(); if (current["SupplierId"] != DBNull.Value) { item.SupplierId = (int)current["SupplierId"]; } if (current["ShopName"] != DBNull.Value) { item.SupplierName = (string)current["ShopName"]; } if (current["ShopOwner"] != DBNull.Value) { item.ShopOwner = (string)current["ShopOwner"]; } item.CreateDate = ""; if (current["CreateDate"] != DBNull.Value) { item.CreateDate = ((DateTime)current["CreateDate"]).ToString("yyyy-MM-dd HH:mm:ss"); } if (current["County"] != DBNull.Value) { int countyId = (int)current["County"]; if (countyId > 0) { item.Location = RegionHelper.GetFullRegion(countyId, ",").Split(',')[0]; } } if (current["Logo"] != DBNull.Value) { item.Image = Util.AppendImageHost((string)current["Logo"]); } if (current["MobileImage"] != DBNull.Value) { item.Background = Util.AppendImageHost((string)current["MobileImage"]); } if (current["CollectCount"] != DBNull.Value) { item.CollectCount = (int)current["CollectCount"]; } if (current["IsCollect"] != DBNull.Value) { item.IsCollect = (int)current["IsCollect"]; } items.Add(item); } } ListResult <SupplierListItem> data = new ListResult <SupplierListItem>(); data.TotalNumOfRecords = dr.TotalRecords; data.Results = items; return(base.JsonActionResult(new StandardResult <ListResult <SupplierListItem> >() { code = 0, msg = "商家列表", data = data })); }