示例#1
0
        public FrmAddAssets(string userName)
        {
            try
            {
                COM_MESSAGE  = new CommonControls.Classes.ClsMessages();
                VALIDATION   = new CommonControls.Classes.ClsValidation();
                COMM_METHODS = new CommonControls.Classes.ClsCommonMethods();
                ADD_ASSET    = new BLL.ClsAssetData();
                MANAGEDB     = new BLL.ClsMetaDataDbChanges();

                InitializeComponent();

                USERNAME           = userName;
                btn_cancel.Visible = true;
                btn_create.Visible = true;
                btn_delete.Visible = false;
                btn_update.Visible = false;

                this.WindowState   = FormWindowState.Maximized;
                this.ActiveControl = txt_assetName;
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
示例#2
0
        public FrmAddAssets(BLL.ClsAssetData asset, string userName)
        {
            try
            {
                COM_MESSAGE  = new CommonControls.Classes.ClsMessages();
                VALIDATION   = new CommonControls.Classes.ClsValidation();
                COMM_METHODS = new CommonControls.Classes.ClsCommonMethods();
                ADD_ASSET    = new BLL.ClsAssetData();
                MANAGEDB     = new BLL.ClsMetaDataDbChanges();

                InitializeComponent();

                IS_UPDATING        = true;
                USERNAME           = userName;
                btn_cancel.Visible = true;
                btn_create.Visible = false;
                btn_delete.Visible = true;
                btn_update.Visible = true;

                fillData(asset);

                this.StartPosition = FormStartPosition.CenterScreen;
                this.ActiveControl = txt_assetName;
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
示例#3
0
        private void grd_editAssets_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;
            int assetId    = 0;

            BLL.ClsAssetData assetData = new BLL.ClsAssetData();

            try
            {
                //check for do action
                if (COMM_METHODS.checkActPermission(this.Name, USERNAME))
                {
                    if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
                    {
                        assetId   = Convert.ToInt32(senderGrid.SelectedCells[e.ColumnIndex].Value);
                        assetData = MANAGEDB.getSingleAssetData(assetId);

                        FrmAddAssets frmAddAssets = new FrmAddAssets(assetData, USERNAME);
                        frmAddAssets.WindowState = FormWindowState.Normal;
                        frmAddAssets.ShowDialog();
                        grd_editAssets.DataSource = MANAGEDB.getAssetDetails();
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
示例#4
0
 private void fillData(BLL.ClsAssetData assetData)
 {
     try
     {
         txt_assetId.Text     = assetData._assetId.ToString();
         txt_assetName.Text   = assetData._assetName;
         txt_description.Text = assetData._descrption;
         txt_value.Text       = assetData._value.ToString();
         txt_quantity.Text    = assetData._quantity.ToString();
         txt_total.Text       = assetData._totalValue.ToString();
     }
     catch (Exception ex)
     {
         COM_MESSAGE.exceptionMessage(ex.Message);
     }
 }