/*Reports related*/ public WMRPTErrViewModel GetErrorsReport() { WMRPTErrViewModel objErr = new WMRPTErrViewModel(FinTrackRes.WM_REPORT_LOAD_ERR, false); try { using (con = new SqlConnection(conStr)) { con.Open(); SqlCommand cmd = new SqlCommand(StaticData.UPDATE_REVIEWER_WORKMAINTENANCE, con); cmd.CommandType = System.Data.CommandType.StoredProcedure; //cmd.Parameters.AddWithValue("@workitemid", data.WorkItemId); //cmd.Parameters.AddWithValue("@userid", Common.GetUser.UserId); //cmd.Parameters.AddWithValue("@revcomments", data.ReviewerComments); //cmd.Parameters.AddWithValue("@starteddate", DateTime.Now); //cmd.Parameters.AddWithValue("@itemstatus", data.Status); //cmd.Parameters.AddWithValue("@usertype", "Reviewer"); //Hard coding this because this will be used only by the reviewer. //cmd.Parameters.AddWithValue("@iserrorfound", data.ErrFound); SqlDataReader rdr = cmd.ExecuteReader(); } } catch (Exception ex) { Logger.Log(Logger.LogType.Error, ex.ToString()); } return(null); }
public ActionResult generateFile(WMReportInputs input) { try { Response.Cookies.Remove("fileDownload"); repository objRep = new repository(); WMRPTErrViewModel rep = objRep.GetHistory(input); XLExport objExp = new XLExport(rep); string flName = objExp.ExcelExport(); return(Json(new { success = true, fileName = flName }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { throw ex; } }
public WMRPTErrViewModel GetHistory(WMReportInputs input) { WMRPTErrViewModel objErr = new WMRPTErrViewModel(FinTrackRes.WM_REPORT_LOAD_ERR, false); try { using (con = new SqlConnection(conStr)) { con.Open(); SqlCommand cmd = new SqlCommand(StaticData.GET_REPORT_BY_DATE_AR, con); //based on the team we can generate the report, same properties can be used for all the teams. if (input.TeamName == "ap") { cmd.CommandText = StaticData.GET_REPORT_BY_DATE_AP; } cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandTimeout = 0; cmd.Parameters.AddWithValue("@startdt", input.RptDate); //if end date is there then pass that also cmd.Parameters.Add(new SqlParameter("@enddate", input.EndDate)); SqlDataReader rdr = cmd.ExecuteReader(); //initialize all the lists. objErr.lst = new List <WMHistory>(); objErr.plst = new List <WMReportTimeTaken>(); objErr.rlst = new List <WMReportReviewerTime>(); objErr.psummary = new List <WMReportProcessorSummary>(); objErr.rDlst = new List <WMReportReviewerData>(); while (rdr.Read()) { objErr.lst.Add(new WMHistory() { WorkItemId = Convert.ToInt32(rdr["Work Item Id"]), ActivityName = Convert.ToString(rdr["Description"]), InvoiceNumber = Convert.ToString(rdr["Invoice#"]), RequestNumber = Convert.ToString(rdr["Request#"]), Comments = Convert.ToString(rdr["Comments"]), CreatedBy = Convert.ToString(rdr["Created By"]), ReviewedBy = Convert.ToString(rdr["Reviewer"]), ReviewerComments = Convert.ToString(rdr["Review Comments"]), ErrFound = Convert.ToBoolean(rdr["Error Found"]), StartedDate = Convert.ToDateTime(rdr["Stamp"]), PresentStatus = Convert.ToString(rdr["status"]) }); } rdr.NextResult(); while (rdr.Read()) { objErr.plst.Add(new WMReportTimeTaken() { WorkItemId = Convert.ToInt32(rdr["Work Item Id"]), ActivityName = Convert.ToString(rdr["Description"]), InvoiceNumber = Convert.ToString(rdr["Invoice#"]), RequestNumber = Convert.ToString(rdr["Request#"]), UserId = Convert.ToString(rdr["Created By"]), TimeTaken_Sec = Convert.ToInt32(rdr["timetaken"]) }); } //new result set which is bringing the Totals of groups. rdr.NextResult(); while (rdr.Read()) { objErr.psummary.Add(new WMReportProcessorSummary() { ProcessorName = Convert.ToString(rdr["created By"]), Description = Convert.ToString(rdr["Description"]), TotalTimeTaken = Convert.ToDecimal(rdr["Total Timespent"]) }); } rdr.NextResult(); while (rdr.Read()) { objErr.rlst.Add(new WMReportReviewerTime() { ReviewerName = Convert.ToString(rdr["Reviewer"]), TimeTaken_Sec = Convert.ToInt32(rdr["timetaken"]) }); } rdr.NextResult(); while (rdr.Read()) { objErr.rDlst.Add(new WMReportReviewerData() { UserId = Convert.ToString(rdr["UserId"]), WorkItemId = Convert.ToInt32(rdr["workitemid"]), ActivityName = Convert.ToString(rdr["ActivityName"]), InvoiceNumber = Convert.ToString(rdr["InvoiceNumber"]), RequestNumber = Convert.ToString(rdr["RequestNumber"]), ReviewerName = Convert.ToString(rdr["Reviewer"]), TimeTaken_Sec = Convert.ToInt32(rdr["TimeTaken_Sec"]), Comments = Convert.ToString(rdr["comments"]), StartTime = Convert.ToDateTime(rdr["StartTime"]), EndTime = Convert.ToDateTime(rdr["EndTime"]), ErrorFound = Convert.ToBoolean(rdr["iserrorfound"]) }); } objErr._success = true; CloseReader(rdr); } } catch (Exception ex) { Logger.Log(Logger.LogType.Error, ex.ToString()); throw ex; } return(objErr); }
/// <summary> /// On Screen Report constructor /// </summary> /// <param name="data"></param> public XLExport(WMRPTErrViewModel data) { _dataToExport = data; }