/// <summary> /// 上传退款信息 /// </summary> /// <param name="obj"></param> public void AddZcOrderRefund(ZcOrderRefund obj) { string sql = "insert into zc_order_refund (id, createTime, updateTime, order_id, order_amount, actual_amount, order_refund_status, hand_date) values (:id,:createTime,:updateTime,:order_id,:order_amount,:actual_amount,:order_refund_status,:hand_date)"; OracleConnection conn = null; OracleTransaction tran = null; OracleCommand cmd = new OracleCommand(); try { conn = OracleUtil.OpenConn(); tran = conn.BeginTransaction(); cmd.CommandText = sql; cmd.Connection = conn; cmd.Parameters.Add(":id", obj.Id); cmd.Parameters.Add(":createTime", obj.CreateTime); cmd.Parameters.Add(":updateTime", obj.UpdateTime); cmd.Parameters.Add(":order_id", obj.Order_id); cmd.Parameters.Add(":order_amount", obj.Order_amount); cmd.Parameters.Add(":actual_amount", obj.Actual_amount); cmd.Parameters.Add(":order_refund_status", obj.Order_refund_status); cmd.Parameters.Add(":hand_date", obj.Hand_date); cmd.ExecuteNonQuery(); tran.Commit(); } catch (Exception ex) { tran.Rollback(); List <UploadInfo> uploadList = new List <UploadInfo>(); UploadDao dao = new UploadDao(); UploadInfo obj1 = new UploadInfo(); obj1.Id = obj.Id; obj1.CreateTime = DateTime.Now; obj1.UpdateTime = DateTime.Now; obj1.Type = Constant.ZC_ORDER_REFUND; uploadList.Add(obj1); dao.AddUploadInfo(uploadList); log.Error("上传退款信息到服务器失败", ex); } finally { tran.Dispose(); cmd.Dispose(); OracleUtil.CloseConn(conn); } }
public bool AddZcOrderRefundI(ZcOrderRefund obj) { bool flag = false; string sql = "insert into zc_order_refund (id, createTime, updateTime, order_id, order_amount, actual_amount, order_refund_status, hand_date) values (:id,:createTime,:updateTime,:order_id,:order_amount,:actual_amount,:order_refund_status,:hand_date)"; OracleConnection conn = null; OracleTransaction tran = null; OracleCommand cmd = new OracleCommand(); try { conn = OracleUtil.OpenConn(); tran = conn.BeginTransaction(); cmd.CommandText = sql; cmd.Connection = conn; cmd.Parameters.Add(":id", obj.Id); cmd.Parameters.Add(":createTime", obj.CreateTime); cmd.Parameters.Add(":updateTime", obj.UpdateTime); cmd.Parameters.Add(":order_id", obj.Order_id); cmd.Parameters.Add(":order_amount", obj.Order_amount); cmd.Parameters.Add(":actual_amount", obj.Actual_amount); cmd.Parameters.Add(":order_refund_status", obj.Order_refund_status); cmd.Parameters.Add(":hand_date", obj.Hand_date); cmd.ExecuteNonQuery(); tran.Commit(); flag = true; } catch (Exception ex) { tran.Rollback(); flag = false; log.Error("上传退款信息到服务器失败", ex); } finally { tran.Dispose(); cmd.Dispose(); OracleUtil.CloseConn(conn); } return(flag); }
/// <summary> /// 添加 /// </summary> /// <param name="obj"></param> public void AddZcOrderRefund(ZcOrderRefund obj) { string sql = "insert into zc_order_refund values (@id,@createTime,@updateTime,@order_id,@order_amount,@actual_amount,@order_refund_status,@hand_date)"; MySqlConnection conn = null; MySqlTransaction tran = null; MySqlCommand cmd = new MySqlCommand(); try { conn = GetConnection(); tran = conn.BeginTransaction(); cmd.CommandText = sql; cmd.Connection = conn; cmd.Parameters.Add(new MySqlParameter("@id", obj.Id)); cmd.Parameters.Add(new MySqlParameter("@createTime", obj.CreateTime)); cmd.Parameters.Add(new MySqlParameter("@updateTime", obj.UpdateTime)); cmd.Parameters.Add(new MySqlParameter("@order_id", obj.Order_id)); cmd.Parameters.Add(new MySqlParameter("@order_amount", obj.Order_amount)); cmd.Parameters.Add(new MySqlParameter("@actual_amount", obj.Actual_amount)); cmd.Parameters.Add(new MySqlParameter("@order_refund_status", obj.Order_refund_status)); cmd.Parameters.Add(new MySqlParameter("@hand_date", obj.Hand_date)); cmd.ExecuteNonQuery(); tran.Commit(); } catch (Exception ex) { tran.Rollback(); log.Error("新增ZcOrderRefund发生异常", ex); } finally { cmd.Dispose(); tran.Dispose(); CloseConnection(conn); } }
public ZcOrderRefund FindById(string p) { ZcOrderRefund obj = new ZcOrderRefund(); string sql = "select * from zc_order_refund where id = @id"; MySqlConnection conn = null; MySqlCommand cmd = new MySqlCommand(); try { conn = GetConnection(); cmd.CommandText = sql; cmd.Connection = conn; cmd.Parameters.AddWithValue("@id", p); MySqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { obj.Id = reader.IsDBNull(0) ? string.Empty : reader.GetString(0); obj.CreateTime = reader.IsDBNull(1) ? default(DateTime) : reader.GetDateTime(1); obj.UpdateTime = reader.IsDBNull(2) ? default(DateTime) : reader.GetDateTime(2); obj.Order_id = reader.IsDBNull(3) ? string.Empty : reader.GetString(3); obj.Order_amount = reader.IsDBNull(4) ? string.Empty : reader.GetString(4); obj.Actual_amount = reader.IsDBNull(5) ? string.Empty : reader.GetString(5); obj.Order_refund_status = reader.IsDBNull(6) ? string.Empty : reader.GetString(6); obj.Hand_date = reader.IsDBNull(7) ? default(DateTime) : reader.GetDateTime(7); } } catch (Exception ex) { log.Error("根据id获取退款信息失败", ex); } finally { cmd.Dispose(); CloseConnection(conn); } return(obj); }
public bool AddZcOrderRefundI(ZcOrderRefund obj) { RefundInfoDao dao = new RefundInfoDao(); return(dao.AddZcOrderRefundI(obj)); }
/// <summary> /// 上传退款信息 /// </summary> /// <param name="obj"></param> public void AddZcOrderRefund(ZcOrderRefund obj) { RefundInfoDao dao = new RefundInfoDao(); dao.AddZcOrderRefund(obj); }
public void AddZcOrderRefund(ZcOrderRefund zcOrderRefund) { BranchZcOrderRefundDao dao = new BranchZcOrderRefundDao(); dao.AddZcOrderRefund(zcOrderRefund); }
/// <summary> /// 网络连通时,上传数据 /// </summary> public static void Upload() { UploadDao dao = new UploadDao(); int count = dao.QueryCount(); if (count != 0) { List <UploadInfo> list = dao.FindAll(); foreach (UploadInfo obj in list) { if (obj.Type == Constant.DAILY_RECEIVE_GOODS) { BranchDailyReceiveGoodsDao dailyDao = new BranchDailyReceiveGoodsDao(); DailyReceiveGoods drg = dailyDao.FindById(obj.Id); drg.CreateTime = DateTime.Now; drg.UpdateTime = DateTime.Now; DailyReceiveGoodsService service = new DailyReceiveGoodsService(); bool flag = service.AddDailyReceiveGoods(drg); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } else if (obj.Type == Constant.ZC_ORDER_TRANSIT_UPDATE) { ZcOrderTransitService service = new ZcOrderTransitService(); bool flag = service.UpdateStatus(obj.Id, Constant.ORDER_STATUS_RECEIPT); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } else if (obj.Type == Constant.PAY_INFO) { BranchPayInfoService service = new BranchPayInfoService(); PayInfo payInfo = service.FindById(obj.Id); PayInfoService masterService = new PayInfoService(); bool flag = masterService.AddPayInfoI(payInfo); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } else if (obj.Type == Constant.ZC_ORDER_HISTORY) { BranchZcOrderHistoryService branchService = new BranchZcOrderHistoryService(); ZcOrderHistory history = branchService.FindById(obj.Id); ZcOrderHistoryService service = new ZcOrderHistoryService(); bool flag = service.AddZcOrderHistoryI(history); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } else if (obj.Type == Constant.ZC_ORDER_HISTORY_ITEM) { BranchZcOrderHistoryItemService branchService = new BranchZcOrderHistoryItemService(); ZcOrderHistoryItem item = branchService.FindById(obj.Id); ZcOrderHistoryItemService service = new ZcOrderHistoryItemService(); bool flag = service.AddZcOrderHistoryItemI(item); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } else if (obj.Type == Constant.ZC_ORDER_TRANSIT_DELETE) { ZcOrderTransitService service = new ZcOrderTransitService(); bool flag = service.DeleteById(obj.Id); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } else if (obj.Type == Constant.ZC_ORDER_TRANSIT_ITEM_DELETE) { ZcOrderTransitItemService service = new ZcOrderTransitItemService(); bool flag = service.DeleteByOrderIdI(obj.Id); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } else if (obj.Type == Constant.ZC_ORDER_REFUSE) { BranchZcOrderRefuseService branchService = new BranchZcOrderRefuseService(); ZcOrderRefuse refuse = branchService.FindById(obj.Id); ZcOrderRefuseService service = new ZcOrderRefuseService(); bool flag = service.AddZcOrderRefuseI(refuse); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } else if (obj.Type == Constant.ZC_ORDER_REFUSE_ITEM) { BranchZcOrderRefuseItemService branchService = new BranchZcOrderRefuseItemService(); ZcOrderRefuseItem item = branchService.FindById(obj.Id); ZcOrderRefuseItemService service = new ZcOrderRefuseItemService(); bool flag = service.AddZcOrderRefuseItemI(item); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } else if (obj.Type == Constant.ZC_ORDER_REFUND) { BranchZcOrderRefundService branchService = new BranchZcOrderRefundService(); ZcOrderRefund refund = branchService.FindById(obj.Id); RefundInfoService service = new RefundInfoService(); bool flag = service.AddZcOrderRefundI(refund); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } else if (obj.Type == Constant.ZC_ORDER_REFUND_ITEM) { BranchZcOrderRefundItemService branchService = new BranchZcOrderRefundItemService(); ZcOrderRefundItem item = branchService.FindById(obj.Id); RefundInfoService service = new RefundInfoService(); bool flag = service.AddZcOrderRefundItemI(item); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } else if (obj.Type == Constant.ZC_ORDER_HISTORY_UPDATE) { BranchZcOrderHistoryService branchService = new BranchZcOrderHistoryService(); ZcOrderHistory history = branchService.FindById(obj.Id); ZcOrderHistoryService service = new ZcOrderHistoryService(); bool flag = service.UpdateOrderStatusByIdsI(obj.Id, history.OrderStatus); if (flag) { dao.DeleteByIdAndType(obj.Id, obj.Type); } } } } }