public void AddTrafficReport(TrafficeFlowReport model) { dareport.AddTrafficReport(model); }
public ActionResult TrafficReport(TrafficeFlowReport model) { if (ModelState.IsValid) { model.CrUser = CurrentUserModel.Current.UserID; model.StationID = CurrentUserModel.Current.StationID; new BLReports().AddTrafficReport(model); return Content("<script>alert('添加成功');window.location.href='/report/TrafficReport';</script>"); } return View(model); }
public void AddTrafficReport(TrafficeFlowReport model) { try { string strSQL = @" if exists (select id from TrafficFlowReport where stationid=@stationid and reportdate=@reportdate) begin update TrafficFlowReport set DownAmount=@DownAmount, TruckAmount=@TruckAmount, MoreThan30=@MoreThan30, MoreThan100=@MoreThan100, EngineeringVehicles=@EngineeringVehicles, EasyAccess=@EasyAccess, CrUser=@CrUser, crtime=getdate() where stationid=@stationid and reportdate=@reportdate end else begin insert into TrafficFlowReport(ReportDate,StationID,DownAmount,TruckAmount,MoreThan30,MoreThan100,EngineeringVehicles,EasyAccess,CrUser) values(@ReportDate,@StationID,@DownAmount,@TruckAmount,@MoreThan30,@MoreThan100,@EngineeringVehicles,@EasyAccess,@CrUser) end "; SqlParameter[] parms = new SqlParameter[]{ new SqlParameter("@reportdate",SqlDbType.DateTime), new SqlParameter("@DownAmount",SqlDbType.Int), new SqlParameter("@TruckAmount",SqlDbType.Int), new SqlParameter("@MoreThan30",SqlDbType.Int), new SqlParameter("@MoreThan100",SqlDbType.Int), new SqlParameter("@EngineeringVehicles",SqlDbType.Int), new SqlParameter("@EasyAccess",SqlDbType.Int), new SqlParameter("@cruser",SqlDbType.Int), new SqlParameter("@stationid",SqlDbType.Int), }; parms[0].Value = model.ReportDate; parms[1].Value = model.DownAmount; parms[2].Value = model.TruckAmount; parms[3].Value = model.MoreThan30; parms[4].Value = model.MoreThan100; parms[5].Value = model.EngineeringVehicles; parms[6].Value = model.EasyAccess; parms[7].Value = model.CrUser; parms[8].Value = model.StationID; SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms); } catch (Exception ex) { throw; } }