Beispiel #1
0
        /// <summary>
        /// when Update
        /// </summary>
        /// <param name="singleItemDetails"></param>
        /// <param name="userName"></param>
        public FrmAddItem(BLL.ClsItemData singleItemDetails, string userName)
        {
            COM_MESSAGE  = new CommonControls.Classes.ClsMessages();
            VALIDATION   = new CommonControls.Classes.ClsValidation();
            COMM_METHODS = new CommonControls.Classes.ClsCommonMethods();
            CREATEITEM   = new BLL.ClsItemData();
            MANAGEDB     = new BLL.ClsInventoryManageDbChanges();

            InitializeComponent();

            txt_itemID.Text      = singleItemDetails._itemId.ToString();
            txt_itemCode.Text    = singleItemDetails._itemCode.ToString();
            txt_altName.Text     = singleItemDetails._altName;
            txt_itemName.Text    = singleItemDetails._itemName;
            txt_itemCode.Enabled = false;

            dropDown_itemType.DataSource     = MANAGEDB.getItemTypeList();
            dropDown_itemType.DisplayMember  = "itemType";
            dropDown_itemType.ValueMember    = "typeId";
            dropDown_itemType.BindingContext = this.BindingContext;
            dropDown_itemType.SelectedIndex  = dropDown_itemType.FindString(singleItemDetails._itemTypeName);

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

            IS_UPDATING = true;
            USERNAME    = userName;

            this.StartPosition = FormStartPosition.CenterScreen;
            this.ActiveControl = txt_itemCode;
        }
Beispiel #2
0
        /// <summary>
        /// when create item
        /// </summary>
        /// <param name="userName"></param>
        public FrmAddItem(string userName)
        {
            COM_MESSAGE  = new CommonControls.Classes.ClsMessages();
            VALIDATION   = new CommonControls.Classes.ClsValidation();
            COMM_METHODS = new CommonControls.Classes.ClsCommonMethods();
            CREATEITEM   = new BLL.ClsItemData();
            MANAGEDB     = new BLL.ClsInventoryManageDbChanges();

            InitializeComponent();

            txt_itemID.Text = MANAGEDB.getMaxItemId().ToString();
            //fill data for itemType from db
            dropDown_itemType.DataSource     = MANAGEDB.getItemTypeList();
            dropDown_itemType.DisplayMember  = "itemType";
            dropDown_itemType.ValueMember    = "typeId";
            dropDown_itemType.BindingContext = this.BindingContext;
            dropDown_itemType.SelectedIndex  = -1;

            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_itemCode;
        }
Beispiel #3
0
        /// <summary>
        /// when create item
        /// </summary>
        /// <param name="userName"></param>
        public FrmAddItem(string userName)
        {
            try
            {
                COM_MESSAGE  = new CommonControls.Classes.ClsMessages();
                VALIDATION   = new CommonControls.Classes.ClsValidation();
                COMM_METHODS = new CommonControls.Classes.ClsCommonMethods();
                CREATEITEM   = new BLL.ClsItemData();
                MANAGEDB     = new BLL.ClsMetaDataDbChanges();

                InitializeComponent();

                filldropDownLists();
                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_itemCode;
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Beispiel #4
0
        /// <summary>
        /// when Update
        /// </summary>
        /// <param name="singleItemDetails"></param>
        /// <param name="userName"></param>
        public FrmAddItem(BLL.ClsItemData singleItemDetails, string userName)
        {
            COM_MESSAGE  = new CommonControls.Classes.ClsMessages();
            VALIDATION   = new CommonControls.Classes.ClsValidation();
            COMM_METHODS = new CommonControls.Classes.ClsCommonMethods();
            CREATEITEM   = new BLL.ClsItemData();
            MANAGEDB     = new BLL.ClsMetaDataDbChanges();

            InitializeComponent();

            txt_itemID.Text      = singleItemDetails._itemId.ToString();
            txt_itemCode.Text    = singleItemDetails._itemCode.ToString();
            txt_altName.Text     = singleItemDetails._altName;
            txt_itemName.Text    = singleItemDetails._itemName;
            txt_itemCode.Enabled = false;

            filldropDownLists();
            dropDown_itemType.SelectedIndex  = dropDown_itemType.FindString(singleItemDetails._itemTypeName);
            dropDown_stockUnit.SelectedIndex = dropDown_stockUnit.FindString(singleItemDetails._stockUnitName);
            dropDown_shopUnit.SelectedIndex  = dropDown_shopUnit.FindString(singleItemDetails._shopUnitName);

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

            IS_UPDATING = true;
            USERNAME    = userName;

            this.StartPosition = FormStartPosition.CenterScreen;
            this.ActiveControl = txt_itemCode;
        }
Beispiel #5
0
        private void grd_editItem_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;
            int itemId     = 0;

            BLL.ClsItemData itemData = new BLL.ClsItemData();

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

                        FrmAddItem frmUser = new FrmAddItem(itemData, USERNAME);
                        frmUser.WindowState = FormWindowState.Normal;
                        frmUser.ShowDialog();
                        grd_editItem.DataSource = MANAGEDB.getItemDetails();
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }