/// <summary> /// 添加车辆派送信息 /// </summary> /// <param name="CarDispatchM">车辆派送信息</param> /// <returns>添加是否成功 false:失败,true:成功</returns> public static bool InsertCarDispatchInfoData(CarDispatchModel CarDispatchM, out int RetValID) { try { #region 车辆申请信息SQL拼写 StringBuilder sql = new StringBuilder(); sql.AppendLine("INSERT INTO officedba.CarDispatch"); sql.AppendLine(" (CompanyCD "); sql.AppendLine(" ,RecordNo "); sql.AppendLine(" ,Title "); sql.AppendLine(" ,ApplyID "); sql.AppendLine(" ,CarNo "); sql.AppendLine(" ,ApplyDate "); sql.AppendLine(" ,Appler "); sql.AppendLine(" ,ApplyDept "); sql.AppendLine(" ,Reason "); sql.AppendLine(" ,LoadHumans "); sql.AppendLine(" ,LoadGoods "); sql.AppendLine(" ,RequireDate "); sql.AppendLine(" ,RequireTime "); sql.AppendLine(" ,PlanReturnDate "); sql.AppendLine(" ,PlanReturnTime "); sql.AppendLine(" ,PlanMileage "); sql.AppendLine(" ,isReturn "); sql.AppendLine(" ,Creator "); sql.AppendLine(" ,CreateDate "); sql.AppendLine(" ,Remark "); sql.AppendLine(" ,ModifiedDate "); sql.AppendLine(" ,ModifiedUserID) "); sql.AppendLine("VALUES "); sql.AppendLine(" (@CompanyCD "); sql.AppendLine(" ,@RecordNo "); sql.AppendLine(" ,@Title "); sql.AppendLine(" ,@ApplyID "); sql.AppendLine(" ,@CarNo "); sql.AppendLine(" ,@ApplyDate "); sql.AppendLine(" ,@Appler "); sql.AppendLine(" ,@ApplyDept "); sql.AppendLine(" ,@Reason "); sql.AppendLine(" ,@LoadHumans "); sql.AppendLine(" ,@LoadGoods "); sql.AppendLine(" ,@RequireDate "); sql.AppendLine(" ,@RequireTime "); sql.AppendLine(" ,@PlanReturnDate "); sql.AppendLine(" ,@PlanReturnTime "); sql.AppendLine(" ,@PlanMileage "); sql.AppendLine(" ,@isReturn "); sql.AppendLine(" ,@Creator "); sql.AppendLine(" ,@CreateDate "); sql.AppendLine(" ,@Remark "); sql.AppendLine(" ,@ModifiedDate "); sql.AppendLine(" ,@ModifiedUserID) "); sql.AppendLine("set @ID=@@IDENTITY"); #endregion #region 车辆申请信息参数设置 SqlParameter[] param; param = new SqlParameter[23]; param[0] = SqlHelper.GetParameter("@CompanyCD", CarDispatchM.CompanyCD); param[1] = SqlHelper.GetParameter("@RecordNo", CarDispatchM.RecordNo); param[2] = SqlHelper.GetParameter("@Title", CarDispatchM.Title); param[3] = SqlHelper.GetParameter("@ApplyID", CarDispatchM.ApplyID); param[4] = SqlHelper.GetParameter("@CarNo", CarDispatchM.CarNo); param[5] = SqlHelper.GetParameter("@ApplyDate", CarDispatchM.ApplyDate); param[6] = SqlHelper.GetParameter("@Appler", CarDispatchM.Appler); param[7] = SqlHelper.GetParameter("@Reason", CarDispatchM.Reason); param[8] = SqlHelper.GetParameter("@LoadHumans", CarDispatchM.LoadHumans); param[9] = SqlHelper.GetParameter("@LoadGoods", CarDispatchM.LoadGoods); param[10] = SqlHelper.GetParameter("@RequireDate", CarDispatchM.RequireDate); param[11] = SqlHelper.GetParameter("@RequireTime", CarDispatchM.RequireTime); param[12] = SqlHelper.GetParameter("@PlanReturnDate", CarDispatchM.PlanReturnDate); param[13] = SqlHelper.GetParameter("@PlanReturnTime", CarDispatchM.PlanReturnTime); param[14] = SqlHelper.GetParameter("@PlanMileage", CarDispatchM.PlanMileage); param[15] = SqlHelper.GetParameter("@isReturn", CarDispatchM.isReturn); param[16] = SqlHelper.GetParameter("@Creator", CarDispatchM.Creator); param[17] = SqlHelper.GetParameter("@CreateDate", CarDispatchM.CreateDate); param[18] = SqlHelper.GetParameter("@Remark", CarDispatchM.Remark); param[19] = SqlHelper.GetParameter("@ModifiedDate", CarDispatchM.ModifiedDate); param[20] = SqlHelper.GetParameter("@ModifiedUserID", CarDispatchM.ModifiedUserID); param[21] = SqlHelper.GetParameter("@ApplyDept", CarDispatchM.ApplyDept); param[22] = SqlHelper.GetOutputParameter("@ID", SqlDbType.Int); #endregion SqlHelper.ExecuteTransSql(sql.ToString(), param); RetValID = Convert.ToInt32(param[22].Value.ToString()); return SqlHelper.Result.OprateCount > 0 ? true : false; } catch { RetValID = 0; return false; } }
/// <summary> /// 更新车辆归还信息 /// </summary> /// <param name="CarDispatchM">车辆归还信息</param> /// <returns>添加是否成功 false:失败,true:成功</returns> public static bool UpdateCarDispatchInfoData(CarDispatchModel CarDispatchM) { try { #region 派车单归还信息SQL拼写 StringBuilder sql = new StringBuilder(); sql.AppendLine("UPDATE officedba.CarDispatch"); sql.AppendLine(" SET Title=@Title "); sql.AppendLine(" ,ApplyID=@ApplyID "); sql.AppendLine(" ,CarNo=@CarNo "); sql.AppendLine(" ,ApplyDate=@ApplyDate "); sql.AppendLine(" ,Appler=@Appler "); sql.AppendLine(" ,ApplyDept=@ApplyDept "); sql.AppendLine(" ,Reason=@Reason "); sql.AppendLine(" ,LoadHumans=@LoadHumans "); sql.AppendLine(" ,LoadGoods=@LoadGoods "); sql.AppendLine(" ,RequireDate=@RequireDate "); sql.AppendLine(" ,RequireTime=@RequireTime "); sql.AppendLine(" ,PlanReturnDate=@PlanReturnDate "); sql.AppendLine(" ,PlanReturnTime=@PlanReturnTime "); sql.AppendLine(" ,PlanMileage=@PlanMileage "); sql.AppendLine(" ,isReturn=@isReturn "); sql.AppendLine(" ,Creator=@Creator "); sql.AppendLine(" ,CreateDate=@CreateDate "); sql.AppendLine(" ,Remark=@Remark "); sql.AppendLine(" ,ModifiedDate=@ModifiedDate "); sql.AppendLine(" ,ModifiedUserID=@ModifiedUserID "); sql.AppendLine("WHERE "); sql.AppendLine(" CompanyCD=@CompanyCD AND RecordNo=@RecordNo "); #endregion #region 派车单归还信息参数设置 SqlParameter[] param; param = new SqlParameter[22]; param[0] = SqlHelper.GetParameter("@Title", CarDispatchM.Title); param[1] = SqlHelper.GetParameter("@ApplyID", CarDispatchM.ApplyID); param[2] = SqlHelper.GetParameter("@CarNo", CarDispatchM.CarNo); param[3] = SqlHelper.GetParameter("@ApplyDate", CarDispatchM.ApplyDate); param[4] = SqlHelper.GetParameter("@Appler", CarDispatchM.Appler); param[5] = SqlHelper.GetParameter("@Reason", CarDispatchM.Reason); param[6] = SqlHelper.GetParameter("@LoadHumans", CarDispatchM.LoadHumans); param[7] = SqlHelper.GetParameter("@LoadGoods", CarDispatchM.LoadGoods); param[8] = SqlHelper.GetParameter("@RequireDate", CarDispatchM.RequireDate); param[9] = SqlHelper.GetParameter("@RequireTime", CarDispatchM.RequireTime); param[10] = SqlHelper.GetParameter("@PlanReturnDate", CarDispatchM.PlanReturnDate); param[11] = SqlHelper.GetParameter("@PlanReturnTime", CarDispatchM.PlanReturnTime); param[12] = SqlHelper.GetParameter("@PlanMileage", CarDispatchM.PlanMileage); param[13] = SqlHelper.GetParameter("@isReturn", CarDispatchM.isReturn); param[14] = SqlHelper.GetParameter("@Creator", CarDispatchM.Creator); param[15] = SqlHelper.GetParameter("@CreateDate", CarDispatchM.CreateDate); param[16] = SqlHelper.GetParameter("@Remark", CarDispatchM.Remark); param[17] = SqlHelper.GetParameter("@ModifiedDate", CarDispatchM.ModifiedDate); param[18] = SqlHelper.GetParameter("@ModifiedUserID", CarDispatchM.ModifiedUserID); param[19] = SqlHelper.GetParameter("@CompanyCD", CarDispatchM.CompanyCD); param[20] = SqlHelper.GetParameter("@RecordNo", CarDispatchM.RecordNo); param[21] = SqlHelper.GetParameter("@ApplyDept", CarDispatchM.ApplyDept); #endregion SqlHelper.ExecuteTransSql(sql.ToString(), param); return SqlHelper.Result.OprateCount > 0 ? true : false; } catch { return false; } }
/// <summary> /// 更新车辆归还信息 /// </summary> /// <param name="CarDispatchM">车辆归还信息</param> /// <returns>添加是否成功 false:失败,true:成功</returns> public static bool UpdateCarDispatchInfoData(CarDispatchModel CarDispatchM, string DispatchID) { try { #region 派车单归还信息SQL拼写 StringBuilder sql = new StringBuilder(); sql.AppendLine("UPDATE officedba.CarDispatch"); sql.AppendLine(" SET OutDate=@OutDate "); sql.AppendLine(" ,OutTime=@OutTime "); sql.AppendLine(" ,BackDate=@BackDate "); sql.AppendLine(" ,BackTime=@BackTime "); sql.AppendLine(" ,isReturn=@isReturn "); sql.AppendLine(" ,RealMileage=@RealMileage "); sql.AppendLine(" ,ModifiedDate=@ModifiedDate "); sql.AppendLine(" ,ModifiedUserID=@ModifiedUserID "); sql.AppendLine("WHERE "); sql.AppendLine(" ID=@DispatchID "); #endregion #region 派车单归还信息参数设置 SqlParameter[] param; param = new SqlParameter[9]; param[0] = SqlHelper.GetParameter("@OutDate", CarDispatchM.OutDate); param[1] = SqlHelper.GetParameter("@OutTime", CarDispatchM.OutTime); param[2] = SqlHelper.GetParameter("@BackDate", CarDispatchM.BackDate); param[3] = SqlHelper.GetParameter("@BackTime", CarDispatchM.BackTime); param[4] = SqlHelper.GetParameter("@isReturn", CarDispatchM.isReturn); param[5] = SqlHelper.GetParameter("@RealMileage", CarDispatchM.RealMileage); param[6] = SqlHelper.GetParameter("@ModifiedDate", CarDispatchM.ModifiedDate); param[7] = SqlHelper.GetParameter("@ModifiedUserID", CarDispatchM.ModifiedUserID); param[8] = SqlHelper.GetParameter("@DispatchID",Convert.ToInt32(DispatchID)); #endregion SqlHelper.ExecuteTransSql(sql.ToString(), param); return SqlHelper.Result.OprateCount > 0 ? true : false; } catch { return false; } }
/// <summary> /// 添加车辆派送信息 /// </summary> /// <param name="CarDispatchM">车辆派送信息</param> /// <returns>添加是否成功 false:失败,true:成功</returns> public static bool InsertCarDispatchInfoData(CarDispatchModel CarDispatchM, out int RetValID) { return CarDispatchDBHelper.InsertCarDispatchInfoData(CarDispatchM, out RetValID); }
/// <summary> /// 更新车辆派送信息 /// </summary> /// <param name="CarDispatchM">车辆派送信息</param> /// <returns>添加是否成功 false:失败,true:成功</returns> public static bool UpdateCarDispatchInfoData(CarDispatchModel CarDispatchM) { return CarDispatchDBHelper.UpdateCarDispatchInfoData(CarDispatchM); }
/// <summary> /// 更新车辆归还信息 /// </summary> /// <param name="CarDispatchM">车辆归还信息</param> /// <returns>添加是否成功 false:失败,true:成功</returns> public static bool UpdateCarDispatchInfoData(CarDispatchModel CarDispatchM, string DispatchID) { return CarDispatchDBHelper.UpdateCarDispatchInfoData(CarDispatchM, DispatchID); }