public ZcOrderRefuse FindById(string id) { ZcOrderRefuse obj = new ZcOrderRefuse(); string sql = "select * from zc_order_refuse where id = @id"; MySqlConnection conn = null; MySqlCommand cmd = new MySqlCommand(); try { conn = GetConnection(); cmd.CommandText = sql; cmd.Connection = conn; cmd.Parameters.AddWithValue("@id", id); 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.orderId = reader.IsDBNull(3) ? string.Empty : reader.GetString(3); obj.orderAmount = reader.IsDBNull(4) ? string.Empty : reader.GetString(4); obj.actualAmount = reader.IsDBNull(5) ? string.Empty : reader.GetString(5); } } catch (Exception ex) { log.Error("根据id获取拒收主表信息失败", ex); } finally { cmd.Dispose(); CloseConnection(conn); } return(obj); }
public void AddZcOrderRefuse(ZcOrderRefuse obj) { string sql = "insert into zc_order_refuse values (@id, @create, @update, @order_id, @order_amount, @actual_amount)"; MySqlConnection conn = null; MySqlTransaction tran = null; MySqlCommand cmd = new MySqlCommand(); try { conn = GetConnection(); tran = conn.BeginTransaction(); cmd.CommandText = sql; cmd.Connection = conn; cmd.Parameters.AddWithValue("@id", obj.id); cmd.Parameters.AddWithValue("@create", obj.createTime); cmd.Parameters.AddWithValue("@update", obj.updateTime); cmd.Parameters.AddWithValue("@order_id", obj.orderId); cmd.Parameters.AddWithValue("@order_amount", obj.orderAmount); cmd.Parameters.AddWithValue("@actual_amount", obj.actualAmount); cmd.ExecuteNonQuery(); tran.Commit(); } catch (Exception ex) { tran.Rollback(); log.Error("添加拒收订单信息异常", ex); } finally { tran.Dispose(); cmd.Dispose(); CloseConnection(conn); } }
public void AddZcOrderRefuse(ZcOrderRefuse obj) { string sql = "insert into zc_order_refuse (id, CREATETIME, UPDATETIME, ACTUAL_AMOUNT, ORDER_AMOUNT, ORDER_ID) values (:id, :createTime, :updateTime, :actual_amount, :order_amount, :order_id)"; 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(":actual_amount", obj.actualAmount); cmd.Parameters.Add(":order_amount", obj.orderAmount); cmd.Parameters.Add(":order_id", obj.orderId); cmd.ExecuteNonQuery(); tran.Commit(); } catch (Exception ex) { tran.Rollback(); UploadDao dao = new UploadDao(); List <UploadInfo> list = new List <UploadInfo>(); UploadInfo obj1 = new UploadInfo(); obj1.Id = obj.id; obj1.CreateTime = DateTime.Now; obj1.UpdateTime = DateTime.Now; obj1.Type = Constant.ZC_ORDER_REFUSE; list.Add(obj1); dao.AddUploadInfo(list); log.Error("上传拒收订单信息异常", ex); } finally { tran.Dispose(); cmd.Dispose(); OracleUtil.CloseConn(conn); } }
public bool AddZcOrderRefuseI(ZcOrderRefuse obj) { bool flag = false; string sql = "insert into zc_order_refuse (id, CREATETIME, UPDATETIME, ACTUAL_AMOUNT, ORDER_AMOUNT, ORDER_ID) values (:id, :createTime, :updateTime, :actual_amount, :order_amount, :order_id)"; 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(":actual_amount", obj.actualAmount); cmd.Parameters.Add(":order_amount", obj.orderAmount); cmd.Parameters.Add(":order_id", obj.orderId); 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); }
public bool AddZcOrderRefuseI(ZcOrderRefuse refuse) { ZcOrderRefuseDao dao = new ZcOrderRefuseDao(); return(dao.AddZcOrderRefuseI(refuse)); }
public void AddZcOrderRefuse(ZcOrderRefuse obj) { ZcOrderRefuseDao dao = new ZcOrderRefuseDao(); dao.AddZcOrderRefuse(obj); }
/// <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); } } } } }
public void AddZcOrderRefuse(ZcOrderRefuse obj) { BranchZcOrderRefuseDao dao = new BranchZcOrderRefuseDao(); dao.AddZcOrderRefuse(obj); }