public TBLAddAssetComponentDlg(int ID, bool New)
        {
            InitializeComponent();

            LSMSCDComponents.QueryableSource = from q in dsLinq.CDComponents select q;
            try
            {
                if (New)
                {
                    Datasource.dsData.TBLAddAssetComponentRow row = dsData.TBLAddAssetComponent.NewTBLAddAssetComponentRow();
                    row.AddComponentezn = (int)adp.NewId();
                    row.AssetsID        = ID;
                    row.ComponentId     = 0;
                    row.AddQuantity     = 0;
                    row.PriceOne        = 0;
                    row.Adddate         = Classes.Managers.DataManager.GetServerDatetime;
                    row.AddReson        = string.Empty;
                    row.UserIn          = Classes.Managers.UserManager.defaultInstance.User.UserId;
                    row.dateIn          = Classes.Managers.DataManager.GetServerDatetime;
                    dsData.TBLAddAssetComponent.AddTBLAddAssetComponentRow(row);
                }
                else
                {
                    adp.FillByAddComponentezn(dsData.TBLAddAssetComponent, ID);
                }
            }
            catch (Exception ex)
            {
                MsgDlg.Show(ex.Message, MsgDlg.MessageType.Error, ex);
                Logger.Error(ex.Message, ex);
            }
        }
 private void btnEditTBLAddAssetComponent_Click(object sender, EventArgs e)
 {
     try
     {
         DataRowView drv = (DataRowView)gridViewTBLAddAssetComponent.GetRow(gridViewTBLAddAssetComponent.FocusedRowHandle);
         if (drv == null)
         {
             return;
         }
         Datasource.dsData.TBLAddAssetComponentRow row = (Datasource.dsData.TBLAddAssetComponentRow)(drv).Row;
         if (row == null)
         {
             return;
         }
         TBLAddAssetComponentDlg frm = new TBLAddAssetComponentDlg(row.AddComponentezn, false);
         if (frm.ShowDialog() == DialogResult.OK)
         {
             gridViewTBLAddAssetComponent.ShowLoadingPanel();
             tBLAddAssetComponentTableAdapter.FillByAssetsID(dsData.TBLAddAssetComponent, row.AssetsID);
             gridViewTBLAddAssetComponent.RefreshData();
             gridViewTBLAddAssetComponent.HideLoadingPanel();
         }
     }
     catch (Exception ex)
     {
         MsgDlg.Show(ex.Message, MsgDlg.MessageType.Error, ex);
     }
 }
 private void btnDeleteTBLAddAssetComponent_Click(object sender, EventArgs e)
 {
     try
     {
         Datasource.dsData.TBLAddAssetComponentRow row = (Datasource.dsData.TBLAddAssetComponentRow)((DataRowView)gridViewTBLAddAssetComponent.GetRow(gridViewTBLAddAssetComponent.FocusedRowHandle)).Row;
         if (row == null)
         {
             return;
         }
         if (MsgDlg.Show("هل انت متأكد ؟", MsgDlg.MessageType.Question) == DialogResult.Yes)
         {
             gridViewTBLAddAssetComponent.ShowLoadingPanel();
             tBLAddAssetComponentTableAdapter.Delete(row.AddComponentezn);
             gridViewTBLAddAssetComponent.DeleteRow(gridViewTBLAddAssetComponent.FocusedRowHandle);
             gridViewTBLAddAssetComponent.RefreshData();
             gridViewTBLAddAssetComponent.HideLoadingPanel();
         }
     }
     catch (Exception ex)
     {
         MsgDlg.Show(ex.Message, MsgDlg.MessageType.Error, ex);
     }
 }