private void PackageIssueInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("PackageIssues", "PackageIssueID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.PackageIssue)); this.totalSmartPortalEntities.CreateTrigger("PackageIssueInitReference", simpleInitReference.CreateQuery()); string queryString = " @PackageIssueID int " + "\r\n"; queryString = queryString + " WITH ENCRYPTION " + "\r\n"; queryString = queryString + " AS " + "\r\n"; queryString = queryString + " SELECT TOP 1 Reference FROM PackageIssues WHERE PackageIssueID = @PackageIssueID " + "\r\n"; this.totalSmartPortalEntities.CreateStoredProcedure("PackageIssueGetReference", queryString); }
private void PurchaseOrderInitReference() { ////CHU Y: FOR EACH PROJECT: STANDARD TRIGGER KHÔNG CÓ TÙY BIẾN BY ProjectID. NOW: PurchaseOrderInitReference HAS BEEN MODIFY DIRECTLY BY SQL TOOL. HERE WE HAVE A COPY OF THE T-SQL ////BELOW IS THE FINAL (CORRECT) TRIGGER. WE MODIFY THIS TRIGGER FROM THE STANDARD TRIGGER ////USE [ProjectManager] ////GO /////****** Object: Trigger [dbo].[PurchaseOrderInitReference] Script Date: 24/07/2017 10:18:03 ******/ ////SET ANSI_NULLS ON ////GO ////SET QUOTED_IDENTIFIER ON ////GO ////ALTER TRIGGER [dbo].[PurchaseOrderInitReference] //// ON [dbo].[PurchaseOrders] AFTER INSERT //// AS //// DECLARE @LocationID int SET @LocationID = (SELECT LocationID FROM Inserted) //// DECLARE @EntityID int SET @EntityID = (SELECT PurchaseOrderID FROM Inserted) //// DECLARE @EntryDate DateTime SET @EntryDate = (SELECT EntryDate FROM Inserted) //// DECLARE @ProjectID int SET @ProjectID = (SELECT ProjectID FROM Inserted) //// DECLARE @PrefixLetter varchar(10) SET @PrefixLetter = 'D' //// DECLARE @columnNameMax int //// SET @columnNameMax = (SELECT MAX(CAST( SUBSTRING(Reference, LEN(@PrefixLetter) + 1, CASE PATINDEX('%.%', Reference) WHEN 0 THEN LEN(Reference) - LEN(@PrefixLetter) ELSE PATINDEX('%.%', Reference) - 1 - LEN(@PrefixLetter) END) AS Int)) AS columnNameMax FROM PurchaseOrders WHERE LocationID = @LocationID AND ProjectID = @ProjectID ////) IF @columnNameMax IS NULL SET @columnNameMax = 1 ELSE SET @columnNameMax = @columnNameMax + 1 UPDATE PurchaseOrders //// SET Reference = @PrefixLetter + RIGHT(CAST(100000000 + @columnNameMax as varchar), 6 - LEN(@PrefixLetter)) //// WHERE PurchaseOrderID = @EntityID //// UPDATE PurchaseOrders SET PoNumber = RIGHT(Reference, 5) WHERE PurchaseOrderID = @EntityID //14-JUL-2017: MR TUAN: NO NEED TO INIT REFERENCE BY PROJECT. JUST USE THE STANDARD TRIGGERR SimpleInitReference simpleInitReference = new SimpleInitReference("PurchaseOrders", "PurchaseOrderID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.PurchaseOrder)); this.projectManagerEntities.CreateTrigger("PurchaseOrderInitReference", simpleInitReference.CreateQuery() + " UPDATE PurchaseOrders SET PoNumber = RIGHT(Reference, 5) WHERE PurchaseOrderID = @EntityID "); }
private void SalesOrderInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("SalesOrders", "SalesOrderID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.SalesOrder)); this.totalSmartPortalEntities.CreateTrigger("SalesOrderInitReference", simpleInitReference.CreateQuery()); }
private void BatchMasterInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("BatchMasters", "BatchMasterID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.BatchMaster)); this.totalSmartCodingEntities.CreateTrigger("BatchMasterInitReference", simpleInitReference.CreateQuery()); }
private void AccountInvoiceInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("AccountInvoices", "AccountInvoiceID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.AccountInvoice)); this.totalBikePortalsEntities.CreateTrigger("AccountInvoiceInitReference", simpleInitReference.CreateQuery()); }
private void HandlingUnitInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("HandlingUnits", "HandlingUnitID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.HandlingUnit)); this.totalSalesPortalEntities.CreateTrigger("HandlingUnitInitReference", simpleInitReference.CreateQuery()); }
private void SemifinishedProductInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("SemifinishedProducts", "SemifinishedProductID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.SemifinishedProduct)); this.totalSmartPortalEntities.CreateTrigger("SemifinishedProductInitReference", simpleInitReference.CreateQuery()); }
private void FinishedItemInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("FinishedItems", "FinishedItemID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.FinishedItem)); this.totalSmartPortalEntities.CreateTrigger("FinishedItemInitReference", simpleInitReference.CreateQuery()); }
private void GoodsReceiptInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("GoodsReceipts", "GoodsReceiptID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.GoodsReceipt)); this.totalBikePortalsEntities.CreateTrigger("GoodsReceiptInitReference", simpleInitReference.CreateQuery()); }
private void PurchaseOrderInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("PurchaseOrders", "PurchaseOrderID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.PurchaseOrder)); this.totalBikePortalsEntities.CreateTrigger("PurchaseOrderInitReference", simpleInitReference.CreateQuery()); }
private void AccountInvoiceInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("AccountInvoices", "AccountInvoiceID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.AccountInvoice)); this.totalSalesPortalEntities.CreateTrigger("AccountInvoiceInitReference", simpleInitReference.CreateQuery()); }
private void ServiceContractInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("ServiceContracts", "ServiceContractID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.ServiceContract)); this.totalBikePortalsEntities.CreateTrigger("ServiceContractInitReference", simpleInitReference.CreateQuery()); }
private void QuotationInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("Quotations", "QuotationID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.Quotation)); this.totalBikePortalsEntities.CreateTrigger("QuotationInitReference", simpleInitReference.CreateQuery()); }
private void DeliveryAdviceInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("DeliveryAdvices", "DeliveryAdviceID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.DeliveryAdvices)); this.totalSmartCodingEntities.CreateTrigger("DeliveryAdviceInitReference", simpleInitReference.CreateQuery()); }
private void BlendingInstructionInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("BlendingInstructions", "BlendingInstructionID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.BlendingInstruction)); this.totalSmartPortalEntities.CreateTrigger("BlendingInstructionInitReference", simpleInitReference.CreateQuery()); }
private void WarehouseAdjustmentInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("WarehouseAdjustments", "WarehouseAdjustmentID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.WarehouseAdjustments)); this.totalSmartCodingEntities.CreateTrigger("WarehouseAdjustmentInitReference", simpleInitReference.CreateQuery()); }
private void GoodsDeliveryInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("GoodsDeliveries", "GoodsDeliveryID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.GoodsDelivery)); this.totalSmartPortalEntities.CreateTrigger("GoodsDeliveryInitReference", simpleInitReference.CreateQuery()); }
private void MaterialIssueInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("MaterialIssues", "MaterialIssueID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.MaterialIssue)); this.totalSmartPortalEntities.CreateTrigger("MaterialIssueInitReference", simpleInitReference.CreateQuery()); }
private void TransferOrderInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("TransferOrders", "TransferOrderID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.TransferOrder)); this.totalBikePortalsEntities.CreateTrigger("TransferOrderInitReference", simpleInitReference.CreateQuery()); }
private void CommoditySettingInitReference() { SimpleInitReference simpleInitReference = new SimpleInitReference("CommoditySettings", "CommoditySettingID", "Reference", ModelSettingManager.ReferenceLength, ModelSettingManager.ReferencePrefix(GlobalEnums.NmvnTaskID.CommoditySettings)); this.totalSmartCodingEntities.CreateTrigger("CommoditySettingInitReference", simpleInitReference.CreateQuery()); }