/// <summary> /// 删除订单 /// </summary> private string DelChargeReceipt_New(DataRow row) { if (!row.Table.Columns.Contains("ReceiptCode") || string.IsNullOrEmpty(row["ReceiptCode"].ToString())) { return(JSONHelper.FromString(false, "订单id不能为空")); } if (!row.Table.Columns.Contains("CorpId") || string.IsNullOrEmpty(row["CorpId"].ToString())) { return(JSONHelper.FromString(false, "物管公司id不能为空")); } string str = ""; try { IDbConnection con = new SqlConnection(PubConstant.GetConnectionString("BusinessContionString")); Tb_Charge_Receipt charge = BussinessCommon.GetChargeReceiptModel(row["ReceiptCode"].ToString()); if (charge != null) { charge.IsDelete = 1; charge.CancellationType = 1;//业主主动取消 charge.CancellationTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); charge.CancellationReason = ""; con.Update <Tb_Charge_Receipt>(charge); con.Execute("update Tb_Charge_ReceiptDetail set RpdIsDelete=1 where ReceiptCode=@ReceiptCode", new { ReceiptCode = charge.Id }); if (charge.IsUseCoupon.HasValue && charge.IsUseCoupon.Value == 1) { con.Execute("proc_Resources_CouponBalance_Return", new { CorpId = AppGlobal.StrToInt(row["CorpId"].ToString()), ReceiptCode = charge.Id }, null, null, CommandType.StoredProcedure); } } else { str = "删除失败"; } } catch (Exception ex) { str = ex.Message; } if (str != "") { return(JSONHelper.FromString(false, str)); } else { return(JSONHelper.FromString(true, "")); } }
/// <summary> /// 修改订单处理状态 UpdateChargeHandleState /// </summary> /// <param name="row"></param> /// ReceiptCode 商品订单票据编码 /// 返回: /// true:"" /// false:删除失败 /// <returns></returns> private string UpdateChargeHandleState(DataRow row) { if (!row.Table.Columns.Contains("ReceiptCode") || string.IsNullOrEmpty(row["ReceiptCode"].ToString())) { return(JSONHelper.FromString(false, "订单不能为空")); } string str = ""; try { IDbConnection con = new SqlConnection(PubConstant.GetConnectionString("BusinessContionString")); Tb_Charge_Receipt charge = BussinessCommon.GetChargeReceiptModel(row["ReceiptCode"].ToString()); if (charge != null) { charge.IsDeliver = "已发货"; charge.IsReceive = "已收货"; charge.ConfirmReceivedTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); con.Update <Tb_Charge_Receipt>(charge); } else { str = "修改失败"; } } catch (Exception ex) { str = ex.Message; } if (str != "") { return(JSONHelper.FromString(false, str)); } else { return(JSONHelper.FromString(true, "")); } }
/// <summary> /// 删除订单 DelChargeReceipt /// </summary> /// <param name="row"></param> /// ReceiptCode 商品订单票据编码 /// 返回: /// true:"" /// false:删除失败 /// <returns></returns> private string DelChargeReceipt(DataRow row) { if (!row.Table.Columns.Contains("ReceiptCode") || string.IsNullOrEmpty(row["ReceiptCode"].ToString())) { return(JSONHelper.FromString(false, "订单不能为空")); } string str = ""; try { IDbConnection con = new SqlConnection(PubConstant.GetConnectionString("BusinessContionString")); Tb_Charge_Receipt charge = BussinessCommon.GetChargeReceiptModel(row["ReceiptCode"].ToString()); if (charge != null) { charge.IsDelete = 1; con.Update <Tb_Charge_Receipt>(charge); con.ExecuteScalar("update Tb_Charge_ReceiptDetail set RpdIsDelete=1 where ReceiptCode=@ReceiptCode", new { ReceiptCode = charge.Id }, null, null, CommandType.Text); } else { str = "删除失败"; } } catch (Exception ex) { str = ex.Message; } if (str != "") { return(JSONHelper.FromString(false, str)); } else { return(JSONHelper.FromString(true, "")); } }