public void updateJzxSj(yw_hddz_jzxxxEntity jzx, string status) { using (var conn = ConnectionFactory.CreateConnection()) { if (conn.State == System.Data.ConnectionState.Closed) { conn.Open(); } StringBuilder sql = new StringBuilder(); sql.Append("update yw_hddz_jzxxx set "); switch (status) { case "0": sql.Append("xcsj=@xcsj "); break; case "1": sql.Append("cgqsj=@cgqsj "); break; default: throw new Exception("status值不正确必须为1或0"); } sql.Append(" where ywbh=@ywbh and cxh=@cxh "); conn.Execute(sql.ToString(), jzx); } }
/// <summary> /// 更新靠港时间 /// </summary> /// <param name="context"></param> public void updateContainerTime(HttpContext context) { string jzxh = request.Params["boxNumber"]; string ztdh = request.Params["ladingBill"]; string sj = request.Params["time"]; string type = request.Params["status"]; try { writeLog(string.Format("updateContainerTime收到参数,boxNumber={0}&ladingBill={1}&time={2}&status={3}", jzxh, ztdh, sj, type)); authorityCheck(context); if (string.IsNullOrEmpty(jzxh) || string.IsNullOrEmpty(ztdh) || string.IsNullOrEmpty(sj) || string.IsNullOrEmpty(type)) { throw new Exception("参数boxNumber,ladingBill,time,status都不能为空"); } DateTime d = new DateTime(); if (!DateTime.TryParse(sj, out d)) { throw new Exception("expectedStopTime格式不正确"); } yw_hddz_jzxxxEntity jzx = new yw_hddz_jzxxxEntity(); switch (type) { case "0": jzx.xcsj = d; break; case "1": jzx.cgqsj = d; break; default: throw new Exception("status值不正确必须为1或0"); } new Interfaces.Service.HddzService().updateJzxSj(jzx, type); res.code = "000"; } catch (Exception ex) { writeLog("updateContainerTime出现异常" + ex.Message); res.des = ex.Message; } }
/// <summary> /// 添加集装箱信息表 /// </summary> public bool AddHddzJzxxx(yw_hddzEntity model, IDbTransaction _transaction) { List <yw_hddz_jzxxxEntity> list = new List <yw_hddz_jzxxxEntity>(); if (string.IsNullOrEmpty(model.hz_jzxh)) { return(true); } string[] strjzxh = model.hz_jzxh.Replace("、", ",").Split(','); int i = 1; foreach (string jzxh in strjzxh) { if (jzxh.Trim() == "") { continue; } yw_hddz_jzxxxEntity jzx = new yw_hddz_jzxxxEntity(); jzx.ywbh = model.ywbh; jzx.jzxh = jzxh; jzx.ysfs = model.ysfs; jzx.xx = "40尺高柜"; jzx.xl = "冷藏集装箱"; jzx.cxh = i++; list.Add(jzx); } if (conn.State == System.Data.ConnectionState.Closed) { conn.Open(); } string sql = SqlFactory.GetInsertSql(new yw_hddz_jzxxxEntity()); return(conn.Execute(sql, list, _transaction) != 0); }