Example #1
0
    /// <summary>
    /// insert event for ETA grid
    /// just need to save to VoyageETASubTable
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgrdETA_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxGridView _grd    = (ASPxGridView)sender;
        DateTime?    _dtnull = null;

        int _voyageid = this.dxhfOrder.Contains("voyage") ? wwi_func.vint(this.dxhfOrder.Get("voyage").ToString()) : 0;
        int _vesselid = this.dxhfOrder.Contains("vessel") ? wwi_func.vint(this.dxhfOrder.Get("vessel").ToString()) : 0;
        int _portid   = e.NewValues["DestinationPortID"] != null?wwi_func.vint(e.NewValues["DestinationPortID"].ToString()) : 0;

        DateTime?_dteta = e.NewValues["ETA"] != null?wwi_func.vdatetime(e.NewValues["ETA"].ToString()) : _dtnull;

        if (_voyageid > 0)
        {
            VoyageETASubTable _tbl = new VoyageETASubTable();
            _tbl.VoyageID          = _voyageid;
            _tbl.DestinationPortID = _portid;
            _tbl.Eta = _dteta;
            _tbl.Save();

            if (_portid > 0 && _vesselid > 0)
            {
                update_ordertable_eta(_portid, _vesselid, _dteta);
            }
        }

        //MUST call this after insert or error: Specified method is not supported
        e.Cancel = true;
        _grd.CancelEdit();
        //rebind
        bind_eta_grid(_voyageid);
    }
Example #2
0
    /// <summary>
    /// update event for ETS grid
    /// check DATE. if it's been changed will need to update order table
    /// ordertabel.ETA = new ETA, ordertable.VesselLastUpdated = now wher ordertable.DestinationPortID = DestinationPortID and ordertable.VesselID = VesselID
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgrdETA_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView _grd = (ASPxGridView)sender;

        int _voyageid = this.dxhfOrder.Contains("voyage") ? wwi_func.vint(this.dxhfOrder.Get("voyage").ToString()) : 0;
        int _vesselid = this.dxhfOrder.Contains("vessel") ? wwi_func.vint(this.dxhfOrder.Get("vessel").ToString()) : 0;
        //key for this record
        int _etaid = wwi_func.vint(e.Keys["VoyageETASubID"].ToString());
        //other required data
        int _portid = e.NewValues["DestinationPortID"] != null?wwi_func.vint(e.NewValues["DestinationPortID"].ToString()) : 0;

        DateTime?_dteta = e.NewValues["ETA"] != null?wwi_func.vdatetime(e.NewValues["ETA"].ToString()) : (DateTime?)null;

        if (_etaid > 0)
        {
            VoyageETASubTable _tbl = new VoyageETASubTable(_etaid);
            _tbl.DestinationPortID = _portid;
            _tbl.Eta = _dteta;
            _tbl.Save();

            //******** for testing
            //_portid = 80;
            //_vesselid = 196;
            //********
            //use voyage id NOT vesel id
            //if (_portid > 0 && _vesselid > 0) //&& (e.NewValues["ETA"] != e.OldValues["ETA"]))
            if (_portid > 0 && _voyageid > 0)
            {
                //update_ordertable_eta(_portid, _vesselid, _dteta);
                update_ordertable_eta(_portid, _voyageid, _dteta);
            }
            //update ordertable if _VoyageETASubID > 0 and _VesselID > 0 and date has been changed
            //if (_vesselid > 0 && (e.NewValues["ETA"] != e.OldValues["ETA"]))
            //{
            //    SubSonic.Update _upd = new SubSonic.Update(DAL.Logistics.Schemas.OrderTable);
            //    int _recordsaffected = _upd.Set(OrderTable.EtaColumn).EqualTo(_tbl.Eta)
            //                           .Where(OrderTable.PortIDColumn).IsEqualTo(_tbl.DestinationPortID)
            //                           .And(OrderTable.VesselIDColumn).IsEqualTo(_vesselid)
            //                           .Execute();
            //}

            //end if vesselid > 0
        }//end if voyageetasubid > 0

        //MUST call this after insert or error: Specified method is not supported
        e.Cancel = true;
        _grd.CancelEdit();
        //rebind
        bind_eta_grid(_voyageid);
    }
	    public void Insert(int? VoyageID,int? DestinationPortID,DateTime? Eta,byte[] Ts)
	    {
		    VoyageETASubTable item = new VoyageETASubTable();
		    
            item.VoyageID = VoyageID;
            
            item.DestinationPortID = DestinationPortID;
            
            item.Eta = Eta;
            
            item.Ts = Ts;
            
	    
		    item.Save(UserName);
	    }
Example #4
0
    //end eta row updating

    /// <summary>
    /// delete row
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgrdETA_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
    {
        ASPxGridView _grd      = (ASPxGridView)sender;
        int          _voyageid = this.dxhfOrder.Contains("voyage") ? wwi_func.vint(this.dxhfOrder.Get("voyage").ToString()) : 0;


        int _etaid = e.Keys["VoyageETASubID"] != null?wwi_func.vint(e.Keys["VoyageETASubID"].ToString()) : 0;

        if (_etaid > 0)
        {
            VoyageETASubTable.Delete(_etaid);
        }
        //MUST call this after insert or error: Specified method is not supported
        e.Cancel = true;
        _grd.CancelEdit();
        //rebind
        bind_eta_grid(_voyageid);
    }
Example #5
0
    /// <summary>
    /// update event for ETS grid
    /// check DATE. if it's been changed will need to update order table
    /// ordertabel.ETA = new ETA, ordertable.VesselLastUpdated = now wher ordertable.DestinationPortID = DestinationPortID and ordertable.VesselID = VesselID
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgrdETA_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView _grd = (ASPxGridView)sender;

        int _voyageid = this.dxhfOrder.Contains("voyage") ? wwi_func.vint(this.dxhfOrder.Get("voyage").ToString()) : 0;
        int _vesselid = this.dxhfOrder.Contains("vessel") ? wwi_func.vint(this.dxhfOrder.Get("vessel").ToString()) : 0; 
        //key for this record
        int _etaid = wwi_func.vint(e.Keys["VoyageETASubID"].ToString());
        //other required data
        int _portid = e.NewValues["DestinationPortID"] != null ? wwi_func.vint(e.NewValues["DestinationPortID"].ToString()) : 0;
        DateTime? _dteta = e.NewValues["ETA"] != null ? wwi_func.vdatetime(e.NewValues["ETA"].ToString()) : (DateTime?)null;
        
        if (_etaid > 0)
        {
            VoyageETASubTable _tbl = new VoyageETASubTable(_etaid);
            _tbl.DestinationPortID = _portid;
            _tbl.Eta = _dteta;
            _tbl.Save();

            //******** for testing 
            //_portid = 80;
            //_vesselid = 196;
            //********
            //use voyage id NOT vesel id
            //if (_portid > 0 && _vesselid > 0) //&& (e.NewValues["ETA"] != e.OldValues["ETA"]))
            if(_portid > 0 && _voyageid > 0)
            {
                //update_ordertable_eta(_portid, _vesselid, _dteta);
                update_ordertable_eta(_portid, _voyageid, _dteta);
            }
            //update ordertable if _VoyageETASubID > 0 and _VesselID > 0 and date has been changed
            //if (_vesselid > 0 && (e.NewValues["ETA"] != e.OldValues["ETA"]))
            //{
            //    SubSonic.Update _upd = new SubSonic.Update(DAL.Logistics.Schemas.OrderTable);
            //    int _recordsaffected = _upd.Set(OrderTable.EtaColumn).EqualTo(_tbl.Eta)
            //                           .Where(OrderTable.PortIDColumn).IsEqualTo(_tbl.DestinationPortID)
            //                           .And(OrderTable.VesselIDColumn).IsEqualTo(_vesselid)
            //                           .Execute();
            //}

            //end if vesselid > 0
        }//end if voyageetasubid > 0

        //MUST call this after insert or error: Specified method is not supported
        e.Cancel = true;
        _grd.CancelEdit();
        //rebind
        bind_eta_grid(_voyageid);  
    }
Example #6
0
    /// <summary>
    /// insert event for ETA grid
    /// just need to save to VoyageETASubTable
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgrdETA_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxGridView _grd = (ASPxGridView)sender;
        DateTime? _dtnull = null;
        
        int _voyageid = this.dxhfOrder.Contains("voyage") ? wwi_func.vint(this.dxhfOrder.Get("voyage").ToString()) : 0;
        int _vesselid = this.dxhfOrder.Contains("vessel") ? wwi_func.vint(this.dxhfOrder.Get("vessel").ToString()) : 0; 
        int _portid = e.NewValues["DestinationPortID"] != null? wwi_func.vint(e.NewValues["DestinationPortID"].ToString()): 0;
        DateTime? _dteta =  e.NewValues["ETA"] != null ? wwi_func.vdatetime(e.NewValues["ETA"].ToString()): _dtnull;

        if (_voyageid > 0)
        {
            VoyageETASubTable _tbl = new VoyageETASubTable();
            _tbl.VoyageID = _voyageid;
            _tbl.DestinationPortID = _portid;
            _tbl.Eta = _dteta;
            _tbl.Save();

            if (_portid > 0 && _vesselid > 0)
            {
                update_ordertable_eta(_portid, _vesselid, _dteta);
            }
        }

        //MUST call this after insert or error: Specified method is not supported
        e.Cancel = true;
        _grd.CancelEdit();
        //rebind
        bind_eta_grid(_voyageid);  
    }
	    public void Update(int VoyageETASubID,int? VoyageID,int? DestinationPortID,DateTime? Eta,byte[] Ts)
	    {
		    VoyageETASubTable item = new VoyageETASubTable();
	        item.MarkOld();
	        item.IsLoaded = true;
		    
			item.VoyageETASubID = VoyageETASubID;
				
			item.VoyageID = VoyageID;
				
			item.DestinationPortID = DestinationPortID;
				
			item.Eta = Eta;
				
			item.Ts = Ts;
				
	        item.Save(UserName);
	    }