PDA

View Full Version : حرفه ای: خطای استیمول



hmahdavi921
شنبه 30 شهریور 1398, 18:30 عصر
سلام
این خطا رو وقتی میخوام گزارش استیمول رو بگیرم دارم.
وقتی با sp دیتا رو میخونم مشکلی نیست اما به دلایلی میخوام از sp استفاده نکنم و سمت کد دیتا رو به گزارش پاس بدم اما خطا میده :

System.ArgumentNullException: Value cannot be null. Parameter name: value at System.Enum.TryParseEnum(Type enumType, String value, Boolean ignoreCase, EnumResult& parseResult) at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) at Stimulsoft.Report.Mvc.StiMvcViewer.SaveReportObjec t(HttpContextBase httpContext, StiReport report) at Stimulsoft.Report.Mvc.StiMvcViewer.GetReportSnapsh otResult(StiReport report) at SPMS.Controllers.ReportController.PackageCommandPr int(String startDate, String endDate, Int32 profileId) in D:\Projects\SPMS\SPMS\Controllers\ReportController .cs:line 83




نکته جالب اینجاست که این خطا رو برای گزارش خالی هم دارم .

public ActionResult PackageCommandPrint(string startDate, string endDate, int profileId)
{
try
{
List<PackageCommand> commands = new List<PackageCommand>();
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Content/Reports/PackageCommand.mrt"));
//report.Load(Server.MapPath("~/Content/Reports/Report.mrt"));
if (HttpContext.Cache["PackageCommands"] == null)
{
using (SPMSEntities db = new SPMSEntities())
{
commands = db.PackageCommands.ToList();
HttpContext.Cache.Insert("PackageCommands", commands, null, DateTime.Now.AddMinutes(15), Cache.NoSlidingExpiration);
}
}
else
{
commands = HttpContext.Cache["PackageCommands"] as List<PackageCommand>;
}
string userFullName;
using (SPMSEntities db = new SPMSEntities())
{
Profile profile = db.Profiles.Find(profileId);
userFullName = profile.FirstName + " " + profile.LastName;
}
//report["TodayPersianDate"] = Convertor.ToPersianDate(DateTime.Now);
//report["UserFullName"] = userFullName;
report.Dictionary.Variables.Add(new StiVariable("Params", "TodayPersianDate", Convertor.ToPersianDate(DateTime.Now)));
report.Dictionary.Variables.Add(new StiVariable("Params", "UserFullName", userFullName));
report.RegBusinessObject("Data", commands);
report.Compile();


return StiMvcViewer.GetReportSnapshotResult(report);
}
catch (Exception e)
{
HelperStoreSqlLog.WriteError(e, "PackageCommand");
return View();
}
}




@using Stimulsoft.Report.Mvc
@{
Layout = null;
}
@Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions()
{
Localization = "~/Content/Reports/Localization/fa.xml",
Theme = StiTheme.Office2013,
ActionGetReportSnapshot = "PackageCommandPrint",
ActionViewerEvent = "PackageCommandViewer",
ServerCacheMode = StiCacheMode.None
})



150761