/// <summary> /// 增加订单明细信息 /// </summary> /// <param name="maxid"></param> private void AddOrderDetail(int maxid, double totalmoney) { if (this.hidorderdetail.Value.Trim() != "") { string[] list = this.hidorderdetail.Value.Trim().TrimEnd(',').Split(','); string[] txt = null; EtNet_Models.AusOrderInfo model = null; for (int i = 0; i < list.Length; i++) { txt = list[i].Split('|'); model = new EtNet_Models.AusOrderInfo(); model.orderId = txt[0] != "" ? int.Parse(txt[0]) : 0; //订单id model.jobflowId = maxid; //工作流id model.orderNum = txt[1]; //订单序号 model.orderType = txt[2]; //订单类型 model.outTime = txt[3] != "" ? DateTime.Parse(txt[3]) : DateTime.Parse("1900-1-1"); //出团日期 model.natrue = txt[4]; //性质 model.tour = txt[5]; //路线 EtNet_BLL.AusOrderInfoManager.Add(model); EtNet_Models.To_OrderInfo orderInfo = To_OrderInfoManager.getTo_OrderInfoById(model.orderId); if (orderInfo != null) { orderInfo.Gross = orderInfo.Gross - totalmoney; To_OrderInfoManager.updateOrderGross(orderInfo); } } } }
/// <summary> /// 得到一个对象实例 /// </summary> /// <param name="id"></param> /// <returns></returns> public static EtNet_Models.AusOrderInfo GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from AusOrderInfo "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = id; EtNet_Models.AusOrderInfo model = null; DataTable dt = DBHelper.GetDataSet(strSql.ToString(), parameters); if (dt.Rows.Count > 0) { model = new EtNet_Models.AusOrderInfo(); model.id = Convert.ToInt32(dt.Rows[0]["id"]); model.orderId = Convert.ToInt32(dt.Rows[0]["orderId"]); model.orderNum = dt.Rows[0]["orderNum"].ToString(); model.orderType = dt.Rows[0]["orderType"].ToString(); model.outTime = Convert.ToDateTime(dt.Rows[0]["outTime"]); model.natrue = dt.Rows[0]["natrue"].ToString(); model.tour = dt.Rows[0]["tour"].ToString(); } return(model); }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool Update(EtNet_Models.AusOrderInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update AusOrderInfo set "); strSql.Append("orderId=@orderId,"); strSql.Append("jobflowId=@jobflowId,"); strSql.Append("orderNum=@orderNum,"); strSql.Append("orderType=@orderType,"); strSql.Append("outTime=@outTime,"); strSql.Append("natrue=@natrue,"); strSql.Append("tour=@tour"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@orderId", SqlDbType.Int, 4), new SqlParameter("@jobflowId", SqlDbType.Int, 4), new SqlParameter("@orderNum", SqlDbType.VarChar, 50), new SqlParameter("@orderType", SqlDbType.VarChar, 50), new SqlParameter("@outTime", SqlDbType.DateTime), new SqlParameter("@natrue", SqlDbType.VarChar, 50), new SqlParameter("@tour", SqlDbType.VarChar, 200), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.orderId; parameters[1].Value = model.jobflowId; parameters[2].Value = model.orderNum; parameters[3].Value = model.orderType; parameters[4].Value = model.outTime; parameters[5].Value = model.natrue; parameters[6].Value = model.tour; parameters[7].Value = model.id; int result = DBHelper.ExecuteCommand(strSql.ToString(), parameters); if (result >= 1) { return(true); } else { return(false); } }
/// <summary> /// 新增一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool Add(EtNet_Models.AusOrderInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into AusOrderInfo("); strSql.Append("orderId,jobflowId,orderNum,orderType,outTime,natrue,tour)"); strSql.Append(" values ("); strSql.Append("@orderId,@jobflowId,@orderNum,@orderType,@outTime,@natrue,@tour)"); SqlParameter[] parameters = { new SqlParameter("@orderId", SqlDbType.Int, 4), new SqlParameter("@jobflowId", SqlDbType.Int, 4), new SqlParameter("@orderNum", SqlDbType.VarChar, 50), new SqlParameter("@orderType", SqlDbType.VarChar, 50), new SqlParameter("@outTime", SqlDbType.DateTime), new SqlParameter("@natrue", SqlDbType.VarChar, 50), new SqlParameter("@tour", SqlDbType.VarChar, 200) }; parameters[0].Value = model.orderId; parameters[1].Value = model.jobflowId; parameters[2].Value = model.orderNum; parameters[3].Value = model.orderType; parameters[4].Value = model.outTime; parameters[5].Value = model.natrue; parameters[6].Value = model.tour; int result = DBHelper.ExecuteCommand(strSql.ToString(), parameters); if (result >= 1) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool Update(EtNet_Models.AusOrderInfo model) { return(EtNet_DAL.AusOrderInfoService.Update(model)); }
/// <summary> /// 新增一条数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool Add(EtNet_Models.AusOrderInfo model) { return(EtNet_DAL.AusOrderInfoService.Add(model)); }