Exemple #1
0
        public void deleteProcess(SqlConnection connection, string feature, string quoteIds, string _userID)
        {
            switch (feature)
            {
            case "Quote":
                List <string> auditIds = AuditDataLayer.GetInstance().GetAuditByQuoteIds(connection, quoteIds);
                if (auditIds.Count > 0)
                {
                    AuditService.GetInstance().DeleteMuti(String.Join(", ", auditIds.ToArray()), _userID);
                }
                List <string> bidPlans = BidPlanDataLayer.GetInstance().GetBidPlanByQuoteIds(connection, quoteIds);
                if (bidPlans.Count > 0)
                {
                    BidPlanService.GetInstance().DeleteMuti(String.Join(", ", bidPlans.ToArray()), _userID);
                }
                List <string> negotiationIDs = NegotiationDataLayer.GetInstance().GetNegotiationByQuoteIds(connection, quoteIds);
                if (negotiationIDs.Count > 0)
                {
                    NegotiationService.GetInstance().DeleteMuti(String.Join(", ", negotiationIDs.ToArray()), _userID);
                }
                List <string> decisonIDs = DecisionDataLayer.GetInstance().GetDecisionByQuoteIds(connection, quoteIds);
                if (decisonIDs.Count > 0)
                {
                    DecisionService.GetInstance().DeleteMuti(String.Join(", ", decisonIDs.ToArray()), _userID);
                }
                List <string> contractIDs = ContractDataLayer.GetInstance().GetContractByQuoteIds(connection, quoteIds, _userID);
                if (contractIDs.Count > 0)
                {
                    ContractService.GetInstance().deleteMuti(String.Join(", ", contractIDs.ToArray()), _userID);
                }
                List <string> deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                List <string> acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "Audit":
                bidPlans = BidPlanDataLayer.GetInstance().GetBidPlanByQuoteIds(connection, quoteIds);
                if (bidPlans.Count > 0)
                {
                    BidPlanService.GetInstance().DeleteMuti(String.Join(", ", bidPlans.ToArray()), _userID);
                }
                negotiationIDs = NegotiationDataLayer.GetInstance().GetNegotiationByQuoteIds(connection, quoteIds);
                if (negotiationIDs.Count > 0)
                {
                    NegotiationService.GetInstance().DeleteMuti(String.Join(", ", negotiationIDs.ToArray()), _userID);
                }
                decisonIDs = DecisionDataLayer.GetInstance().GetDecisionByQuoteIds(connection, quoteIds);
                if (decisonIDs.Count > 0)
                {
                    DecisionService.GetInstance().DeleteMuti(String.Join(", ", decisonIDs.ToArray()), _userID);
                }
                contractIDs = ContractDataLayer.GetInstance().GetContractByQuoteIds(connection, quoteIds, _userID);
                if (contractIDs.Count > 0)
                {
                    ContractService.GetInstance().deleteMuti(String.Join(", ", contractIDs.ToArray()), _userID);
                }
                deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "BidPlan":
                negotiationIDs = NegotiationDataLayer.GetInstance().GetNegotiationByQuoteIds(connection, quoteIds);
                if (negotiationIDs.Count > 0)
                {
                    NegotiationService.GetInstance().DeleteMuti(String.Join(", ", negotiationIDs.ToArray()), _userID);
                }
                decisonIDs = DecisionDataLayer.GetInstance().GetDecisionByQuoteIds(connection, quoteIds);
                if (decisonIDs.Count > 0)
                {
                    DecisionService.GetInstance().DeleteMuti(String.Join(", ", decisonIDs.ToArray()), _userID);
                }
                contractIDs = ContractDataLayer.GetInstance().GetContractByQuoteIds(connection, quoteIds, _userID);
                if (contractIDs.Count > 0)
                {
                    ContractService.GetInstance().deleteMuti(String.Join(", ", contractIDs.ToArray()), _userID);
                }
                deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "Negotiation":
                decisonIDs = DecisionDataLayer.GetInstance().GetDecisionByQuoteIds(connection, quoteIds);
                if (decisonIDs.Count > 0)
                {
                    DecisionService.GetInstance().DeleteMuti(String.Join(", ", decisonIDs.ToArray()), _userID);
                }
                contractIDs = ContractDataLayer.GetInstance().GetContractByQuoteIds(connection, quoteIds, _userID);
                if (contractIDs.Count > 0)
                {
                    ContractService.GetInstance().deleteMuti(String.Join(", ", contractIDs.ToArray()), _userID);
                }
                deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "Decision":
                contractIDs = ContractDataLayer.GetInstance().GetContractByQuoteIds(connection, quoteIds, _userID);
                if (contractIDs.Count > 0)
                {
                    ContractService.GetInstance().deleteMuti(String.Join(", ", contractIDs.ToArray()), _userID);
                }
                deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "Contract":
                deliveryReceiptIDs = DeliveryReceiptDataLayer.GetInstance().GetDeliveryReceiptByQuoteIds(connection, quoteIds);
                if (deliveryReceiptIDs.Count > 0)
                {
                    DeliveryReceiptServices.GetInstance().DeleteMuti(String.Join(", ", deliveryReceiptIDs.ToArray()), _userID);
                }
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            case "DeliveryReceipt":
                acceptanceIDs = AcceptanceDataLayer.GetInstance().GetAcceptanceByQuoteIds(connection, quoteIds);
                if (acceptanceIDs.Count > 0)
                {
                    AcceptanceServices.GetInstance().DeleteMuti(String.Join(", ", acceptanceIDs.ToArray()));
                }
                break;

            default:
                break;
            }
        }