Example #1
0
        //get data additional condition
        public List <DTO.ClientAdditionalConditionDTO> GetACData(int id, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification {
                Type = Library.DTO.NotificationType.Success
            };
            List <DTO.ClientAdditionalConditionDTO> data = new List <DTO.ClientAdditionalConditionDTO>();

            //try to get data
            try
            {
                using (FactoryQuotation2MngEntities context = CreateContext())
                {
                    if (id > 0)
                    {
                        data = converter.DB2DTO_ACData(context.FactoryQuotation2Mng_ClientAdditionalCondition_View.ToList());
                    }
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
Example #2
0
        public bool ImportQuotationDetail(int userId, object dtoItems, out Library.DTO.Notification notification)
        {
            List <DTO.ImportQuotationDetailDTO> dtoImports = ((Newtonsoft.Json.Linq.JArray)dtoItems).ToObject <List <DTO.ImportQuotationDetailDTO> >();

            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            //try to get data
            try
            {
                using (FactoryQuotation2MngEntities context = CreateContext())
                {
                    foreach (var item in dtoImports)
                    {
                        context.FactoryQuotation2Mng_action_AddQuotationOffer(item.QuotationDetailID, item.FactoryPrice, item.NewComment, userId);
                        context.FW_function_RefreshPriceCacheRow(item.Season, item.QuotationDetailID, null);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                notification = new Library.DTO.Notification()
                {
                    Message = ex.Message, Type = Library.DTO.NotificationType.Error
                };
                return(false);
            }
        }
Example #3
0
        public List <DTO.OfferHistoryDTO> GetHistoryData(int id, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification {
                Type = Library.DTO.NotificationType.Success
            };
            List <DTO.OfferHistoryDTO> data = new List <DTO.OfferHistoryDTO>();

            //try to get data
            try
            {
                using (FactoryQuotation2MngEntities context = CreateContext())
                {
                    if (id > 0)
                    {
                        data = converter.DB2DTO_OfferHistory(context.FactoryQuotation2Mng_OfferHistory_View.Where(o => o.QuotationDetailID == id).OrderByDescending(o => o.UpdatedDate).ToList());
                    }
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
Example #4
0
        private FactoryQuotation2MngEntities CreateContext()
        {
            FactoryQuotation2MngEntities mContext = new FactoryQuotation2MngEntities(Library.Helper.CreateEntityConnectionString("DAL.FactoryQuotation2MngModel"));

            mContext.Database.CommandTimeout = 300;
            return(mContext);
        }
Example #5
0
        //
        // CUSTOM FUNCTION HERE
        //

        public DTO.SupportFormData GetSearchFilter(out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.SupportFormData data = new DTO.SupportFormData();
            data.QuotationStatusDTOs = new List <DTO.QuotationStatusDTO>();

            //try to get data
            try
            {
                using (FactoryQuotation2MngEntities context = CreateContext())
                {
                    data.QuotationStatusDTOs = converter.DB2DTO_QuotationStatus(context.SupportMng_QuotationStatus_View.ToList());
                    //
                    // ADD CUSTOM STATUS AS REQUESTED - HARD CODE
                    //
                    List <int> toBeRemoveItems = new List <int>();
                    foreach (var item in data.QuotationStatusDTOs)
                    {
                        if (item.QuotationStatusID != 1 && item.QuotationStatusID != 3 && item.QuotationStatusID != 5)
                        {
                            toBeRemoveItems.Add(item.QuotationStatusID);
                        }
                    }
                    foreach (int id in toBeRemoveItems)
                    {
                        data.QuotationStatusDTOs.Remove(data.QuotationStatusDTOs.FirstOrDefault(o => o.QuotationStatusID == id));
                    }
                    data.QuotationStatusDTOs.Add(new DTO.QuotationStatusDTO {
                        QuotationStatusID = -1, QuotationStatusNM = "ITEMS COSTPRICE"
                    });
                    data.QuotationStatusDTOs.Add(new DTO.QuotationStatusDTO {
                        QuotationStatusID = -2, QuotationStatusNM = "ITEMS NO COSTPRICE"
                    });
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
            }

            return(data);
        }
Example #6
0
        public bool UpdateData(int userId, object dtoItems, out Library.DTO.Notification notification)
        {
            List <DTO.FactoryQuotationSearchResultDTO> dtoOffers = ((Newtonsoft.Json.Linq.JArray)dtoItems).ToObject <List <DTO.FactoryQuotationSearchResultDTO> >();

            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            List <int> confirmedQuotationDetailIDs = new List <int>();

            try
            {
                //
                // check factory access permission
                //
                foreach (DTO.FactoryQuotationSearchResultDTO dtoOffer in dtoOffers)
                {
                    if (fwFactory.CheckFactoryPermission(userId, dtoOffer.FactoryID.Value) <= 0)
                    {
                        throw new Exception("You dont have permission for accessing factory data for [" + dtoOffer.FactoryUD + "]!");
                    }
                }

                using (FactoryQuotation2MngEntities context = CreateContext())
                {
                    // get similar item: same offerlineid, same factoryid
                    int[] existingIDs = dtoOffers.Where(o => o.NewPurchasingPrice.HasValue).Select(o => o.QuotationDetailID.Value).ToArray();
                    List <DTO.FactoryQuotationSearchResultDTO> additionalItems = new List <DTO.FactoryQuotationSearchResultDTO>();
                    foreach (DTO.FactoryQuotationSearchResultDTO dtoItem in dtoOffers.Where(o => o.NewPurchasingPrice.HasValue && o.OfferSeasonDetailID.HasValue && o.StatusID != 3).ToList())
                    {
                        additionalItems = converter.DB2DTO_SimilarItems(context.FactoryQuotation2Mng_SimilarItem_View.Where(o =>
                                                                                                                            !existingIDs.Contains(o.QuotationDetailID) &&
                                                                                                                            o.OfferSeasonDetailID == dtoItem.OfferSeasonDetailID &&
                                                                                                                            o.FactoryID == dtoItem.FactoryID &&
                                                                                                                            o.StatusID != 3).ToList());

                        if (additionalItems.Count() > 0)
                        {
                            additionalItems.ForEach(o => { o.NewPurchasingPrice = dtoItem.NewPurchasingPrice.Value; o.NewPurchasingComment = dtoItem.NewPurchasingComment; });
                            dtoOffers.AddRange(additionalItems);
                        }
                    }

                    foreach (DTO.FactoryQuotationSearchResultDTO dtoItem in dtoOffers.Where(o => o.NewPurchasingPrice.HasValue && o.QuotationStatusNM != "WAITING REJECT"))
                    {
                        QuotationDetail dbQuotationDetail = context.QuotationDetail.FirstOrDefault(o => o.QuotationDetailID == dtoItem.QuotationDetailID);
                        if (dbQuotationDetail == null)
                        {
                            throw new Exception("Quotation item: [" + dtoItem.ArticleCode + "] [" + dtoItem.FactoryUD + "] not found!");
                        }
                        var dbDiff = context.PriceDifference.FirstOrDefault(o => o.PriceDifferenceUD == dtoItem.PriceDifferenceCode && o.Season == dtoItem.Season);
                        if (dbDiff == null)
                        {
                            throw new Exception("Quality code: [" + dtoItem.PriceDifferenceCode + "] [" + dtoItem.Season + "] not found!");
                        }

                        dbQuotationDetail.PurchasingPrice  = dtoItem.NewPurchasingPrice.Value;
                        dbQuotationDetail.PriceUpdatedDate = DateTime.Now;
                        dbQuotationDetail.SalePrice        = dtoItem.NewPurchasingPrice.Value * (1 + Math.Round(dbDiff.Rate.Value / 100, 2, MidpointRounding.AwayFromZero));

                        // check if can confirm
                        if (dbQuotationDetail.TargetPrice == null)
                        {
                            dbQuotationDetail.TargetPrice = 0;
                        }
                        if (dbQuotationDetail.SalePrice == Math.Round(dbQuotationDetail.TargetPrice.Value / (1 + dbDiff.Rate.Value), 2, MidpointRounding.AwayFromZero))
                        {
                            dbQuotationDetail.StatusID          = 3; // confirm status;
                            dbQuotationDetail.StatusUpdatedBy   = userId;
                            dbQuotationDetail.StatusUpdatedDate = DateTime.Now;
                            //confirmedQuotationDetailIDs.Add(dbQuotationDetail.QuotationDetailID);
                            if (dbQuotationDetail.OfferSeasonQuotationRequestDetailID.HasValue)
                            {
                                confirmedQuotationDetailIDs.Add(dbQuotationDetail.QuotationDetailID);
                            }
                        }

                        QuotationOffer dbOffer = new QuotationOffer();
                        context.QuotationOffer.Add(dbOffer);
                        dbOffer.QuotationOfferVersion     = context.QuotationOffer.Count(o => o.QuotationID == dbQuotationDetail.QuotationID) + 1;
                        dbOffer.QuotationID               = dbQuotationDetail.QuotationID;
                        dbOffer.QuotationOfferDate        = DateTime.Now;
                        dbOffer.QuotationOfferDirectionID = 1;
                        dbOffer.UpdatedBy   = userId;
                        dbOffer.UpdatedDate = DateTime.Now;

                        QuotationOfferDetail dbOfferDetail = new QuotationOfferDetail();
                        dbOffer.QuotationOfferDetail.Add(dbOfferDetail);
                        dbOfferDetail.QuotationDetailID = dtoItem.QuotationDetailID;
                        dbOfferDetail.Price             = dtoItem.NewPurchasingPrice.Value;
                        if (!string.IsNullOrEmpty(dtoItem.NewPurchasingComment))
                        {
                            dbOfferDetail.Remark = dtoItem.NewPurchasingComment;
                        }
                    }

                    foreach (DTO.FactoryQuotationSearchResultDTO dtoItem in dtoOffers.Where(o => o.QuotationStatusNM == "WAITING REJECT"))
                    {
                        QuotationDetail dbQuotationDetail = context.QuotationDetail.FirstOrDefault(o => o.QuotationDetailID == dtoItem.QuotationDetailID);
                        if (dbQuotationDetail == null)
                        {
                            throw new Exception("Quotation item: [" + dtoItem.ArticleCode + "] [" + dtoItem.FactoryUD + "] not found!");
                        }

                        dbQuotationDetail.StatusID          = 5; //REJECTED
                        dbQuotationDetail.StatusUpdatedBy   = userId;
                        dbQuotationDetail.StatusUpdatedDate = DateTime.Now;

                        //reset data OfferSeasonDetail
                        context.FactoryQuotation2Mng_function_AfterUnConfirm(dtoItem.QuotationDetailID);
                    }
                    context.SaveChanges();

                    // update offer season planing purchasing price
                    foreach (int quotationDetailID in confirmedQuotationDetailIDs)
                    {
                        context.FW_function_UpdateOfferSeasonDetailPurchasingPriceFromQuotationConfirmed(quotationDetailID, userId);
                    }

                    // refresh cached data
                    foreach (DTO.FactoryQuotationSearchResultDTO dtoItem in dtoOffers.ToList())
                    {
                        context.FW_function_RefreshPriceCacheRow(dtoItem.Season, dtoItem.QuotationDetailID, null);
                    }

                    return(true);
                }
            }
            catch (Exception ex)
            {
                notification = new Library.DTO.Notification()
                {
                    Message = ex.Message, Type = Library.DTO.NotificationType.Error
                };
                return(false);
            }
        }
Example #7
0
        public override DTO.SearchFormData GetDataWithFilter(System.Collections.Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Library.DTO.Notification notification)
        {
            notification = new Library.DTO.Notification {
                Type = Library.DTO.NotificationType.Success
            };
            DTO.SearchFormData data = new DTO.SearchFormData();
            data.Data = new List <DTO.FactoryQuotationSearchResultDTO>();
            data.WaitForFactoryConclusionDTOs           = new List <DTO.FactoryDTO>();
            data.WaitForFactoryProductionConclusionDTOs = new List <DTO.FactoryDTO>();
            totalRows = 0;

            string Season                    = null;
            string ClientUD                  = null;
            string Description               = null;
            string FactoryUD                 = null;
            string ProformaInvoiceNo         = null;
            int?   ItemTypeID                = null;
            int?   StatusID                  = null;
            int?   QuotationOfferDirectionID = null;
            int?   BusinessDataStatusID      = null;
            int    UserID                    = 0;
            bool?  IsDeadline                = null;
            bool?  IsRepeatItem              = null;

            if (filters.ContainsKey("Season") && filters["Season"] != null && !string.IsNullOrEmpty(filters["Season"].ToString()))
            {
                Season = filters["Season"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("ClientUD") && !string.IsNullOrEmpty(filters["ClientUD"].ToString()))
            {
                ClientUD = filters["ClientUD"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("Description") && !string.IsNullOrEmpty(filters["Description"].ToString()))
            {
                Description = filters["Description"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("FactoryUD") && !string.IsNullOrEmpty(filters["FactoryUD"].ToString()))
            {
                FactoryUD = filters["FactoryUD"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("ProformaInvoiceNo") && !string.IsNullOrEmpty(filters["ProformaInvoiceNo"].ToString()))
            {
                ProformaInvoiceNo = filters["ProformaInvoiceNo"].ToString().Replace("'", "''");
            }
            if (filters.ContainsKey("ItemTypeID") && filters["ItemTypeID"] != null && !string.IsNullOrEmpty(filters["ItemTypeID"].ToString()))
            {
                ItemTypeID = Convert.ToInt32(filters["ItemTypeID"].ToString());
            }
            if (filters.ContainsKey("StatusID") && filters["StatusID"] != null && !string.IsNullOrEmpty(filters["StatusID"].ToString()))
            {
                StatusID = Convert.ToInt32(filters["StatusID"].ToString());
            }
            if (filters.ContainsKey("QuotationOfferDirectionID") && filters["QuotationOfferDirectionID"] != null && !string.IsNullOrEmpty(filters["QuotationOfferDirectionID"].ToString()))
            {
                QuotationOfferDirectionID = Convert.ToInt32(filters["QuotationOfferDirectionID"].ToString());
            }
            if (filters.ContainsKey("BusinessDataStatusID") && filters["BusinessDataStatusID"] != null && !string.IsNullOrEmpty(filters["BusinessDataStatusID"].ToString()))
            {
                BusinessDataStatusID = Convert.ToInt32(filters["BusinessDataStatusID"].ToString());
            }
            if (filters.ContainsKey("UserID") && filters["UserID"] != null && !string.IsNullOrEmpty(filters["UserID"].ToString()))
            {
                UserID = Convert.ToInt32(filters["UserID"].ToString());
            }
            if (filters.ContainsKey("IsDeadLine") && filters["IsDeadLine"] != null && !string.IsNullOrEmpty(filters["IsDeadLine"].ToString()))
            {
                IsDeadline = Convert.ToBoolean(int.Parse(filters["IsDeadLine"].ToString()));
            }
            if (filters.ContainsKey("IsRepeatItem") && filters["IsRepeatItem"] != null && !string.IsNullOrEmpty(filters["IsRepeatItem"].ToString()))
            {
                IsRepeatItem = Convert.ToBoolean(int.Parse(filters["IsRepeatItem"].ToString()));
            }
            //try to get data
            try
            {
                using (FactoryQuotation2MngEntities context = CreateContext())
                {
                    // get search data
                    if (pageIndex > 1)
                    {
                        totalRows = -1;
                    }
                    else
                    {
                        // get conclusion by season
                        var dbConclusion = context.FactoryQuotation2Mng_function_GetQuotaionConclusion(Season, ClientUD, Description, FactoryUD,
                                                                                                       ItemTypeID, StatusID, QuotationOfferDirectionID, ProformaInvoiceNo, BusinessDataStatusID).FirstOrDefault();
                        data.TotalItem                    = dbConclusion.TotalItem.Value;
                        data.TotalConfirmedItem           = dbConclusion.TotalConfirmedItem.Value;
                        data.TotalWaitForEurofar          = dbConclusion.TotalWaitEurofar.Value;
                        data.TotalContainer               = dbConclusion.TotalContainer.Value;
                        data.TotalConfirmedContainer      = dbConclusion.TotalConfirmedContainer.Value;
                        data.TotalContainerWaitForEurofar = dbConclusion.TotalContainerWaitEurofar.Value;

                        // wait for factory conclusion - offer item
                        var WaitForFactoryConclusionDTOs = converter.DB2DTO_WaitForFactoryConclusionDTO(context.FactoryQuotation2Mng_function_GetWaitForFactoryConclusion(Season, UserID).ToList());
                        WaitForFactoryConclusionDTOs.Select(o => new { o.FactoryID, o.FactoryUD }).Distinct().ToList().ForEach(o => data.WaitForFactoryConclusionDTOs.Add(new DTO.FactoryDTO {
                            FactoryID = o.FactoryID, FactoryUD = o.FactoryUD
                        }));
                        foreach (DTO.FactoryDTO dtoFactory in data.WaitForFactoryConclusionDTOs)
                        {
                            if (WaitForFactoryConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 1) != null)
                            {
                                dtoFactory.OverDue1Day = WaitForFactoryConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 1).TotalItem;
                            }

                            if (WaitForFactoryConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 2) != null)
                            {
                                dtoFactory.OverDue2Day = WaitForFactoryConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 2).TotalItem;
                            }

                            if (WaitForFactoryConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 3) != null)
                            {
                                dtoFactory.OverDue3Day = WaitForFactoryConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 3).TotalItem;
                            }

                            if (WaitForFactoryConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 4) != null)
                            {
                                dtoFactory.OverDue4DayOrMore = WaitForFactoryConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 4).TotalItem;
                            }

                            dtoFactory.TotalPendingItem    = WaitForFactoryConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID).TotalPendingItem;
                            dtoFactory.PricingTeamMemberID = WaitForFactoryConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID).PricingTeamMemberID;
                            dtoFactory.PricingTeamMemberNM = WaitForFactoryConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID).PricingTeamMemberNM;
                        }

                        // wait for factory conclusion - production item
                        var WaitForFactoryProductionConclusionDTOs = converter.DB2DTO_WaitForFactoryProductionConclusionDTO(context.FactoryQuotation2Mng_function_GetWaitForFactoryProductionConclusion(Season, UserID).ToList());
                        WaitForFactoryProductionConclusionDTOs.Select(o => new { o.FactoryID, o.FactoryUD }).Distinct().ToList().ForEach(o => data.WaitForFactoryProductionConclusionDTOs.Add(new DTO.FactoryDTO {
                            FactoryID = o.FactoryID, FactoryUD = o.FactoryUD
                        }));
                        foreach (DTO.FactoryDTO dtoFactory in data.WaitForFactoryProductionConclusionDTOs)
                        {
                            if (WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == -1) != null)
                            {
                                dtoFactory.OverLDS = WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == -1).TotalItem;
                            }

                            if (WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 0) != null)
                            {
                                dtoFactory.LDS = WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 0).TotalItem;
                            }

                            if (WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 1) != null)
                            {
                                dtoFactory.OneToTwoDays = WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 1).TotalItem;
                            }

                            if (WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 2) != null)
                            {
                                dtoFactory.ThreeToFourDays = WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 2).TotalItem;
                            }

                            if (WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 3) != null)
                            {
                                dtoFactory.FiveToSixDays = WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 3).TotalItem;
                            }

                            if (WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 4) != null)
                            {
                                dtoFactory.MoreThanSixDays = WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID && o.TotalWaitedWeeks == 4).TotalItem;
                            }

                            dtoFactory.TotalPendingItem    = WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID).TotalPendingItem;
                            dtoFactory.PricingTeamMemberID = WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID).PricingTeamMemberID;
                            dtoFactory.PricingTeamMemberNM = WaitForFactoryProductionConclusionDTOs.FirstOrDefault(o => o.FactoryID == dtoFactory.FactoryID).PricingTeamMemberNM;
                        }

                        //totalRows = context.FactoryQuotation2Mng__function_GetTotalRowFound(Season, ClientUD, Description, FactoryUD, ItemTypeID, StatusID, QuotationOfferDirectionID, ProformaInvoiceNo, BusinessDataStatusID, UserID).FirstOrDefault().Value;
                        totalRows = context.FactoryQuotation2Mng_function_SearchFactoryQuotation(Season, ClientUD, Description, FactoryUD, ItemTypeID, StatusID, QuotationOfferDirectionID, ProformaInvoiceNo, BusinessDataStatusID, UserID, IsDeadline, IsRepeatItem, orderBy, orderDirection).Count();
                    }

                    var result = context.FactoryQuotation2Mng_function_SearchFactoryQuotation(Season, ClientUD, Description, FactoryUD, ItemTypeID, StatusID, QuotationOfferDirectionID, ProformaInvoiceNo, BusinessDataStatusID, UserID, IsDeadline, IsRepeatItem, orderBy, orderDirection);
                    data.Data = converter.DB2DTO_FactoryQuotationSearchResult(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = Library.Helper.HandleExceptionSingleLine(ex);
            }

            return(data);
        }