//end update

    /// <summary>
    /// new record
    /// </summary>
    protected int insert_company_type()
    {
        int _newid = 0;

        try
        {
            ///new instance of record
            TypeTable _tbl = new TypeTable();

            //get values off insert form
            //check for duplicate name
            ASPxTextBox _txt = (ASPxTextBox)this.fmvCompanyType.FindControl("dxtxtTypeNameInsert");
            if (_txt != null && _txt.Text != "")
            {
                string _newvalue = _txt.Text.Trim().ToString(); //country name

                if (!wwi_func.value_exists("TypeName", "TypeTable", _newvalue))
                {
                    _tbl.TypeName = _txt.Text.Trim().ToString();

                    //insert
                    _tbl.Save();
                    //get new id
                    _newid = (int)_tbl.GetPrimaryKeyValue();
                }
                else
                {
                    string _ex = string.Format("{0} is already in database. This record will not be saved", _newvalue);
                    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);
    }
    //end update

    /// <summary>
    /// new record
    /// </summary>
    protected int insert_company_type()
    {
        int _newid = 0;

        try
        {
            ///new instance of record
            TypeTable _tbl = new TypeTable();
            
            //get values off insert form
            //check for duplicate name
            ASPxTextBox _txt = (ASPxTextBox)this.fmvCompanyType.FindControl("dxtxtTypeNameInsert");
            if (_txt != null && _txt.Text != "")
            {
                string _newvalue = _txt.Text.Trim().ToString(); //country name

                if (!wwi_func.value_exists("TypeName", "TypeTable", _newvalue))
                {
                    _tbl.TypeName = _txt.Text.Trim().ToString();

                    //insert
                    _tbl.Save();
                    //get new id
                    _newid = (int)_tbl.GetPrimaryKeyValue();
                }
                else
                {
                    string _ex = string.Format("{0} is already in database. This record will not be saved", _newvalue);
                    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;
    }