private void btnAddTBLAssetOhda_Click(object sender, EventArgs e) { try { XPDataTableObject row = (XPDataTableObject)gridViewAsset.GetRow(gridViewAsset.FocusedRowHandle); if (row == null) { return; } if (row == null) { return; } TBLAssetOhdaDlg frm = new TBLAssetOhdaDlg(Convert.ToInt32(row.GetMemberValue("AssetsID")), true); if (frm.ShowDialog() == DialogResult.OK) { gridViewTBLAssetOhda.ShowLoadingPanel(); tBLAssetOhdaTableAdapter.FillByAssetsID(dsData.TBLAssetOhda, Convert.ToInt32(row.GetMemberValue("AssetsID"))); gridViewTBLAssetOhda.RefreshData(); gridViewTBLAssetOhda.HideLoadingPanel(); } } catch (Exception ex) { MsgDlg.Show(ex.Message, MsgDlg.MessageType.Error, ex); } }
private void gridViewMain_ShownEditor(object sender, EventArgs e) { DevExpress.XtraGrid.Views.Base.ColumnView view = (DevExpress.XtraGrid.Views.Base.ColumnView)sender; XPDataTableObject row = (XPDataTableObject)gridViewMain.GetRow(gridViewMain.FocusedRowHandle); if (row == null) { return; } if (row.GetMemberValue("jointocheck") == null || Convert.ToBoolean(row.GetMemberValue("jointocheck")) == false) { view.ActiveEditor.Properties.ReadOnly = true; } else { view.ActiveEditor.Properties.ReadOnly = false; } }
private void repositoryItemButtonEditPrint_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { XPDataTableObject row = ((XPDataTableObject)gridViewParent.GetRow(gridViewParent.FocusedRowHandle)); object id = row.GetMemberValue("TwreedOrderId"); if (id == null) { MsgDlg.Show("من فضلك احفظ قبل الطباعة", MsgDlg.MessageType.Error); return; } FixedAssets.XRep.xRep002 rep = new FixedAssets.XRep.xRep002(Convert.ToInt32(id)); Classes.Misc.ShowPrintPreview(rep); }
private void gridViewTBLTBBuyorderdetails_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e) { XPDataTableObject ParentRow = (XPDataTableObject)gridViewParent.GetRow(gridViewParent.FocusedRowHandle); if (ParentRow == null) { return; } Datasource.dsData.TBLTwreedOrderdetailsRow Row = (Datasource.dsData.TBLTwreedOrderdetailsRow)((DataRowView)gridViewDetails.GetRow(gridViewDetails.FocusedRowHandle)).Row; if (Row == null) { return; } Row.TwreedOrderId = Convert.ToInt32(ParentRow.GetMemberValue("TwreedOrderId")); Row.UserIn = Classes.Managers.UserManager.defaultInstance.User.UserId; Row.dateIn = Classes.Managers.DataManager.GetServerDatetime; }
private void gridViewEmp_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e) { XPDataTableObject ParentRow = (XPDataTableObject)gridViewMain.GetRow(gridViewMain.FocusedRowHandle); if (ParentRow == null) { return; } Datasource.dsData.TBLCheckEmpRow Row = (Datasource.dsData.TBLCheckEmpRow)((DataRowView)gridViewEmp.GetRow(gridViewEmp.FocusedRowHandle)).Row; if (Row == null) { return; } int ChecklagnaID = Convert.ToInt32(ParentRow.GetMemberValue("ChecklagnaID")); Row.ChecklagnaID = ChecklagnaID; Row.UserIn = Classes.Managers.UserManager.defaultInstance.User.UserId; Row.dateIn = Classes.Managers.DataManager.GetServerDatetime; }
private void btnEditTBLBuyorder_Click(object sender, EventArgs e) { try { XPDataTableObject row = (XPDataTableObject)gridViewParent.GetRow(gridViewParent.FocusedRowHandle); if (row == null) { return; } TBLTwreedOrderDlg frm = new TBLTwreedOrderDlg(Convert.ToInt32(row.GetMemberValue("TwreedOrderId")), false); if (frm.ShowDialog() == DialogResult.OK) { XPSCSTBLTwreedOrder.Session.DropIdentityMap(); XPSCSTBLTwreedOrder.Reload(); gridViewParent.RefreshData(); } } catch (Exception ex) { MsgDlg.Show(ex.Message, MsgDlg.MessageType.Error, ex); } }
private void btnEditAsset_Click(object sender, EventArgs e) { try { XPDataTableObject row = (XPDataTableObject)gridViewItem.GetRow(gridViewItem.FocusedRowHandle); if (row == null) { return; } TblAsnafEditorDlg frm = new TblAsnafEditorDlg(Convert.ToInt32(row.GetMemberValue("SanfID")), false); if (frm.ShowDialog() == DialogResult.OK) { sessionItem.DropIdentityMap(); XPCSItem.Reload(); gridViewItem.RefreshData(); } } catch (Exception ex) { MsgDlg.Show(ex.Message, MsgDlg.MessageType.Error, ex); } }
public static object rowInsert(string tablename, Dictionary<string, object> values) { try { using (UnitOfWork uow = XpoHelper.GetNewUnitOfWork()) { XPDataTableObject obj = new XPDataTableObject(uow, XpoHelper.dynamicClasses[tablename]); foreach (KeyValuePair<string, object> item in values) { obj.SetMemberValue(item.Key, item.Value); } uow.CommitChanges(); obj.Reload(); return obj.GetMemberValue(obj.ClassInfo.KeyProperty.DisplayName); } } catch (Exception ex) { SiAuto.Main.LogColored(Color.Red, "Loi rowInsert:" + ex.ToString()); throw ex; } }