public ActionResult ComplainHandler() { int id = string.IsNullOrEmpty(Request["id"]) ? 0 : int.Parse(Request["id"]); //得到一个实体 cscomod = cscobll.GetModel(id); ViewBag.cscomod = cscomod; return(View()); }
public ActionResult ComplainOrderUpdate() { int id = string.IsNullOrEmpty(Request["id"]) ? 0 : int.Parse(Request["id"]); if (id > 0) { cscomod = cscobll.GetModel(id); string[] Envidence = cscomod.Envidence.Split(','); ViewBag.Envidence = Envidence; } ViewBag.UploadUrl = ConfigurationManager.AppSettings["imgurl"]; ViewBag.cscomod = cscomod; return(View()); }
public ActionResult ComplainOrderAdd() { string o_code = string.IsNullOrEmpty(Request["o_code"]) ? "" : Request["o_code"]; string u_id = string.IsNullOrEmpty(Request["u_id"]) ? "" : Request["u_id"]; //appId string o_app_id = string.IsNullOrEmpty(Request["o_app_id"]) ? "" : Request["o_app_id"]; //通道配置表ID int o_interface_id = string.IsNullOrEmpty(Request["o_interface_id"]) ? 0 : int.Parse(Request["o_interface_id"]); //查询投诉类型名称 cscomod = cscobll.SelectListOrder(o_code); ViewBag.CustomModel = cscomod; ViewBag.o_code = o_code; ViewBag.u_id = u_id; ViewBag.o_app_id = o_app_id; ViewBag.o_interface_id = o_interface_id; return(View()); }
public JsonResult CustomAdd(JMP.MDL.CsComplainOrder mode) { object retJson = new { success = 0, msg = "操作失败" }; if (mode.Id > 0) { #region 修改 //得到一个实体对象 cscomod = cscobll.GetModel(mode.Id); //拷贝 var mocolne = cscomod.Clone(); cscomod.ComplainTypeId = mode.ComplainTypeId; cscomod.ComplainTypeName = mode.ComplainTypeName; cscomod.ComplainDate = mode.ComplainDate; cscomod.Envidence = mode.Envidence; cscomod.DownstreamStartTime = mode.DownstreamStartTime; cscomod.DownstreamEndTime = mode.DownstreamEndTime; if (cscobll.Update(cscomod)) { Logger.ModifyLog("修改投诉", mocolne, cscomod); retJson = new { success = 1, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } #endregion } else { //判断该订单是否已经添加到投诉表中 var exists = cscobll.GetModelList(string.Format("OrderNumber='{0}'", mode.OrderNumber.Replace("'", "''"))); if (exists != null && exists.Count > 0) { return(Json(new { success = 0, msg = "此订单已提交过了" })); } var time = DateTime.ParseExact(mode.OrderNumber.Substring(0, 8), "yyyyMMdd", CultureInfo.CurrentCulture); var tableName = WeekDateTime.GetOrderTableName(time.ToString(CultureInfo.InvariantCulture)); mode.state = 0; mode.CreatedOn = DateTime.Now; mode.FounderId = UserInfo.UserId; mode.FounderName = UserInfo.UserName; mode.OrderTable = tableName; try { //从订单归档表读取订单金额 var orderBll = new JMP.BLL.jmp_order(); var archiveOrder = orderBll.FindOrderByTableNameAndOrderNo(tableName, mode.OrderNumber); if (archiveOrder == null || archiveOrder.o_price <= 0) { retJson = new { success = 0, msg = "添加失败[读取订单金额失败]" }; GlobalErrorLogger.Log("添加失败[读取订单金额失败]", summary: "添加投诉失败"); return(Json(retJson)); } mode.Price = archiveOrder.o_price; } catch (Exception ex) { retJson = new { success = 0, msg = "添加失败[读取订单金额失败]" }; GlobalErrorLogger.Log("添加失败[读取订单金额失败]", summary: "添加投诉失败"); return(Json(retJson)); } int num = cscobll.Add(mode); if (num > 0) { Logger.CreateLog("添加投诉", mode); retJson = new { success = 1, msg = "添加成功" }; } else { retJson = new { success = 0, msg = "添加失败" }; } } return(Json(retJson)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.CsComplainOrder model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into CsComplainOrder("); strSql.Append("Envidence,HandlerId,HandlerName,HandleDate,HandleResult,state,FounderId,FounderName,IsRefund,Price,OrderNumber,DownstreamStartTime,DownstreamEndTime,ChannelId,OrderTable,UserId,AppId,ComplainTypeId,ComplainTypeName,ComplainDate,CreatedOn"); strSql.Append(") values ("); strSql.Append("@Envidence,@HandlerId,@HandlerName,@HandleDate,@HandleResult,@state,@FounderId,@FounderName,@IsRefund,@Price,@OrderNumber,@DownstreamStartTime,@DownstreamEndTime,@ChannelId,@OrderTable,@UserId,@AppId,@ComplainTypeId,@ComplainTypeName,@ComplainDate,@CreatedOn"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Envidence", SqlDbType.NVarChar, -1), new SqlParameter("@HandlerId", SqlDbType.Int, 4), new SqlParameter("@HandlerName", SqlDbType.NVarChar, 50), new SqlParameter("@HandleDate", SqlDbType.DateTime), new SqlParameter("@HandleResult", SqlDbType.NVarChar, 500), new SqlParameter("@state", SqlDbType.Int, 4), new SqlParameter("@FounderId", SqlDbType.Int, 4), new SqlParameter("@FounderName", SqlDbType.NVarChar, 50), new SqlParameter("@IsRefund", SqlDbType.Bit, 1), new SqlParameter("@Price", SqlDbType.Money, 8), new SqlParameter("@OrderNumber", SqlDbType.NVarChar, 50), new SqlParameter("@DownstreamStartTime", SqlDbType.DateTime), new SqlParameter("@DownstreamEndTime", SqlDbType.DateTime), new SqlParameter("@ChannelId", SqlDbType.Int, 4), new SqlParameter("@OrderTable", SqlDbType.NVarChar, 30), new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@AppId", SqlDbType.Int, 4), new SqlParameter("@ComplainTypeId", SqlDbType.Int, 4), new SqlParameter("@ComplainTypeName", SqlDbType.NVarChar, 50), new SqlParameter("@ComplainDate", SqlDbType.DateTime), new SqlParameter("@CreatedOn", SqlDbType.DateTime) }; parameters[0].Value = model.Envidence; parameters[1].Value = model.HandlerId; parameters[2].Value = model.HandlerName; parameters[3].Value = model.HandleDate; parameters[4].Value = model.HandleResult; parameters[5].Value = model.state; parameters[6].Value = model.FounderId; parameters[7].Value = model.FounderName; parameters[8].Value = model.IsRefund; parameters[9].Value = model.Price; parameters[10].Value = model.OrderNumber; parameters[11].Value = model.DownstreamStartTime; parameters[12].Value = model.DownstreamEndTime; parameters[13].Value = model.ChannelId; parameters[14].Value = model.OrderTable; parameters[15].Value = model.UserId; parameters[16].Value = model.AppId; parameters[17].Value = model.ComplainTypeId; parameters[18].Value = model.ComplainTypeName; parameters[19].Value = model.ComplainDate; parameters[20].Value = model.CreatedOn; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public JMP.MDL.CsComplainOrder GetModel(int Id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select Id, Envidence, HandlerId, HandlerName, HandleDate, HandleResult, state, FounderId, FounderName, IsRefund, Price, OrderNumber, DownstreamStartTime, DownstreamEndTime, ChannelId, OrderTable, UserId, AppId, ComplainTypeId, ComplainTypeName, ComplainDate, CreatedOn "); strSql.Append(" from CsComplainOrder "); strSql.Append(" where Id=@Id"); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) }; parameters[0].Value = Id; JMP.MDL.CsComplainOrder model = new JMP.MDL.CsComplainOrder(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Id"].ToString() != "") { model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString()); } model.Envidence = ds.Tables[0].Rows[0]["Envidence"].ToString(); if (ds.Tables[0].Rows[0]["HandlerId"].ToString() != "") { model.HandlerId = int.Parse(ds.Tables[0].Rows[0]["HandlerId"].ToString()); } model.HandlerName = ds.Tables[0].Rows[0]["HandlerName"].ToString(); if (ds.Tables[0].Rows[0]["HandleDate"].ToString() != "") { model.HandleDate = DateTime.Parse(ds.Tables[0].Rows[0]["HandleDate"].ToString()); } model.HandleResult = ds.Tables[0].Rows[0]["HandleResult"].ToString(); if (ds.Tables[0].Rows[0]["state"].ToString() != "") { model.state = int.Parse(ds.Tables[0].Rows[0]["state"].ToString()); } if (ds.Tables[0].Rows[0]["FounderId"].ToString() != "") { model.FounderId = int.Parse(ds.Tables[0].Rows[0]["FounderId"].ToString()); } model.FounderName = ds.Tables[0].Rows[0]["FounderName"].ToString(); if (ds.Tables[0].Rows[0]["IsRefund"].ToString() != "") { if ((ds.Tables[0].Rows[0]["IsRefund"].ToString() == "1") || (ds.Tables[0].Rows[0]["IsRefund"].ToString().ToLower() == "true")) { model.IsRefund = true; } else { model.IsRefund = false; } } if (ds.Tables[0].Rows[0]["Price"].ToString() != "") { model.Price = decimal.Parse(ds.Tables[0].Rows[0]["Price"].ToString()); } model.OrderNumber = ds.Tables[0].Rows[0]["OrderNumber"].ToString(); if (ds.Tables[0].Rows[0]["DownstreamStartTime"].ToString() != "") { model.DownstreamStartTime = DateTime.Parse(ds.Tables[0].Rows[0]["DownstreamStartTime"].ToString()); } if (ds.Tables[0].Rows[0]["DownstreamEndTime"].ToString() != "") { model.DownstreamEndTime = DateTime.Parse(ds.Tables[0].Rows[0]["DownstreamEndTime"].ToString()); } if (ds.Tables[0].Rows[0]["ChannelId"].ToString() != "") { model.ChannelId = int.Parse(ds.Tables[0].Rows[0]["ChannelId"].ToString()); } model.OrderTable = ds.Tables[0].Rows[0]["OrderTable"].ToString(); if (ds.Tables[0].Rows[0]["UserId"].ToString() != "") { model.UserId = int.Parse(ds.Tables[0].Rows[0]["UserId"].ToString()); } if (ds.Tables[0].Rows[0]["AppId"].ToString() != "") { model.AppId = int.Parse(ds.Tables[0].Rows[0]["AppId"].ToString()); } if (ds.Tables[0].Rows[0]["ComplainTypeId"].ToString() != "") { model.ComplainTypeId = int.Parse(ds.Tables[0].Rows[0]["ComplainTypeId"].ToString()); } model.ComplainTypeName = ds.Tables[0].Rows[0]["ComplainTypeName"].ToString(); if (ds.Tables[0].Rows[0]["ComplainDate"].ToString() != "") { model.ComplainDate = DateTime.Parse(ds.Tables[0].Rows[0]["ComplainDate"].ToString()); } if (ds.Tables[0].Rows[0]["CreatedOn"].ToString() != "") { model.CreatedOn = DateTime.Parse(ds.Tables[0].Rows[0]["CreatedOn"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JMP.MDL.CsComplainOrder model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update CsComplainOrder set "); strSql.Append(" Envidence = @Envidence , "); strSql.Append(" HandlerId = @HandlerId , "); strSql.Append(" HandlerName = @HandlerName , "); strSql.Append(" HandleDate = @HandleDate , "); strSql.Append(" HandleResult = @HandleResult , "); strSql.Append(" state = @state , "); strSql.Append(" FounderId = @FounderId , "); strSql.Append(" FounderName = @FounderName , "); strSql.Append(" IsRefund = @IsRefund , "); strSql.Append(" Price = @Price , "); strSql.Append(" OrderNumber = @OrderNumber , "); strSql.Append(" DownstreamStartTime = @DownstreamStartTime , "); strSql.Append(" DownstreamEndTime = @DownstreamEndTime , "); strSql.Append(" ChannelId = @ChannelId , "); strSql.Append(" OrderTable = @OrderTable , "); strSql.Append(" UserId = @UserId , "); strSql.Append(" AppId = @AppId , "); strSql.Append(" ComplainTypeId = @ComplainTypeId , "); strSql.Append(" ComplainTypeName = @ComplainTypeName , "); strSql.Append(" ComplainDate = @ComplainDate , "); strSql.Append(" CreatedOn = @CreatedOn "); strSql.Append(" where Id=@Id "); SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4), new SqlParameter("@Envidence", SqlDbType.NVarChar, -1), new SqlParameter("@HandlerId", SqlDbType.Int, 4), new SqlParameter("@HandlerName", SqlDbType.NVarChar, 50), new SqlParameter("@HandleDate", SqlDbType.DateTime), new SqlParameter("@HandleResult", SqlDbType.NVarChar, 500), new SqlParameter("@state", SqlDbType.Int, 4), new SqlParameter("@FounderId", SqlDbType.Int, 4), new SqlParameter("@FounderName", SqlDbType.NVarChar, 50), new SqlParameter("@IsRefund", SqlDbType.Bit, 1), new SqlParameter("@Price", SqlDbType.Money, 8), new SqlParameter("@OrderNumber", SqlDbType.NVarChar, 50), new SqlParameter("@DownstreamStartTime", SqlDbType.DateTime), new SqlParameter("@DownstreamEndTime", SqlDbType.DateTime), new SqlParameter("@ChannelId", SqlDbType.Int, 4), new SqlParameter("@OrderTable", SqlDbType.NVarChar, 30), new SqlParameter("@UserId", SqlDbType.Int, 4), new SqlParameter("@AppId", SqlDbType.Int, 4), new SqlParameter("@ComplainTypeId", SqlDbType.Int, 4), new SqlParameter("@ComplainTypeName", SqlDbType.NVarChar, 50), new SqlParameter("@ComplainDate", SqlDbType.DateTime), new SqlParameter("@CreatedOn", SqlDbType.DateTime) }; parameters[0].Value = model.Id; parameters[1].Value = model.Envidence; parameters[2].Value = model.HandlerId; parameters[3].Value = model.HandlerName; parameters[4].Value = model.HandleDate; parameters[5].Value = model.HandleResult; parameters[6].Value = model.state; parameters[7].Value = model.FounderId; parameters[8].Value = model.FounderName; parameters[9].Value = model.IsRefund; parameters[10].Value = model.Price; parameters[11].Value = model.OrderNumber; parameters[12].Value = model.DownstreamStartTime; parameters[13].Value = model.DownstreamEndTime; parameters[14].Value = model.ChannelId; parameters[15].Value = model.OrderTable; parameters[16].Value = model.UserId; parameters[17].Value = model.AppId; parameters[18].Value = model.ComplainTypeId; parameters[19].Value = model.ComplainTypeName; parameters[20].Value = model.ComplainDate; parameters[21].Value = model.CreatedOn; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 获得数据列表 /// </summary> public List <JMP.MDL.CsComplainOrder> DataTableToList(DataTable dt) { List <JMP.MDL.CsComplainOrder> modelList = new List <JMP.MDL.CsComplainOrder>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { JMP.MDL.CsComplainOrder model; for (int n = 0; n < rowsCount; n++) { model = new JMP.MDL.CsComplainOrder(); if (dt.Rows[n]["Id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["Id"].ToString()); } model.Envidence = dt.Rows[n]["Envidence"].ToString(); if (dt.Rows[n]["HandlerId"].ToString() != "") { model.HandlerId = int.Parse(dt.Rows[n]["HandlerId"].ToString()); } model.HandlerName = dt.Rows[n]["HandlerName"].ToString(); if (dt.Rows[n]["HandleDate"].ToString() != "") { model.HandleDate = DateTime.Parse(dt.Rows[n]["HandleDate"].ToString()); } model.HandleResult = dt.Rows[n]["HandleResult"].ToString(); if (dt.Rows[n]["state"].ToString() != "") { model.state = int.Parse(dt.Rows[n]["state"].ToString()); } if (dt.Rows[n]["FounderId"].ToString() != "") { model.FounderId = int.Parse(dt.Rows[n]["FounderId"].ToString()); } model.FounderName = dt.Rows[n]["FounderName"].ToString(); if (dt.Rows[n]["IsRefund"].ToString() != "") { if ((dt.Rows[n]["IsRefund"].ToString() == "1") || (dt.Rows[n]["IsRefund"].ToString().ToLower() == "true")) { model.IsRefund = true; } else { model.IsRefund = false; } } if (dt.Rows[n]["Price"].ToString() != "") { model.Price = decimal.Parse(dt.Rows[n]["Price"].ToString()); } model.OrderNumber = dt.Rows[n]["OrderNumber"].ToString(); if (dt.Rows[n]["DownstreamStartTime"].ToString() != "") { model.DownstreamStartTime = DateTime.Parse(dt.Rows[n]["DownstreamStartTime"].ToString()); } if (dt.Rows[n]["DownstreamEndTime"].ToString() != "") { model.DownstreamEndTime = DateTime.Parse(dt.Rows[n]["DownstreamEndTime"].ToString()); } if (dt.Rows[n]["ChannelId"].ToString() != "") { model.ChannelId = int.Parse(dt.Rows[n]["ChannelId"].ToString()); } model.OrderTable = dt.Rows[n]["OrderTable"].ToString(); if (dt.Rows[n]["UserId"].ToString() != "") { model.UserId = int.Parse(dt.Rows[n]["UserId"].ToString()); } if (dt.Rows[n]["AppId"].ToString() != "") { model.AppId = int.Parse(dt.Rows[n]["AppId"].ToString()); } if (dt.Rows[n]["ComplainTypeId"].ToString() != "") { model.ComplainTypeId = int.Parse(dt.Rows[n]["ComplainTypeId"].ToString()); } model.ComplainTypeName = dt.Rows[n]["ComplainTypeName"].ToString(); if (dt.Rows[n]["ComplainDate"].ToString() != "") { model.ComplainDate = DateTime.Parse(dt.Rows[n]["ComplainDate"].ToString()); } if (dt.Rows[n]["CreatedOn"].ToString() != "") { model.CreatedOn = DateTime.Parse(dt.Rows[n]["CreatedOn"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JMP.MDL.CsComplainOrder model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JMP.MDL.CsComplainOrder model) { return(dal.Add(model)); }