/// <summary> /// Export records to CSV format by PO Id /// </summary> /// <param name="PONumber"></param> /// <returns></returns> public ActionResult ExportRecordByPOId(string PONumber) { IEnumerable <PurchaseOrderModel> lstPurchaseOrderList = _empRepository.GetRecordByPONumber(PONumber); string VendorName = ""; string ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); Int32? UserID = HttpContext.Session.GetInt32("UserID"); string ErrorMessage = string.Empty; try { if (lstPurchaseOrderList != null) { VendorName = lstPurchaseOrderList.ElementAt(0).VendorName; } } catch (Exception ex) { var st = new StackTrace(ex, true); var frame = st.GetFrame(0); int ErrorLine = frame.GetFileLineNumber(); var Result = _CommonRepository.LogManagement(ControllerName, ActionName, ex.Message, ErrorLine, UserID); return(RedirectToAction("ErrorPage", "Common")); } return(RedirectToAction("ExportPurchaseOrderData", new RouteValueDictionary( new { controller = "PurchaseOrder", action = "Main", PONumber = PONumber, VendorName = VendorName }))); }