internal static string Serialize(WeekDateTime dateTime, ISO8601Options options) { if (options == null) { options = ISO8601Options.Default; } return dateTime.Date.ToString(options) + dateTime.Time.ToString(options); }
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)); }
internal static CalendarDateTime ToCalendarDateTime(WeekDateTime datetime) { return new CalendarDateTime(datetime.Date.ToCalendarDate(), datetime.Time); }
/// <summary> /// 订单明细(商务) /// </summary> /// <param name="userid"></param> /// <param name="orderBy"></param> /// <param name="searchType"></param> /// <param name="searchname"></param> /// <param name="stime"></param> /// <param name="etime"></param> /// <param name="paymode"></param> /// <param name="paymentstate"></param> /// <param name="noticestate"></param> /// <param name="parameters"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public IPagedList <jmp_order> FindPagedListByBP(int userid, int relationtype, string orderBy, int searchType, string searchname, string stime, string etime, int paymode, string paymentstate, string noticestate, object parameters = null, int pageIndex = 0, int pageSize = 20) { string sql = ""; string sql1 = ""; string TableName = ""; //表名 orderBy = "o_ptime"; //排序字段 ArrayList sjfw = WeekDateTime.WeekMonday(DateTime.Parse(stime), DateTime.Parse(etime)); //根据时间返回获取每周周一组装查询语句 // var where = new List<string>(); string where = " "; string BpWhere = ""; string AgentWhere = ""; for (int i = 0; i < sjfw.Count; i++) { TableName = "jmp_order_" + DateTime.Parse(sjfw[i].ToString()).ToString("yyyyMMdd"); sql += " SELECT o_id,o_code,o_bizcode,o_tradeno,o_paymode_id,o_app_id,o_goodsname,o_term_key,o_price,o_payuser,o_ctime,o_ptime,o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id,o_showaddress FROM " + TableName + " where 1=1 "; if (!string.IsNullOrEmpty(stime) && !string.IsNullOrEmpty(etime)) { sql += " and convert(varchar(10),o_ptime,120)>='" + stime + "' and convert(varchar(10),o_ptime,120)<='" + etime + "' "; } if (paymode > 0) { sql += " and o_paymode_id='" + paymode + "' "; } if (!string.IsNullOrEmpty(paymentstate)) { sql += " and o_state='" + paymentstate + "' "; } if (!string.IsNullOrEmpty(noticestate)) { sql += " and o_noticestate='" + noticestate + "' "; } sql += "AND EXISTS ( SELECT a_id FROM APP WHERE APP.a_id=o_app_id)"; sql += "UNION ALL "; } if (searchType > 0 && !string.IsNullOrEmpty(searchname)) { switch (searchType) { case 1: where += " and ord.o_code='" + searchname + "' "; break; case 2: where += "and app.a_name='" + searchname + "'"; break; case 3: where += " and ord.o_goodsname='" + searchname + "'"; break; case 4: where += " and ord.o_tradeno= '" + searchname + "' "; break; case 5: where += " and ord.o_bizcode like '%" + searchname + "%'"; break; } } if (relationtype > 0) { where += " and users.relation_type = '" + relationtype + "'"; } //查询直客条件 BpWhere = " relation_type =" + (int)Relationtype.Bp + " and relation_person_id=" + userid + ""; AgentWhere = " a.relation_type =" + (int)Relationtype.Agent + " and c.OwnerId=" + userid + ""; //组装时时表数据 sql1 = "SELECT o_id,o_code,o_bizcode,o_tradeno,o_paymode_id,o_app_id,o_goodsname,o_term_key,o_price,o_payuser,o_ctime,o_ptime,o_state,o_times,o_address,o_noticestate,o_noticetimes,o_privateinfo,o_interface_id, o_showaddress FROM jmp_order where 1=1 "; if (!string.IsNullOrEmpty(stime) && !string.IsNullOrEmpty(etime)) { sql1 += " and convert(varchar(10),o_ptime,120)>='" + stime + "' and convert(varchar(10),o_ptime,120)<='" + etime + "' "; } if (paymode > 0) { sql1 += " and o_paymode_id='" + paymode + "' "; } if (!string.IsNullOrEmpty(paymentstate)) { sql1 += " and o_state='" + paymentstate + "' "; } if (!string.IsNullOrEmpty(noticestate)) { sql1 += " and o_noticestate='" + noticestate + "' "; } sql1 += "AND EXISTS ( SELECT a_id FROM APP WHERE APP.a_id=o_app_id)"; sql = sql + sql1; return(_repository.FindPagedListByBP(orderBy, sql, where, BpWhere, AgentWhere, null, pageIndex, pageSize)); }
internal static OrdinalDateTime ToOrdinalDateTime(WeekDateTime datetime) { return new OrdinalDateTime(datetime.Date.ToOrdinalDate(), datetime.Time); }