Backdate validation for user control in EP MSD axapta

If you are seeking code for Backdate validation for user control in Enterprise portal page for  axapta then below code can help you.

Its tricky to find code on EP so its helpful for you.
 string cDate1 = DateTime.Now.ToString("dd/MM/yyyy");  
  int flag = 0;  
  Proxy.Info objinfolog = new Proxy.Info(this.AxSession.AxaptaAdapter);  
  DateTime x;  
  DateTime a;  
 Int32 r1;  
 Date1 = txtDate1.Text;  
 Ir = dsTestNewForm.GetDataSourceView("TestNewForm").DataSetView.GetCurrent().GetRecord();  
     if (txtDate1.Text != "" && Ir.GetField("Date1").ToString() == "1/1/1900 12:00:00 AM")  
     {  
        x = DateTime.Parse(cDate1, new CultureInfo("en-CA"));  
        a = DateTime.Parse(Date1, new CultureInfo("en-CA"));  
        r1 = DateTime.Compare(a, x);  
       if (Ir.GetField("Date1").ToString() == "1/1/1900 12:00:00 AM" && r1 < 0 && Date1 != "")  
       {  
         objinfolog.add(Proxy.Exception.Warning, "Back Date not allowed!!");  
         flag = flag + 1;  
       }  
     }