示例#1
0
        public DTO.SearchForm GetDataWithFilter(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            totalRows = 0;

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

            DTO.SearchForm data = new DTO.SearchForm();
            data.FactoryLocations = new List <DTO.FactoryLocation>();

            try
            {
                using (var context = CreateContext())
                {
                    string locationUD            = filters.ContainsKey("locationUD") && filters["locationUD"] != null && !string.IsNullOrEmpty(filters["locationUD"].ToString().Replace("'", "''")) ? filters["locationUD"].ToString().Trim() : null;
                    string locationNM            = filters.ContainsKey("locationNM") && filters["locationNM"] != null && !string.IsNullOrEmpty(filters["locationNM"].ToString().Replace("'", "''")) ? filters["locationNM"].ToString().Trim() : null;
                    int?   manufacturerCountryID = filters.ContainsKey("manufacturerCountryID") && filters["manufacturerCountryID"] != null && !string.IsNullOrEmpty(filters["manufacturerCountryID"].ToString().Replace("'", "''")) ? (int?)Convert.ToInt32(filters["manufacturerCountryID"].ToString().Trim()) : null;

                    totalRows             = context.FactoryLocationMng_function_LocationSearchResult(locationUD, locationNM, manufacturerCountryID, orderBy, orderDirection).Count();
                    data.FactoryLocations = converter.DB2DTO_FactoryLocationSearchResult(context.FactoryLocationMng_function_LocationSearchResult(locationUD, locationNM, manufacturerCountryID, orderBy, orderDirection).ToList());
                }
            }
            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(data);
        }
示例#2
0
        public DTO.SearchForm GetDataWithFilter(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            totalRows = 0;

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

            DTO.SearchForm searchForm = new DTO.SearchForm();
            searchForm.SystemSetting = new List <DTO.SystemSetting2>();

            try
            {
                using (var context = CreateContext())
                {
                    string settingKey   = filters.ContainsKey("settingKey") && filters["settingKey"] != null && !string.IsNullOrEmpty(filters["settingKey"].ToString().Replace("'", "''")) ? filters["settingKey"].ToString().Trim() : null;
                    string settingValue = filters.ContainsKey("settingValue") && filters["settingValue"] != null && !string.IsNullOrEmpty(filters["settingValue"].ToString().Replace("'", "''")) ? filters["settingValue"].ToString().Trim() : null;
                    string season       = filters.ContainsKey("season") && filters["season"] != null && !string.IsNullOrEmpty(filters["season"].ToString().Replace("'", "''")) ? filters["season"].ToString().Trim() : null;

                    totalRows = context.SystemSetting2Mng_function_SystemSettingSearchResult(season, orderBy, orderDirection).Count();
                    searchForm.SystemSetting = converter.DB2DTO_SystemSettingSearchResult(context.SystemSetting2Mng_function_SystemSettingSearchResult(season, orderBy, orderDirection).ToList());
                }
            }
            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(searchForm);
        }
示例#3
0
        public DTO.SearchForm GetDataWithFilters(int userId, Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            DTO.SearchForm data = new DTO.SearchForm();
            data.CustomerDatas       = new List <DTO.CustomerData>();
            data.ProductionItemDatas = new List <DTO.ProductionItemData>();
            notification             = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            totalRows = 0;
            try
            {
                string salesOrderNo         = "";
                int?   factoryRawMaterialID = null;
                string startDate            = "";
                string endDate = "";

                if (filters.ContainsKey("salesOrderNo") && !string.IsNullOrEmpty(filters["salesOrderNo"].ToString()))
                {
                    salesOrderNo = filters["salesOrderNo"].ToString().Replace("'", "''");
                }

                if (filters.ContainsKey("factoryRawMaterialID") && filters["factoryRawMaterialID"] != null && !string.IsNullOrEmpty(filters["factoryRawMaterialID"].ToString()))
                {
                    factoryRawMaterialID = Convert.ToInt32(filters["factoryRawMaterialID"]);
                }

                if (filters.ContainsKey("startDate") && !string.IsNullOrEmpty(filters["startDate"].ToString()))
                {
                    startDate = filters["startDate"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("endDate") && !string.IsNullOrEmpty(filters["endDate"].ToString()))
                {
                    endDate = filters["endDate"].ToString().Replace("'", "''");
                }
                Framework.DAL.DataFactory fwFactory = new Framework.DAL.DataFactory();
                int?companyID = fwFactory.GetCompanyID(userId);

                using (var context = CreateContext())
                {
                    var results = context.SummarySalesRpt_function_CustomerReport(factoryRawMaterialID, salesOrderNo, companyID, startDate, endDate);
                    data.CustomerDatas       = converter.DB2DTO_GetCustomerDatas(results.ToList());
                    data.ProductionItemDatas = converter.DB2DTO_GetProductionItemDatas(context.SummarySalesRpt_function_ProductionItemReport(factoryRawMaterialID, salesOrderNo, companyID, startDate, endDate).ToList());
                }
                return(data);
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                notification.DetailMessage.Add(ex.Message);
                if (ex.GetBaseException() != null)
                {
                    notification.DetailMessage.Add(ex.GetBaseException().Message);
                }
                return(data);
            }
        }
示例#4
0
        public object GetInitData(int userID, out Notification notification)
        {
            DTO.SearchForm data = new DTO.SearchForm();
            notification = new Notification()
            {
                Type = NotificationType.Success
            };

            try
            {
                using (var context = CreateContext())
                {
                    data.ProductTypes = converter.DB2DTO_GetProductType(context.SupportMng_ProductType_View.ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = Library.Helper.GetInnerException(ex).Message;
            }

            return(data);
        }
示例#5
0
        public DTO.SearchForm GetDataWithFilters(int userID, int productionItemID, int factoryWarehouseID, string startDate, string endDate, out Library.DTO.Notification notification)
        {
            notification      = new Library.DTO.Notification();
            notification.Type = Library.DTO.NotificationType.Success;

            DTO.SearchForm data = new DTO.SearchForm();
            data.FinalBeginning        = 0;
            data.TotalPurchaseOrderQnt = null;
            data.StorageCards          = new List <DTO.StorageCard>();

            try
            {
                Framework.DAL.DataFactory fwFactory = new Framework.DAL.DataFactory();
                int?companyID = fwFactory.GetCompanyID(userID);

                using (var context = CreateContext())
                {
                    data.FinalBeginning = context.StorageCardRpt_function_GetTotalBeginning(productionItemID, factoryWarehouseID, startDate, endDate, companyID).FirstOrDefault();

                    var results = context.StorageCardRpt_function_StorageCardSearchResult(productionItemID, factoryWarehouseID, startDate, endDate, companyID);
                    data.StorageCards = converter.DB2DTO_SearchResults(results.ToList());

                    //get from PurchaseOrder
                    var     POItem           = context.StorageCardRpt_ListItemPurchaseOrder_View.Where(o => o.ProductionItemID == productionItemID).ToList();
                    decimal?totalQnt         = 0;
                    int?    checkPR          = null;
                    string  strPurchaseOrder = "";
                    for (int i = 0; i < POItem.Count; i++)
                    {
                        var item = POItem[i];
                        totalQnt += item.OrderQnt;
                        if (item.PurchaseOrderID != null)
                        {
                            if (checkPR != item.PurchaseOrderID)
                            {
                                if (strPurchaseOrder != "")
                                {
                                    strPurchaseOrder += ",";
                                }
                                strPurchaseOrder += item.PurchaseOrderID;
                                checkPR           = item.PurchaseOrderID;
                            }
                        }
                    }
                    data.TotalPurchaseOrderQnt = totalQnt;
                    data.PurchaseOrderIDs      = strPurchaseOrder;
                }
            }
            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(data);
        }
示例#6
0
        public DTO.SearchForm GetDataWithFilter(int userId, Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            DTO.SearchForm searchForm = new DTO.SearchForm();
            searchForm.Factories = new List <Support.DTO.Factory>();
            notification         = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            totalRows = 0;
            try
            {
                string qcReportUD        = null;
                int?   factoryID         = null;
                string clientUD          = null;
                string articleCode       = null;
                string proformaInvoiceNo = null;
                string updatedDate       = null;

                if (filters.ContainsKey("QCReportUD") && !string.IsNullOrEmpty(filters["QCReportUD"].ToString()))
                {
                    qcReportUD = filters["QCReportUD"].ToString().Replace("'", "''");
                }

                if (filters.ContainsKey("FactoryID") && filters["FactoryID"] != null && !string.IsNullOrEmpty(filters["FactoryID"].ToString()))
                {
                    factoryID = Convert.ToInt32(filters["FactoryID"]);
                }

                if (filters.ContainsKey("ArticleCode") && !string.IsNullOrEmpty(filters["ArticleCode"].ToString()))
                {
                    articleCode = filters["ArticleCode"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("ProformaInvoiceNo") && !string.IsNullOrEmpty(filters["ProformaInvoiceNo"].ToString()))
                {
                    proformaInvoiceNo = filters["ProformaInvoiceNo"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("UpdatedDate") && !string.IsNullOrEmpty(filters["UpdatedDate"].ToString()))
                {
                    updatedDate = filters["UpdatedDate"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("ClientUD") && !string.IsNullOrEmpty(filters["ClientUD"].ToString()))
                {
                    clientUD = filters["ClientUD"].ToString().Replace("'", "''");
                }

                //if (filters.ContainsKey("TestDate") && !string.IsNullOrEmpty(filters["TestDate"].ToString()))
                //{
                //    testDate = filters["TestDate"].ToString().Replace("'", "''");
                //}
                DateTime?valTestDate = updatedDate.ConvertStringToDateTime();

                using (QCReportEntities context = CreateContext())
                {
                    totalRows = context.QCReportMng_function_SearchQCReportMng(qcReportUD, factoryID, clientUD, articleCode, proformaInvoiceNo, valTestDate, orderBy, orderDirection).Count();
                    var result = context.QCReportMng_function_SearchQCReportMng(qcReportUD, factoryID, clientUD, articleCode, proformaInvoiceNo, valTestDate, orderBy, orderDirection);
                    searchForm.Data = converter.DB2DTO_SearchQCReport(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }
                searchForm.Factories = supportFactory.GetFactory().ToList();
                return(searchForm);
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                notification.DetailMessage.Add(ex.Message);
                if (ex.GetBaseException() != null)
                {
                    notification.DetailMessage.Add(ex.GetBaseException().Message);
                }
                return(searchForm);
            }
        }
示例#7
0
        public DTO.SearchForm GetDataWithFilters(int userId, Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            DTO.SearchForm data = new DTO.SearchForm();
            data.StockDTOs = new List <DTO.StockDTO>();
            notification   = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            totalRows = 0;
            try
            {
                string itemSource    = "";
                int?   productTypeID = null;
                string articleCode   = "";
                string subEANCode    = "";
                string description   = "";

                if (filters.ContainsKey("itemSource") && !string.IsNullOrEmpty(filters["itemSource"].ToString()))
                {
                    itemSource = filters["itemSource"].ToString().Replace("'", "''");
                }

                if (filters.ContainsKey("productTypeID") && filters["productTypeID"] != null && !string.IsNullOrEmpty(filters["productTypeID"].ToString()))
                {
                    productTypeID = Convert.ToInt32(filters["productTypeID"]);
                }

                if (filters.ContainsKey("articleCode") && !string.IsNullOrEmpty(filters["articleCode"].ToString()))
                {
                    articleCode = filters["articleCode"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("subEANCode") && !string.IsNullOrEmpty(filters["subEANCode"].ToString()))
                {
                    subEANCode = filters["subEANCode"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("description") && !string.IsNullOrEmpty(filters["description"].ToString()))
                {
                    description = filters["description"].ToString().Replace("'", "''");
                }
                Framework.DAL.DataFactory fwFactory = new Framework.DAL.DataFactory();
                int?companyID = fwFactory.GetCompanyID(userId);

                using (var context = CreateContext())
                {
                    totalRows = context.StockOverviewRpt_function_StockOverview(itemSource, productTypeID, articleCode, subEANCode, description).Count();
                    var results = context.StockOverviewRpt_function_StockOverview(itemSource, productTypeID, articleCode, subEANCode, description);
                    data.StockDTOs = converter.DB2DTO_GetStock(results.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }
                return(data);
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                notification.DetailMessage.Add(ex.Message);
                if (ex.GetBaseException() != null)
                {
                    notification.DetailMessage.Add(ex.GetBaseException().Message);
                }
                return(data);
            }
        }