/// <summary> /// 得到一个对象实体 /// </summary> public CommOrderModel GetModel(string OrderId, string userId) { Database db = NoName.NetShop.Common.CommDataAccess.DbReader; StringBuilder strSql = new StringBuilder(); strSql.Append("select UserId,DerateFee,RecieverName,RecieverEmail,RecieverPhone,Postalcode,RecieverCity,RecieverProvince,AddressDetial,ChangeTime,PayTime,OrderId,CreateTime,OrderType,ServerIp,ClientIp,InvoiceTitle,IsNeedInvoice,UserNotes,RecieverCountry,RecieverCounty,OrderStatus,PayMethod,ShipMethod,PayStatus,Paysum,ShipFee,ProductFee,payorderId,IsTotalFeeAdjust,suitId from spOrder "); strSql.Append(" where OrderId=@OrderId and userId=@userId"); DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()); db.AddInParameter(dbCommand, "OrderId", DbType.AnsiString, OrderId); db.AddInParameter(dbCommand, "userId", DbType.AnsiString, userId); CommOrderModel model = null; using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { if (dataReader.Read()) { model = ReaderBind(dataReader); } } return(model); }
/// <summary> /// 对象实体绑定数据 /// </summary> private CommOrderModel ReaderBind(IDataReader dataReader) { CommOrderModel model = new CommOrderModel(); object ojb; model.UserId = dataReader["UserId"].ToString(); model.OrderId = dataReader["OrderId"].ToString(); ojb = dataReader["OrderStatus"]; if (ojb != null && ojb != DBNull.Value) { model.OrderStatus = (OrderStatus)(Convert.ToInt32(ojb)); } ojb = dataReader["PayMethod"]; if (ojb != null && ojb != DBNull.Value) { model.PayMethod = (PayMethType)(Convert.ToInt32(ojb)); } ojb = dataReader["ShipMethod"]; if (ojb != null && ojb != DBNull.Value) { model.ShipMethod = (ShipMethodType)(Convert.ToInt32(ojb)); } ojb = dataReader["PayStatus"]; if (ojb != null && ojb != DBNull.Value) { model.PayStatus = (PayStatus)(Convert.ToInt32(ojb)); } ojb = dataReader["Paysum"]; if (ojb != null && ojb != DBNull.Value) { model.Paysum = (decimal)ojb; } ojb = dataReader["ShipFee"]; if (ojb != null && ojb != DBNull.Value) { model.ShipFee = (decimal)ojb; } ojb = dataReader["ProductFee"]; if (ojb != null && ojb != DBNull.Value) { model.ProductFee = (decimal)ojb; } ojb = dataReader["DerateFee"]; if (ojb != null && ojb != DBNull.Value) { model.DerateFee = (decimal)ojb; } model.RecieverName = dataReader["RecieverName"].ToString(); model.RecieverEmail = dataReader["RecieverEmail"].ToString(); model.RecieverPhone = dataReader["RecieverPhone"].ToString(); model.Postalcode = dataReader["Postalcode"].ToString(); model.RecieverCity = dataReader["RecieverCity"].ToString(); model.RecieverProvince = dataReader["RecieverProvince"].ToString(); model.AddressDetial = dataReader["AddressDetial"].ToString(); ojb = dataReader["ChangeTime"]; if (ojb != null && ojb != DBNull.Value) { model.ChangeTime = (DateTime)ojb; } ojb = dataReader["PayTime"]; if (ojb != null && ojb != DBNull.Value) { model.PayTime = (DateTime)ojb; } ojb = dataReader["CreateTime"]; if (ojb != null && ojb != DBNull.Value) { model.CreateTime = (DateTime)ojb; } ojb = dataReader["OrderType"]; if (ojb != null && ojb != DBNull.Value) { model.OrderType = (OrderType)(Convert.ToInt32(ojb)); } model.ServerIp = dataReader["ServerIp"].ToString(); model.ClientIp = dataReader["ClientIp"].ToString(); model.InvoiceTitle = dataReader["InvoiceTitle"].ToString(); ojb = dataReader["IsNeedInvoice"]; if (ojb != null && ojb != DBNull.Value) { model.IsNeedInvoice = (bool)ojb; } model.UserNotes = dataReader["UserNotes"].ToString(); model.RecieverCountry = dataReader["RecieverCountry"].ToString(); model.RecieverCounty = dataReader["RecieverCounty"].ToString(); model.PayorderId = dataReader["payorderId"].ToString(); ojb = dataReader["IsTotalFeeAdjust"]; if (ojb != null && ojb != DBNull.Value) { model.IsTotalFeeAdjust = (bool)ojb; } ojb = dataReader["suitId"]; if (ojb != null && ojb != DBNull.Value) { model.SuitId = Convert.ToInt32(ojb); } return model; }
/// <summary> /// 显示允许管理员操作的按钮 /// 在线支付 /// 未支付 —— 关闭订单 /// 支付成功,—— 审核通过,开始备货 /// 支付成功,—— 退款给买家,交易失败 /// 开始备货,—— 发货 /// 开始备货 —— 退款给买家,交易失败 /// 已发货,—— 物流确认到货 /// 已发货,—— 买家拒收,退款给买家,交易失败 /// 物流确认到货,买家确认收货或超时 —— 交易完成 /// /// 银行转帐,邮件汇款 /// 未支付 —— 关闭订单 /// 未支付 —— 买家付款成功 /// 支付成功,—— 审核通过,开始备货 /// 支付成功,—— 退款给买家,交易失败 /// 开始备货,—— 发货 /// 开始备货 —— 退款给买家,交易失败 /// 已发货,—— 物流确认到货,交易完成 /// 已发货,—— 买家拒收,退款给买家,交易失败 /// 货到付款 /// 未支付 —— 关闭订单 /// 未支付 —— 审核通过,备货 /// 备货中 —— 发货 /// 发货中 —— 物流确认收货收款,交易成功 /// 发货中 —— 买家未签收,交易失败 /// </summary> /// <param name="order"></param> private void ShowActions(CommOrderModel order) { btnAskRefund.Visible = false; btnCherrys.Visible = false; btnGoPay.Visible = false; txtActionRemark.Visible = false; if ((order.OrderStatus == OrderStatus.交易关闭 || order.OrderStatus == OrderStatus.交易失败 || order.OrderStatus == OrderStatus.交易完成) && (order.PayStatus == PayStatus.支付成功)) { return; } if (order.PayMethod == PayMethType.支付宝) { if (order.PayStatus == PayStatus.等待付款) { btnGoPay.Visible = true; } } if (order.PayStatus == PayStatus.支付成功) { btnAskRefund.Visible = true; txtActionRemark.Visible = true; } if (order.OrderStatus == OrderStatus.已发货) { btnCherrys.Visible = true; } }
/// <summary> /// 对象实体绑定数据 /// </summary> private CommOrderModel ReaderBind(IDataReader dataReader) { CommOrderModel model = new CommOrderModel(); object ojb; model.UserId = dataReader["UserId"].ToString(); model.OrderId = dataReader["OrderId"].ToString(); ojb = dataReader["OrderStatus"]; if (ojb != null && ojb != DBNull.Value) { model.OrderStatus = (OrderStatus)(Convert.ToInt32(ojb)); } ojb = dataReader["PayMethod"]; if (ojb != null && ojb != DBNull.Value) { model.PayMethod = (PayMethType)(Convert.ToInt32(ojb)); } ojb = dataReader["ShipMethod"]; if (ojb != null && ojb != DBNull.Value) { model.ShipMethod = (ShipMethodType)(Convert.ToInt32(ojb)); } ojb = dataReader["PayStatus"]; if (ojb != null && ojb != DBNull.Value) { model.PayStatus = (PayStatus)(Convert.ToInt32(ojb)); } ojb = dataReader["Paysum"]; if (ojb != null && ojb != DBNull.Value) { model.Paysum = (decimal)ojb; } ojb = dataReader["ShipFee"]; if (ojb != null && ojb != DBNull.Value) { model.ShipFee = (decimal)ojb; } ojb = dataReader["ProductFee"]; if (ojb != null && ojb != DBNull.Value) { model.ProductFee = (decimal)ojb; } ojb = dataReader["DerateFee"]; if (ojb != null && ojb != DBNull.Value) { model.DerateFee = (decimal)ojb; } model.RecieverName = dataReader["RecieverName"].ToString(); model.RecieverEmail = dataReader["RecieverEmail"].ToString(); model.RecieverPhone = dataReader["RecieverPhone"].ToString(); model.Postalcode = dataReader["Postalcode"].ToString(); model.RecieverCity = dataReader["RecieverCity"].ToString(); model.RecieverProvince = dataReader["RecieverProvince"].ToString(); model.AddressDetial = dataReader["AddressDetial"].ToString(); ojb = dataReader["ChangeTime"]; if (ojb != null && ojb != DBNull.Value) { model.ChangeTime = (DateTime)ojb; } ojb = dataReader["PayTime"]; if (ojb != null && ojb != DBNull.Value) { model.PayTime = (DateTime)ojb; } ojb = dataReader["CreateTime"]; if (ojb != null && ojb != DBNull.Value) { model.CreateTime = (DateTime)ojb; } ojb = dataReader["OrderType"]; if (ojb != null && ojb != DBNull.Value) { model.OrderType = (OrderType)(Convert.ToInt32(ojb)); } model.ServerIp = dataReader["ServerIp"].ToString(); model.ClientIp = dataReader["ClientIp"].ToString(); model.InvoiceTitle = dataReader["InvoiceTitle"].ToString(); ojb = dataReader["IsNeedInvoice"]; if (ojb != null && ojb != DBNull.Value) { model.IsNeedInvoice = (bool)ojb; } model.UserNotes = dataReader["UserNotes"].ToString(); model.RecieverCountry = dataReader["RecieverCountry"].ToString(); model.RecieverCounty = dataReader["RecieverCounty"].ToString(); model.PayorderId = dataReader["payorderId"].ToString(); ojb = dataReader["IsTotalFeeAdjust"]; if (ojb != null && ojb != DBNull.Value) { model.IsTotalFeeAdjust = (bool)ojb; } ojb = dataReader["suitId"]; if (ojb != null && ojb != DBNull.Value) { model.SuitId = Convert.ToInt32(ojb); } return(model); }
/// <summary> /// 显示允许管理员操作的按钮 /// 在线支付 /// 未支付 —— 关闭订单 /// 支付成功,—— 审核通过,开始备货 /// 支付成功,—— 退款给买家,交易失败 /// 开始备货,—— 发货 /// 开始备货 —— 退款给买家,交易失败 /// 已发货,—— 物流确认到货 /// 已发货,—— 买家拒收,退款给买家,交易失败 /// 物流确认到货,买家确认收货或超时 —— 交易完成 /// /// 银行转帐,邮件汇款 /// 未支付 —— 关闭订单 /// 未支付 —— 买家付款成功 /// 支付成功,—— 审核通过,开始备货 /// 支付成功,—— 退款给买家,交易失败 /// 开始备货,—— 发货 /// 开始备货 —— 退款给买家,交易失败 /// 已发货,—— 物流确认到货,交易完成 /// 已发货,—— 买家拒收,退款给买家,交易失败 /// 货到付款 /// 未支付 —— 关闭订单 /// 未支付 —— 审核通过,备货 /// 备货中 —— 发货 /// 发货中 —— 物流确认收货收款,交易成功 /// 发货中 —— 买家未签收,交易失败 /// </summary> /// <param name="order"></param> private void ShowActions(CommOrderModel order) { btnClose.Visible = false; btnPrepareGoods.Visible = false; btnFail.Visible = false; btnSend.Visible = false; btnCherrys.Visible = false; btnFinish.Visible = false; btnPaySucc.Visible = false; btnRefund.Visible = false; txtActionRemark.Visible = false; if (order.OrderStatus == OrderStatus.交易关闭 || order.OrderStatus == OrderStatus.交易失败 || order.OrderStatus == OrderStatus.交易完成) { return; } if (order.PayMethod == PayMethType.货到付款) { if (order.OrderStatus == OrderStatus.已创建) { btnPrepareGoods.Visible = true; btnClose.Visible = true; txtActionRemark.Visible = true; } else if (order.OrderStatus == OrderStatus.备货中) { btnSend.Visible = true; btnClose.Visible = true; txtActionRemark.Visible = true; } else if (order.OrderStatus == OrderStatus.已发货) { btnCherrys.Visible = true; btnFail.Visible = true; txtActionRemark.Visible = true; } else if (order.OrderStatus == OrderStatus.物流到货) { btnFinish.Visible = true; txtActionRemark.Visible = true; } } if (order.PayMethod == PayMethType.银行转账 || order.PayMethod == PayMethType.邮局汇款) { if (order.PayStatus == PayStatus.等待付款) { if (order.OrderStatus == OrderStatus.已创建) { btnClose.Visible = true; btnPaySucc.Visible = true; txtActionRemark.Visible = true; } } else if (order.PayStatus == PayStatus.支付成功) { if (order.OrderStatus == OrderStatus.已创建) { btnRefund.Visible = true; btnPrepareGoods.Visible = true; txtActionRemark.Visible = true; } else if (order.OrderStatus == OrderStatus.备货中) { btnRefund.Visible = true; btnSend.Visible = true; txtActionRemark.Visible = true; } else if (order.OrderStatus == OrderStatus.已发货) { btnCherrys.Visible = true; txtActionRemark.Visible = true; } else if (order.OrderStatus == OrderStatus.物流到货 || order.OrderStatus == OrderStatus.买家确认) { btnFinish.Visible = true; txtActionRemark.Visible = true; } } else if (order.PayStatus == PayStatus.退款申请中) { btnRefund.Visible = true; txtActionRemark.Visible = true; } else if (order.PayStatus == PayStatus.退款完成) { btnFail.Visible = true; txtActionRemark.Visible = true; } } #region 支付宝 if (order.PayMethod == PayMethType.支付宝) { if (order.PayStatus == PayStatus.等待付款 && String.IsNullOrEmpty(order.PayorderId)) { txtActionRemark.Visible = true; btnClose.Visible = true; } } //if (order.PayMethod == PayMethType.支付宝) //{ // if (order.PayStatus == PayStatus.等待付款 && String.IsNullOrEmpty(order.PayorderId)) // { // txtActionRemark.Visible = true; // btnClose.Visible = true; // } // else if (order.PayStatus == PayStatus.支付成功) // { // btnRefund.Visible = true; // if (order.OrderStatus == OrderStatus.已创建) // { // btnRefund.Visible = true; // btnPrepareGoods.Visible = true; // txtActionRemark.Visible = true; // btnClose.Visible = true; // } // else if (order.OrderStatus == OrderStatus.备货中) // { // btnSend.Visible = true; // txtActionRemark.Visible = true; // if (order.PayStatus == PayStatus.退款申请中) // { // btnRefund.Visible = true; // } // } // else if (order.OrderStatus == OrderStatus.已发货) // { // if (order.PayStatus == PayStatus.退款申请中) // { // btnRefund.Visible = true; // } // btnCherrys.Visible = true; // txtActionRemark.Visible = true; // } // else if (order.OrderStatus == OrderStatus.物流到货) // { // btnFinish.Visible = true; // txtActionRemark.Visible = true; // } // else if (order.OrderStatus == OrderStatus.买家确认) // { // btnFinish.Visible = true; // txtActionRemark.Visible = true; // } // } // else if (order.PayStatus == PayStatus.退款申请中) // { // txtActionRemark.Visible = true; // btnRefund.Visible = true; // } // else if (order.PayStatus == PayStatus.退款完成) // { // txtActionRemark.Visible = true; // btnFail.Visible = true; // } //} #endregion }