public string ExportExcelClientComplaint(Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; var ds = new ReportDataObject(); try { var da = new SqlDataAdapter() { SelectCommand = new SqlCommand("ClientComplaint_function_ExportExcelOverview", new SqlConnection(Helper.GetSQLConnectionString())) }; da.SelectCommand.CommandType = CommandType.StoredProcedure; da.Fill(ds, "ClientComplaintOverview"); foreach (DataRow dr in ds.Tables["ClientComplaintOverview"].Rows) { if (dr["PicturesOfComplaint"].ToString() != "NONE") { var arrImageURL = dr["PicturesOfComplaint"].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); var listImageURL = arrImageURL.Select(a => FrameworkSetting.Setting.MediaThumbnailUrl + a.ToString()).ToList(); dr["PicturesOfComplaint"] = String.Join(",", listImageURL); } } return(Helper.CreateReportFileWithEPPlus2(ds, "ClientComplaintOverview")); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }
public string ExportExcelClientComplaintItem(Hashtable filters, out Library.DTO.Notification notification) { notification = new Library.DTO.Notification() { Type = Library.DTO.NotificationType.Success }; var ds = new ReportDataObject(); try { var da = new SqlDataAdapter() { SelectCommand = new SqlCommand("ClientComplaint_function_ExportExcelDetailItem", new SqlConnection(Helper.GetSQLConnectionString())) }; da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.AddWithValue("@ClientComplaintItemID", filters["clientComplaintItemID"]); da.TableMappings.Add("Table", "Data1"); da.TableMappings.Add("Table1", "SRFData"); da.TableMappings.Add("Table2", "SRFDataImages"); da.Fill(ds); foreach (DataRow dr in ds.Tables["Data1"].Rows) { if (dr["ModelThumbnail"].ToString() != "") { dr["ModelThumbnail"] = FrameworkSetting.Setting.MediaThumbnailUrl + dr["ModelThumbnail"].ToString(); } if (dr["MaterialThumbnail"].ToString() != "") { dr["MaterialThumbnail"] = FrameworkSetting.Setting.MediaThumbnailUrl + dr["MaterialThumbnail"].ToString(); } if (dr["SubMaterialThumbnail"].ToString() != "") { dr["SubMaterialThumbnail"] = FrameworkSetting.Setting.MediaThumbnailUrl + dr["SubMaterialThumbnail"].ToString(); } if (dr["SignatureThumbnail"].ToString() != "") { dr["SignatureThumbnail"] = FrameworkSetting.Setting.MediaThumbnailUrl + dr["SignatureThumbnail"].ToString(); } } foreach (DataRow dr in ds.Tables["SRFDataImages"].Rows) { if (dr["FileLocation"].ToString() != "") { dr["FileLocation"] = FrameworkSetting.Setting.MediaThumbnailUrl + dr["FileLocation"].ToString(); } } return(Helper.CreateReportFileWithEPPlus2(ds, "ClientComplaintItemDetail")); } catch (Exception ex) { notification.Type = Library.DTO.NotificationType.Error; notification.Message = ex.Message; if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message)) { notification.DetailMessage.Add(ex.InnerException.Message); } return(string.Empty); } }