Ejemplo n.º 1
0
    /// <summary>
    /// update hvoyagetable
    /// </summary>
    /// <param name="hblid">int</param>
    protected void update_dimensions()
    {
        //voyageid
        int _pid = wwi_func.vint(wwi_security.DecryptString(get_token("pid").ToString(), "publiship"));

        if (_pid > 0)
        {
            try
            {
                //get instance of record
                DeliverySubSubTable _tbl = new DeliverySubSubTable(_pid);
                ASPxTextBox         _txt = null;

                //depth
                _txt = (ASPxTextBox)this.fmvDimensions.FindControl("dxtxtDepthEdit");
                if (_txt != null && _txt.Text != "")
                {
                    _tbl.BookDepth = wwi_func.vdecimal(_txt.Text.ToString());
                }

                //length
                _txt = (ASPxTextBox)this.fmvDimensions.FindControl("dxtxtLengthEdit");
                if (_txt != null && _txt.Text != "")
                {
                    _tbl.BookLength = wwi_func.vdecimal(_txt.Text.ToString());
                }

                //weight
                _txt = (ASPxTextBox)this.fmvDimensions.FindControl("dxtxtWeightEdit");
                if (_txt != null && _txt.Text != "")
                {
                    _tbl.BookWeight = wwi_func.vdecimal(_txt.Text.ToString());
                }

                //width
                _txt = (ASPxTextBox)this.fmvDimensions.FindControl("dxtxtWidthEdit");
                if (_txt != null && _txt.Text != "")
                {
                    _tbl.BookWidth = wwi_func.vdecimal(_txt.Text.ToString());
                }

                //update
                _tbl.Save();
                //get values off edit form
            }
            catch (Exception ex)
            {
                string _ex = ex.Message.ToString();
                this.dxlblErr.Text          = _ex;
                this.dxpnlErr.ClientVisible = true;
            }
        }
        else
        {
            string _ex = "Can't update record ID = 0";
            this.dxlblErr.Text          = _ex;
            this.dxpnlErr.ClientVisible = true;
        }
    }
Ejemplo n.º 2
0
    protected void bind_formview(string mode)
    {
        //have to use a collection as formview needs to bind to enumerable
        DeliverySubSubTableCollection _tbl = new DeliverySubSubTableCollection();

        if (mode != "Insert")
        {
            int _pid = wwi_func.vint(wwi_security.DecryptString(get_token("pid").ToString(), "publiship"));
            DeliverySubSubTable _ct = new DeliverySubSubTable(_pid);
            _tbl.Add(_ct);
            this.fmvDimensions.DataSource = _tbl;
            this.fmvDimensions.DataBind();
        }
        else //there's no insert option on this form it's jsut fer editting book/cartrton dimension
        {
            this.dxlblErr.Text          = "This option is not available";
            this.dxpnlErr.ClientVisible = true;
        }
    }
	    public void Insert(int? DeliveryID,int? TitleID,string Title,int? Copies,int? CurrentStatusID,string Remarks,int? CopiesPerCarton,float? TotalConsignmentWeight,float? TotalConsignmentCube,decimal? CartonLength,decimal? CartonDepth,decimal? CartonHeight,int? TotalCartons,float? CartonWeight,float? LastCarton,int? Jackets,int? FullPallets,int? CartonsPerFullPallet,int? PartPallets,int? CartonsPerPartPallet,decimal? ActualPPC,byte[] Ts,decimal? EstimatedPPC,decimal? BookLength,decimal? BookWidth,decimal? BookDepth,decimal? BookWeight)
	    {
		    DeliverySubSubTable item = new DeliverySubSubTable();
		    
            item.DeliveryID = DeliveryID;
            
            item.TitleID = TitleID;
            
            item.Title = Title;
            
            item.Copies = Copies;
            
            item.CurrentStatusID = CurrentStatusID;
            
            item.Remarks = Remarks;
            
            item.CopiesPerCarton = CopiesPerCarton;
            
            item.TotalConsignmentWeight = TotalConsignmentWeight;
            
            item.TotalConsignmentCube = TotalConsignmentCube;
            
            item.CartonLength = CartonLength;
            
            item.CartonDepth = CartonDepth;
            
            item.CartonHeight = CartonHeight;
            
            item.TotalCartons = TotalCartons;
            
            item.CartonWeight = CartonWeight;
            
            item.LastCarton = LastCarton;
            
            item.Jackets = Jackets;
            
            item.FullPallets = FullPallets;
            
            item.CartonsPerFullPallet = CartonsPerFullPallet;
            
            item.PartPallets = PartPallets;
            
            item.CartonsPerPartPallet = CartonsPerPartPallet;
            
            item.ActualPPC = ActualPPC;
            
            item.Ts = Ts;
            
            item.EstimatedPPC = EstimatedPPC;
            
            item.BookLength = BookLength;
            
            item.BookWidth = BookWidth;
            
            item.BookDepth = BookDepth;
            
            item.BookWeight = BookWeight;
            
	    
		    item.Save(UserName);
	    }
        public void Update(int SubDeliveryID, int? DeliveryID, int? TitleID, string Title, int? Copies, int? CurrentStatusID, string Remarks, int? CopiesPerCarton, float? TotalConsignmentWeight, float? TotalConsignmentCube, decimal? CartonLength, decimal? CartonDepth, decimal? CartonHeight, int? TotalCartons, float? CartonWeight, float? LastCarton, int? Jackets, int? FullPallets, int? CartonsPerFullPallet, int? PartPallets, int? CartonsPerPartPallet, decimal? PencePerCopy, byte[] Ts)
        {
            DeliverySubSubTable item = new DeliverySubSubTable();
            item.MarkOld();
            item.IsLoaded = true;

            item.SubDeliveryID = SubDeliveryID;

            item.DeliveryID = DeliveryID;

            item.TitleID = TitleID;

            item.Title = Title;

            item.Copies = Copies;

            item.CurrentStatusID = CurrentStatusID;

            item.Remarks = Remarks;

            item.CopiesPerCarton = CopiesPerCarton;

            item.TotalConsignmentWeight = TotalConsignmentWeight;

            item.TotalConsignmentCube = TotalConsignmentCube;

            item.CartonLength = CartonLength;

            item.CartonDepth = CartonDepth;

            item.CartonHeight = CartonHeight;

            item.TotalCartons = TotalCartons;

            item.CartonWeight = CartonWeight;

            item.LastCarton = LastCarton;

            item.Jackets = Jackets;

            item.FullPallets = FullPallets;

            item.CartonsPerFullPallet = CartonsPerFullPallet;

            item.PartPallets = PartPallets;

            item.CartonsPerPartPallet = CartonsPerPartPallet;

            item.ActualPPC = PencePerCopy;

            item.Ts = Ts;

            item.Save(UserName);
        }
    /// <summary>
    /// insert new title
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void dxgridTitles_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxGridView _grd = (ASPxGridView)sender;
        int _deliveryid = wwi_func.vint(_grd.GetMasterRowKeyValue().ToString());

        try
        {
            if (_deliveryid > 0)
            {
                //need to get title from edit itemtemplate it won't be found in NewValues
                string _title = "";
                int? _titleid = null;
                int? _intnull = null;

                GridViewDataColumn _col = (GridViewDataColumn)_grd.Columns["colTitle"];
                ASPxComboBox _cbo = (ASPxComboBox)_grd.FindEditRowCellTemplateControl(_col, "dxcbotitle");
                if (_cbo != null)
                {
                    _title = _cbo.Text != null ? _cbo.Text.ToString() : "";
                    _titleid = _cbo.Value != null ? wwi_func.vint(_cbo.Value.ToString()) : _intnull;

                }

                DeliverySubSubTable _t = new DeliverySubSubTable();
                //required
                _t.DeliveryID = _deliveryid;
                //
                _t.Title = _title;
                _t.TitleID = _titleid;
                //18.02.15 pencepercopy field renamed actualppc
                if (e.NewValues["ActualPPC"] != null) { _t.ActualPPC = wwi_func.vdecimal(e.NewValues["ActualPPC"].ToString()); } else { _t.ActualPPC = null; }
                if (e.NewValues["Copies"] != null) { _t.Copies = wwi_func.vint(e.NewValues["Copies"].ToString()); } else { _t.Copies = null; }
                if (e.NewValues["CopiesPerCarton"] != null) { _t.CopiesPerCarton = wwi_func.vint(e.NewValues["CopiesPerCarton"].ToString()); } else { _t.CopiesPerCarton = null; }
                if (e.NewValues["CartonLength"] != null) { _t.CartonLength = wwi_func.vdecimal(e.NewValues["CartonLength"].ToString()); } else { _t.CartonLength = null; }
                if (e.NewValues["CartonDepth"] != null) { _t.CartonDepth = wwi_func.vdecimal(e.NewValues["CartonDepth"].ToString()); } else { _t.CartonDepth = null; }
                if (e.NewValues["CartonHeight"] != null) { _t.CartonHeight = wwi_func.vdecimal(e.NewValues["CartonHeight"].ToString()); } else { _t.CartonHeight = null; }
                if (e.NewValues["TotalCartons"] != null) { _t.TotalCartons = wwi_func.vint(e.NewValues["TotalCartons"].ToString()); } else { _t.TotalCartons = null; }
                if (e.NewValues["CartonWeight"] != null) { _t.CartonWeight = wwi_func.vfloat(e.NewValues["CartonWeight"].ToString()); } else { _t.CartonWeight = null; }
                if (e.NewValues["LastCarton"] != null) { _t.LastCarton = wwi_func.vfloat(e.NewValues["LastCarton"].ToString()); } else { _t.LastCarton = null; }
                if (e.NewValues["CartonsPerFullPallet"] != null) { _t.CartonsPerFullPallet = wwi_func.vint(e.NewValues["CartonsPerFullPallet"].ToString()); } else { _t.CartonsPerFullPallet = null; }
                if (e.NewValues["FullPallets"] != null) { _t.FullPallets = wwi_func.vint(e.NewValues["FullPallets"].ToString()); } else { _t.FullPallets = null; }
                if (e.NewValues["CartonsPerPartPallet"] != null) { _t.CartonsPerPartPallet = wwi_func.vint(e.NewValues["CartonsPerPartPallet"].ToString()); } else { _t.CartonsPerPartPallet = null; }
                if (e.NewValues["Jackets"] != null) { _t.Jackets = wwi_func.vint(e.NewValues["Jackets"].ToString()); } else { _t.Jackets = null; }
                if (e.NewValues["PartPallets"] != null) { _t.PartPallets = wwi_func.vint(e.NewValues["PartPallets"].ToString()); } else { _t.PartPallets = null; }
                if (e.NewValues["TotalConsignmentWeight"] != null) { _t.TotalConsignmentWeight = wwi_func.vfloat(e.NewValues["TotalConsignmentWeight"].ToString()); } else { _t.TotalConsignmentWeight = null; }
                if (e.NewValues["TotalConsignmentCube"] != null) { _t.TotalConsignmentCube = wwi_func.vfloat(e.NewValues["TotalConsignmentCube"].ToString()); } else { _t.TotalConsignmentCube = null; }
                if (e.NewValues["Remarks"] != null) { _t.Remarks = e.NewValues["Remarks"].ToString(); } else { _t.Remarks = ""; }
                //new fields 18.02.15
                if (e.NewValues["EstimatedPPC"] != null) { _t.EstimatedPPC = wwi_func.vdecimal(e.NewValues["EstimatedPPC"].ToString()); } else { _t.EstimatedPPC = null; }
                if (e.NewValues["BookLength"] != null) { _t.BookLength = wwi_func.vdecimal(e.NewValues["BookLength"].ToString()); } else { _t.BookLength = null; }
                if (e.NewValues["BookWidth"] != null) { _t.BookWidth = wwi_func.vdecimal(e.NewValues["BookWidth"].ToString()); } else { _t.BookWidth = null; }
                if (e.NewValues["BookDepth"] != null) { _t.BookDepth = wwi_func.vdecimal(e.NewValues["BookDepth"].ToString()); } else { _t.BookDepth = null; }
                if (e.NewValues["BookWeight"] != null) { _t.BookWeight = wwi_func.vdecimal(e.NewValues["BookWeight"].ToString()); } else { _t.BookWeight = null; }
                //append new 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("Title # {0} NOT added. Error: {1}", _deliveryid, _ex);
            this.dxpnlErr.ClientVisible = true;
        }
        finally
        {
            //MUST call this after insert or error: Specified method is not supported
            e.Cancel = true;
            _grd.CancelEdit();
            _grd.DataBind(); 
        }
    }
Ejemplo n.º 6
0
    /// <summary>
    /// update hvoyagetable
    /// </summary>
    /// <param name="hblid">int</param>
    protected void update_dimensions()
    {
        //voyageid
        int _pid = wwi_func.vint(wwi_security.DecryptString(get_token("pid").ToString(), "publiship"));
        
        if (_pid > 0)
        {
            try
            {
                //get instance of record
                DeliverySubSubTable _tbl = new DeliverySubSubTable(_pid);
                ASPxTextBox _txt = null;

                //depth
                _txt = (ASPxTextBox)this.fmvDimensions.FindControl("dxtxtDepthEdit");
                if (_txt != null && _txt.Text != "")
                {
                    _tbl.BookDepth = wwi_func.vdecimal(_txt.Text.ToString());
                }

                //length
                _txt = (ASPxTextBox)this.fmvDimensions.FindControl("dxtxtLengthEdit");
                if (_txt != null && _txt.Text != "")
                {
                    _tbl.BookLength = wwi_func.vdecimal(_txt.Text.ToString());
                }

                //weight
                _txt = (ASPxTextBox)this.fmvDimensions.FindControl("dxtxtWeightEdit");
                if (_txt != null && _txt.Text != "")
                {
                    _tbl.BookWeight = wwi_func.vdecimal(_txt.Text.ToString());
                }

                //width
                _txt = (ASPxTextBox)this.fmvDimensions.FindControl("dxtxtWidthEdit");
                if (_txt != null && _txt.Text != "")
                {
                    _tbl.BookWidth = wwi_func.vdecimal(_txt.Text.ToString());
                }

                //update
                _tbl.Save();
                //get values off edit form
                
            }
            catch (Exception ex)
            {
                string _ex = ex.Message.ToString();
                this.dxlblErr.Text = _ex;
                this.dxpnlErr.ClientVisible = true;
            }
        }
        else
        {
            string _ex = "Can't update record ID = 0";
            this.dxlblErr.Text = _ex;
            this.dxpnlErr.ClientVisible = true;
        }
    }
Ejemplo n.º 7
0
 protected void bind_formview(string mode)
 {
     //have to use a collection as formview needs to bind to enumerable
     DeliverySubSubTableCollection _tbl = new DeliverySubSubTableCollection();
     if (mode != "Insert")
     {
         int _pid = wwi_func.vint(wwi_security.DecryptString(get_token("pid").ToString(), "publiship"));
         DeliverySubSubTable  _ct = new DeliverySubSubTable(_pid);
         _tbl.Add(_ct);
         this.fmvDimensions.DataSource = _tbl;
         this.fmvDimensions.DataBind();
 
     }
     else //there's no insert option on this form it's jsut fer editting book/cartrton dimension
     {
         this.dxlblErr.Text = "This option is not available";
         this.dxpnlErr.ClientVisible = true;
     }
 }