Tuesday, December 15, 2009
How To See all Trigger in SQL SERVER
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 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)
Or
CriteriaOperator.Parse("GetYear(Date1)=2009")
How To Add ListViewFilter From BO Model in XAF
How To Add Conditional Formatting in XAF
How To Add Item in Grid Control Like Button/TextBox in XAF
{
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;
gc.Controls.Add(te);
gc.Controls.Add(dp);
gc.Controls.Add(l);
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
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
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()
{
base.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;
listView.CollectionSource.Criteria.Remove("EmptyCollectionCriteria");
}
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
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
Note : Here donot Apply "" in GroupWiseMasterDailyLedger and also one lessthan and greater than Sign
How To Find Top 10 Record in ListView in XAF
{
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
How To Apply Clock and Date on Your Application
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.
How To Change Grid into VerticalGrid
:DevExpress.XtraGrid;
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
Open Popup ListView of any Class 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)
{
base.ShowNavigationItem(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();
args.ShowViewParameters.Controllers.Add(dc);
dc.Accepting += new EventHandler
}
}
}
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;
}
Monday, November 23, 2009
How To Convert ArrayList to String
string jj=string .Empty;
jj=string.Join(“,”, (string []) ar.ToArray(typeof(string)))
How To Hide Some Class from New Button List/Navigation Item in XAF
{
public HideItemsControll()
{
InitializeComponent();
RegisterActions(components);
}
protected override void OnActivated()
{
base.OnActivated();
CollectCreatableItemTypes += new EventHandler
}
void HideItemsControll_CollectCreatableItemTypes(object sender, CollectTypesEventArgs e)
{
CustomizeList(e.Types);
}
public void CustomizeList(ICollection
{
//Get the ShowNavigationItemController, then get its ShowNavigationItemAction
SingleChoiceAction showNavigationItemAction = Frame.GetController
//Get the item selected in the navigation control
ChoiceActionItem selectedItem = showNavigationItemAction.SelectedItem;
ChoiceActionItem currentGroup = null;
if (selectedItem != null)
{
//Get the selected item's parent group
currentGroup = selectedItem.ParentItem;
List
//Collect the types that must be deleted
foreach (Type type in types)
{
//bool deletionRequired = true;
if (type.Name.Equals("BillByBill"))
{
unusableTypes.Add(type);
}
if (type.Name.Equals("AccountIntrest"))
{
unusableTypes.Add(type);
}
foreach (Type type in unusableTypes)
types.Remove(type);
}}}
How to Find ObjectSpace
Here we can see the unit of work
How To Find Type of a Property/Member
ITypeInfo TypeInfo= XafTypesInfo.Instance.FindTypeInfo();
IMemberInfo iminfo = TypeInfo.FindMember(memberName);
If (iminfo.MemberTypeInfo.Type == typeof(double)){}
The Default View Only Populate After a Search has been done and Not Automatically Populate the View at Startup
You search anything
namespace FilterListView.Module
{
public partial class ViewController1 : ViewController
{
public ViewController1()
{
InitializeComponent();
RegisterActions(components);
}
protected override void OnActivated()
{
base.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;
listView.CollectionSource.Criteria.Remove("EmptyCollectionCriteria");
}
}
}
Associassion Through Module Base with the help of Interface
have to add two Properties
FormsToIssue, FormsToRecieve in a Class which have Implemented ICST Interface
public sealed partial class InModule : ModuleBase
{
public InModule()
{
InitializeComponent();
}
public override void CustomizeTypesInfo(DevExpress.ExpressApp.DC.ITypesInfo typesInfo)
{
base.CustomizeTypesInfo(typesInfo);
if (Application == null || Application.XPDictionary == null) return;
XPDictionary xpDCT = XafTypesInfo.XpoTypeInfoSource.XPDictionary;
foreach (XPClassInfo item in Application.XPDictionary.Classes)
{
if (item.ClassType != null && XafTypesInfo.Instance.FindTypeInfo(item.ClassType).ImplementsICST())
{
classInfo = item;
if (XafTypesInfo.Instance.FindTypeInfo(classInfo.ClassType).ImplementsICST())
{
if (classInfo.FindMember(classInfo.ClassType.Name) == null && classInfo.BaseClass.FindMember(classInfo.ClassType.Name) == null)
{
classInfo.CreateMember("FormsToIssue", typeof(StatutoryForms), new VisibleInListViewAttribute(false), new VisibleInLookupListViewAttribute(false));
classInfo.CreateMember("FormsToRecieve", typeof(StatutoryForms), new VisibleInListViewAttribute(false), new VisibleInLookupListViewAttribute(false));
}
XafTypesInfo.Instance.RefreshInfo(classInfo.ClassType);
}}}}}}
Here ICST is a Interface that is attached with various Class in that class two
property will be added
How To Find Method of Other Modules
Argument in a Different Modules Xpert.Procurement
And this method is Used in AccountModules Xpert.Account and we can not used
Xpert.Procurement This DLL in Account Module because AccountModules is Top Level
So we used this Method by this way as given below…..
First here we find the class in which Method is defined here method is defined in
PurchaseUtils Class
Now find the Method and Pass Parameter……
Type TP = ReflectionHelper.FindType("PurchaseUtils");
MethodInfo MI = TP.GetMethod("ClosingBalance");
object[] parameters = new object[3];
parameters[0] = Session;
XPCollection x = new XPCollection(ReflectionHelper.FindType("ItemDetails"));
parameters[1] = DateTime.Now;
parameters[2] = DateTime.Now;
_Amount = (double)(MI.Invoke(null, parameters));
Wednesday, November 11, 2009
How To Set Column Width in AspxGridView in C#
Now Find Ledger Property From AccountGroup and Find its ListView and then Find the Column whose width you have to Change.
if (View is DetailView && View.ObjectTypeInfo.Type == typeof(AccountGroup))
{
DetailView dv = (DetailView)View;
ListPropertyEditor lv = (ListPropertyEditor)dv.FindItem("Ledger");
ListView Lv = (ListView)lv.ListView;
ASPxGridListEditor editor = (ASPxGridListEditor)lv.ListView.Editor;
ASPxGridControl gridView = editor.Grid;
gridView.SettingsBehavior.ColumnResizeMode = ColumnResizeMode.Control;
gridView.Columns["Name"].Width = new System.Web.UI.WebControls.Unit(350);
}
Monday, November 9, 2009
How To Backup a Database in C#
string backupDir = @"E:\web";
try
{
string[] picList = Directory.GetFiles(sourceDir, "*.mdb");
string[] txtList = Directory.GetFiles(sourceDir, "*.ldb");
foreach (string f in picList)
{
string fName = f.Substring(sourceDir.Length + 1);
File.Copy(Path.Combine(sourceDir, fName), Path.Combine(backupDir, fName), true);
}
foreach (string f in txtList)
{
string fName = f.Substring(sourceDir.Length + 1);
try
{
File.Copy(Path.Combine(sourceDir, fName), Path.Combine(backupDir, fName));
}
catch (IOException copyError)
{
Console.WriteLine(copyError.Message);v }
}
}
catch (DirectoryNotFoundException dirNotFound)
{
Console.WriteLine(dirNotFound.Message);
}
Monday, October 26, 2009
How to Hide or Show an Property in the DetailView Against the Value of the Object's Property.
Assembly:
DevExpress.XtraLayout;
DevExpress.ExpressApp.Win.Layout;
if (View is DetailView && View.ObjectTypeInfo.Type == typeof(Item))
{
if (e.Object.GetType() == typeof(Item))
{
LayoutControl layoutControl = ((LayoutControl)View.Control);
DetailView dv = (DetailView)View;
Item itm = (Item)View.CurrentObject;
LayoutControlItem target = FindLayoutControlItemByName("ItemName", ((LayoutControl)(((WinLayoutManager)(dv.LayoutManager)).Container)).Items);
ITypeInfo imf = (ITypeInfo)XafTypesInfo.Instance.FindTypeInfo(View.CurrentObject.GetType());
IMemberInfo imi = imf.FindMember("IsApplicable");
Boolean ValueOfIsApplicable = false;
if (imi != null)
{
ValueOfIsApplicable = (Boolean)imi.GetValue(View.CurrentObject);
}
layoutControl.BeginUpdate();
if (target != null && ValueOfIsApplicable)
{
target.HideToCustomization();
}
else
{
target.RestoreFromCustomization();
}
layoutControl.EndUpdate();
}
}
Here is Method
private LayoutControlItem FindLayoutControlItemByName(string name, CollectionBase items)
{
foreach (object item in items)
{
if (item is LayoutControlItem)
{
if ((item as LayoutControlItem).ControlName != null)
{
if ((item as LayoutControlItem).ControlName.IndexOf(name) >= 0)
{
return item as LayoutControlItem;
}}}}
return null;
}
How To Rename a TAB on DetailView
Assembly:
DevExpress.XtraLayout;
DevExpress.ExpressApp.Win.Layout;
public void RenameTab(DetailView view, string tabName, bool isVisible)
{ LayoutControl layoutControl = ((LayoutControl)view.Control); foreach (object obj in layoutControl.Items) { if (obj is TabbedControlGroup) { TabbedControlGroup tabbedControlGroup = (TabbedControlGroup)obj; foreach (object item in tabbedControlGroup.TabPages) { string Name = ((LayoutGroup)(item)).Name; if (Name.IndexOf("OriginalTABName1") >= 0 || Name.IndexOf("OrignalTABName2") >= 0) { if (Name.IndexOf(tabName) <= 0) { ((LayoutGroup)(item)).BeginUpdate(); ((LayoutGroup)(item)).CustomizationFormText = tabName; ((LayoutGroup)(item)).Text = tabName; ((LayoutGroup)(item)).EndUpdate(); } return;}}}} layoutControl.EndUpdate(); } Now Write Code on ObjectChange void ObjectSpace_ObjectChanged(object sender, ObjectChangedEventArgs e) { if (View is DetailView && View.ObjectTypeInfo.Type == typeof(Ledger)) { if (e.Object.GetType() == typeof(Ledger)) { LayoutControl layoutControl = ((LayoutControl)View.Control); DetailView dv = (DetailView)View; Ledger ldg = (Ledger)View.CurrentObject; LayoutControlItem target = FindLayoutControlItemByName("DeducteeType", ((LayoutControl)(((WinLayoutManager)(dv.LayoutManager)).Container)).Items); ITypeInfo imf = (ITypeInfo)XafTypesInfo.Instance.FindTypeInfo(View.CurrentObject.GetType()); IMemberInfo imi = imf.FindMember("IsTDSApplicable"); Boolean ValueOfIsTDSApplicable = false; if (imi != null) { ValueOfIsTDSApplicable = (Boolean)imi.GetValue(View.CurrentObject); } layoutControl.BeginUpdate(); if (target != null && ValueOfIsTDSApplicable) { RenameTab(dv, "TDSDetails", true); target.Text = "DeducteeType"; } else { RenameTab(dv, "TCSDetails", true); target.Text = "CollecteeType"; } layoutControl.EndUpdate(); }}}
How To Find LayoutControlItem on DetailView
Thursday, October 1, 2009
How To DeleteDuplicateRecord From ArrayList
How To Get Property Value From Application Model
Auto Index in GridView
How To Validate a Row
How To Filter ListView Staticely
How To Filter ListView on ControlCreated
Collection Sorting on Multiple Field
How To Sort a XPCollection
How To Call a DetailView On Action
How to Find List Selected Item on Accepting
How To Call a ListView On Action
How To Add New Row in ListView
How To Access The Value Of ReadonlyParameter
How to Find Edit value of Lookup
Comparing Two Property Value in Same class
How to Filter Popup Window
Apply Criteria on XPCollection
How To To Disable New Button and Close Button From Lookup Window
How To Apply Email validation
Aassociassion with Module Base
How to Find Property of Class with XafTypeInfo
How To Find GridView From DetailView
How To Hide BO Model For Normal User
How to Prevent Deletion Of Record From ListView
How to Prevent a DetailView From being Shown When the User Double Clicks/Presses the Enter Key on a Record in the ListView
how To Add a Simple Button on Detail View
How To a Add Simple Button on DetailView
Fire Event on Button Added on DetailView
How To Find Master Object of ListView
Enble Master View of GridView
Activate Panel on Class
Hide Link Button From Associated Class
Hide Skin Action From Toolbar
Hide New Button From Lookup
Open ListView on Navigation Click
protected override void ShowNavigationItem(SingleChoiceActionExecuteEventArgs args)
{
base.ShowNavigationItem(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(); args.ShowViewParameters.Controllers.Add(dc); dc.Accepting += new EventHandler
}
}
}
Now Write Code on Accepting
void dc_Accepting(object sender, DialogControllerAcceptingEventArgs e)
{
ObjectSpace os=Application.CreateObjectSpace ();
DevExpress.ExpressApp.ListView lv = ((DevExpress.ExpressApp.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));
}
DevExpress.ExpressApp.ListView listView = Application.CreateListView("Shipment_ListView", cs, true); e.ShowViewParameters.CreatedView = listView;
e.ShowViewParameters.TargetWindow = TargetWindow.Default;
}
Mat Table Angular
Mat Table in Angular Mat table is used to display data . its a material designed styled data-table . For using Material Table MatTableMo...
-
CriteriaOperator criteria = new BinaryOperator("Age", 30, BinaryOperatorType.Greater); CriteriaOperator criteria = CriteriaOperato...
-
SortingCollection sc = new SortingCollection(); sc.Add (new SortProperty("field on which you want to sort",DevExpress.Xpo.DB.Sorti...
-
Here ItemName will be Enable/Disable According to IsApplicable Property Assembly: DevExpress.XtraLayout; DevExpress.ExpressApp.Win.Layou...