private void GetLoginOn(HttpContext context) { UsersBLL bll = new UsersBLL(); ReturnModel ReturnModel = new ReturnModel(); //int IsManager = 0; int result = 0; try { string LoginName = context.Request.Params["LoginName"]; string Password = context.Request.Params["Password"]; string CardID = context.Request.Params["CardID"]; //string IsRemember = context.Request.Params["IsRemember"]; if (!string.IsNullOrEmpty(LoginName) && !string.IsNullOrEmpty(Password) && !string.IsNullOrEmpty(CardID)) { Users users = new Users(); string PwdKey = LinkFun.getPwdKey(); Password = DESEncrypt.Encrypt(PwdKey, Password);//旧密码加密 ReturnModel = bll.VerificationPassword(LoginName, Password, CardID); if (ReturnModel.IsSuccess) { int UserID = (int)ReturnModel.Data; result = UserID; MerchantFrontCookieBLL.SetMerchantFrontCookie(UserID, LoginName); #region 改造前端登录方法存储到缓存 UsersBLL bllUsers = new UsersBLL(); Users model = bllUsers.GetModel(UserID); if (model != null) { string key = ComPage.memberModelCacheDependency + model.UserID; ComPage.SetBWJSCache(key, Guid.NewGuid(), null, DateTime.Now.AddMinutes(ComPage.SafeToDouble(LinkFun.ConfigString("FrontEndCookieExpires", "120"))), TimeSpan.Zero); HttpCookie cookie = new HttpCookie(LinkFun.ConfigString("FrontEndCookieName", "BWJSFrontEnd20180108")); cookie.Expires = DateTime.Now.AddMinutes(ComPage.SafeToDouble(LinkFun.ConfigString("FrontEndCookieExpires", "120"))); cookie.Values.Add("Id", HttpContext.Current.Server.UrlEncode(model.UserID.ToString())); System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8"); System.Web.HttpContext.Current.Response.AppendCookie(cookie); model.LastAccessIP = HttpContext.Current.Request.UserHostAddress; model.LoginTimes = ComPage.SafeToInt(model.LoginTimes) + 1; model.RecordUpdateTime = DateTime.Now; model.IsLogined = 1; bllUsers.Update(model); } #endregion } } context.Response.Write(ObjectToJson(ReturnModel)); } catch (Exception ex) { context.Response.Write(ex); } }
/// <summary> /// 获取结算申请列表 /// </summary> static public Object GetSettlementList() { string result = string.Empty; try { string sEcho = JsonRequest.GetJsonKeyVal(jsonText, "sEcho"); int displayStart = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart")); int displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength")); int pageIndex = (displayStart / displayLength) + 1; int pageSize = displayLength; StringBuilder where = new StringBuilder(); where.Append("a.IsDeleted=0 "); #region 权限 if (ComPage.CurrentAdmin.UserType != 1) { where.Append("AND a.UserID IN (select ID from [dbo].[GetChildrenRole](" + ComPage.CurrentAdmin.UserID + "))"); } #endregion #region 条件搜索 #region 结算方式 string settlementMethod = DNTRequest.GetString("settlementMethod"); if (string.IsNullOrEmpty(settlementMethod)) { settlementMethod = JsonRequest.GetJsonKeyVal(jsonText, "settlementMethod"); } if (!string.IsNullOrEmpty(settlementMethod)) { where.AppendFormat(" and a.SettlementMethod={0}", settlementMethod); } #endregion #region 支付方式 string paymentMethod = DNTRequest.GetString("paymentMethod"); if (string.IsNullOrEmpty(paymentMethod)) { paymentMethod = JsonRequest.GetJsonKeyVal(jsonText, "paymentMethod"); } if (!string.IsNullOrEmpty(paymentMethod)) { where.AppendFormat(" and a.PaymentMethod={0}", paymentMethod); } #endregion #region 结算状态 string status = DNTRequest.GetString("status"); if (string.IsNullOrEmpty(status)) { status = JsonRequest.GetJsonKeyVal(jsonText, "status"); } if (!string.IsNullOrEmpty(status)) { where.AppendFormat(" and a.ApplyStatus={0}", status); } #endregion #region 商家 string merchantName = DNTRequest.GetString("merchantName"); if (string.IsNullOrEmpty(merchantName)) { merchantName = JsonRequest.GetJsonKeyVal(jsonText, "merchantName"); merchantName = System.Web.HttpContext.Current.Server.UrlDecode(merchantName); } if (!string.IsNullOrEmpty(merchantName)) { where.AppendFormat(" and b.UserName like'%{0}%'", merchantName); } #endregion #region 开户行 string openingBank = DNTRequest.GetString("openingBank"); if (string.IsNullOrEmpty(openingBank)) { openingBank = JsonRequest.GetJsonKeyVal(jsonText, "openingBank"); openingBank = System.Web.HttpContext.Current.Server.UrlDecode(openingBank); } if (!string.IsNullOrEmpty(openingBank)) { where.AppendFormat(" and a.OpeningBank like'%{0}%'", openingBank); } #endregion #region 持卡人 string cardHolder = DNTRequest.GetString("cardHolder"); if (string.IsNullOrEmpty(cardHolder)) { cardHolder = JsonRequest.GetJsonKeyVal(jsonText, "cardHolder"); cardHolder = System.Web.HttpContext.Current.Server.UrlDecode(cardHolder); } if (!string.IsNullOrEmpty(cardHolder)) { where.AppendFormat(" and a.CardHolder like'%{0}%'", cardHolder); } #endregion #region 卡号 string cardNumber = DNTRequest.GetString("cardNumber"); if (string.IsNullOrEmpty(cardNumber)) { cardNumber = JsonRequest.GetJsonKeyVal(jsonText, "cardNumber"); cardNumber = System.Web.HttpContext.Current.Server.UrlDecode(cardNumber); } if (!string.IsNullOrEmpty(cardNumber)) { where.AppendFormat(" and a.CardNumber like '%{0}%'", cardNumber); } #endregion #region 备注 string remark = DNTRequest.GetString("remark"); if (string.IsNullOrEmpty(remark)) { remark = JsonRequest.GetJsonKeyVal(jsonText, "remark"); remark = System.Web.HttpContext.Current.Server.UrlDecode(remark); } if (!string.IsNullOrEmpty(remark)) { where.AppendFormat(" and a.Remark like '%{0}%'", remark); } #endregion #region 结算金额 string applyMoney = DNTRequest.GetString("applyMoney"); if (string.IsNullOrEmpty(applyMoney)) { applyMoney = JsonRequest.GetJsonKeyVal(jsonText, "applyMoney"); applyMoney = System.Web.HttpContext.Current.Server.UrlDecode(applyMoney); } if (!string.IsNullOrEmpty(applyMoney)) { where.AppendFormat(" and (a.ApplyMoney={0} or a.ActualMoney={0})", applyMoney); } #endregion #region 结算周期 string startDate = DNTRequest.GetString("startDate"); if (string.IsNullOrEmpty(applyMoney)) { startDate = JsonRequest.GetJsonKeyVal(jsonText, "startDate"); startDate = System.Web.HttpContext.Current.Server.UrlDecode(startDate); } string endDate = DNTRequest.GetString("endDate"); if (string.IsNullOrEmpty(endDate)) { endDate = JsonRequest.GetJsonKeyVal(jsonText, "endDate"); endDate = System.Web.HttpContext.Current.Server.UrlDecode(endDate); } if (!string.IsNullOrEmpty(startDate) && !string.IsNullOrEmpty(endDate)) { where.AppendFormat(" and (a.StartDate>='{0} 00:00:00' and a.EndDate<='{1} 23:59:59')", startDate, endDate); } else if (string.IsNullOrEmpty(startDate) && !string.IsNullOrEmpty(endDate)) { where.AppendFormat(" and (a.StartDate>='{0} 00:00:00' and a.EndDate<='{1} 23:59:59')", endDate, endDate); } else if (!string.IsNullOrEmpty(startDate) && string.IsNullOrEmpty(endDate)) { where.AppendFormat(" and (a.StartDate>='{0} 00:00:00' and a.EndDate<='{1} 23:59:59')", startDate, startDate); } #endregion #endregion #region 排序字段 string iSortCol_0 = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0"); string sSortDir_0 = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0"); int iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols")); string orderBy = string.Empty; if (!string.IsNullOrEmpty(iSortCol_0)) { string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0)); orderBy = string.Format(" {0} {1}", orderField, sSortDir_0); } #endregion #region 分页查询 string sql = ""; int zys = 0; int sumcount = 0; OrderRebateSettlementApplyBLL opOrderRebateSettlementApplyBLL = new OrderRebateSettlementApplyBLL(); DataTable dt = opOrderRebateSettlementApplyBLL.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount); #endregion #region 查询结果 object obj = new { result = true, code = "", msg = "", recordsTotal = sumcount, recordsFiltered = sumcount, data = ((dt == null) ? (new DataTable()) : (dt)), sEcho = sEcho, }; #endregion result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "获取结算申请信息异常,", ex.Message); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }
/// <summary> /// 申请结算提交 /// </summary> /// <returns></returns> static public Object ApplySettlement() { string result = string.Empty; using (TransactionScope ts = new TransactionScope()) { try { string userIdAndDepartmentId = DNTRequest.GetString("userIdAndDepartmentId"); if (string.IsNullOrEmpty(userIdAndDepartmentId)) { return(DNTRequest.GetResultJson(false, "请先选择需要结算的商户", null)); } int userId = 0; int departmentId = 0; if (!string.IsNullOrEmpty(userIdAndDepartmentId)) { string[] userIdAndDepartmentIdList = userIdAndDepartmentId.Split(new char[] { ',' }); userId = ComPage.SafeToInt(userIdAndDepartmentIdList[0]); departmentId = ComPage.SafeToInt(userIdAndDepartmentIdList[1]); } if (userId == 0) { return(DNTRequest.GetResultJson(false, "请先选择需要结算的商户", null)); } //订单返利结算申请表主键 int orderRebateSettlementApplyId = 0; int res01 = 0; int res02 = 0; #region 订单返利结算申请信息入库 string objOrderRebateSettlementApply = DNTRequest.GetString("modelOrderRebateSettlementApply"); OrderRebateSettlementApply postOrderRebateSettlementApply = JsonConvert.DeserializeObject <OrderRebateSettlementApply>(objOrderRebateSettlementApply); OrderRebateSettlementApplyBLL opOrderRebateSettlementApply = new OrderRebateSettlementApplyBLL(); OrderRebateSettlementApply modelOrderRebateSettlementApply = new OrderRebateSettlementApply(); modelOrderRebateSettlementApply.UserId = userId; modelOrderRebateSettlementApply.DepartmentId = departmentId; modelOrderRebateSettlementApply.StartDate = postOrderRebateSettlementApply.StartDate; modelOrderRebateSettlementApply.EndDate = postOrderRebateSettlementApply.EndDate; modelOrderRebateSettlementApply.ApplyMoney = postOrderRebateSettlementApply.ApplyMoney; modelOrderRebateSettlementApply.ActualMoney = postOrderRebateSettlementApply.ActualMoney; modelOrderRebateSettlementApply.ApplyStatus = 0; modelOrderRebateSettlementApply.SettlementMethod = null; modelOrderRebateSettlementApply.SalesPercentage = 0; modelOrderRebateSettlementApply.PaymentMethod = postOrderRebateSettlementApply.PaymentMethod; modelOrderRebateSettlementApply.OpeningBank = postOrderRebateSettlementApply.OpeningBank; modelOrderRebateSettlementApply.CardHolder = postOrderRebateSettlementApply.CardHolder; modelOrderRebateSettlementApply.CardNumber = postOrderRebateSettlementApply.CardNumber; modelOrderRebateSettlementApply.Remark = postOrderRebateSettlementApply.Remark; modelOrderRebateSettlementApply.CreateId = ComPage.CurrentAdmin.UserID; modelOrderRebateSettlementApply.CreateDate = DateTime.Now; modelOrderRebateSettlementApply.EditId = null; modelOrderRebateSettlementApply.EditDate = null; modelOrderRebateSettlementApply.IsDeleted = 0; orderRebateSettlementApplyId = opOrderRebateSettlementApply.Add(modelOrderRebateSettlementApply); #endregion #region 结算申请详情信息入库和修改订单返利结算申请表的结算状态为已申请 if (orderRebateSettlementApplyId > 0) { #region 结算申请详情信息入库和修改订单返利结算申请表的结算状态为已申请 StringBuilder where = new StringBuilder(); where.Append("b.ProductId=0"); #region 获取结算申请列表查询条件 string UserId = DNTRequest.GetString("UserId"); if (string.IsNullOrEmpty(UserId)) { UserId = JsonRequest.GetJsonKeyVal(jsonText, "UserId"); } if (!string.IsNullOrEmpty(UserId)) { where.AppendFormat(" and a.UserId={0}", UserId); } string CompanyId = DNTRequest.GetString("CompanyId"); if (string.IsNullOrEmpty(CompanyId)) { CompanyId = JsonRequest.GetJsonKeyVal(jsonText, "CompanyId"); } if (!string.IsNullOrEmpty(CompanyId)) { where.AppendFormat(" and a.CompanyId={0}", CompanyId); } string StartDate = DNTRequest.GetString("StartDate"); if (string.IsNullOrEmpty(StartDate)) { StartDate = JsonRequest.GetJsonKeyVal(jsonText, "StartDate"); } string EndDate = DNTRequest.GetString("EndDate"); if (string.IsNullOrEmpty(EndDate)) { EndDate = JsonRequest.GetJsonKeyVal(jsonText, "EndDate"); } if (!string.IsNullOrEmpty(StartDate) && !string.IsNullOrEmpty(EndDate)) { where.AppendFormat(" and a.CreateDate between '{0} 00:00:00' and '{1} 23:59:59'", StartDate, EndDate); } else if (string.IsNullOrEmpty(StartDate) && !string.IsNullOrEmpty(EndDate)) { where.AppendFormat(" and a.CreateDate<='{0} 23:59:59'", EndDate); } else if (!string.IsNullOrEmpty(StartDate) && string.IsNullOrEmpty(EndDate)) { where.AppendFormat(" and a.CreateDate >= '{0} 00:00:00'", StartDate); } #endregion where.Append(" and a.IsDeleted=0 and a.PayStatus=1 and a.IsSettled=0 and a.IsCancel=0"); OrderRebateBLL op = new OrderRebateBLL(); op.ApplySettlement(orderRebateSettlementApplyId, ComPage.CurrentAdmin.UserID, where.ToString(), ref res01, ref res02); #endregion } #endregion if (orderRebateSettlementApplyId > 0 && res01 > 0 && res02 > 0) { ts.Complete(); result = DNTRequest.GetResultJson(true, "申请结算成功", null); } else { ts.Dispose(); result = DNTRequest.GetResultJson(false, "申请结算失败,请稍后再试", null); } } catch (Exception ex) { ts.Dispose(); result = DNTRequest.GetResultJson(false, "申请结算异常,请稍后再试", null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } } return(result); }
/// <summary> /// 查询可结算订单列表 /// </summary> static public Object QueryOrderList() { string result = string.Empty; try { string sEcho = JsonRequest.GetJsonKeyVal(jsonText, "sEcho"); int displayStart = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart")); int displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength")); int pageIndex = (displayStart / displayLength) + 1; int pageSize = displayLength; #region 获取列表 StringBuilder where = new StringBuilder(); where.Append("b.ProductId=0"); #region 查询条件 #region 商家 string UserId = DNTRequest.GetString("UserId"); if (string.IsNullOrEmpty(UserId)) { UserId = JsonRequest.GetJsonKeyVal(jsonText, "UserId"); } if (!string.IsNullOrEmpty(UserId)) { where.AppendFormat(" and a.UserId={0}", UserId); } #endregion #region 道 string CompanyId = DNTRequest.GetString("CompanyId"); if (string.IsNullOrEmpty(CompanyId)) { CompanyId = JsonRequest.GetJsonKeyVal(jsonText, "CompanyId"); } if (!string.IsNullOrEmpty(CompanyId)) { where.AppendFormat(" and a.CompanyId={0}", CompanyId); } #endregion #region 结算周期 string StartDate = DNTRequest.GetString("StartDate"); if (string.IsNullOrEmpty(StartDate)) { StartDate = JsonRequest.GetJsonKeyVal(jsonText, "StartDate"); } string EndDate = DNTRequest.GetString("EndDate"); if (string.IsNullOrEmpty(EndDate)) { EndDate = JsonRequest.GetJsonKeyVal(jsonText, "EndDate"); } if (!string.IsNullOrEmpty(StartDate) && !string.IsNullOrEmpty(EndDate)) { where.AppendFormat(" and a.CreateDate between '{0} 00:00:00' and '{1} 23:59:59'", StartDate, EndDate); } else if (string.IsNullOrEmpty(StartDate) && !string.IsNullOrEmpty(EndDate)) { where.AppendFormat(" and a.CreateDate<='{0} 23:59:59'", EndDate); } else if (!string.IsNullOrEmpty(StartDate) && string.IsNullOrEmpty(EndDate)) { where.AppendFormat(" and a.CreateDate>='{0} 00:00:00'", StartDate); } #endregion #endregion #region 固定的查询条件 where.Append(" and a.IsDeleted=0 and a.PayStatus=1 and a.IsSettled=0 and a.IsCancel=0"); #endregion #region 执行sql OrderRebateBLL op = new OrderRebateBLL(); DataTable dt = op.QueryOrderList(where.ToString()); #endregion #region 结果处理 double sumOrderMoney = 0; double sumMerchantMoney = 0; double sumAgentMoney = 0; double sumHQMoney = 0; double sumNetProfit = 0; double sumApplyMoney = 0; int totalCount = 0; if (dt != null && dt.Rows.Count > 0) { totalCount = dt.Rows.Count; foreach (DataRow dr in dt.Rows) { sumOrderMoney += Math.Round(ComPage.SafeToDouble(dr["sumOrderMoney"]), 2, MidpointRounding.AwayFromZero); sumMerchantMoney += Math.Round(ComPage.SafeToDouble(dr["sumMerchantMoney"]), 2, MidpointRounding.AwayFromZero); sumAgentMoney += Math.Round(ComPage.SafeToDouble(dr["sumAgentMoney"]), 2, MidpointRounding.AwayFromZero); sumHQMoney += Math.Round(ComPage.SafeToDouble(dr["sumHQMoney"]), 2, MidpointRounding.AwayFromZero); sumNetProfit += Math.Round(ComPage.SafeToDouble(dr["sumNetProfit"]), 2, MidpointRounding.AwayFromZero); int settlementMethod = ComPage.SafeToInt(dr["SettlementMethod"]); double salesPercentage = ComPage.SafeToDouble(dr["SalesPercentage"]); int userType = ComPage.SafeToInt(dr["UserType"]); switch (settlementMethod) { case 1: #region 销售额百分比分成 double salesPercentageMoney = (sumOrderMoney * salesPercentage) / 100; sumApplyMoney += Math.Round(salesPercentageMoney, 2, MidpointRounding.AwayFromZero); #endregion break; case 2: #region 单笔结算分成 switch (userType) { case 2: //经销商 sumApplyMoney += Math.Round(sumMerchantMoney, 2, MidpointRounding.AwayFromZero); break; case 3: //代理商 sumApplyMoney += Math.Round(sumAgentMoney, 2, MidpointRounding.AwayFromZero); break; } #endregion break; } } } #endregion #region 拼装返回结果 var obj = new { result = true, code = "", msg = "", sumOrderMoney = sumOrderMoney, sumMerchantMoney = sumMerchantMoney, sumAgentMoney = sumAgentMoney, sumHQMoney = sumHQMoney, sumNetProfit = sumNetProfit, sumApplyMoney = sumApplyMoney, recordsTotal = totalCount, recordsFiltered = totalCount, data = ((dt == null) ? (new DataTable()) : (dt)), sEcho = sEcho }; #endregion result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); #endregion } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "获取结算申请信息异常,", ex.Message); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }
/// <summary> /// 获取的支付结果 /// </summary> protected void GetPayResult() { //HttpContext.Current.Response.ContentType = "application/octet-stream"; //HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding("UTF-8"); //byte[] reqData = HttpContext.Current.Request.BinaryRead(HttpContext.Current.Request.TotalBytes); //string jsonText = Encoding.Default.GetString(reqData); /* * BSId String 业务系统流水号 * Price String 支付的金额 * PayOrderNumber String 支付单号码(支付系统唯一标识) * OnlinePaymnetId String 在线支付标识 * PaymentId String 支付系统流水号 * Success String 成功则为:Success,失败不会通知 */ try { #region 取值 string BSId = DNTRequest.GetString("BSId"); string Price = DNTRequest.GetString("Price"); string PayOrderNumber = DNTRequest.GetString("PayOrderNumber"); string OnlinePaymnetId = DNTRequest.GetString("OnlinePaymnetId"); string PaymentId = DNTRequest.GetString("PaymentId"); string Success = DNTRequest.GetString("Success"); int orderApplyId = 0; int orderRebateId = 0; string insureNum = DNTRequest.GetString("insureNum"); StringBuilder where = new StringBuilder(); DataSet ds = null; DataTable dt = null; if (!string.IsNullOrEmpty(insureNum)) { OrderApplyBLL opOrderApplyBLL = new OrderApplyBLL(); OrderApply modelOrderApply = new OrderApply(); where.AppendFormat("insurenum='{0}'", insureNum); ds = new DataSet(); ds = opOrderApplyBLL.GetList(where.ToString()); if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; } } #endregion #region 支付结果更新 if (dt != null && dt.Rows.Count > 0) { DataRow dr = dt.Rows[0]; orderApplyId = ComPage.SafeToInt(dr["OrderApplyID"]); #region 更新订单返利信息 OrderRebateBLL opSys_OrderRebate = new OrderRebateBLL(); OrderRebate modelSys_OrderRebate = new OrderRebate(); where = new StringBuilder(); where.AppendFormat("OrderApplyId={0}", orderApplyId); ds = new DataSet(); ds = opSys_OrderRebate.GetList(where.ToString()); if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { modelSys_OrderRebate = opSys_OrderRebate.DataRowToModel(dt.Rows[0]); if (modelSys_OrderRebate != null) { litPrice.Text = modelSys_OrderRebate.OrderMoney.ToString("N2") + "元"; modelSys_OrderRebate.PayStatus = 1; orderRebateId = modelSys_OrderRebate.OrderRebateId; opSys_OrderRebate.Update(modelSys_OrderRebate); } } } #endregion #region 更新订单支付申请 if (orderRebateId > 0) { OrderPayApplyBLL opSys_OrderPayApplyBLL = new OrderPayApplyBLL(); OrderPayApply modelSys_OrderPayApply = new OrderPayApply(); where = new StringBuilder(); where.AppendFormat("OrderRebateId={0}", orderRebateId); ds = new DataSet(); ds = opSys_OrderPayApplyBLL.GetList(where.ToString()); if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; if (dt != null && dt.Rows.Count > 0) { modelSys_OrderPayApply = opSys_OrderPayApplyBLL.DataRowToModel(dt.Rows[0]); if (modelSys_OrderPayApply != null) { modelSys_OrderPayApply.PayOrderNumber = PayOrderNumber; modelSys_OrderPayApply.PayStatus = 1; modelSys_OrderPayApply.PayPlatform = 1; modelSys_OrderPayApply.PayMethod = 1; modelSys_OrderPayApply.PayCode = Success; string payMethod = "支付宝"; switch (modelSys_OrderPayApply.PayMethod) { case 1: payMethod = "支付宝"; break; } litPayMethod.Text = payMethod; litRemark.Text = modelSys_OrderPayApply.Remark; modelSys_OrderPayApply.PayDate = DateTime.Now; opSys_OrderPayApplyBLL.Update(modelSys_OrderPayApply); } } } } #endregion } else { litSuccess.Text = "未获取到支付信息"; } #endregion #region 显示到页面 litBSId.Text = insureNum; //litPayOrderNumber.Text = PayOrderNumber; litSuccess.Text = "支付成功"; #endregion #region 记录通知结果 var obj = new { BSId = BSId, Price = Price, PayOrderNumber = PayOrderNumber, OnlinePaymnetId = OnlinePaymnetId, PaymentId = PaymentId, Success = Success, }; string res = Newtonsoft.Json.JsonConvert.SerializeObject(obj); //ExceptionLogBLL.WriteExceptionLogToDB("支付通知:" + res); #endregion } catch (Exception ex) { ExceptionLogBLL.WriteExceptionLogToDB("支付结果通知异常:" + ex.ToString()); } }
/// <summary> /// 确定按钮 /// </summary> protected void FunctionInfoSave() { FunctionBLL funInfoBLL = new FunctionBLL(); FunctionNameChild = this.txtFunctionNameChild.Value.Trim(); FunctionType = Convert.ToInt32(this.SeleFunctionType.Value.Trim()); FunctionName = this.txtFunctionName.Value.ToString(); try { ParentID = int.Parse(this.txtFunctionID.Value); } catch { } if (FunctionNameChild == "") { Response.Write(IFrameLayerClosetwo("请填写功能名称!")); Response.End(); } if (FunctionNameChild.Length > 50) { Response.Write(IFrameLayerClosetwo("功能名称输入过长,请重新输入!")); Response.End(); } if (this.SeleFunctionType.Value.Trim() == "2") { Response.Write(IFrameLayerClosetwo("请选择功能类型!")); Response.End(); } if ((ParentID == FunctionId) && ParentID != 0 && FunctionId != 0) { Response.Write(IFrameLayerClosetwo("父级选择错误,请重新选择!")); Response.End(); } DataSet ds = new DataSet(); ds = funInfoBLL.GetList(" FunctionId<>" + FunctionId + " and FunctionName='" + FunctionNameChild + "' and IsDeleted=0 "); if (ds.Tables[0].Rows.Count > 0) { Response.Write(IFrameLayerClosetwo("功能名称重复,重新填写!")); Response.End(); } bool bFlag = false; if (this.btnSave.Text == "修改功能") { Function model = new Function(); model.FunctionId = Request.QueryString["FunctionID"].ToString().ToInt(); model.FunctionName = FunctionNameChild; model.ExternalLinkAddress = txtExternalLinkAddress.Value.Trim(); model.OrderId = ComPage.SafeToInt(txtOrderId.Value.Trim()); model.ParentId = ParentID; model.FunctionCode = this.HidFunctionCode.Value.ToString(); model.ClassId = FunctionType; model.IsDeleted = 0; model.EditId = LoginUserID; model.EditDate = DateTime.Now; bFlag = funInfoBLL.Update(model); if (bFlag) { Response.Write(IFrameLayerClosetwo("修改功能成功!")); Response.End(); } else { Response.Write(IFrameLayerClosetwo("修改功能失败")); Response.End(); } } else { bool aFlag = false; RandomCode = GetRandomCode(); aFlag = funInfoBLL.soleFunctionCode(RandomCode, 0); if (aFlag == true) { RandomCode = GetRandomCode(); } Function model = new Function(); model.FunctionId = FunctionID; model.FunctionName = FunctionNameChild; model.ExternalLinkAddress = txtExternalLinkAddress.Value.Trim(); model.OrderId = ComPage.SafeToInt(txtOrderId.Value.Trim()); model.ParentId = ParentID; model.FunctionCode = RandomCode; model.ClassId = FunctionType; model.IsDeleted = 0; model.CreateId = LoginUserID; model.EditId = LoginUserID; model.EditDate = DateTime.Now; model.CreateDate = DateTime.Now; int FunctionIdNew = 0; FunctionIdNew = funInfoBLL.Add(model); if (FunctionIdNew > 0) { Response.Write(IFrameLayerClosetwo("添加功能成功!")); Response.End(); } else { Response.Write(IFrameLayerClosetwo("添加功能失败,继续添加!")); Response.End(); } } }
/// <summary> /// 检查是否已登录 /// </summary> /// <returns></returns> static public Object Test() { string result = string.Empty; try { string sEcho = JsonRequest.GetJsonKeyVal(jsonText, "sEcho"); int displayStart = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart")); int displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength")); string sSearch = JsonRequest.GetJsonKeyVal(jsonText, "sSearch"); string iSortCol_0 = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0"); string sSortDir_0 = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0"); int iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols")); string timeStamp = JsonRequest.GetJsonKeyVal(jsonText, "timeStamp"); int pageIndex = (displayStart / displayLength) + 1; int pageSize = displayLength; string orderBy = string.Empty; if (!string.IsNullOrEmpty(iSortCol_0)) { string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0)); orderBy = string.Format(" order by {0} {1}", orderField, sSortDir_0); } List <object> list = new List <object>(); //list.Sort(); int totalCount = 1000; for (int i = 1; i <= totalCount; i++) { if (i > displayStart && i <= (displayStart + displayLength)) { object data = new { Id = i, Name = "hfm" + i.ToString().PadLeft(4, '0'), Sex = new Random().Next(0, 2).ToString(), CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), }; list.Add(data); } } object obj = new { result = true, code = "", msg = "", recordsTotal = totalCount, recordsFiltered = totalCount, data = list, sEcho = sEcho, #region 注释 //iColumns = 6, //sColumns = "", //mDataProp_0 = "Id", //sSearch_0 = "", //bRegex_0 = false, //bSearchable_0 = true, //bSortable_0 = false, //mDataProp_1 = "Id", //sSearch_1 = "", //bRegex_1 = false, //bSearchable_1 = true, //bSortable_1 = true, //mDataProp_2 = "Name", //sSearch_2 = "", //bRegex_2 = false, //bSearchable_2 = true, //bSortable_2 = true, //mDataProp_3 = "Sex", //sSearch_3 = "", //bRegex_3 = false, //bSearchable_3 = true, //bSortable_3 = true, //mDataProp_4 = "CreateDate", //sSearch_4 = "", //bRegex_4 = false, //bSearchable_4 = true, //bSortable_4 = true, //mDataProp_5 = "", //sSearch_5 = "", //bRegex_5 = false, //bSearchable_5 = true, //bSortable_5 = true, //sSearch = "", //bRegex = false, //iSortCol_0 = 0, //sSortDir_0 = "asc", //iSortingCols = 1, #endregion }; result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null); Log.WriteLog(" " + ex); } return(result); }
/// <summary> /// 获取用户列表 /// </summary> static public Object GetUsersList() { string result = string.Empty; try { string sEcho = JsonRequest.GetJsonKeyVal(jsonText, "sEcho"); int displayStart = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart")); int displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength")); int pageIndex = (displayStart / displayLength) + 1; int pageSize = displayLength; #region 获取列表 StringBuilder where = new StringBuilder(); where.Append("1=1 and u.RecordIsDelete=0 "); DepartmentInfo df = new DepartmentInfo(); DepartmentInfoBLL bll = new DepartmentInfoBLL(); df = bll.GetModel(ComPage.CurrentAdmin.DepartmentID); if (ComPage.CurrentAdmin.UserType != 1) { if ((df == null) || (df != null && df.IsReceiveBusiness != false)) { where.Append(" AND u. UserID IN(select ID from [BWJSDB].dbo.[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))"); } } #region 条件搜索 string key = DNTRequest.GetString("searchKey"); if (string.IsNullOrEmpty(key)) { key = JsonRequest.GetJsonKeyVal(jsonText, "searchKey"); } string LoginName = DNTRequest.GetString("LoginName"); string UsersName = DNTRequest.GetString("UsersName"); string Mobiles = DNTRequest.GetString("Mobiles"); string DepartmentInfoID = DNTRequest.GetString("DepartmentInfoID"); if (string.IsNullOrEmpty(LoginName)) { LoginName = JsonRequest.GetJsonKeyVal(jsonText, "LoginName"); LoginName = System.Web.HttpContext.Current.Server.UrlDecode(LoginName); } if (string.IsNullOrEmpty(UsersName)) { UsersName = JsonRequest.GetJsonKeyVal(jsonText, "UsersName"); UsersName = System.Web.HttpContext.Current.Server.UrlDecode(UsersName); } if (string.IsNullOrEmpty(Mobiles)) { Mobiles = JsonRequest.GetJsonKeyVal(jsonText, "Mobiles"); Mobiles = System.Web.HttpContext.Current.Server.UrlDecode(Mobiles); } if (string.IsNullOrEmpty(DepartmentInfoID)) { DepartmentInfoID = JsonRequest.GetJsonKeyVal(jsonText, "DepartmentInfoID"); DepartmentInfoID = System.Web.HttpContext.Current.Server.UrlDecode(DepartmentInfoID); } if (!string.IsNullOrEmpty(LoginName)) { where.AppendFormat(" and u.LoginName like'{0}%' ", LoginName); } if (!string.IsNullOrEmpty(UsersName)) { where.AppendFormat(" and u.UserName like'{0}%' ", UsersName); } if (!string.IsNullOrEmpty(Mobiles)) { where.AppendFormat(" and u.Phone like'{0}%' ", Mobiles); } if (!string.IsNullOrEmpty(DepartmentInfoID) && DepartmentInfoID != "undefined" && DepartmentInfoID != "0") { where.AppendFormat(" and u.DepartmentID ={0} ", DepartmentInfoID); } #endregion string iSortCol_0 = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0"); string sSortDir_0 = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0"); int iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols")); string orderBy = string.Empty; if (!string.IsNullOrEmpty(iSortCol_0)) { string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0)); orderBy = string.Format(" {0} {1}", orderField, sSortDir_0); } string sql = ""; int zys = 0; int sumcount = 0; UsersBLL Usersbll = new UsersBLL(); DataTable dt = Usersbll.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount); /* * iTotalRecord = sumcount, * iTotalDisplayRecords = sumcount, */ object obj = new { result = true, code = "", msg = "", recordsTotal = sumcount, recordsFiltered = sumcount, data = ((dt == null) ? (new DataTable()) : (dt)), sEcho = sEcho, }; result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); #endregion } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }
/// <summary> /// 获取渠道列表 /// </summary> static public Object GetCompanyList() { string result = string.Empty; try { string sEcho = JsonRequest.GetJsonKeyVal(jsonText, "sEcho"); int displayStart = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart")); int displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength")); int pageIndex = (displayStart / displayLength) + 1; int pageSize = displayLength; #region 获取列表 StringBuilder where = new StringBuilder(); where.Append("1=1 and c.IsDeleted=0"); #region 条件搜索 string key = DNTRequest.GetString("searchKey"); if (string.IsNullOrEmpty(key)) { key = JsonRequest.GetJsonKeyVal(jsonText, "searchKey"); } string val = DNTRequest.GetString("searchValue"); if (string.IsNullOrEmpty(val)) { val = JsonRequest.GetJsonKeyVal(jsonText, "searchValue"); val = System.Web.HttpContext.Current.Server.UrlDecode(val); } if (!string.IsNullOrEmpty(val) && val != "undefined") { where.AppendFormat(" and (c.CompanyName like '{0}%')", val); } string CompanyCategoryId = DNTRequest.GetString("CompanyCategoryId"); string CompanyManager = DNTRequest.GetString("CompanyManager"); if (string.IsNullOrEmpty(CompanyCategoryId)) { CompanyCategoryId = JsonRequest.GetJsonKeyVal(jsonText, "CompanyCategoryId"); CompanyCategoryId = System.Web.HttpContext.Current.Server.UrlDecode(CompanyCategoryId); } if (string.IsNullOrEmpty(CompanyManager)) { CompanyManager = JsonRequest.GetJsonKeyVal(jsonText, "CompanyManager"); CompanyManager = System.Web.HttpContext.Current.Server.UrlDecode(CompanyManager); } if (!string.IsNullOrEmpty(CompanyCategoryId) && CompanyCategoryId != "null" && CompanyCategoryId != "undefined") { where.AppendFormat(" and c.CompanyCategoryId ={0} ", CompanyCategoryId); } if (!string.IsNullOrEmpty(CompanyManager) && CompanyManager != "null" && CompanyManager != "undefined") { where.AppendFormat(" and c.CompanyManager like'{0}%' ", CompanyManager); } #endregion string iSortCol_0 = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0"); string sSortDir_0 = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0"); int iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols")); string orderBy = string.Empty; if (!string.IsNullOrEmpty(iSortCol_0)) { string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0)); orderBy = string.Format(" {0} {1}", orderField, sSortDir_0); } string sql = ""; int zys = 0; int sumcount = 0; CompanyBLL companybll = new CompanyBLL(); DataTable dt = companybll.GetNameList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount); /* * iTotalRecord = sumcount, * iTotalDisplayRecords = sumcount, */ object obj = new { result = true, code = "", msg = "", recordsTotal = sumcount, recordsFiltered = sumcount, data = ((dt == null) ? (new DataTable()) : (dt)), sEcho = sEcho, }; result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); #endregion } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }
/// <summary> /// 获取分利列表 /// </summary> static public Object GetOrderRebateList() { string result = string.Empty; try { string sEcho = JsonRequest.GetJsonKeyVal(jsonText, "sEcho"); int displayStart = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart")); int displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength")); int pageIndex = (displayStart / displayLength) + 1; int pageSize = displayLength; #region 获取列表 StringBuilder where = new StringBuilder(); where.Append("1=1 and ort.IsDeleted=0 "); DepartmentInfo df = new DepartmentInfo(); DepartmentInfoBLL bll = new DepartmentInfoBLL(); df = bll.GetModel(ComPage.CurrentAdmin.DepartmentID); if (ComPage.CurrentAdmin.UserType != 1) { if ((df == null) || (df != null && df.IsReceiveBusiness != false)) { //where.Append(" AND moa.UserID IN(select ID from [BWJSDB].dbo.[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))"); where.Append(" AND moa.UserID IN(SELECT ID from[BWJSDB].dbo.[GetDepartmentChildren](" + ComPage.CurrentAdmin.UserID + "))"); } } #region 条件搜索 string key = DNTRequest.GetString("searchKey"); if (string.IsNullOrEmpty(key)) { key = JsonRequest.GetJsonKeyVal(jsonText, "searchKey"); } string val = DNTRequest.GetString("searchValue"); if (string.IsNullOrEmpty(val)) { val = JsonRequest.GetJsonKeyVal(jsonText, "searchValue"); val = System.Web.HttpContext.Current.Server.UrlDecode(val); } if (!string.IsNullOrEmpty(val)) { where.AppendFormat(" and (moa.InsureNum like'" + val + "%' or ort.TransNo like'" + val + "%') ", val); } #endregion string iSortCol_0 = JsonRequest.GetJsonKeyVal(jsonText, "iSortCol_0"); string sSortDir_0 = JsonRequest.GetJsonKeyVal(jsonText, "sSortDir_0"); int iSortingCols = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iSortingCols")); string orderBy = string.Empty; if (!string.IsNullOrEmpty(iSortCol_0)) { string orderField = JsonRequest.GetJsonKeyVal(jsonText, string.Format("mDataProp_{0}", iSortCol_0)); orderBy = string.Format(" {0} {1}", orderField, sSortDir_0); } string sql = ""; int zys = 0; int sumcount = 0; OrderRebateBLL orderRebatebll = new OrderRebateBLL(); DataTable dt = orderRebatebll.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount); /* * iTotalRecord = sumcount, * iTotalDisplayRecords = sumcount, */ object obj = new { result = true, code = "", msg = "", recordsTotal = sumcount, recordsFiltered = sumcount, data = ((dt == null) ? (new DataTable()) : (dt)), sEcho = sEcho, }; result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); #endregion } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }
static public Object SupplierInfo() { string result = string.Empty; try { string sEcho = JsonRequest.GetJsonKeyVal(jsonText, "sEcho"); int displayStart = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayStart")); int displayLength = ComPage.SafeToInt(JsonRequest.GetJsonKeyVal(jsonText, "iDisplayLength")); int pageIndex = (displayStart / displayLength) + 1; int pageSize = displayLength; #region 搜索 StringBuilder sqlSearch = new StringBuilder(); string SignName = DNTRequest.GetString("SignName"); string UserName = DNTRequest.GetString("UserName"); string UserMobile = DNTRequest.GetString("UserMobile"); if (string.IsNullOrEmpty(SignName)) { SignName = JsonRequest.GetJsonKeyVal(jsonText, "SignName"); SignName = System.Web.HttpContext.Current.Server.UrlDecode(SignName); } if (string.IsNullOrEmpty(UserName)) { UserName = JsonRequest.GetJsonKeyVal(jsonText, "UserName"); UserName = System.Web.HttpContext.Current.Server.UrlDecode(UserName); } if (string.IsNullOrEmpty(UserMobile)) { UserMobile = JsonRequest.GetJsonKeyVal(jsonText, "UserMobile"); UserMobile = System.Web.HttpContext.Current.Server.UrlDecode(UserMobile); } if (!string.IsNullOrEmpty(SignName)) { sqlSearch.AppendFormat(" and SignName like'{0}%' ", SignName); } if (!string.IsNullOrEmpty(UserName)) { sqlSearch.AppendFormat(" and UserName like'{0}%' ", UserName); } if (!string.IsNullOrEmpty(UserMobile)) { sqlSearch.AppendFormat(" and UserMobile ='{0}' ", UserMobile); } #endregion string orderBy = string.Empty; string sql = ""; int zys = 0; int sumcount = 0; SupplierInfoBLL op = new SupplierInfoBLL(); List <SupplierInfo> list = new List <SupplierInfo>(); StringBuilder where = new StringBuilder(); where.Append("State=0"); where.Append(sqlSearch); DataTable dt = op.GetList(where.ToString(), pageIndex, pageSize, orderBy, ref sql, ref zys, ref sumcount); object obj = new { result = true, code = "", msg = "", recordsTotal = sumcount, recordsFiltered = sumcount, data = ((dt == null) ? (new DataTable()) : (dt)), sEcho = sEcho, }; result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "获取商户信息异常,请稍后再试", null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }