Ejemplo n.º 1
0
    //end insert order number

    /// <summary>
    /// function to update order number in ordertable
    /// creates a new ordernumber in office table depending on officeid and updates specified order with this ordernumber
    /// </summary>
    /// <param name="orderid">from newly saved order on ordertable</param>
    /// <param name="officeid">from user profile or selected office</param>
    /// <returns></returns>
    public static int update_office_ordernumber(int orderid, int officeid)
    {
        int _newordernumber = 0;
        //get officeid, officeindicator - this will be used to determine the office indicator when the cloned order is saved
        //and it might be different to the original order depending on who is creating the clone
        //get new office indicator
        //using xml file for lookup at the officelookuptable in the database is not correctly configured (check with Dave re: fix)
        //make sure we have a default but it should come from lookup
        string _newoffice = wwi_func.lookup_xml_string("//xml//office_names.xml", "value", officeid.ToString(), "name", "UK Order");

        //create and return a new ordernumber from appropriate table
        _newordernumber = wwi_data.insert_order_number(officeid);
        //update the order just saved
        OrderTable _t = new OrderTable(orderid);

        _t.OrderNumber     = _newordernumber;
        _t.OfficeIndicator = _newoffice;
        //update order
        _t.Save();

        return(_newordernumber);
    }
        public void PodUpdate(int OrderID, int OrderNumber, bool HotJob, int? CompanyID, int? AgentAtOriginID, int? PrinterID, int? OrderControllerID, int? OperationsControllerID, int? OriginPortControllerID, int? ContactID, DateTime? ExWorksDate, DateTime? CargoReady, DateTime? WarehouseDate, DateTime? BookingReceived, int? OriginPointID, int? PortID, int? DestinationPortID, int? FinalDestinationID, int? CountryID, int? Palletise, string RemarksToCustomer, bool DocsRcdAndApproved, DateTime? DocsApprovedDate, bool ExpressBL, bool FumigationCert, bool GSPCert, bool PackingDeclaration, string OtherDocsRequired)
        {
            //this is a fix for the issue: ods controller does not update nullable columns to null values
            //When using the Update method on ODSController (ie using GridView / FormView in an ASP.NET //application) and passing null values to nullable columns, the nullable column value remains //unchanged.
            //By creating an empty MyItem instance (all fields are null) and setting a nullable field to //null doesn' t allow the column to finish in the DirtyColumns collection (see ActiveHelper //GetUpdateCommand).
            //loading the specified record using key means MyItem instance is populated and so the nulled //column wil be dirty
            //OrderTable item = new OrderTable();
            OrderTable item = new OrderTable(OrderID);
            item.MarkOld();
            item.IsLoaded = true;

            item.OrderID = OrderID;

            item.OrderNumber = OrderNumber; //required field

            item.HotJob = HotJob;

            item.CompanyID = CompanyID;

            item.AgentAtOriginID = AgentAtOriginID;

            item.PrinterID = PrinterID;

            item.OrderControllerID = OrderControllerID;

            item.OperationsControllerID = OperationsControllerID;

            item.OriginPortControllerID = OriginPortControllerID;

            item.ContactID = ContactID;

            item.ExWorksDate = ExWorksDate;

            item.CargoReady = CargoReady;

            item.WarehouseDate = WarehouseDate;

            item.BookingReceived = BookingReceived;

            item.OriginPointID = OriginPointID;

            item.PortID = PortID;

            item.DestinationPortID = DestinationPortID;

            item.FinalDestinationID = FinalDestinationID;

            item.CountryID = CountryID;

            item.Palletise = Palletise;

            item.RemarksToCustomer = RemarksToCustomer;

            item.DocsRcdAndApproved = DocsRcdAndApproved;

            item.DocsApprovedDate = DocsApprovedDate;

            item.ExpressBL = ExpressBL;

            item.FumigationCert = FumigationCert;

            item.GSPCert = GSPCert;

            item.PackingDeclaration = PackingDeclaration;

            item.OtherDocsRequired = OtherDocsRequired;

            item.Save(UserName);
        }
        public void PodInsert(int? OrderNumber, string OfficeIndicator, bool PublishipOrder, DateTime? DateOrderCreated, bool HotJob, int? CompanyID, int? ConsigneeID, int? NotifyPartyID, int? AgentAtOriginID, int? AgentAtDestinationID, int? PrinterID, int? ClearingAgentID, int? OnCarriageID, int? OrderControllerID, int? OperationsControllerID, int? OriginPortControllerID, int? DestinationPortControllerID, string CustomersRef, int? ContactID, DateTime? ExWorksDate, DateTime? EWDLastUpdated, DateTime? CargoReady, DateTime? WarehouseDate, bool? OnTime, DateTime? BookingReceived, int? OriginPointID, int? PortID, int? DestinationPortID, int? FinalDestinationID, int? CountryID, string OldVesselName, int? DestinationCountryID, int? VesselID, DateTime? VesselLastUpdated, DateTime? Ets, DateTime? Eta, string PearsonDivCode, string PearsonSSRRef, string HouseBLNUmber, bool HouseBLAdded, bool ShippedOnBoard, float? EstCopies, DateTime? CopiesLastUpdated, int? EstCartons, int? EstPallets, int? EstWeight, float? EstVolume, int? Palletise, int? PackageTypeID, int? NumberOfPackages, int? ActualCartons, int? ActualPallets, int? Jackets, int? ActualWeight, DateTime? WeightLastUpdated, float? ActualVolume, DateTime? VolumeLastUpdated, bool? Fcllcl, int? Est20, int? Est40, int? EstLCLWt, float? EstLCLVol, int? No20, int? No40, int? LCLWt, float? LCLVol, string Remarks, string RemarksToCustomer, int? QuoteRef, string Sellingrate, string SellingrateAgent, bool DocsRcdAndApproved, DateTime? DocsApprovedDate, DateTime? JobClosureDate, bool JobClosed, bool ExpressBL, bool FumigationCert, bool GSPCert, bool COfO, bool PackingDeclaration, string OtherDocsRequired, string Incoterms, float? PricePerCopy, string Customs, string Currency, int? InvoiceAddresseeID, int? ConsolNumber, float? UnitPricePerCopy, bool OnHold, string ContainerInfo, DateTime? Cleared, float? HodderPricePerCopy, bool FileCoverPrintedOrigin, bool FileCoverPrintedDest, string ClientsTerms, string OriginTrucking, string OrignTHC, string OriginDocs, string Freight, string DestTHC, string DestPalletisation, string CustomsClearance, string DeliveryCharges, string CoLoaderComments, string Pdcid, string HCCompositeRef, decimal? HCInvoiceAmount, string Impression, decimal? InsuranceValue, double? InsuranceValues, int? InvoiceNumber, DateTime? InvoiceDate, DateTime? CancelRequestRcd, bool? OrderCancelled, DateTime? CancelDate, int? CancelledBy, int? InvoiceTo, decimal? HCInvoiceAmount2, bool? OrderAckSent, int? CargoUpdateId, int? QuoteId, int? DocumentFolder, byte[] Ts)
        {
            OrderTable item = new OrderTable();

            item.OrderNumber = OrderNumber;

            item.OfficeIndicator = OfficeIndicator;

            item.PublishipOrder = PublishipOrder;

            item.DateOrderCreated = DateOrderCreated;

            item.HotJob = HotJob;

            item.CompanyID = CompanyID;

            item.ConsigneeID = ConsigneeID;

            item.NotifyPartyID = NotifyPartyID;

            item.AgentAtOriginID = AgentAtOriginID;

            item.AgentAtDestinationID = AgentAtDestinationID;

            item.PrinterID = PrinterID;

            item.ClearingAgentID = ClearingAgentID;

            item.OnCarriageID = OnCarriageID;

            item.OrderControllerID = OrderControllerID;

            item.OperationsControllerID = OperationsControllerID;

            item.OriginPortControllerID = OriginPortControllerID;

            item.DestinationPortControllerID = DestinationPortControllerID;

            item.CustomersRef = CustomersRef;

            item.ContactID = ContactID;

            item.ExWorksDate = ExWorksDate;

            item.EWDLastUpdated = EWDLastUpdated;

            item.CargoReady = CargoReady;

            item.WarehouseDate = WarehouseDate;

            item.OnTime = OnTime;

            item.BookingReceived = BookingReceived;

            item.OriginPointID = OriginPointID;

            item.PortID = PortID;

            item.DestinationPortID = DestinationPortID;

            item.FinalDestinationID = FinalDestinationID;

            item.CountryID = CountryID;

            item.OldVesselName = OldVesselName;

            item.DestinationCountryID = DestinationCountryID;

            item.VesselID = VesselID;

            item.VesselLastUpdated = VesselLastUpdated;

            item.Ets = Ets;

            item.Eta = Eta;

            item.PearsonDivCode = PearsonDivCode;

            item.PearsonSSRRef = PearsonSSRRef;

            item.HouseBLNUmber = HouseBLNUmber;

            item.HouseBLAdded = HouseBLAdded;

            item.ShippedOnBoard = ShippedOnBoard;

            item.EstCopies = EstCopies;

            item.CopiesLastUpdated = CopiesLastUpdated;

            item.EstCartons = EstCartons;

            item.EstPallets = EstPallets;

            item.EstWeight = EstWeight;

            item.EstVolume = EstVolume;

            item.Palletise = Palletise;

            item.PackageTypeID = PackageTypeID;

            item.NumberOfPackages = NumberOfPackages;

            item.ActualCartons = ActualCartons;

            item.ActualPallets = ActualPallets;

            item.Jackets = Jackets;

            item.ActualWeight = ActualWeight;

            item.WeightLastUpdated = WeightLastUpdated;

            item.ActualVolume = ActualVolume;

            item.VolumeLastUpdated = VolumeLastUpdated;

            item.Fcllcl = Fcllcl;

            item.Est20 = Est20;

            item.Est40 = Est40;

            item.EstLCLWt = EstLCLWt;

            item.EstLCLVol = EstLCLVol;

            item.No20 = No20;

            item.No40 = No40;

            item.LCLWt = LCLWt;

            item.LCLVol = LCLVol;

            item.Remarks = Remarks;

            item.RemarksToCustomer = RemarksToCustomer;

            item.QuoteRef = QuoteRef;

            item.Sellingrate = Sellingrate;

            item.SellingrateAgent = SellingrateAgent;

            item.DocsRcdAndApproved = DocsRcdAndApproved;

            item.DocsApprovedDate = DocsApprovedDate;

            item.JobClosureDate = JobClosureDate;

            item.JobClosed = JobClosed;

            item.ExpressBL = ExpressBL;

            item.FumigationCert = FumigationCert;

            item.GSPCert = GSPCert;

            item.COfO = COfO;

            item.PackingDeclaration = PackingDeclaration;

            item.OtherDocsRequired = OtherDocsRequired;

            item.Incoterms = Incoterms;

            item.PricePerCopy = PricePerCopy;

            item.Customs = Customs;

            item.Currency = Currency;

            item.InvoiceAddresseeID = InvoiceAddresseeID;

            item.ConsolNumber = ConsolNumber;

            item.UnitPricePerCopy = UnitPricePerCopy;

            item.OnHold = OnHold;

            item.ContainerInfo = ContainerInfo;

            item.Cleared = Cleared;

            item.HodderPricePerCopy = HodderPricePerCopy;

            item.FileCoverPrintedOrigin = FileCoverPrintedOrigin;

            item.FileCoverPrintedDest = FileCoverPrintedDest;

            item.ClientsTerms = ClientsTerms;

            item.OriginTrucking = OriginTrucking;

            item.OrignTHC = OrignTHC;

            item.OriginDocs = OriginDocs;

            item.Freight = Freight;

            item.DestTHC = DestTHC;

            item.DestPalletisation = DestPalletisation;

            item.CustomsClearance = CustomsClearance;

            item.DeliveryCharges = DeliveryCharges;

            item.CoLoaderComments = CoLoaderComments;

            item.Pdcid = Pdcid;

            item.HCCompositeRef = HCCompositeRef;

            item.HCInvoiceAmount = HCInvoiceAmount;

            item.Impression = Impression;

            item.InsuranceValue = InsuranceValue;

            item.InsuranceValues = InsuranceValues;

            item.InvoiceNumber = InvoiceNumber;

            item.InvoiceDate = InvoiceDate;

            item.CancelRequestRcd = CancelRequestRcd;

            item.OrderCancelled = OrderCancelled;

            item.CancelDate = CancelDate;

            item.CancelledBy = CancelledBy;

            item.InvoiceTo = InvoiceTo;

            item.HCInvoiceAmount2 = HCInvoiceAmount2;

            item.OrderAckSent = OrderAckSent;

            item.CargoUpdateId = CargoUpdateId;

            item.QuoteId = QuoteId;

            item.DocumentFolder = DocumentFolder;

            item.Ts = Ts;


            item.Save(UserName);
        }
        public void PodUpdate(int OrderID, int OrderNumber, bool HotJob, int?CompanyID, int?AgentAtOriginID, int?PrinterID, int?OrderControllerID, int?OperationsControllerID, int?OriginPortControllerID, int?ContactID, DateTime?ExWorksDate, DateTime?CargoReady, DateTime?WarehouseDate, DateTime?BookingReceived, int?OriginPointID, int?PortID, int?DestinationPortID, int?FinalDestinationID, int?CountryID, int?Palletise, string RemarksToCustomer, bool DocsRcdAndApproved, DateTime?DocsApprovedDate, bool ExpressBL, bool FumigationCert, bool GSPCert, bool PackingDeclaration, string OtherDocsRequired)
        {
            //this is a fix for the issue: ods controller does not update nullable columns to null values
            //When using the Update method on ODSController (ie using GridView / FormView in an ASP.NET //application) and passing null values to nullable columns, the nullable column value remains //unchanged.
            //By creating an empty MyItem instance (all fields are null) and setting a nullable field to //null doesn' t allow the column to finish in the DirtyColumns collection (see ActiveHelper //GetUpdateCommand).
            //loading the specified record using key means MyItem instance is populated and so the nulled //column wil be dirty
            //OrderTable item = new OrderTable();
            OrderTable item = new OrderTable(OrderID);

            item.MarkOld();
            item.IsLoaded = true;

            item.OrderID = OrderID;

            item.OrderNumber = OrderNumber; //required field

            item.HotJob = HotJob;

            item.CompanyID = CompanyID;

            item.AgentAtOriginID = AgentAtOriginID;

            item.PrinterID = PrinterID;

            item.OrderControllerID = OrderControllerID;

            item.OperationsControllerID = OperationsControllerID;

            item.OriginPortControllerID = OriginPortControllerID;

            item.ContactID = ContactID;

            item.ExWorksDate = ExWorksDate;

            item.CargoReady = CargoReady;

            item.WarehouseDate = WarehouseDate;

            item.BookingReceived = BookingReceived;

            item.OriginPointID = OriginPointID;

            item.PortID = PortID;

            item.DestinationPortID = DestinationPortID;

            item.FinalDestinationID = FinalDestinationID;

            item.CountryID = CountryID;

            item.Palletise = Palletise;

            item.RemarksToCustomer = RemarksToCustomer;

            item.DocsRcdAndApproved = DocsRcdAndApproved;

            item.DocsApprovedDate = DocsApprovedDate;

            item.ExpressBL = ExpressBL;

            item.FumigationCert = FumigationCert;

            item.GSPCert = GSPCert;

            item.PackingDeclaration = PackingDeclaration;

            item.OtherDocsRequired = OtherDocsRequired;

            item.Save(UserName);
        }
        public void PodInsert(int?OrderNumber, string OfficeIndicator, bool PublishipOrder, DateTime?DateOrderCreated, bool HotJob, int?CompanyID, int?ConsigneeID, int?NotifyPartyID, int?AgentAtOriginID, int?AgentAtDestinationID, int?PrinterID, int?ClearingAgentID, int?OnCarriageID, int?OrderControllerID, int?OperationsControllerID, int?OriginPortControllerID, int?DestinationPortControllerID, string CustomersRef, int?ContactID, DateTime?ExWorksDate, DateTime?EWDLastUpdated, DateTime?CargoReady, DateTime?WarehouseDate, bool?OnTime, DateTime?BookingReceived, int?OriginPointID, int?PortID, int?DestinationPortID, int?FinalDestinationID, int?CountryID, string OldVesselName, int?DestinationCountryID, int?VesselID, DateTime?VesselLastUpdated, DateTime?Ets, DateTime?Eta, string PearsonDivCode, string PearsonSSRRef, string HouseBLNUmber, bool HouseBLAdded, bool ShippedOnBoard, float?EstCopies, DateTime?CopiesLastUpdated, int?EstCartons, int?EstPallets, int?EstWeight, float?EstVolume, int?Palletise, int?PackageTypeID, int?NumberOfPackages, int?ActualCartons, int?ActualPallets, int?Jackets, int?ActualWeight, DateTime?WeightLastUpdated, float?ActualVolume, DateTime?VolumeLastUpdated, bool?Fcllcl, int?Est20, int?Est40, int?EstLCLWt, float?EstLCLVol, int?No20, int?No40, int?LCLWt, float?LCLVol, string Remarks, string RemarksToCustomer, int?QuoteRef, string Sellingrate, string SellingrateAgent, bool DocsRcdAndApproved, DateTime?DocsApprovedDate, DateTime?JobClosureDate, bool JobClosed, bool ExpressBL, bool FumigationCert, bool GSPCert, bool COfO, bool PackingDeclaration, string OtherDocsRequired, string Incoterms, float?PricePerCopy, string Customs, string Currency, int?InvoiceAddresseeID, int?ConsolNumber, float?UnitPricePerCopy, bool OnHold, string ContainerInfo, DateTime?Cleared, float?HodderPricePerCopy, bool FileCoverPrintedOrigin, bool FileCoverPrintedDest, string ClientsTerms, string OriginTrucking, string OrignTHC, string OriginDocs, string Freight, string DestTHC, string DestPalletisation, string CustomsClearance, string DeliveryCharges, string CoLoaderComments, string Pdcid, string HCCompositeRef, decimal?HCInvoiceAmount, string Impression, decimal?InsuranceValue, double?InsuranceValues, int?InvoiceNumber, DateTime?InvoiceDate, DateTime?CancelRequestRcd, bool?OrderCancelled, DateTime?CancelDate, int?CancelledBy, int?InvoiceTo, decimal?HCInvoiceAmount2, bool?OrderAckSent, int?CargoUpdateId, int?QuoteId, int?DocumentFolder, byte[] Ts)
        {
            OrderTable item = new OrderTable();

            item.OrderNumber = OrderNumber;

            item.OfficeIndicator = OfficeIndicator;

            item.PublishipOrder = PublishipOrder;

            item.DateOrderCreated = DateOrderCreated;

            item.HotJob = HotJob;

            item.CompanyID = CompanyID;

            item.ConsigneeID = ConsigneeID;

            item.NotifyPartyID = NotifyPartyID;

            item.AgentAtOriginID = AgentAtOriginID;

            item.AgentAtDestinationID = AgentAtDestinationID;

            item.PrinterID = PrinterID;

            item.ClearingAgentID = ClearingAgentID;

            item.OnCarriageID = OnCarriageID;

            item.OrderControllerID = OrderControllerID;

            item.OperationsControllerID = OperationsControllerID;

            item.OriginPortControllerID = OriginPortControllerID;

            item.DestinationPortControllerID = DestinationPortControllerID;

            item.CustomersRef = CustomersRef;

            item.ContactID = ContactID;

            item.ExWorksDate = ExWorksDate;

            item.EWDLastUpdated = EWDLastUpdated;

            item.CargoReady = CargoReady;

            item.WarehouseDate = WarehouseDate;

            item.OnTime = OnTime;

            item.BookingReceived = BookingReceived;

            item.OriginPointID = OriginPointID;

            item.PortID = PortID;

            item.DestinationPortID = DestinationPortID;

            item.FinalDestinationID = FinalDestinationID;

            item.CountryID = CountryID;

            item.OldVesselName = OldVesselName;

            item.DestinationCountryID = DestinationCountryID;

            item.VesselID = VesselID;

            item.VesselLastUpdated = VesselLastUpdated;

            item.Ets = Ets;

            item.Eta = Eta;

            item.PearsonDivCode = PearsonDivCode;

            item.PearsonSSRRef = PearsonSSRRef;

            item.HouseBLNUmber = HouseBLNUmber;

            item.HouseBLAdded = HouseBLAdded;

            item.ShippedOnBoard = ShippedOnBoard;

            item.EstCopies = EstCopies;

            item.CopiesLastUpdated = CopiesLastUpdated;

            item.EstCartons = EstCartons;

            item.EstPallets = EstPallets;

            item.EstWeight = EstWeight;

            item.EstVolume = EstVolume;

            item.Palletise = Palletise;

            item.PackageTypeID = PackageTypeID;

            item.NumberOfPackages = NumberOfPackages;

            item.ActualCartons = ActualCartons;

            item.ActualPallets = ActualPallets;

            item.Jackets = Jackets;

            item.ActualWeight = ActualWeight;

            item.WeightLastUpdated = WeightLastUpdated;

            item.ActualVolume = ActualVolume;

            item.VolumeLastUpdated = VolumeLastUpdated;

            item.Fcllcl = Fcllcl;

            item.Est20 = Est20;

            item.Est40 = Est40;

            item.EstLCLWt = EstLCLWt;

            item.EstLCLVol = EstLCLVol;

            item.No20 = No20;

            item.No40 = No40;

            item.LCLWt = LCLWt;

            item.LCLVol = LCLVol;

            item.Remarks = Remarks;

            item.RemarksToCustomer = RemarksToCustomer;

            item.QuoteRef = QuoteRef;

            item.Sellingrate = Sellingrate;

            item.SellingrateAgent = SellingrateAgent;

            item.DocsRcdAndApproved = DocsRcdAndApproved;

            item.DocsApprovedDate = DocsApprovedDate;

            item.JobClosureDate = JobClosureDate;

            item.JobClosed = JobClosed;

            item.ExpressBL = ExpressBL;

            item.FumigationCert = FumigationCert;

            item.GSPCert = GSPCert;

            item.COfO = COfO;

            item.PackingDeclaration = PackingDeclaration;

            item.OtherDocsRequired = OtherDocsRequired;

            item.Incoterms = Incoterms;

            item.PricePerCopy = PricePerCopy;

            item.Customs = Customs;

            item.Currency = Currency;

            item.InvoiceAddresseeID = InvoiceAddresseeID;

            item.ConsolNumber = ConsolNumber;

            item.UnitPricePerCopy = UnitPricePerCopy;

            item.OnHold = OnHold;

            item.ContainerInfo = ContainerInfo;

            item.Cleared = Cleared;

            item.HodderPricePerCopy = HodderPricePerCopy;

            item.FileCoverPrintedOrigin = FileCoverPrintedOrigin;

            item.FileCoverPrintedDest = FileCoverPrintedDest;

            item.ClientsTerms = ClientsTerms;

            item.OriginTrucking = OriginTrucking;

            item.OrignTHC = OrignTHC;

            item.OriginDocs = OriginDocs;

            item.Freight = Freight;

            item.DestTHC = DestTHC;

            item.DestPalletisation = DestPalletisation;

            item.CustomsClearance = CustomsClearance;

            item.DeliveryCharges = DeliveryCharges;

            item.CoLoaderComments = CoLoaderComments;

            item.Pdcid = Pdcid;

            item.HCCompositeRef = HCCompositeRef;

            item.HCInvoiceAmount = HCInvoiceAmount;

            item.Impression = Impression;

            item.InsuranceValue = InsuranceValue;

            item.InsuranceValues = InsuranceValues;

            item.InvoiceNumber = InvoiceNumber;

            item.InvoiceDate = InvoiceDate;

            item.CancelRequestRcd = CancelRequestRcd;

            item.OrderCancelled = OrderCancelled;

            item.CancelDate = CancelDate;

            item.CancelledBy = CancelledBy;

            item.InvoiceTo = InvoiceTo;

            item.HCInvoiceAmount2 = HCInvoiceAmount2;

            item.OrderAckSent = OrderAckSent;

            item.CargoUpdateId = CargoUpdateId;

            item.QuoteId = QuoteId;

            item.DocumentFolder = DocumentFolder;

            item.Ts = Ts;


            item.Save(UserName);
        }
Ejemplo n.º 6
0
    //end update
    /// <summary>
    /// we don't really need an insert sub as address details can't be entered until main order details have been saved
    /// </summary>
    protected void insert_addresses()
    {
        try
        {
            //use order id 303635 for testing purposes
            int _orderid = wwi_func.vint(wwi_security.DecryptString(get_token("pid"), "publiship"));

            if (_orderid > 0)
            {
                OrderTable _t = new OrderTable(_orderid);

                //dlls
                int?         _intnull = null;
                ASPxComboBox _cb      = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboConsigneeIDEdit");
                if (_cb != null)
                {
                    _t.ConsigneeID = _cb.Value != null?wwi_func.vint(_cb.Value.ToString()) : _intnull;
                }

                _cb = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboClearingAgentIDEdit");
                if (_cb != null)
                {
                    _t.ClearingAgentID = _cb.Value != null?wwi_func.vint(_cb.Value.ToString()) : _intnull;
                }

                _cb = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboAgentAtDestinationIDEdit");
                if (_cb != null)
                {
                    _t.AgentAtDestinationID = _cb.Value != null?wwi_func.vint(_cb.Value.ToString()) : _intnull;
                }

                _cb = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboNotifyPartyIDEdit");
                if (_cb != null)
                {
                    _t.NotifyPartyID = _cb.Value != null?wwi_func.vint(_cb.Value.ToString()) : _intnull;
                }

                _cb = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboOnCarriageIDEdit");
                if (_cb != null)
                {
                    _t.OnCarriageID = _cb.Value != null?wwi_func.vint(_cb.Value.ToString()) : _intnull;
                }

                _cb = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboDestinationPortControllerIDEdit");
                if (_cb != null)
                {
                    _t.DestinationPortControllerID = _cb.Value != null?wwi_func.vint(_cb.Value.ToString()) : _intnull;
                }

                //save record
                _t.Save();
            }
        }
        catch (Exception ex)
        {
            string _orderno = wwi_security.DecryptString(get_token("pno"), "publiship");
            string _ex      = ex.Message.ToString();
            this.dxlblErr.Text          = string.Format("Order # {0} NOT updated. Error: {1}", _orderno, _ex);
            this.dxpnlErr.ClientVisible = true;
        }
    }
    protected void update_charges()
    {
        try
        {
            int _orderid = wwi_func.vint(wwi_security.DecryptString(get_token("pid"), "publiship"));
            //Int32 _orderid = this.dxhfOrder.Contains("pid") ? wwi_func.vint(this.dxhfOrder.Get("pid").ToString()) : 0;
            if (_orderid > 0)
            {
                OrderTable _ot = new OrderTable(_orderid);

                ASPxComboBox _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboClientsTerms");
                if (_cbo != null)
                {
                    _ot.ClientsTerms = _cbo.Text.ToString();
                }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOriginTrucking");
                if (_cbo != null)
                {
                    _ot.OriginTrucking = _cbo.Text.ToString();
                }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOrignTHC");
                if (_cbo != null)
                {
                    _ot.OrignTHC = _cbo.Text.ToString();
                }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOriginDocs");
                if (_cbo != null)
                {
                    _ot.OriginDocs = _cbo.Text.ToString();
                }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboFreight");
                if (_cbo != null)
                {
                    _ot.Freight = _cbo.Text.ToString();
                }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDestTHC");
                if (_cbo != null)
                {
                    _ot.DestTHC = _cbo.Text.ToString();
                }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDestPalletisation");
                if (_cbo != null)
                {
                    _ot.DestPalletisation = _cbo.Text.ToString();
                }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboCustomsClearance");
                if (_cbo != null)
                {
                    _ot.CustomsClearance = _cbo.Text.ToString();
                }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDeliveryCharges");
                if (_cbo != null)
                {
                    _ot.DeliveryCharges = _cbo.Text.ToString();
                }

                ASPxMemo _mem = (ASPxMemo)this.fmvCharge.FindControl("dxmemCoLoaderComments");
                if (_mem != null)
                {
                    _ot.CoLoaderComments = _mem.Text.ToString();
                }

                _ot.Save();
                //confirm saved
                //string _msg = "Order " + this.dxlblOrderNo.Text.ToString() + " has been updated";
                //this.dxlblInfo.Text = _msg;
                //this.dxpnlMsg.ClientVisible = true;
            }
            else
            {
                string _err = "Unable to update charges. Order number not found.";
                this.dxlblErr.Text          = _err;
                this.dxpnlErr.ClientVisible = true;
            }
        }
        catch (Exception ex)
        {
            string _err = ex.Message.ToString();
            this.dxlblErr.Text          = _err;
            this.dxpnlErr.ClientVisible = true;
        }
    }
    /// <summary>
    /// deprecated version
    /// </summary>
    /// <param name="containerid"></param>
    /// <param name="vesselid"></param>
    /// <returns></returns>
    protected bool change_vessel_deprecated(int containerid, int vesselid)
    {
        bool _changed = false;
        DateTime _currentdate = DateTime.Now;

        //for testing
        containerid = 2332;

        try
        {
            //for testing q1 ********
            //SqlQuery _s1 = new Select(DAL.Logistics.Tables.OrderTable);
            //_s1.InnerJoin(DAL.Logistics.ContainerSubTable.OrderIDColumn, DAL.Logistics.OrderTable.OrderIDColumn);
            //_s1.InnerJoin(DAL.Logistics.ContainerTable.ContainerIDColumn, DAL.Logistics.ContainerSubTable.ContainerIDColumn);
            //_s1.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid);
            //DataTable _dt1 = _s1.ExecuteDataSet().Tables[0];

            string[] _cols1 = { "OrderTable.OrderID", "OrderTable.VesselID", "OrderTable.VesselLastUpdated" };
            DataTable _dt = new Select(_cols1).From(DAL.Logistics.Tables.OrderTable)
            .InnerJoin(DAL.Logistics.ContainerSubTable.OrderIDColumn, DAL.Logistics.OrderTable.OrderIDColumn)
            .InnerJoin(DAL.Logistics.ContainerTable.ContainerIDColumn, DAL.Logistics.ContainerSubTable.ContainerIDColumn)
            .Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid).ExecuteDataSet().Tables[0];
            
            if (_dt.Rows.Count > 0)
            {
                for (int _ix = 0; _ix < _dt.Rows.Count; _ix++)
                {
                    int _id = wwi_func.vint(_dt.Rows[_ix]["OrderID"].ToString());
                    //update
                    OrderTable _tb = new OrderTable(_id);
                    _tb.VesselID = vesselid;
                    _tb.VesselLastUpdated = _currentdate;
                    _tb.Save(); 
                }
            }
            
            
            //alternative method?
            //IList<int> _ids = new Select().From(DAL.Logistics.Tables.OrderTable)
            //.InnerJoin(DAL.Logistics.ContainerSubTable.OrderIDColumn, DAL.Logistics.OrderTable.OrderIDColumn)
            //.InnerJoin(DAL.Logistics.ContainerTable.ContainerIDColumn, DAL.Logistics.ContainerSubTable.ContainerIDColumn)
            //.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid).ExecuteTypedList<int>();
            //
            //IList<int> _q1 = new SubSonic.Update(DAL.Logistics.Tables.OrderTable)
            //    .Set(OrderTable.Columns.VesselID).EqualTo(vesselid)
            //    .Set(OrderTable.Columns.VesselLastUpdated).EqualTo(_currentdate)
            //    .Where(OrderTable.Columns.OrderID).In(_ids).ExecuteTypedList<int>();  
            
            //for testing q2 *******
            //Update _s2 = new Update(DAL.Logistics.Tables.OrderTable);
            //_s2.InnerJoin(DAL.Logistics.ContainerSubTable.OrderIDColumn, DAL.Logistics.OrderTable.OrderIDColumn);
            //_s2.InnerJoin(DAL.Logistics.ContainerTable.ContainerIDColumn, DAL.Logistics.ContainerSubTable.ContainerIDColumn);
            //_s2.InnerJoin(DAL.Logistics.VoyageTable.VoyageIDColumn, DAL.Logistics.OrderTable.VesselIDColumn);
            //_s2.InnerJoin(DAL.Logistics.VoyageETSSubTable.VoyageIDColumn, DAL.Logistics.VoyageTable.VoyageIDColumn);
            //_s2.InnerJoin(DAL.Logistics.VoyageETASubTable.VoyageIDColumn, DAL.Logistics.VoyageTable.VoyageIDColumn);
            //_s2.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid);
            //DataTable _dt2 = _s2.ExecuteDataSet().Tables[0];
            //**********************

            //can't use an update query here as there will likely be multiple orders to update and you will get 'multi-part identifier can't be bound'
            //get data with reader as we need the ETS and ETA values
            string[] _cols2 = { "OrderTable.OrderID", "VoyageETSSubTable.ETS", "VoyageETASubTable.ETA" };
            _dt = new Select(_cols2).From(DAL.Logistics.Tables.OrderTable)
            .InnerJoin(DAL.Logistics.ContainerSubTable.OrderIDColumn, DAL.Logistics.OrderTable.OrderIDColumn)
            .InnerJoin(DAL.Logistics.ContainerTable.ContainerIDColumn, DAL.Logistics.ContainerSubTable.ContainerIDColumn)
            .InnerJoin(DAL.Logistics.VoyageTable.VoyageIDColumn, DAL.Logistics.OrderTable.VesselIDColumn)
            .InnerJoin(DAL.Logistics.VoyageETSSubTable.VoyageIDColumn, DAL.Logistics.VoyageTable.VoyageIDColumn)
            .InnerJoin(DAL.Logistics.VoyageETASubTable.VoyageIDColumn, DAL.Logistics.VoyageTable.VoyageIDColumn)
            .Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid).ExecuteDataSet().Tables[0];
 
            for (int _ix = 0; _ix < _dt.Rows.Count; _ix++)
            {
                int _id = wwi_func.vint(_dt.Rows[_ix]["OrderID"].ToString());
                DateTime _ets = wwi_func.vdatetime(_dt.Rows[_ix]["Ets"].ToString());
                DateTime _eta = wwi_func.vdatetime(_dt.Rows[_ix]["Eta"].ToString());
                //update
                OrderTable _tb = new OrderTable(_id);
                _tb.Ets = _ets;
                _tb.Eta = _eta;
                _tb.Save();
            }
            
            //can't do this as causes error multi-part identifier can't be bound
            //Update _q2 = new Update(DAL.Logistics.Tables.OrderTable);
            //    _q2.InnerJoin(DAL.Logistics.ContainerSubTable.OrderIDColumn, DAL.Logistics.OrderTable.OrderIDColumn);
            //    _q2.InnerJoin(DAL.Logistics.ContainerTable.ContainerIDColumn, DAL.Logistics.ContainerSubTable.ContainerIDColumn);    
            //    _q2.InnerJoin(DAL.Logistics.VoyageTable.VoyageIDColumn, DAL.Logistics.OrderTable.VesselIDColumn);
            //    _q2.InnerJoin(DAL.Logistics.VoyageETSSubTable.VoyageIDColumn, DAL.Logistics.VoyageTable.VoyageIDColumn);
            //    _q2.InnerJoin(DAL.Logistics.VoyageETASubTable .VoyageIDColumn, DAL.Logistics.VoyageTable.VoyageIDColumn);
            //    _q2.Set(DAL.Logistics.OrderTable.EtsColumn).EqualTo(DAL.Logistics.VoyageETSSubTable.EtsColumn);
            //    _q2.Set(DAL.Logistics.OrderTable.EtaColumn).EqualTo(DAL.Logistics.VoyageETASubTable.EtaColumn);
            //    _q2.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid);
            //_test = _q2.ToString();      
            //_q2.Execute();   

            //for testing q3 *******
            //SqlQuery _s3 = new Select(DAL.Logistics.Tables.ContainerTable);
            //_s3.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid);
            //DataTable _dt3 = _s3.ExecuteDataSet().Tables[0];
            //**********************

            Update _q3 = new Update(DAL.Logistics.Tables.ContainerTable);
            _q3.Set(DAL.Logistics.ContainerTable.VoyageIDColumn).EqualTo(vesselid);
            _q3.Where(DAL.Logistics.ContainerTable.ContainerIDColumn).IsEqualTo(containerid);
            //_test = _q3.ToString();
            _q3.Execute();   

            _changed = true;
        }
        catch (Exception ex)
        {
            string _er = ex.Message.ToString();
            this.dxlblErr.Text = _er;
            this.dxpnlErr.Visible = true;
        }

        return _changed;
    }
    protected void update_charges()
    {
        try
        {
            int _orderid = wwi_func.vint(wwi_security.DecryptString(get_token("pid"), "publiship"));
            //Int32 _orderid = this.dxhfOrder.Contains("pid") ? wwi_func.vint(this.dxhfOrder.Get("pid").ToString()) : 0;
            if (_orderid > 0)
            {
                OrderTable _ot = new OrderTable(_orderid);

                ASPxComboBox _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboClientsTerms");
                if (_cbo != null) { _ot.ClientsTerms = _cbo.Text.ToString(); }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOriginTrucking");
                if (_cbo != null) { _ot.OriginTrucking = _cbo.Text.ToString(); }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOrignTHC");
                if (_cbo != null) { _ot.OrignTHC = _cbo.Text.ToString(); }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOriginDocs");
                if (_cbo != null) { _ot.OriginDocs = _cbo.Text.ToString(); }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboFreight");
                if (_cbo != null) { _ot.Freight = _cbo.Text.ToString(); }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDestTHC");
                if (_cbo != null) { _ot.DestTHC = _cbo.Text.ToString(); }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDestPalletisation");
                if (_cbo != null) { _ot.DestPalletisation = _cbo.Text.ToString(); }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboCustomsClearance");
                if (_cbo != null) { _ot.CustomsClearance = _cbo.Text.ToString(); }

                _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDeliveryCharges");
                if (_cbo != null) { _ot.DeliveryCharges = _cbo.Text.ToString(); }

                ASPxMemo _mem = (ASPxMemo)this.fmvCharge.FindControl("dxmemCoLoaderComments");
                if (_mem != null) { _ot.CoLoaderComments = _mem.Text.ToString(); }
                
                _ot.Save();
                //confirm saved
                //string _msg = "Order " + this.dxlblOrderNo.Text.ToString() + " has been updated";
                //this.dxlblInfo.Text = _msg;
                //this.dxpnlMsg.ClientVisible = true;
            }
            else
            {
                string _err = "Unable to update charges. Order number not found.";
                this.dxlblErr.Text = _err;
                this.dxpnlErr.ClientVisible = true;
            }
        }
        catch (Exception ex)
        {
            string _err = ex.Message.ToString();
            this.dxlblErr.Text = _err;
            this.dxpnlErr.ClientVisible = true;
        }
    }
    //end update

    /// <summary>
    /// we won't need this as charges are in ordertable which must have key information saved before chrge allocations can be entered
    /// </summary>
    protected void insert_charges()
    {
        try
        {
            OrderTable _ot = new OrderTable();

            ASPxComboBox _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboClientsTerms");
            if (_cbo != null) { _ot.ClientsTerms = _cbo.Text.ToString(); }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOriginTrucking");
            if (_cbo != null) { _ot.OriginTrucking = _cbo.Text.ToString(); }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOrignTHC");
            if (_cbo != null) { _ot.OrignTHC = _cbo.Text.ToString(); }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOriginDocs");
            if (_cbo != null) { _ot.OriginDocs = _cbo.Text.ToString(); }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboFreight");
            if (_cbo != null) { _ot.Freight = _cbo.Text.ToString(); }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDestTHC");
            if (_cbo != null) { _ot.DestTHC = _cbo.Text.ToString(); }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDestPalletisation");
            if (_cbo != null) { _ot.DestPalletisation = _cbo.Text.ToString(); }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboCustomsClearance");
            if (_cbo != null) { _ot.CustomsClearance = _cbo.Text.ToString(); }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDeliveryCharges");
            if (_cbo != null) { _ot.DeliveryCharges = _cbo.Text.ToString(); }

            ASPxMemo _mem = (ASPxMemo)this.fmvCharge.FindControl("dxmemCoLoaderComments");
            if (_mem != null) { _ot.CoLoaderComments = _cbo.Text.ToString(); }

            _ot.Save();

            //return new order id
            Int32 _newid = (Int32)_ot.GetPrimaryKeyValue();
                            
            //confirm saved
            //string _msg = "Order " + _newid.ToString() + " has been updated";
            //this.dxlblOrderNo.Text = _newid.ToString(); 
            //this.dxlblInfo.Text = _msg;
            //this.dxpnlMsg.ClientVisible = true;
        }
        catch (Exception ex)
        {
            string _err = ex.Message.ToString();
            this.dxlblErr.Text = _err;
            this.dxpnlErr.ClientVisible = true;
        }
    }
Ejemplo n.º 11
0
    }//end update

    /// <summary>
    /// we don't actually need an insert sub as shipment/vessel data is part of the ordertable which must have
    /// been saved before we get to shipment/vessel
    /// </summary>
    protected void insert_shipment()
    {
        try
        {
            //use order id 303635 for testing purposes
            int _orderid = wwi_func.vint(wwi_security.DecryptString(get_token("pid"), "publiship"));

            if (_orderid > 0)
            {
                OrderTable _t = new OrderTable(_orderid);

                //dlls
                //dlls
                int?         _intnull = null;
                ASPxComboBox _cb      = (ASPxComboBox)this.fmvShipment.FindControl("dxcboVesselID");
                if (_cb != null)
                {
                    _t.VesselID = _cb.Value != null?wwi_func.vint(_cb.Value.ToString()) : _intnull;
                }

                _cb = (ASPxComboBox)this.fmvShipment.FindControl("dxcboPackageTypeID");
                if (_cb != null)
                {
                    _t.PackageTypeID = _cb.Value != null?wwi_func.vint(_cb.Value.ToString()) : _intnull;
                }


                //why are the LCL/FCL values set to lcl=1, fcl=2 when the db data type is a bit? this doesn't make any sense
                //disbable code until confirmation from dave
                //_cb = (ASPxComboBox)this.fmvShipment.FindControl("dxcboFCLLCL");
                //if (_cb != null && _cb.Value != null) {
                //    string _lclfcl = _cb.Value.ToString();
                //    _t.Fcllcl = _lclfcl == "-1" ? true : false : false; //0 or -1
                //}

                ASPxTextBox _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstPallets");
                if (_tx != null && _tx.Text != "")
                {
                    _t.EstPallets = wwi_func.vint(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstCartons");
                if (_tx != null && _tx.Text != "")
                {
                    _t.EstCartons = wwi_func.vint(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstWeight");
                if (_tx != null && _tx.Text != "")
                {
                    _t.EstWeight = wwi_func.vint(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstVolume");
                if (_tx != null && _tx.Text != "")
                {
                    _t.EstVolume = wwi_func.vfloat(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstLCLWt");
                if (_tx != null && _tx.Text != "")
                {
                    _t.EstLCLWt = wwi_func.vint(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstLCLVol");
                if (_tx != null && _tx.Text != "")
                {
                    _t.EstLCLVol = wwi_func.vfloat(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEst20");
                if (_tx != null && _tx.Text != "")
                {
                    _t.Est20 = wwi_func.vint(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEst40");
                if (_tx != null && _tx.Text != "")
                {
                    _t.Est40 = wwi_func.vint(_tx.Text.ToString());
                }

                //actuals
                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtActualWeight");
                if (_tx != null && _tx.Text != "")
                {
                    _t.ActualWeight = wwi_func.vint(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtActualVolume");
                if (_tx != null && _tx.Text != "")
                {
                    _t.ActualVolume = wwi_func.vfloat(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtLCLWt");
                if (_tx != null && _tx.Text != "")
                {
                    _t.LCLWt = wwi_func.vint(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtLCLvol");
                if (_tx != null && _tx.Text != "")
                {
                    _t.LCLVol = wwi_func.vfloat(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtActual20");
                if (_tx != null && _tx.Text != "")
                {
                    _t.No20 = wwi_func.vint(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtActual40");
                if (_tx != null && _tx.Text != "")
                {
                    _t.No40 = wwi_func.vint(_tx.Text.ToString());
                }

                //other
                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtNumberOfPackages");
                if (_tx != null && _tx.Text != "")
                {
                    _t.NumberOfPackages = wwi_func.vint(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtHouseBLNUmber");
                if (_tx != null && _tx.Text != "")
                {
                    _t.HouseBLNUmber = _tx.Text.ToString();
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtJackets");
                if (_tx != null && _tx.Text != "")
                {
                    _t.Jackets = wwi_func.vint(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtConsolNumber");
                if (_tx != null && _tx.Text != "")
                {
                    _t.ConsolNumber = wwi_func.vint(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtConsolNumber");
                if (_tx != null && _tx.Text != "")
                {
                    _t.HodderPricePerCopy = wwi_func.vfloat(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtHCCompositeRef");
                if (_tx != null && _tx.Text != "")
                {
                    _t.HCCompositeRef = _tx.Text.ToString();
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtHCInvoiceAmount2");
                if (_tx != null && _tx.Text != "")
                {
                    _t.HCInvoiceAmount = wwi_func.vdecimal(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtInsuranceValue");
                if (_tx != null && _tx.Text != "")
                {
                    _t.InsuranceValue = wwi_func.vdecimal(_tx.Text.ToString());
                }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtImpression");
                if (_tx != null && _tx.Text != "")
                {
                    _t.Impression = _tx.Text.ToString();
                }

                //datetimes
                DateTime?    _dtnull = null; //default for nullable datetimes
                ASPxDateEdit _dt     = (ASPxDateEdit)this.fmvShipment.FindControl("dxdtETS");
                if (_dt != null)
                {
                    _t.Ets = _dt.Value != null?wwi_func.vdatetime(_dt.Date.ToString()) : _dtnull;
                }

                _dt = (ASPxDateEdit)this.fmvShipment.FindControl("dxdtETA");
                if (_dt != null)
                {
                    _t.Eta = _dt.Value != null?wwi_func.vdatetime(_dt.Date.ToString()) : _dtnull;
                }

                _dt = (ASPxDateEdit)this.fmvShipment.FindControl("dxdtJobClosureDate");
                if (_dt != null)
                {
                    _t.JobClosureDate = _dt.Value != null?wwi_func.vdatetime(_dt.Date.ToString()) : _dtnull;
                }

                _dt = (ASPxDateEdit)this.fmvShipment.FindControl("dxdtWarehouseDate");
                if (_dt != null)
                {
                    _t.WarehouseDate = _dt.Value != null?wwi_func.vdatetime(_dt.Date.ToString()) : _dtnull;
                }

                //checkboxes
                ASPxCheckBox _ck = (ASPxCheckBox)this.fmvShipment.FindControl("dxckJobClosed");
                if (_ck != null)
                {
                    _t.JobClosed = _ck.Checked;
                }

                _ck = (ASPxCheckBox)this.fmvShipment.FindControl("dxckOnBoard");
                if (_ck != null)
                {
                    _t.ShippedOnBoard = _ck.Checked;
                }

                //update record
                _t.Save();
            }
        }
        catch (Exception ex)
        {
            string _orderno = wwi_security.DecryptString(get_token("pno"), "publiship");
            string _ex      = ex.Message.ToString();
            this.dxlblErr.Text          = string.Format("Order # {0} NOT updated. Error: {1}", _orderno, _ex);
            this.dxpnlErr.ClientVisible = true;
        }
    }//end insert
    //end update
    /// <summary>
    /// we don't really need an insert sub as address details can't be entered until main order details have been saved
    /// </summary>
    protected void insert_addresses()
    {
        try
        {
            //use order id 303635 for testing purposes
            int _orderid = wwi_func.vint(wwi_security.DecryptString(get_token("pid"), "publiship"));

            if (_orderid > 0)
            {
                OrderTable _t = new OrderTable(_orderid);

                //dlls
                int? _intnull = null;
                ASPxComboBox _cb = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboConsigneeIDEdit");
                if (_cb != null) { _t.ConsigneeID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboClearingAgentIDEdit");
                if (_cb != null) { _t.ClearingAgentID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboAgentAtDestinationIDEdit");
                if (_cb != null) { _t.AgentAtDestinationID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboNotifyPartyIDEdit");
                if (_cb != null) { _t.NotifyPartyID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboOnCarriageIDEdit");
                if (_cb != null) { _t.OnCarriageID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.fmvAddresses.FindControl("dxcboDestinationPortControllerIDEdit");
                if (_cb != null) { _t.DestinationPortControllerID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                //save record
                _t.Save();
            }
        }
        catch (Exception ex)
        {
            string _orderno = wwi_security.DecryptString(get_token("pno"), "publiship");
            string _ex = ex.Message.ToString();
            this.dxlblErr.Text = string.Format("Order # {0} NOT updated. Error: {1}", _orderno, _ex);
            this.dxpnlErr.ClientVisible = true;
        }
    }
Ejemplo n.º 13
0
    //end insert order number

    /// <summary>
    /// function to update order number in ordertable
    /// creates a new ordernumber in office table depending on officeid and updates specified order with this ordernumber
    /// </summary>
    /// <param name="orderid">from newly saved order on ordertable</param>
    /// <param name="officeid">from user profile or selected office</param>
    /// <returns></returns>
    public static int update_office_ordernumber(int orderid, int officeid)
    {
        int _newordernumber = 0;
        //get officeid, officeindicator - this will be used to determine the office indicator when the cloned order is saved
        //and it might be different to the original order depending on who is creating the clone
        //get new office indicator
        //using xml file for lookup at the officelookuptable in the database is not correctly configured (check with Dave re: fix)
        //make sure we have a default but it should come from lookup
        string _newoffice = wwi_func.lookup_xml_string("//xml//office_names.xml", "value", officeid.ToString(), "name", "UK Order");

        //create and return a new ordernumber from appropriate table
        _newordernumber = wwi_data.insert_order_number(officeid);
        //update the order just saved
        OrderTable _t = new OrderTable(orderid);
        _t.OrderNumber = _newordernumber;
        _t.OfficeIndicator = _newoffice;
        //update order
        _t.Save();
 
        return _newordernumber;
    }
Ejemplo n.º 14
0
    /// <summary>
    /// update order table
    /// 140114 replacing objectdatasource with code behind
    /// </summary>
    protected void update_order()
    {
        try
        {
            //use order id 303635 for testing purposes
            int _orderid = wwi_func.vint(wwi_security.DecryptString(get_token("pid"), "publiship"));
            
            if (_orderid > 0)
            {
                OrderTable _t = new OrderTable(_orderid);

                //dlls
                int? _intnull = null;
                ASPxComboBox _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboController");
                if (_cb != null) { _t.OrderControllerID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboOps");
                if (_cb != null) { _t.OperationsControllerID =_cb.Value != null ? wwi_func.vint(_cb.Value.ToString()): _intnull; }
  
                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboCompany");
                if (_cb != null) { _t.CompanyID =  _cb.Value != null ?wwi_func.vint(_cb.Value.ToString()): _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboCountry");
                if (_cb != null) { _t.CountryID = _cb.Value != null ?wwi_func.vint(_cb.Value.ToString()): _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboOrigin");
                if (_cb != null) { _t.OriginPointID =  _cb.Value != null ?wwi_func.vint(_cb.Value.ToString()): _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboOriginPort");
                if (_cb != null) { _t.PortID = _cb.Value != null ?wwi_func.vint(_cb.Value.ToString()): _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboDestPort");
                if (_cb != null) { _t.DestinationPortID =  _cb.Value != null ?wwi_func.vint(_cb.Value.ToString()): _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboFinal");
                if (_cb != null) { _t.FinalDestinationID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()): _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboClientContact");
                if (_cb != null) { _t.ContactID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()): _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboPrinter");
                if (_cb != null) { _t.PrinterID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()): _intnull; }
                
                _cb= (ASPxComboBox)this.formOrder.FindControl("dxcboAgentAtOrigin");
                if (_cb != null) { _t.AgentAtOriginID = _cb.Value != null ?wwi_func.vint(_cb.Value.ToString()): _intnull; }
               
                _cb= (ASPxComboBox)this.formOrder.FindControl("dxcboOriginController");
                if (_cb != null) { _t.OriginPortControllerID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }
               
                //dates
                DateTime? _dtnull = null; //default for nullable datetimes
                ASPxDateEdit _dt = (ASPxDateEdit)this.formOrder.FindControl("dxdtExWorks");
                if (_dt != null) { _t.ExWorksDate = _dt.Value != null ? wwi_func.vdatetime(_dt.Value.ToString()): _dtnull; } 
    
                _dt = (ASPxDateEdit)this.formOrder.FindControl("dxdtCargoReady");
                if (_dt != null) { _t.CargoReady = _dt.Value != null ? wwi_func.vdatetime(_dt.Value.ToString()) : _dtnull; }
                
                _dt = (ASPxDateEdit)this.formOrder.FindControl("dxdtWarehouse");
                if (_dt != null) { _t.WarehouseDate = _dt.Value != null ? wwi_func.vdatetime(_dt.Value.ToString()) : _dtnull; }
            
                _dt = (ASPxDateEdit)this.formOrder.FindControl("dxdtBookingReceived");
                if (_dt != null) { _t.BookingReceived = _dt.Value != null ? wwi_func.vdatetime(_dt.Value.ToString()) : _dtnull; }
            
                _dt = (ASPxDateEdit)this.formOrder.FindControl("dxdtDocsApproved");
                if (_dt != null) { _t.DocsApprovedDate = _dt.Value != null ? wwi_func.vdatetime(_dt.Value.ToString()) : _dtnull; }

                //checkboxes
                ASPxCheckBox _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditJobPubliship");
                if (_ck != null) { _t.PublishipOrder = _ck.Checked; }

                //jobclosed not visible on this form
                //_ck = (ASPxCheckBox)this.formOrder.FindControl("dxckJobClosed");
                //if (_ck != null) { 
                //    //check if job has been closed in this update
                //    if (_t.JobClosed == false && _ck.Checked == true) { _t.JobClosureDate = DateTime.Now; }
                //    _t.JobClosed = _ck.Checked; 
                //}
                
                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditJobHot");
                if (_ck != null) { _t.HotJob = _ck.Checked; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditPalletised");
                if (_ck != null) { _t.Palletise = _ck.Checked? -1: 0; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditDocsAppr");
                if (_ck != null) { _t.DocsRcdAndApproved = _ck.Checked; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditIssueDl");
                if (_ck != null) { _t.ExpressBL = _ck.Checked; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditFumigation");
                if (_ck != null) { _t.FumigationCert = _ck.Checked; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditGSP");
                if (_ck != null) { _t.GSPCert = _ck.Checked; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditPacking");
                if (_ck != null) { _t.PackingDeclaration = _ck.Checked; }
                
                //memos
                ASPxMemo _mo = (ASPxMemo)this.formOrder.FindControl("dxmemoRemarksToCustomer");
                if(_mo != null){ _t.RemarksToCustomer = _mo.Text.ToString(); }
                
                _mo = (ASPxMemo)this.formOrder.FindControl("dxmemoRemarksToAgent");
                if(_mo != null){ _t.Remarks = _mo.Text.ToString(); }
                
                _mo = (ASPxMemo)this.formOrder.FindControl("dxmemoDocs");
                if(_mo != null){ _t.OtherDocsRequired = _mo.Text.ToString(); }
                
                //text boxes
                ASPxTextBox _tx = (ASPxTextBox)this.formOrder.FindControl("dxtxtCustomersRef");   
                if(_tx != null){ _t.CustomersRef = _tx.Text.ToString(); }

                _tx = (ASPxTextBox)this.formOrder.FindControl("dxtxtSellingRate");   
                if(_tx != null){ _t.Sellingrate = _tx.Text.ToString(); }

                _tx = (ASPxTextBox)this.formOrder.FindControl("dxtxtSellingAgent");
                if (_tx != null) { _t.SellingrateAgent = _tx.Text.ToString(); }

                //update record
                _t.Save();
            }
        }
        catch (Exception ex)
        {
            string _orderno = wwi_security.DecryptString(get_token("pno"), "publiship");
            string _ex = ex.Message.ToString();
            this.dxlblErr.Text = string.Format("Order # {0} NOT updated. Error: {1}", _orderno ,  _ex);
            this.dxpnlErr.ClientVisible = true;
        }
    }
    //end update

    /// <summary>
    /// we won't need this as charges are in ordertable which must have key information saved before chrge allocations can be entered
    /// </summary>
    protected void insert_charges()
    {
        try
        {
            OrderTable _ot = new OrderTable();

            ASPxComboBox _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboClientsTerms");
            if (_cbo != null)
            {
                _ot.ClientsTerms = _cbo.Text.ToString();
            }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOriginTrucking");
            if (_cbo != null)
            {
                _ot.OriginTrucking = _cbo.Text.ToString();
            }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOrignTHC");
            if (_cbo != null)
            {
                _ot.OrignTHC = _cbo.Text.ToString();
            }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboOriginDocs");
            if (_cbo != null)
            {
                _ot.OriginDocs = _cbo.Text.ToString();
            }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboFreight");
            if (_cbo != null)
            {
                _ot.Freight = _cbo.Text.ToString();
            }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDestTHC");
            if (_cbo != null)
            {
                _ot.DestTHC = _cbo.Text.ToString();
            }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDestPalletisation");
            if (_cbo != null)
            {
                _ot.DestPalletisation = _cbo.Text.ToString();
            }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboCustomsClearance");
            if (_cbo != null)
            {
                _ot.CustomsClearance = _cbo.Text.ToString();
            }

            _cbo = (ASPxComboBox)this.fmvCharge.FindControl("dxcboDeliveryCharges");
            if (_cbo != null)
            {
                _ot.DeliveryCharges = _cbo.Text.ToString();
            }

            ASPxMemo _mem = (ASPxMemo)this.fmvCharge.FindControl("dxmemCoLoaderComments");
            if (_mem != null)
            {
                _ot.CoLoaderComments = _cbo.Text.ToString();
            }

            _ot.Save();

            //return new order id
            Int32 _newid = (Int32)_ot.GetPrimaryKeyValue();

            //confirm saved
            //string _msg = "Order " + _newid.ToString() + " has been updated";
            //this.dxlblOrderNo.Text = _newid.ToString();
            //this.dxlblInfo.Text = _msg;
            //this.dxpnlMsg.ClientVisible = true;
        }
        catch (Exception ex)
        {
            string _err = ex.Message.ToString();
            this.dxlblErr.Text          = _err;
            this.dxpnlErr.ClientVisible = true;
        }
    }
Ejemplo n.º 16
0
    //end update

    /// <summary>
    /// append to order table
    /// 140114 replacing objectdatasource with code behind
    /// </summary>
    /// <param name="officeid">required so we can get next ordernumber from appropriate table</param>
    /// <returns></returns>
    protected int insert_order(int officeid, int newordernumber, string officeindicator)
    {
        //orderid of saved record
        int _newid = 0;
        
        try
        {
            if (newordernumber > 0)
            {
                OrderTable _t = new OrderTable();

                //defaults
                _t.OrderNumber = newordernumber;
                _t.OfficeIndicator = officeindicator;
                _t.DateOrderCreated = DateTime.Now;
                _t.EWDLastUpdated = DateTime.Now; //exworks last updated

                //dlls
                int? _intnull = null;
                ASPxComboBox _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboController");
                if (_cb != null) { _t.OrderControllerID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboOps");
                if (_cb != null) { _t.OperationsControllerID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboCompany");
                if (_cb != null) { _t.CompanyID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboCountry");
                if (_cb != null) { _t.CountryID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboOrigin");
                if (_cb != null) { _t.OriginPointID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboOriginPort");
                if (_cb != null) { _t.PortID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboDestPort");
                if (_cb != null) { _t.DestinationPortID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboFinal");
                if (_cb != null) { _t.FinalDestinationID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboClientContact");
                if (_cb != null) { _t.ContactID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboPrinter");
                if (_cb != null) { _t.PrinterID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboAgentAtOrigin");
                if (_cb != null) { _t.AgentAtOriginID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.formOrder.FindControl("dxcboOriginController");
                if (_cb != null) { _t.OriginPortControllerID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                //dates
                DateTime? _dtnull = null; //default for nullable datetimes
                ASPxDateEdit _dt = (ASPxDateEdit)this.formOrder.FindControl("dxdtExWorks");
                if (_dt != null) { _t.ExWorksDate = _dt.Value != null ? wwi_func.vdatetime(_dt.Value.ToString()) : _dtnull; }

                _dt = (ASPxDateEdit)this.formOrder.FindControl("dxdtCargoReady");
                if (_dt != null) { _t.CargoReady = _dt.Value != null ? wwi_func.vdatetime(_dt.Value.ToString()) : _dtnull; }

                _dt = (ASPxDateEdit)this.formOrder.FindControl("dxdtWarehouse");
                if (_dt != null) { _t.WarehouseDate = _dt.Value != null ? wwi_func.vdatetime(_dt.Value.ToString()) : _dtnull; }

                _dt = (ASPxDateEdit)this.formOrder.FindControl("dxdtBookingReceived");
                if (_dt != null) { _t.BookingReceived = _dt.Value != null ? wwi_func.vdatetime(_dt.Value.ToString()) : _dtnull; }

                _dt = (ASPxDateEdit)this.formOrder.FindControl("dxdtDocsApproved");
                if (_dt != null) { _t.DocsApprovedDate = _dt.Value != null ? wwi_func.vdatetime(_dt.Value.ToString()) : _dtnull; }

                //checkboxes
                ASPxCheckBox _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditJobPubliship");
                if (_ck != null) { _t.PublishipOrder = _ck.Checked; }

                //job closed not visible on this form
                //_ck = (ASPxCheckBox)this.formOrder.FindControl("dxckJobClosed");
                //if (_ck != null)
                //{
                //    //check if job has been closed in this append
                //    if (_t.JobClosed == false && _ck.Checked == true) { _t.JobClosureDate = DateTime.Now; }
                //    _t.JobClosed = _ck.Checked;
                //}

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditJobHot");
                if (_ck != null) { _t.HotJob = _ck.Checked; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditPalletised");
                if (_ck != null) { _t.Palletise = _ck.Checked ? -1 : 0; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditDocsAppr");
                if (_ck != null) { _t.DocsRcdAndApproved = _ck.Checked; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditIssueDl");
                if (_ck != null) { _t.ExpressBL = _ck.Checked; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditFumigation");
                if (_ck != null) { _t.FumigationCert = _ck.Checked; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditGSP");
                if (_ck != null) { _t.GSPCert = _ck.Checked; }

                _ck = (ASPxCheckBox)this.formOrder.FindControl("dxckEditPacking");
                if (_ck != null) { _t.PackingDeclaration = _ck.Checked; }

                //memos
                ASPxMemo _mo = (ASPxMemo)this.formOrder.FindControl("dxmemoRemarksToCustomer");
                if (_mo != null) { _t.RemarksToCustomer = _mo.Text.ToString(); }

                _mo = (ASPxMemo)this.formOrder.FindControl("dxmemoRemarksToAgent");
                if (_mo != null) { _t.Remarks = _mo.Text.ToString(); }

                _mo = (ASPxMemo)this.formOrder.FindControl("dxmemoDocs");
                if (_mo != null) { _t.OtherDocsRequired = _mo.Text.ToString(); }

                //text boxes
                ASPxTextBox _tx = (ASPxTextBox)this.formOrder.FindControl("dxtxtCustomersRef");
                if (_tx != null) { _t.CustomersRef = _tx.Text.ToString(); }

                _tx = (ASPxTextBox)this.formOrder.FindControl("dxtxtSellingRate");
                if (_tx != null) { _t.Sellingrate = _tx.Text.ToString(); }

                _tx = (ASPxTextBox)this.formOrder.FindControl("dxtxtSellingAgent");
                if (_tx != null) { _t.SellingrateAgent = _tx.Text.ToString(); }

                //append record
                _t.Save();
                //get new id
                _newid = (int)_t.GetPrimaryKeyValue();
            }
            else
            {
                string _ex = "Not able to find next Order Number";
                this.dxlblErr.Text = string.Format("Order NOT saved. Error: {0}", _ex);
                this.dxpnlErr.ClientVisible = true;
            }
        }
        catch (Exception ex)
        {
            string _ex = ex.Message.ToString();
            this.dxlblErr.Text = string.Format("Order NOT saved. Error: {0}", _ex);
            this.dxpnlErr.ClientVisible = true;
        }

        return _newid;
    }
Ejemplo n.º 17
0
    }//end update

    /// <summary>
    /// we don't actually need an insert sub as shipment/vessel data is part of the ordertable which must have
    /// been saved before we get to shipment/vessel
    /// </summary>
    protected void insert_shipment()
    {
        try
        {
            //use order id 303635 for testing purposes
            int _orderid = wwi_func.vint(wwi_security.DecryptString(get_token("pid"), "publiship"));

            if (_orderid > 0)
            {
                OrderTable _t = new OrderTable(_orderid);

                //dlls
                //dlls
                int? _intnull = null;
                ASPxComboBox _cb = (ASPxComboBox)this.fmvShipment.FindControl("dxcboVesselID");
                if (_cb != null) { _t.VesselID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }

                _cb = (ASPxComboBox)this.fmvShipment.FindControl("dxcboPackageTypeID");
                if (_cb != null) { _t.PackageTypeID = _cb.Value != null ? wwi_func.vint(_cb.Value.ToString()) : _intnull; }


                //why are the LCL/FCL values set to lcl=1, fcl=2 when the db data type is a bit? this doesn't make any sense
                //disbable code until confirmation from dave
                //_cb = (ASPxComboBox)this.fmvShipment.FindControl("dxcboFCLLCL");
                //if (_cb != null && _cb.Value != null) {
                //    string _lclfcl = _cb.Value.ToString();
                //    _t.Fcllcl = _lclfcl == "-1" ? true : false : false; //0 or -1
                //} 

                ASPxTextBox _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstPallets");
                if (_tx != null && _tx.Text != "") { _t.EstPallets = wwi_func.vint(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstCartons");
                if (_tx != null && _tx.Text != "") { _t.EstCartons = wwi_func.vint(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstWeight");
                if (_tx != null && _tx.Text != "") { _t.EstWeight = wwi_func.vint(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstVolume");
                if (_tx != null && _tx.Text != "") { _t.EstVolume = wwi_func.vfloat(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstLCLWt");
                if (_tx != null && _tx.Text != "") { _t.EstLCLWt = wwi_func.vint(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEstLCLVol");
                if (_tx != null && _tx.Text != "") { _t.EstLCLVol = wwi_func.vfloat(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEst20");
                if (_tx != null && _tx.Text != "") { _t.Est20 = wwi_func.vint(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtEst40");
                if (_tx != null && _tx.Text != "") { _t.Est40 = wwi_func.vint(_tx.Text.ToString()); }

                //actuals
                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtActualWeight");
                if (_tx != null && _tx.Text != "") { _t.ActualWeight = wwi_func.vint(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtActualVolume");
                if (_tx != null && _tx.Text != "") { _t.ActualVolume = wwi_func.vfloat(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtLCLWt");
                if (_tx != null && _tx.Text != "") { _t.LCLWt = wwi_func.vint(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtLCLvol");
                if (_tx != null && _tx.Text != "") { _t.LCLVol = wwi_func.vfloat(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtActual20");
                if (_tx != null && _tx.Text != "") { _t.No20 = wwi_func.vint(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtActual40");
                if (_tx != null && _tx.Text != "") { _t.No40 = wwi_func.vint(_tx.Text.ToString()); }

                //other
                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtNumberOfPackages");
                if (_tx != null && _tx.Text != "") { _t.NumberOfPackages = wwi_func.vint(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtHouseBLNUmber");
                if (_tx != null && _tx.Text != "") { _t.HouseBLNUmber = _tx.Text.ToString(); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtJackets");
                if (_tx != null && _tx.Text != "") { _t.Jackets = wwi_func.vint(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtConsolNumber");
                if (_tx != null && _tx.Text != "") { _t.ConsolNumber = wwi_func.vint(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtConsolNumber");
                if (_tx != null && _tx.Text != "") { _t.HodderPricePerCopy = wwi_func.vfloat(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtHCCompositeRef");
                if (_tx != null && _tx.Text != "") { _t.HCCompositeRef = _tx.Text.ToString(); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtHCInvoiceAmount2");
                if (_tx != null && _tx.Text != "") { _t.HCInvoiceAmount = wwi_func.vdecimal(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtInsuranceValue");
                if (_tx != null && _tx.Text != "") { _t.InsuranceValue = wwi_func.vdecimal(_tx.Text.ToString()); }

                _tx = (ASPxTextBox)this.fmvShipment.FindControl("dxtxtImpression");
                if (_tx != null && _tx.Text != "") { _t.Impression = _tx.Text.ToString(); }

                //datetimes
                DateTime? _dtnull = null; //default for nullable datetimes
                ASPxDateEdit _dt = (ASPxDateEdit)this.fmvShipment.FindControl("dxdtETS");
                if (_dt != null) { _t.Ets = _dt.Value != null ? wwi_func.vdatetime(_dt.Date.ToString()) : _dtnull; }

                _dt = (ASPxDateEdit)this.fmvShipment.FindControl("dxdtETA");
                if (_dt != null) { _t.Eta = _dt.Value != null ? wwi_func.vdatetime(_dt.Date.ToString()) : _dtnull; }

                _dt = (ASPxDateEdit)this.fmvShipment.FindControl("dxdtJobClosureDate");
                if (_dt != null) { _t.JobClosureDate = _dt.Value != null ? wwi_func.vdatetime(_dt.Date.ToString()) : _dtnull; }

                _dt = (ASPxDateEdit)this.fmvShipment.FindControl("dxdtWarehouseDate");
                if (_dt != null) { _t.WarehouseDate = _dt.Value != null ? wwi_func.vdatetime(_dt.Date.ToString()) : _dtnull; }

                //checkboxes
                ASPxCheckBox _ck = (ASPxCheckBox)this.fmvShipment.FindControl("dxckJobClosed");
                if (_ck != null) { _t.JobClosed = _ck.Checked; }

                _ck = (ASPxCheckBox)this.fmvShipment.FindControl("dxckOnBoard");
                if (_ck != null) { _t.ShippedOnBoard = _ck.Checked; }

                //update record
                _t.Save();
            }
        }
        catch (Exception ex)
        {
            string _orderno = wwi_security.DecryptString(get_token("pno"), "publiship");
            string _ex = ex.Message.ToString();
            this.dxlblErr.Text = string.Format("Order # {0} NOT updated. Error: {1}", _orderno, _ex);
            this.dxpnlErr.ClientVisible = true;
        }

    }//end insert
Ejemplo n.º 18
0
    //end incremental filtering of printer
    #endregion

    #region crud events
    /// <summary>
    /// on save 
    /// copy order from ordertable to new record in ordertable
    /// </summary>
    protected int insert_clone(int orderid, int neworderno, string officeindicator)
    {
        int _newid = 0;
        
        try
        {
            //get order details we are cloning
            OrderTable _clone = new OrderTable(orderid); 
            
            //new order
            OrderTable _neworder = new OrderTable();
            //values changed from original order
            _neworder.DateOrderCreated = DateTime.Now;
            _neworder.OfficeIndicator = officeindicator;
            _neworder.OrderNumber = neworderno;

            //values derived from original order
            _neworder.PublishipOrder = _clone.PublishipOrder;
            _neworder.CompanyID = _clone.CompanyID;
            _neworder.ConsigneeID = _clone.ConsigneeID;
            _neworder.NotifyPartyID = _clone.NotifyPartyID;
            _neworder.AgentAtOriginID = _clone.AgentAtOriginID;
            _neworder.AgentAtDestinationID = _clone.AgentAtDestinationID;
            _neworder.PrinterID = _clone.PrinterID;
            _neworder.ClearingAgentID = _clone.ClearingAgentID;
            _neworder.OnCarriageID = _clone.OnCarriageID;
            _neworder.OrderControllerID = _clone.OrderControllerID;
            _neworder.OperationsControllerID = _clone.OperationsControllerID;
            _neworder.OriginPortControllerID = _clone.OriginPortControllerID;
            _neworder.DestinationPortControllerID = _clone.DestinationPortControllerID;
            _neworder.CustomersRef = _clone.CustomersRef;
            _neworder.ContactID = _clone.ContactID;
            _neworder.OriginPointID = _clone.OriginPointID;
            _neworder.PortID = _clone.PortID;
            _neworder.DestinationPortID = _clone.DestinationPortID;
            _neworder.FinalDestinationID = _clone.FinalDestinationID;
            _neworder.CountryID = _clone.CountryID;
            _neworder.DestinationCountryID = _clone.DestinationCountryID;

            _neworder.Save();

            _newid = (int)_neworder.GetPrimaryKeyValue();
        }
        catch (Exception ex)
        {
            string _ex = ex.Message.ToString();
            this.dxlblErr.Text = _ex;
            this.dxpnlErr.ClientVisible = true;
        }

        return _newid;
    }
    /// <summary>
    /// insert function for a template generated from a specified order
    /// </summary>
    /// <param name="orderid">int</param>
    /// <returns>int key id of new record</returns>
    protected int insert_order_from_template(int templateid, int neworderno, string newoffice)
    {
        int _newid = 0;
        //return next available orderno but just as a placeholder as it is required for appending the order
        //do not update actual orderno until new order is saved
       
        try
        {
            if (templateid > 0)
            {
                OrderTemplateTable _template = new OrderTemplateTable(templateid);
                //copy from template to order
                OrderTable _order = new OrderTable();

                _order.OrderNumber = neworderno;
                _order.OfficeIndicator = newoffice; //_template.OfficeIndicator;
                
                //copy details to order table 
                _order.PublishipOrder = (bool)_template.PublishipOrder;
                _order.CompanyID = _template.CompanyID;
                _order.ConsigneeID = _template.ConsigneeID;
                _order.NotifyPartyID = _template.NotifyPartyID;
                _order.AgentAtOriginID = _template.AgentAtOriginID;
                _order.AgentAtDestinationID = _template.AgentAtDestinationID;
                _order.PrinterID = _template.PrinterID;
                _order.ClearingAgentID = _template.ClearingAgentID;
                _order.OnCarriageID = _template.OnCarriageID;
                _order.OrderControllerID = _template.OrderControllerID;
                _order.OperationsControllerID = _template.OperationsControllerID;
                _order.OriginPortControllerID = _template.OriginPortControllerID;
                _order.DestinationPortControllerID = _template.DestinationPortControllerID;
                _order.CustomersRef = _template.CustomersRef;
                _order.ContactID = _template.ContactID;
                _order.OriginPointID = _template.OriginPointID;
                _order.PortID = _template.PortID;
                _order.DestinationPortID = _template.DestinationPortID;
                _order.FinalDestinationID = _template.FinalDestinationID;
                _order.CountryID = _template.CountryID;
                _order.DestinationCountryID = _template.DestinationCountryID;

                _order.DateOrderCreated = DateTime.Now;
                //save values
                _order.Save();

                _newid = (int)_order.GetPrimaryKeyValue();
            }
            else
            {
                string _ex = "Not able to create order. Template ID is 0";
                this.dxlblErr.Text = _ex;
                this.dxpnlErr.ClientVisible = true;
            }
        }
        catch (Exception ex)
        {
            string _ex = ex.Message.ToString();
            this.dxlblErr.Text = _ex;
            this.dxpnlErr.ClientVisible = true;
        }

        return _newid;
    }