Tuesday, December 15, 2009

How To See all Trigger in SQL SERVER

select * from sys.triggers
It will show all trigger that is applied on database tables

Friday, December 11, 2009

Criteria /Filtering year, month or day in XAF

SELECT * FROM table WHERE YEAR(date1) = '2009'
SELECT * FROM table WHERE MONTH(date1) = '1'
SELECT * FROM table WHERE DAY(date1) = '20'
There are equivalent Criteria in XAf
The FunctionOperator allows you to use "SQL" functions such as YEAR()
New BinaryOperator(New FunctionOperator(FunctionOperatorType.GetYear, New
OperandProperty("Date1")), New OperandValue(2009), BinaryOperatorType.Equal)

How To Add ListViewFilter From BO Model in XAF

To add Filter go in BO Model=>ListView and Right Click On ListView and Choose Add Filters and give CurrentFilterId and Click on Filter and Right Click on Add Filter and Give Criteria . now a ListBox Comes in ListView To Filter Record

How To Add Conditional Formatting in XAF

To add Conditional formatting go in BO Model=>ListView and Right Click On ListView and add Conditional formatting ang Then Right Click On=> Add Rule here You can Give Criteria according criteria Colour will be change of BackGround/Foreground

How To Add Item in Grid Control Like Button/TextBox in XAF

if (View is ListView && View .ObjectTypeInfo.Type==typeof (MasterDailyLedger))
ListView Lv = (ListView)View;
DevExpress.XtraEditors.TextEdit te = new TextEdit();
System.Windows.Forms.ListBox l = new System.Windows.Forms.ListBox();
DropDownButton dp = new DropDownButton();
GridControl gc = (GridControl)Lv.Control;
foreach (System.Windows.Forms.Control g in gc.Controls)
if (g is DevExpress.XtraEditors.TextEdit)
DevExpress.XtraEditors.TextEdit te1 = (DevExpress.XtraEditors.TextEdit)g;
te1.Text = "System";

How To Change Case of GridColumn in Upper Case/Cell Content in Upper Case

Assembly : Devexpress.XtraEditors.Repository

void View_ControlsCreated(object sender, EventArgs e)
if (View is DevExpress.ExpressApp.ListView && View.ObjectTypeInfo.Type == typeof(DomainObject1))
DevExpress.ExpressApp.ListView lv = (DevExpress.ExpressApp.ListView)View;
GridControl gd = (GridControl)lv.Control;
GridControl gd1 = new GridControl();
GridView gv = (GridView)gd.FocusedView;
RepositoryItemTextEdit rite = new RepositoryItemTextEdit();
rite.CharacterCasing = CharacterCasing.Upper;
gv.Columns["NameOfPerson"].ColumnEdit = rite;

Filter ListView Data Will Not Show on ListView Activated When You Search Record Then Record Will Show in XAF

Here I have a Class ContactA
I want Data Will not Populate in ListView on ListView Activated
Data Will Show when I search any Thing from search Button

protected override void OnActivated()
if (View is ListView && View.ObjectTypeInfo.Type == typeof(ContactA))
ListView lv = (ListView)View;
lv.CollectionSource.CollectionChanged += new EventHandler(CollectionSource_CollectionChanged);

void CollectionSource_CollectionChanged(object sender, EventArgs e)
ListView listView = (ListView)View ;
if (listView.CollectionSource.Collection.Count > 0)
if (!listView.CollectionSource.Criteria.ContainsKey("EmptyCollectionCriteria"))
listView.CollectionSource.Criteria.Add("EmptyCollectionCriteria", CollectionSource.EmptyCollectionCriteria);
listView.CollectionSource.Criteria.Changed += new EventHandler(Criteria_Changed);

void Criteria_Changed(object sender, EventArgs e)
ListView listView = (ListView)View;

How To Apply EditorState on Property in XAF

Assembly : DevExpress.ExpressApp.ConditionalEditorState;

[EditorStateRule("ServiceTaxApp", "IsServiceTaxApplicable", ViewType.DetailView, "")]

public EditorState EditorSTA(out bool active)


active = true;

if (AccountGroups != null && StatutoryConfig != null && StatutoryConfig.IsServiceTaxApplicable)


active = !(AccountGroups.IsTaxApplicable(SSType.ServiceTax));


return EditorState.Hidden;


How To Find Object of Maximum Salary in XAF

GroupWiseMasterDailyLedger lt = ObjectSpace.Session.FindObject<<"GroupWiseMasterDailyLedger">>(CriteriaOperator.Parse(String.Format("Debit={0}",ObjectSpace.Session.Evaluate<<"GroupWiseMasterDailyLedger">>(CriteriaOperator.Parse("MAX(Debit)"), null))));

Here You Can Find Maximum Debit Object
And int maxValue = int.Parse(Session.Evaluate(typeof(class), CriteriaOperator.Parse("Max(salary)")));
int maxValue = int.Parse(Session.Evaluate(CriteriaOperator.Parse("Max(salary)")));

Note : Here donot Apply "" in GroupWiseMasterDailyLedger and also one lessthan and greater than Sign

How To Find Top 10 Record in ListView in XAF

if (View is ListView && View.ObjectTypeInfo.Type == typeof(GroupWiseMasterDailyLedger))
ListView lv = (ListView)View;
XPCollection XPC =(XPCollection) lv.CollectionSource.Collection;
SortingCollection sc = new SortingCollection(); sc.Add(new SortProperty("Debit", DevExpress.Xpo.DB.SortingDirection.Descending));
XPC.Sorting = sc;
XPC.TopReturnedObjects = 5;

How To Add Search Option on Lookup

[LookupEditorMode(LookupEditorMode.AllItemsWithSearch)] Apply this Attribute on lookup

How To Apply Clock and Date on Your Application

To apply A Clock on Your Application You have To add A SimpleAction Take A controller and Add a SimpleAction Now Write Code void View_ControlsCreated(object sender, EventArgs e) { if (View is ListView) { System.Windows.Forms.Timer tmr = new System.Windows.Forms.Timer(); tmr.Enabled = true; tmr.Start(); tmr.Tick += new EventHandler(tmr_Tick); } } void tmr_Tick(object sender, EventArgs e) { SimpleAction1.Caption = DateTime.Now.ToString(); }

Display Format for Timespan in C#

EditMask {0:HH:mm}

EditMask HH:mm

Set the mask so the user can enter a phone number, with optional area code, and a state in capitals.this.c1TrueDBGrid.Columns[0].EditMask = "(###) 000-0000 St\ate\: >LL";

$#,##0.00;($#,##0.00) Currency format.

0 Fixed number format.

#,##0 Commas format.

0% Percent format.

0.00E+00 Scientific format.

c General Date and Time format.

dddddd Long Date format.

dd-mmm-yy Medium Date format.

ddddd Short Date format.

ttttt Long Time format.

hh:mm AM/PM Medium Time format.

hh:mm Short Time format.

How To Change Grid into VerticalGrid

Assembly : DevExpress.XtraVerticalGrid;

void View_ControlsCreated(object sender, EventArgs e)
ListView LV=(ListView)View;
GridControl GD = (GridControl)LV.Editor.Control;
VGridControl VG = new VGridControl(); VG.DataSource = LV.CollectionSource.Collection;
GD.Controls.Add (VG);
VG.AllowDrop = true;
VG.Dock = System.Windows.Forms.DockStyle.Fill;
VG.Appearance.FocusedRow.BackColor = System.Drawing.Color.Red;
VG.AllowDrop = true;
VG.LayoutStyle = LayoutViewStyle.MultiRecordView;
System.Drawing.Size sz = new System.Drawing.Size(1500, 1500);
VG.Size = sz;
VG.OptionsBehavior.AutoFocusNewRecord = true;
VG.OptionsBehavior.Editable = true;
VG.OptionsBehavior.RecordsMouseWheel = true;
VG.OptionsView.AutoScaleBands = true;
VG.OptionsView.ShowButtons = true;

How to Check That Interface is implemented in the Class

if (View is DetailView && View.ObjectTypeInfo.Implements<"ILedger>"()){} here Plz Do not Apply Double quotes before/after ILedger

Open Popup ListView of any Class on Navigation Click

If You Want To Open a PopupListView on Navigation Click
To do this you have to write a Controller and
inherit it with ShowNavigationItemController

Here There is a Class Shipment when I click on Shipment in NavigationBar then a
PopupListView will Come of DispatchRegister
Now add the code below

protected override void ShowNavigationItem(SingleChoiceActionExecuteEventArgs args)
if ((args.SelectedChoiceActionItem != null) && args.SelectedChoiceActionItem.Enabled)
if (args.SelectedChoiceActionItem.Id == "Shipment_ListView")
ObjectSpace os = Application.CreateObjectSpace();
DevExpress.ExpressApp.ListView lv = Application.CreateListView(os, typeof(DispatchRegister), true);
args.ShowViewParameters.CreatedView = lv;
args.ShowViewParameters.TargetWindow = TargetWindow.NewModalWindow;
args.ShowViewParameters.CreateAllControllers = true;
DialogController dc = new DialogController();
dc.Accepting += new EventHandler(dc_Accepting);

Now Write Code on Accepting Here You Can Find Selected Item after Clicking on OK Button
void dc_Accepting(object sender, DialogControllerAcceptingEventArgs e)
ObjectSpace os=Application.CreateObjectSpace ();
ListView lv = ((ListView)((WindowController)sender).Window.View);
Shipment sp = null;
CollectionSource cs = new CollectionSource(os, typeof(Shipment));
CollectionSourceBase cs1 = (CollectionSourceBase)lv.CollectionSource;
foreach (DispatchRegister dr in lv.SelectedObjects)
sp = new Shipment(os.Session);
sp.BlockNo = dr.DeliveryNumber;
sp.ChallanNo = dr.DistributionChannel;
cs.Collection.Add(os.GetObject (sp));
ListView listView = Application.CreateListView("Shipment_ListView", cs, true);
e.ShowViewParameters.CreatedView = listView;
e.ShowViewParameters.TargetWindow = TargetWindow.Default;


Visitor No

click for free hit counter
Download a free hit counter here.