protected override TemplateListRD ProcessRequest(APIRequest <TemplateListRP> pRequest) { var rd = new TemplateListRD(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; T_CTW_LEventTemplateBLL bllTemplate = new T_CTW_LEventTemplateBLL(loggingSessionInfo); DataSet ds = bllTemplate.GetTemplateList(para.ActivityGroupCode); if (ds.Tables.Count > 0) { if (ds.Tables[0] != null && ds.Tables[0].Columns.Count > 0) { rd.BannerList = DataTableToObject.ConvertToList <BannerInfo>(ds.Tables[0]); } if (ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0) { rd.TemplateList = DataTableToObject.ConvertToList <TemplateInfo>(ds.Tables[1]); } if (ds.Tables[2] != null && ds.Tables[2].Rows.Count > 0) { rd.PlanList = DataTableToObject.ConvertToList <PlanInfo>(ds.Tables[2]); } if (ds.Tables[3] != null && ds.Tables[3].Rows.Count > 0) { rd.PlanImageUrl = ds.Tables[3].Rows[0]["PlanImageUrl"].ToString(); } } return(rd); }
public string GetEventList() { var responseData = new ResponseData(); var eventTypeId = FormatParamValue(Request("eventTypeId")); var title = Utils.GetIntVal(FormatParamValue(Request("title"))); var eventBeginTime = Utils.GetIntVal(FormatParamValue(Request("eventBeginTime"))); var eventEndTime = Utils.GetIntVal(FormatParamValue(Request("eventEndTime"))); var itemservice = new ItemService(this.CurrentUserInfo); var content = new GetLEventsListRespContentData(); try { var ds = itemservice.GetLEventsList(this.CurrentUserInfo.ClientID, eventTypeId.ToString(), title.ToString(), eventBeginTime.ToString(), eventEndTime.ToString()); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { content.newsList = DataTableToObject.ConvertToList <GetLEventsListEntity>(ds.Tables[0]); } responseData.success = true; responseData.data = content; return(responseData.ToJSON()); } catch (Exception ex) { responseData.success = false; responseData.msg = ex.ToString(); return(responseData.ToJSON()); } }
/// <summary> /// 获取优惠劵列表 /// </summary> /// <param name="pRequest"></param> /// <returns></returns> private string GetCouponList(string pRequest) { getCouponListRespData respData = new getCouponListRespData(); try { var reqObj = pRequest.DeserializeJSONTo <reqConunbondata>(); if (string.IsNullOrEmpty(reqObj.userId)) { respData.ResultCode = "103"; respData.Message = "登陆用户不能为空"; } var loggingSessionInfo = Default.GetBSLoggingSession(reqObj.customerId, "1"); CouponBLL bll = new CouponBLL(loggingSessionInfo); //DataSet ds = bll.GetCouponList(reqObj.userId, reqObj.Parameters.couponTypeID); DataSet ds = bll.GetCouponList(reqObj.userId, ""); if (ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { respData.couponList = DataTableToObject.ConvertToList <CouponEntity>(ds.Tables[0]); } } catch (Exception) { respData.ResultCode = "103"; respData.Message = "数据库操作失败"; } return(respData.ToJSON()); }
/// <summary> /// 获取第一级商品分类 /// </summary> public string GetLevel1ItemCategory() { var responseData = new ResponseData(); var categoryService = new ItemCategoryService(this.CurrentUserInfo); var content = new GetLevel1ItemCategoryRespContentData(); //商品类别集合 try { var ds = categoryService.GetLevel1ItemCategory(this.CurrentUserInfo.ClientID); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { content.categoryList = DataTableToObject.ConvertToList <GetLevel1ItemCategoryEntity>(ds.Tables[0]); } responseData.success = true; responseData.data = content; return(responseData.ToJSON()); } catch (Exception ex) { responseData.success = false; responseData.msg = ex.ToString(); return(responseData.ToJSON()); } }
public string GetRetailTraders(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <SellUserMainAchieveRP> >(); var pageSize = rp.Parameters.PageSize; var pageIndex = rp.Parameters.PageIndex; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var bll = new RetailTraderBLL(loggingSessionInfo); var rd = new GetRetailTradersBySellUserRD(); var rsp = new SuccessResponse <IAPIResponseData>(rd); //获取分销商的信息,loggingSessionInfo.ClientID var ds = bll.GetRetailTraders(rp.Parameters.RetailTraderName, rp.Parameters.RetailTraderAddress, rp.Parameters.RetailTraderMan, rp.Parameters.Status, rp.Parameters.CooperateType, rp.Parameters.UnitID, "", loggingSessionInfo.ClientID, loggingSessionInfo.UserID, pageIndex ?? 1, pageSize ?? 15, rp.Parameters.OrderBy, rp.Parameters.OrderType); //获取 //判断账号是否存在 if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { var tempDt = ds.Tables[1]; rd.RetailTraderList = DataTableToObject.ConvertToList <RetailTraderInfo>(tempDt);//直接根据所需要的字段反序列化 rd.TotalCount = Convert.ToInt32(ds.Tables[0].Rows[0]["TotalCount"]); rd.TotalPages = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(Convert.ToInt32(ds.Tables[0].Rows[0]["TotalCount"]) * 1.00 / (pageSize ?? 15) * 1.00))); } return(rsp.ToJSON()); }
/// <summary> /// 会员金矿主页 图 /// </summary> /// <param name="pRequest"></param> /// <returns></returns> protected override GetVipGoldHomeListRD ProcessRequest(APIRequest <GetVipGoldHomeListRP> pRequest) { var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; //登录状态信息 var rd = new GetVipGoldHomeListRD(); R_VipGoldHomeBLL vipgoldService = new R_VipGoldHomeBLL(loggingSessionInfo); //按照时间排序 查找最新一条记录 var ds = vipgoldService.GetReceiveRecodsByCustomerId(loggingSessionInfo.ClientID); if (ds != null && ds.Tables.Count > 0) { var result = DataTableToObject.ConvertToList <R_VipGoldHomeEntity>(ds.Tables[0]).FirstOrDefault(); if (result != null) { rd.OnlineFansCount = result.OnlineFansCount == null ? 0 : (int)result.OnlineFansCount; rd.OnlineOnlyFansCount = result.OnlineOnlyFansCount == null ? 0 : (int)result.OnlineOnlyFansCount; rd.OnlineVipCount = result.OnlineVipCount == null ? 0 : (int)result.OnlineVipCount; rd.VipCount = result.VipCount == null ? 0 : (int)result.VipCount; rd.OfflineVipCount = result.OfflineVipCount == null ? 0 : (int)result.OfflineVipCount; rd.OnlineVipCountFor30DayOrder = result.OnlineVipCountFor30DayOrder == null ? 0 : (int)result.OnlineVipCountFor30DayOrder; rd.OnlineVipCountPerFor30DayOrder = result.OnlineVipCountPerFor30DayOrder == null ? 0 : (decimal)result.OnlineVipCountPerFor30DayOrder; rd.OnlineVipCountFor30DayOrderM2M = result.OnlineVipCountFor30DayOrderM2M == null ? 0 : (decimal)result.OnlineVipCountFor30DayOrderM2M; rd.OnlineVipCountPerFor30DayOrderM2M = result.OnlineVipCountPerFor30DayOrderM2M == null ? 0 : (decimal)result.OnlineVipCountPerFor30DayOrderM2M; rd.OnlineVipSalesFor30Day = result.OnlineVipSalesFor30Day == null ? 0 : (decimal)result.OnlineVipSalesFor30Day; rd.OnlineVipSalesFor30DayM2M = result.OnlineVipSalesFor30DayM2M == null ? 0 : (decimal)result.OnlineVipSalesFor30DayM2M; rd.OnlineVipSalesPerFor30Day = result.OnlineVipSalesPerFor30Day == null ? 0 : (decimal)result.OnlineVipSalesPerFor30Day; rd.OnlineVipSalesPerFor30DayM2M = result.OnlineVipSalesPerFor30DayM2M == null ? 0 : (decimal)result.OnlineVipSalesPerFor30DayM2M; } } return(rd); }
public string GetTCTWPanicbuyingEventKV(string pRequest) { TCTWPanicbuyingEventKVRD rd = new TCTWPanicbuyingEventKVRD(); try { var rp = pRequest.DeserializeJSONTo <APIRequest <GetTCTWPanicbuyingEventKVRP> >(); //var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID); var bll = new PanicbuyingEventSkuMappingBLL(loggingSessionInfo); DataSet ds = bll.GetTCTWPanicbuyingEventKV(rp.Parameters.CTWEventId); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count != 0) { rd.TCTWPanicbuyingEventKVInfo = DataTableToObject.ConvertToObject <T_CTW_PanicbuyingEventKVEntity>(ds.Tables[0].Rows[0]); } var rsp = new SuccessResponse <IAPIResponseData>(rd); return(rsp.ToJSON()); } catch (Exception ex) { throw new APIException(ex.Message); } //return "{\"ResultCode\":0,\"Message\":\"OK\",\"Data\":{\"ItemList\":[{\"ItemID\":\"22\",\"ItemName\":\"美的\",\"ImageUrl\":\"http://www.o2omarketing.cn: 8400/Framework/Javascript/Other/kindeditor/attached/image/lzlj/album1.jpg\",\"SkuList\":[{\"kuID\":\"1111\",\"SkuName\":\"138L(银灰色)\",\"Qty\":\"250\",\"KeepQty\":\"200\",\"SoldQty\":\"30\",\"InverTory\":\"20\"}]}]}}"; }
public string GetVipCount15Days(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <GeneralRP> >(); var para = rp.Parameters; var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1"); var bll = new SysRetailRewardRuleBLL(loggingSessionInfo); var rd = new VipCountRD(); var rsp = new SuccessResponse <IAPIResponseData>(rd); rd.VipCountList = DataTableToObject.ConvertToList <VipCountInfo>(bll.GetRetailTraderVipCountByDays(rp.Parameters.RetailTraderId, 15).Tables[0]).ToArray(); var dsMain = bll.GetRetailTraderEarnings(para.RetailTraderId, "All", 0, 0); if (dsMain.Tables[0].Rows.Count > 0) { rd.Bonus = Convert.ToDecimal(dsMain.Tables[0].Rows[0]["Bonus"]); rd.SalesMoney = Convert.ToDecimal(dsMain.Tables[0].Rows[0]["SalesMoney"]); } var dsMonth = bll.GetRetailTraderEarnings(para.RetailTraderId, "Month", 0, 0); if (dsMonth.Tables[0].Rows.Count > 0) { rd.Bonus_Month = Convert.ToDecimal(dsMonth.Tables[0].Rows[0]["Bonus"]); rd.SalesMoney_Month = Convert.ToDecimal(dsMonth.Tables[0].Rows[0]["SalesMoney"]); } var dsDaily = bll.GetRetailTraderEarnings(para.RetailTraderId, "Daily", 0, 0); if (dsDaily.Tables[0].Rows.Count > 0) { rd.Bonus_Day = Convert.ToDecimal(dsDaily.Tables[0].Rows[0]["Bonus"]); rd.SalesMoney_Day = Convert.ToDecimal(dsDaily.Tables[0].Rows[0]["SalesMoney"]); } return(rsp.ToJSON()); }
public string GetMonthVipList(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <SellUserMainAchieveRP> >(); if (string.IsNullOrEmpty(rp.UserID)) { throw new APIException("缺少参数【UserID】或参数值为空") { ErrorCode = 135 }; } var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1"); var bll = new RetailTraderBLL(loggingSessionInfo); var rd = new GetMonthVipListRD(); var rsp = new SuccessResponse <IAPIResponseData>(rd); //获取分销商的信息,loggingSessionInfo.ClientID int year = DateTime.Now.Year; int month = DateTime.Now.Month; var ds = bll.GetMonthVipList(rp.UserID, loggingSessionInfo.ClientID, month, year); //获取 //判断账号是否存在 if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { var tempDt = ds.Tables[0]; rd.VipList = DataTableToObject.ConvertToList <VipInfo>(tempDt);//直接根据所需要的字段反序列化 } return(rsp.ToJSON()); }
/// <summary> /// 获取我的卡包 /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public string GetCardBag(string pRequest) { try { string cloudCustomerId = ConfigurationManager.AppSettings["CloudCustomerId"];//云店标识 var rp = pRequest.DeserializeJSONTo <APIRequest <EmptyRequestParameter> >(); var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID); var vipBll = new VipBLL(loggingSessionInfo); var vipInfo = vipBll.GetByID(rp.UserID); string userId = string.Empty; var rd = new CardBagRD(); if (vipInfo != null) { if (!string.IsNullOrEmpty(vipInfo.WeiXinUserId)) { DataSet dsVip = vipBll.GetCardBag(vipInfo.WeiXinUserId, cloudCustomerId); if (dsVip.Tables[0].Rows.Count > 0) { rd.CardBagList = DataTableToObject.ConvertToList <CardBag>(dsVip.Tables[0]); } } } var rsp = new SuccessResponse <IAPIResponseData>(rd); return(rsp.ToJSON()); } catch (Exception ex) { throw new APIException(ex.Message); } }
public string GetLNewsList() { var responseData = new ResponseData(); //请求参数 var newsTypeId = FormatParamValue(Request("newsTypeId")); var publishTimeFrom = Utils.GetIntVal(FormatParamValue(Request("publishTimeFrom"))); var publishTimeTo = Utils.GetIntVal(FormatParamValue(Request("publishTimeTo"))); var newsTitle = Utils.GetIntVal(FormatParamValue(Request("newsTitle"))); var itemservice = new ItemService(this.CurrentUserInfo); var content = new GetLNewsListRespContentData(); //咨询类别集合 try { var ds = itemservice.GetLNewsList(this.CurrentUserInfo.ClientID, newsTypeId.ToString(), publishTimeFrom.ToString(), publishTimeTo.ToString(), newsTitle.ToString()); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { content.newsList = DataTableToObject.ConvertToList <GetLNewsListEntity>(ds.Tables[0]); } responseData.success = true; responseData.data = content; return(responseData.ToJSON()); } catch (Exception ex) { responseData.success = false; responseData.msg = ex.ToString(); return(responseData.ToJSON()); } }
protected override GetEventPrizeListRD ProcessRequest(APIRequest <GetEventPrizeListRP> pRequest) { var rd = new GetEventPrizeListRD(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;//后台管理系统,从session里取数据 T_CTW_LEventBLL _T_CTW_LEventBLL = new JIT.CPOS.BS.BLL.T_CTW_LEventBLL(loggingSessionInfo); DataSet ds = _T_CTW_LEventBLL.GetEventPrizeList( pRequest.Parameters.CTWEventId, pRequest.Parameters.PageSize, pRequest.Parameters.PageIndex, CurrentUserInfo.ClientID); if (ds.Tables.Count > 0) { if (ds.Tables[0] != null && ds.Tables[0].Columns.Count > 0) { rd.TotalCount = Convert.ToInt32(ds.Tables[0].Rows[0]["TotalCount"]); int mod = rd.TotalCount % pRequest.Parameters.PageSize; rd.TotalPage = rd.TotalCount / pRequest.Parameters.PageSize + (mod > 0 ? 1 : 0); } if (ds.Tables[1] != null && ds.Tables[1].Columns.Count > 0) { rd.EventPrizeList = DataTableToObject.ConvertToList <EventPrizeInfo>(ds.Tables[1]); } } return(rd); }
public string GetRetailMonthRewardList(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <GetSellUserRewardListRP> >(); var pageSize = rp.Parameters.PageSize; var pageIndex = rp.Parameters.PageIndex; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var bll = new RetailTraderBLL(loggingSessionInfo); var rd = new GetRetailMonthRewardListRD(); var rsp = new SuccessResponse <IAPIResponseData>(rd); //获取分销商的信息,loggingSessionInfo.ClientID,必须要传customerID var ds = bll.GetRetailMonthRewardList(rp.Parameters.UnitID, rp.Parameters.SellerOrRetailName, rp.Parameters.Year, rp.Parameters.Month, loggingSessionInfo.ClientID, loggingSessionInfo.UserID, pageIndex ?? 1, pageSize ?? 15, rp.Parameters.OrderBy, rp.Parameters.OrderType); //获取 //判断账号是否存在 if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { var tempDt = ds.Tables[1]; rd.RetailMonthRewardList = DataTableToObject.ConvertToList <RetailMonthRewards>(tempDt);//直接根据所需要的字段反序列化 rd.TotalCount = ds.Tables[0].Rows.Count; rd.TotalPages = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(ds.Tables[0].Rows.Count * 1.00 / (pageSize ?? 15) * 1.00))); } return(rsp.ToJSON()); }
/// 内部消息 /// </summary> public string GetInnerGroupNewsList(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <GetInnerGroupNewsListRP> >();//不需要参数 string userId = rp.UserID; string customerId = rp.CustomerID; var pageSize = rp.Parameters.PageSize; var pageIndex = rp.Parameters.PageIndex; LoggingSessionInfo loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID); // var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; InnerGroupNewsBLL bll = new InnerGroupNewsBLL(loggingSessionInfo); var rd = new GetInnerGroupNewsListRD(); var ds = bll.GetInnerGroupNewsList(pageIndex ?? 1, pageSize ?? 15, rp.Parameters.OrderBy, rp.Parameters.OrderType, rp.UserID, loggingSessionInfo.ClientID, rp.Parameters.DeptID); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { rd.InnerGroupNewsList = DataTableToObject.ConvertToList <InnerGroupNewsInfo>(ds.Tables[1]);//直接根据所需要的字段反序列化 rd.TotalCount = ds.Tables[1].Rows.Count; rd.TotalPages = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(ds.Tables[0].Rows.Count * 1.00 / (pageSize ?? 15) * 1.00))); } var rsp = new SuccessResponse <IAPIResponseData>(rd); return(rsp.ToJSON()); }
private string GetUsers(string reqContent) { var rd = new APIResponse <UserInfoListRD>(); try { var rp = reqContent.DeserializeJSONTo <APIRequest <UserInfoListRP> >(); if (rp.Parameters != null) { rp.Parameters.Validate(); } var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID); T_UserBLL bll = new T_UserBLL(loggingSessionInfo); DataSet ds = bll.GetUserInfo(rp.CustomerID, rp.Parameters.Email, rp.Parameters.Phone, rp.Parameters.UserCode, rp.Parameters.UserName, rp.Parameters.PageIndex, rp.Parameters.PageSize); if (ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { var rdData = new UserInfoListRD(); rdData.UserInfo = DataTableToObject.ConvertToList <T_UserEntity>(ds.Tables[0]); rd.Data = rdData; rd.Message = "获取成功"; } else { rd.Message = "获取失败"; } } catch (Exception) { throw; } return(rd.ToJSON()); }
protected override GetSuperRetailTraderItemDetailRD ProcessRequest(APIRequest <GetSuperRetailTraderItemDetailRP> pRequest) { GetSuperRetailTraderItemDetailRP rp = pRequest.Parameters; GetSuperRetailTraderItemDetailRD rd = new GetSuperRetailTraderItemDetailRD(); OnlineShoppingItemBLL itemService = new OnlineShoppingItemBLL(CurrentUserInfo); var superRetailTraderItemMappingBll = new T_SuperRetailTraderItemMappingBLL(CurrentUserInfo); var superRetailTraderSkuMappingBll = new T_SuperRetailTraderSkuMappingBLL(CurrentUserInfo); var superRetailTraderConfigBll = new T_SuperRetailTraderConfigBLL(CurrentUserInfo); var customerBasicSettingBll = new CustomerBasicSettingBLL(CurrentUserInfo); //获取商品详细信息 var ItemDetail = superRetailTraderItemMappingBll.GetSuperRetailTraderItemDetail(rp.ItemId); //获取Sku详细信息 var skuList = superRetailTraderSkuMappingBll.GetSuperRetailTraderSkuDetail(rp.ItemId, pRequest.CustomerID); //获取分销商配置信息 T_SuperRetailTraderConfigEntity superRetailTraderConfigEntity = superRetailTraderConfigBll.QueryByEntity(new T_SuperRetailTraderConfigEntity() { CustomerId = CurrentUserInfo.ClientID }, null).FirstOrDefault(); #region 商品图片 var dsImages = itemService.GetItemImageList(rp.ItemId); if (dsImages != null && dsImages.Tables.Count > 0 && dsImages.Tables[0].Rows.Count > 0) { rd.ImageList = DataTableToObject.ConvertToList <ImageInfo>(dsImages.Tables[0]); } #endregion rd.ItemId = ItemDetail.ItemId; rd.ItemName = ItemDetail.ItemName; rd.Prop1 = ItemDetail.Prop1Name; rd.Prop2 = ItemDetail.Prop2Name; rd.Price = ItemDetail.Price; rd.DistributerPrice = Math.Round(Convert.ToDecimal(ItemDetail.DistributerCostPrice / Convert.ToDecimal(superRetailTraderConfigEntity.Cost / 100)), 2, MidpointRounding.AwayFromZero); //分销价格 成本价 / 成本占比 if (rd.Price == 0) //价格为零,折扣为10折 { rd.Discount = 1; } else { rd.Discount = Math.Round(rd.DistributerPrice / rd.Price, 2, MidpointRounding.AwayFromZero); //折扣 } rd.ItemIntroduce = ItemDetail.ItemIntroduce; rd.SkuList = skuList.Select(n => new APISkuInfo() { SkuID = n.SkuId, PropName1 = n.PropName1, PropName2 = n.PropName2, DistributerPrice = Math.Round(Convert.ToDecimal(n.DistributerCostPrice / Convert.ToDecimal(superRetailTraderConfigEntity.Cost / 100)), 2, MidpointRounding.AwayFromZero), //分销价格 成本价 / 成本占比 DistributerStock = Convert.ToInt32(n.DistributerStock) - Convert.ToInt32(n.SalesPrice), SoldQty = Convert.ToInt32(n.SalesQty) }).ToList(); rd.DeliveryDesc = customerBasicSettingBll.GetSettingValueByCode("DeliveryStrategy"); return(rd); }
public string GetDept(string pRequest) { var rd = new APIResponse <GetJobFuncRD>(); var rdData = new GetJobFuncRD(); var rp = pRequest.DeserializeJSONTo <APIRequest <GetJobFuncRP> >(); if (rp.Parameters == null) { throw new ArgumentException(); } if (rp.Parameters != null) { rp.Parameters.Validate(); } var loggingSessionInfo = new LoggingSessionManager().CurrentSession; try { JobFunctionBLL jobBll = new JobFunctionBLL(loggingSessionInfo); //IWhereCondition[] iwhere = { new EqualsCondition { DateTimeAccuracy = null, FieldName = "CustomerID", Value = rp.CustomerID } }; //if (!string.IsNullOrEmpty(rp.Parameters.JobFunctionID)) //{ // iwhere = new IWhereCondition[] // { // new EqualsCondition { DateTimeAccuracy = null, FieldName = "CustomerID", Value = rp.CustomerID }, // new EqualsCondition { DateTimeAccuracy = null, FieldName = "JobFunctionID", Value = rp.Parameters.JobFunctionID } // }; //} //PagedQueryResult<JobFunctionEntity> jobFunction = jobBll.PagedQuery(iwhere, new OrderBy[] { new OrderBy { FieldName = "Name", Direction = OrderByDirections.Asc } }, rp.Parameters.PageIndex, rp.Parameters.PageSize); int totalPage = 0; DataTable dTable = jobBll.GetJobFuncList(rp.Parameters.JobFunctionID, rp.Parameters.PageIndex, rp.Parameters.PageSize, rp.Parameters.Keyword, out totalPage); //排序 DataView dv = dTable.DefaultView; string sort = string.IsNullOrEmpty(rp.Parameters.sort) ? "Name asc" : rp.Parameters.sort; dv.Sort = sort; DataTable dt2 = dv.ToTable(); dTable = dt2; if (dTable != null) { rdData.JobFuncList = DataTableToObject.ConvertToList <JobFunctionEntity>(dTable); } rdData.TotalPage = totalPage; rd.Data = rdData; rd.ResultCode = 0; } catch (Exception ex) { rd.ResultCode = 103; rd.Message = ex.Message; } return(rd.ToJSON()); }
public string GetTestPaper(string pRequest) { var rd = new APIResponse <GetTestPaperRD>(); var rdData = new GetTestPaperRD(); var rp = pRequest.DeserializeJSONTo <APIRequest <GetTestPaperRP> >(); if (rp.Parameters == null) { throw new ArgumentException(); } if (rp.Parameters != null) { rp.Parameters.Validate(); } var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID); try { //获取考题 QuesQuestionsBLL queBll = new QuesQuestionsBLL(loggingSessionInfo); DataTable dTbl = queBll.GetQuesQuestions(rp.Parameters.SurveyTestId); List <QuesQuestionItem> quesList = new List <QuesQuestionItem>(); if (dTbl != null) { quesList = DataTableToObject.ConvertToList <QuesQuestionItem>(dTbl); } //循环获取考题选项 QuesOptionBLL quesOpBll = new QuesOptionBLL(loggingSessionInfo); List <QuesOptionItem> quesOptionList = new List <QuesOptionItem>(); DataTable dTblOption = null; foreach (var qItem in quesList) { quesOptionList = new List <QuesOptionItem>(); dTblOption = quesOpBll.GetQuesOptions(qItem.QuestionID); if (dTblOption != null && dTblOption.Rows.Count > 0) { quesOptionList = DataTableToObject.ConvertToList <QuesOptionItem>(dTblOption); } qItem.QuesOptionList = quesOptionList; } rdData.QuesQuestionList = quesList; rd.ResultCode = 0; } catch (Exception ex) { rd.ResultCode = 103; rd.Message = ex.Message; } rd.Data = rdData; return(rd.ToJSON()); }
/// <summary> /// 获取安装设备 /// </summary> /// <param name="pCustomerId"></param> /// <param name="pOrderNo"></param> /// <returns></returns> public List <InstallDeviceViewModel> GetInstallDevice(string pCustomerId, string pOrderNo) { var gldiibll = new GLDeviceInstallItemBLL(_loggingSessionInfo); DataSet dsDevice = gldiibll.GetDeviceInstallItemByOrderNo(pCustomerId, pOrderNo); if (dsDevice.Tables[0] != null && dsDevice.Tables.Count > 0 && dsDevice.Tables[0].Rows.Count > 0) { return(DataTableToObject.ConvertToList <InstallDeviceViewModel>(dsDevice.Tables[0])); } return(new List <InstallDeviceViewModel>()); }
public string GetCategoryTreeData() { string content = string.Empty; string strBat_id = ""; if (Request("BatId") != null && Request("BatId") != "") { strBat_id = Request("BatId"); } var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;//获取session数据 var itemService = new ItemService(loggingSessionInfo); T_Item_CategoryBLL bllCategory = new T_Item_CategoryBLL(loggingSessionInfo); var dsItem = itemService.GetItemTreeByCategoryType(strBat_id); var dsCategory = bllCategory.GetCategoryByCustomerId(loggingSessionInfo.ClientID, strBat_id); List <TreeNode> treeNode = new List <TreeNode>(); if (dsCategory != null && dsCategory.Tables.Count != 0) { treeNode = DataTableToObject.ConvertToList <TreeNode>(dsCategory.Tables[0]); } var ItemList = new List <TreeNode>(); if (dsItem != null && dsItem.Tables.Count != 0) { ItemList = DataTableToObject.ConvertToList <TreeNode>(dsItem.Tables[0]); } foreach (var node in treeNode) { foreach (var item in ItemList) { if (node.id == item.ParentId) { if (node.children == null) { node.children = new List <TreeNode>(); } node.children.Add(item); } } } var jsonData = new JsonData(); jsonData.totalCount = treeNode.Count.ToString(); jsonData.data = treeNode; content = jsonData.ToJSON(); return(content); }
public void SyncWelfareBrand() { var interfaceName = "syncwelFareBrand"; var loggingSessionInfo = BaseService.GetLoggingSession(); var brandService = new BrandDetailBLL(loggingSessionInfo); var dsBrands = new DataSet(); var brands = new BrandList(); brands.brandlist = new List <Brand>(); //更新接口同步表 var queryList = UpdateInterfaceTimestamp(interfaceName, loggingSessionInfo); if (queryList != null && queryList.Length > 0) { //存在,根据日期条件查询 dsBrands = brandService.GetSynWelfareBrandList(queryList.FirstOrDefault().LatestTime.ToString()); } else { //不存在,查询所有数据 dsBrands = brandService.GetSynWelfareBrandList(string.Empty); } if (dsBrands != null && dsBrands.Tables.Count > 0 && dsBrands.Tables[0].Rows.Count > 0) { brands.brandlist = DataTableToObject.ConvertToList <Brand>(dsBrands.Tables[0]); var content = brands.ToJSON(); //将描述字段Encode foreach (var item in brands.brandlist) { item.branddesc = HttpUtility.UrlEncode(item.branddesc, Encoding.UTF8); byte[] buff = Encoding.UTF8.GetBytes(item.branddesc); item.branddesc = Convert.ToBase64String(buff); } //上传数据 var result = UploadData(interfaceName, brands.ToJSON()); //写入接口日志 var logEntity = new ZInterfaceLogEntity() { LogId = Utils.NewGuid(), InterfaceName = interfaceName, Params = content, ResultCode = result.code, ResultDesc = result.description }; InsertInterfaceLog(logEntity, loggingSessionInfo); } }
protected override PrizeWinnerListRD ProcessRequest(DTO.Base.APIRequest <GetPrizeLocationListRP> pRequest) { var rd = new PrizeWinnerListRD();//返回值 LPrizeWinnerBLL bllWinner = new LPrizeWinnerBLL(this.CurrentUserInfo); DataTable dtWinner = bllWinner.GetTop10PizewWinnerListByEventId(pRequest.Parameters.EventID).Tables[0]; rd.WinnerList = DataTableToObject.ConvertToList <WinnerInfo>(dtWinner); rd.TotalCount = dtWinner.Rows.Count; return(rd); }
/// <summary> /// 获取部门全部直接子部门 /// </summary> /// <param name="pUnitID"></param> /// <returns></returns> public List <DepartmentInfo> GetDeptDirectSubDept(string pUnitID) { List <DepartmentInfo> listDepartment = new List <DepartmentInfo>(); TUnitBLL unitBll = new TUnitBLL(_loggingSessionInfo); DataTable dTbl = unitBll.GetDirectSubDept(pUnitID); if (dTbl != null) { listDepartment = DataTableToObject.ConvertToList <DepartmentInfo>(dTbl); } return(listDepartment); }
public string GetRewardsDayRiseList(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <SellUserMainAchieveRP> >(); if (string.IsNullOrEmpty(rp.Parameters.UserOrRetailID)) { throw new APIException("缺少参数【UserOrRetailID】或参数值为空") { ErrorCode = 135 }; } var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1"); var bll = new RetailTraderBLL(loggingSessionInfo); var rd = new MonthDayRewardsRD(); var rsp = new SuccessResponse <IAPIResponseData>(rd); //获取分销商的信息,loggingSessionInfo.ClientID // int month = DateTime.Now.Month; //int year = DateTime.Now.Year;//目前只取今年的 //int month = DateTime.Now.Month;//目前只取今年的 DateTime nowDay = Convert.ToDateTime(DateTime.Now.ToShortDateString()); // var ds = bll.GetRewardsDayRiseList(rp.Parameters.UserOrRetailID, loggingSessionInfo.ClientID, nowDay.AddDays(-14), nowDay.AddDays(1).AddSeconds(-1)); //获取今天和前面14天的数据 var VipRiseList = new List <RewardsDayRiseTrand>(); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { var tempDt = ds.Tables[0]; VipRiseList = DataTableToObject.ConvertToList <RewardsDayRiseTrand>(tempDt);//直接根据所需要的字段反序列化 } int currentDay = DateTime.Now.Day; //判断账号是否存在 rd.MonthRewardList = new List <RewardsDayRiseTrand>(); for (DateTime i = nowDay.AddDays(-14); i <= nowDay; i = i.AddDays(1)) { RewardsDayRiseTrand temp = VipRiseList.Where(p => p.formatDate == i.ToString("yyyy-MM-dd")).SingleOrDefault();//直接根据所需要的字段反序列化 if (temp == null) { temp = new RewardsDayRiseTrand(); temp.Year = i.Year; temp.Month = i.Month; temp.Day = i.Day; temp.formatDate = temp.Year + "-" + temp.Month + "-" + temp.Day; temp.DayAmount = 0; temp.DayVipAmount = 0; temp.DayTradeAmount = 0; } temp.myDate = temp.Month + "/" + temp.Day; rd.MonthRewardList.Add(temp); } return(rsp.ToJSON()); }
/// <summary> /// 考卷列表 /// </summary> /// <param name="pType"></param> /// <param name="pPageIndex"></param> /// <param name="pPageSize"></param> /// <returns></returns> public List <SurveyTestItem> GetQuestionnaires(string pType, int pPageIndex, int pPageSize) { List <SurveyTestItem> list = new List <SurveyTestItem>(); QuestionnaireBLL quesBll = new QuestionnaireBLL(_loggingSessionInfo); DataTable dTbl = quesBll.GetQuestionnaire(pType, pPageIndex, pPageSize); if (dTbl != null) { list = DataTableToObject.ConvertToList <SurveyTestItem>(dTbl); } return(list); }
/// <summary> /// 获取用户考卷答题列表 /// </summary> /// <param name="pSurveyTestId"></param> /// <param name="pUserId"></param> /// <returns></returns> public List <AnswerResultItem> GetAnswerSheetItem(string pAnswerSheetId, string pUserId) { List <AnswerResultItem> answerList = new List <AnswerResultItem>(); MLAnswerSheetItemBLL answerBll = new MLAnswerSheetItemBLL(_loggingSessionInfo); DataTable dTbl = answerBll.GetAnswerSheetItem(pAnswerSheetId, pUserId); if (dTbl != null) { answerList = DataTableToObject.ConvertToList <AnswerResultItem>(dTbl); } return(answerList); }
/// <summary> /// 获取部门直接个人成员 /// </summary> /// <param name="pUnitID"></param> /// <returns></returns> public List <PersonListItemInfo> GetDirectPersMembers(string pUnitID) { List <PersonListItemInfo> listPersMembers = new List <PersonListItemInfo>(); UserDeptJobMappingBLL mappingBll = new UserDeptJobMappingBLL(_loggingSessionInfo); DataTable dTbl = mappingBll.GetDirectPersMembers(pUnitID); if (dTbl != null) { listPersMembers = DataTableToObject.ConvertToList <PersonListItemInfo>(dTbl); } return(listPersMembers); }
public string MonthRewards(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <SellUserMainAchieveRP> >(); if (string.IsNullOrEmpty(rp.Parameters.UserOrRetailID)) { throw new APIException("缺少参数【UserOrRetailID】或参数值为空") { ErrorCode = 135 }; } var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1"); var bll = new RetailTraderBLL(loggingSessionInfo); var rd = new MonthRewardsRD(); var rsp = new SuccessResponse <IAPIResponseData>(rd); //获取分销商的信息,loggingSessionInfo.ClientID // int month = DateTime.Now.Month; int year = DateTime.Now.Year; //目前只取今年的 int month = DateTime.Now.Month; //目前只取今年的 var ds = bll.MonthRewards(rp.Parameters.UserOrRetailID, loggingSessionInfo.ClientID, year); //获取 var VipRiseList = new List <MonthRewardInfo>(); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { var tempDt = ds.Tables[0]; VipRiseList = DataTableToObject.ConvertToList <MonthRewardInfo>(tempDt);//直接根据所需要的字段反序列化 } int currentMonth = DateTime.Now.Month; //判断账号是否存在 rd.MonthRewardList = new List <MonthRewardInfo>(); for (int i = 1; i <= currentMonth; i++) { MonthRewardInfo temp = VipRiseList.Where(p => p.Month == i).SingleOrDefault();//直接根据所需要的字段反序列化 if (temp == null) { temp = new MonthRewardInfo(); temp.Year = year; temp.Month = i; temp.MonthAmount = 0; temp.MonthVipAmount = 0; temp.MonthTradeAmount = 0; } rd.MonthRewardList.Add(temp); } rd.MonthRewardList.Reverse();//顺序反转 return(rsp.ToJSON()); }
protected override ThemeListRD ProcessRequest(APIRequest <EmptyRequestParameter> pRequest) { var rd = new ThemeListRD(); var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; T_CTW_LEventThemeBLL bllTheme = new T_CTW_LEventThemeBLL(loggingSessionInfo); DataSet ds = bllTheme.GetInSeasonThemeList(); if (ds != null && ds.Tables.Count > 0) { rd.ThemeList = DataTableToObject.ConvertToList <T_CTW_LEventThemeEntity>(ds.Tables[0]).OrderBy(a => a.StartDate).ToList(); } return(rd); }
/// <summary> /// 商品列表带分润价格 /// </summary> /// <param name="pRequest"></param> /// <returns></returns> public string GetItemList(string pRequest) { var rp = pRequest.DeserializeJSONTo <APIRequest <GetItemListRP> >(); var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, "1"); var bll = new SysRetailRewardRuleBLL(loggingSessionInfo); var rd = new GetItemListRD(); var rsp = new SuccessResponse <IAPIResponseData>(rd); rd.ItemList = DataTableToObject.ConvertToList <ItemInfo>(bll.GetItemListWithSharePrice(rp.CustomerID, rp.Parameters.RetailTraderID, rp.Parameters.PageIndex, rp.Parameters.PageSize, rp.Parameters.Sort, rp.Parameters.SortName).Tables[0]).ToArray(); return(rsp.ToJSON()); }