Example #1
0
        public string ExportFSCReport(string startDate, string endDate, out Library.DTO.Notification notification)
        {
            notification      = new Library.DTO.Notification();
            notification.Type = Library.DTO.NotificationType.Success;

            ReportObjectData ds       = new ReportObjectData();
            string           fileName = string.Empty;

            DateTime?valStartDate = startDate.ConvertStringToDateTime();
            DateTime?valEndDate   = endDate.ConvertStringToDateTime();

            try
            {
                System.Data.SqlClient.SqlDataAdapter adap = new System.Data.SqlClient.SqlDataAdapter();
                adap.SelectCommand             = new System.Data.SqlClient.SqlCommand("FSCRpt_function_FSCOverviewExcel", new System.Data.SqlClient.SqlConnection(Library.Helper.GetSQLConnectionString()));
                adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;
                adap.SelectCommand.Parameters.AddWithValue("@StartDate", valStartDate.Value.Date);
                adap.SelectCommand.Parameters.AddWithValue("@EndDate", valEndDate.Value.Date);
                adap.TableMappings.Add("Table", "FSCRpt_FSCOverview_View FSCOverview");
                adap.Fill(ds);

                ReportObjectData.ReportHeaderRow hRow = ds.ReportHeader.NewReportHeaderRow();
                hRow.StartDate = startDate;
                hRow.EndDate   = endDate;
                ds.ReportHeader.AddReportHeaderRow(hRow);

                ds.AcceptChanges();

                fileName = Library.Helper.CreateReportFileWithEPPlus(ds, "FSCReport");
            }
            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(fileName);
        }
Example #2
0
        public string ExportExcel(string season, out Library.DTO.Notification notification)
        {
            string fileName = "";

            notification      = new Library.DTO.Notification();
            notification.Type = Library.DTO.NotificationType.Success;

            ReportObjectData ds = new ReportObjectData();

            try
            {
                System.Data.SqlClient.SqlDataAdapter adap = new System.Data.SqlClient.SqlDataAdapter();
                adap.SelectCommand             = new System.Data.SqlClient.SqlCommand("ShipmentToBeInvoiceRpt_function_ExportExcel", new System.Data.SqlClient.SqlConnection(Library.Helper.GetSQLConnectionString()));
                adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;
                adap.SelectCommand.Parameters.AddWithValue("@Season", season);

                adap.TableMappings.Add("Table", "ShipmentToBeInvoice_Common");
                adap.TableMappings.Add("Table1", "ShipmentToBeInvoice_Detail");
                adap.Fill(ds);

                ds.AcceptChanges();

                fileName = Library.Helper.CreateReportFileWithEPPlus2(ds, "ShipmentToBeInvoice");
            }
            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(fileName);
        }
Example #3
0
        public object ExportExcel(int userID, System.Collections.Hashtable filters, out Library.DTO.Notification notification)
        {
            notification      = new Library.DTO.Notification();
            notification.Type = Library.DTO.NotificationType.Success;

            try
            {
                string client        = (filters.ContainsKey("clientSearch") && filters["clientSearch"] != null && !string.IsNullOrEmpty(filters["clientSearch"].ToString().Trim())) ? filters["clientSearch"].ToString().Trim() : null;
                string model         = (filters.ContainsKey("modelSearch") && filters["modelSearch"] != null && !string.IsNullOrEmpty(filters["modelSearch"].ToString().Trim())) ? filters["modelSearch"].ToString().Trim() : null;
                string product       = (filters.ContainsKey("productSearch") && filters["productSearch"] != null && !string.IsNullOrEmpty(filters["productSearch"].ToString().Trim())) ? filters["productSearch"].ToString().Trim() : null;
                string sampleProduct = (filters.ContainsKey("sampleSearch") && filters["sampleSearch"] != null && !string.IsNullOrEmpty(filters["sampleSearch"].ToString().Trim())) ? filters["sampleSearch"].ToString().Trim() : null;

                ReportObjectData ds = new ReportObjectData();
                System.Data.SqlClient.SqlDataAdapter adap = new System.Data.SqlClient.SqlDataAdapter();

                adap.SelectCommand             = new System.Data.SqlClient.SqlCommand("ProductBreakDownPAL_function_ProductBreakDownPALSearchResult", new System.Data.SqlClient.SqlConnection(Library.Helper.GetSQLConnectionString()));
                adap.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure;
                adap.SelectCommand.Parameters.AddWithValue("@clientSearch", client);
                adap.SelectCommand.Parameters.AddWithValue("@modelSearch", model);
                adap.SelectCommand.Parameters.AddWithValue("@productSearch", product);
                adap.SelectCommand.Parameters.AddWithValue("@sampleSearch", sampleProduct);

                adap.TableMappings.Add("Table", "ProductBreakDownView");
                adap.Fill(ds);

                ds.AcceptChanges();

                return(Library.Helper.CreateReportFileWithEPPlus2(ds, "Product_BreakDown_PAL"));
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
                return(string.Empty);
            }
        }