private void LoadInventory()
        {
            BSInventoryItem bs = new BSInventoryItem();
            item = bs.getInventoryItem(this.item.ItemId);

            if (item != null)
            {
                txtItemName.Text = item.ItemName;
                txtCategory.Text = item.CategoryName;
                txtQuantity.Text = item.Quantity.ToString();
                txtPrice.Text = item.Price.ToString();
                txtAvailable.Text = item.Available;
                txtRemarks.Text = item.Remarks;
                lblCreated.Text = item.CreatedByName + " at " + String.Format("{0:MMMM dd, yyyy}", item.CreatedDate) + " " + String.Format("{0:HH:MM:sstt}", item.CreatedDate);

                if (String.IsNullOrEmpty(item.ModifiedByName))
                {
                    lblModified.Visible = false;
                    lblTitleCreatedBy.Visible = false;
                }
                else
                {
                    lblModified.Visible = true;
                    lblTitleCreatedBy.Visible = true;
                    lblModified.Text = item.ModifiedByName + " at " + String.Format("{0:MMMM dd, yyyy}", item.ModifiedDate) + " " + String.Format("{0:HH:MM:sstt}", item.ModifiedDate);
                }
            }
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                BSInventoryItem bs = new BSInventoryItem();
                Boolean isExists = false;

                isExists = bs.checkInventoryItemByName(txtItemName.Text.Trim());

                if (isExists)
                {
                    VJUtility util = new VJUtility();
                    util.ShowMessage(VJConstants.MSG_ITEM_ALREADY_EXISTS, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                else
                {

                    this.item.ItemName = txtItemName.Text;
                    this.item.CategoryId = Convert.ToInt32(cmbCategory.SelectedValue);
                    this.item.Price = Convert.ToDecimal(txtPrice.Text);
                    this.item.Quantity = Convert.ToInt32(npdQuantity.Value);
                    this.item.Remarks = txtRemarks.Text;
                    if (cmbAvailable.SelectedItem.ToString() == "Yes")
                    {
                        this.item.Available = VJConstants.CONST_YES;
                    }
                    else
                    {
                        this.item.Available = VJConstants.CONST_NO;
                    }
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
            }
        }
Example #3
0
        private Boolean DeleteInventoryItem(int itemid)
        {
            Boolean result = false;

            BSInventoryItem bs = new BSInventoryItem();

            result = bs.DeleteInventoryItem(itemid);

            return result;
        }
Example #4
0
        private void tsbAddItem_Click(object sender, EventArgs e)
        {
            frmAddEditInventory frm = new frmAddEditInventory();

            if (frm.ShowDialog(this) == DialogResult.OK)
            {
                InventoryItem objItem = frm.item;
                BSInventoryItem bs = new BSInventoryItem();

                Boolean result = false;

                result = bs.InsertInventoryItem(objItem.ItemName, objItem.CategoryId, objItem.Quantity, objItem.Price, objItem.Available, objItem.Remarks, this.userinfo.EmployeeID);

                if (result)
                {
                    MessageBox.Show(VJConstants.MSG_ITEM_SUCCESSFULLY_ADDED, VJConstants.MESSAGEBOX_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadInventory();
                }
                else
                {
                    MessageBox.Show(VJConstants.MSG_ERROR_ENCOUNTERED, VJConstants.MESSAGEBOX_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error);

                }
            }

            frm.Dispose();
        }
Example #5
0
        private void LoadInventory()
        {
            BSInventoryItem bs = new BSInventoryItem();
            List<InventoryItem> itemlist = new List<InventoryItem>();
            InventoryItem s = new InventoryItem();

            DataGridViewLinkColumn Editlink = new DataGridViewLinkColumn();
            Editlink.UseColumnTextForLinkValue = true;
            Editlink.HeaderText = "";
            Editlink.DataPropertyName = "lnkColumn";
            Editlink.LinkBehavior = LinkBehavior.SystemDefault;
            Editlink.Text = "Edit";
            dgvData.Columns.Add(Editlink);

            DataGridViewLinkColumn Deletelink = new DataGridViewLinkColumn();
            Deletelink.UseColumnTextForLinkValue = true;
            Deletelink.HeaderText = "";
            Deletelink.DataPropertyName = "lnkColumn";
            Deletelink.LinkBehavior = LinkBehavior.SystemDefault;
            Deletelink.Text = "Delete";
            dgvData.Columns.Add(Deletelink);

            itemlist = bs.getInventoryItem(0, 0);
            dgvData.DataSource = null;
            dgvData.Rows.Clear();
            dgvData.Columns.Clear();
            dgvData.Refresh();
            dgvData.DataSource = itemlist;

            for (int i = 0; i < dgvData.ColumnCount; i++)
            {
                if (dgvData.Columns[i].HeaderText.ToUpper() == VJColumnName.CONST_ITEM_ID.ToUpper() ||
                    dgvData.Columns[i].HeaderText.ToUpper() == VJColumnName.CONST_CATEGORY_ID.ToUpper()||
                    dgvData.Columns[i].HeaderText.ToUpper() == VJColumnName.CONST_CREATED_BY.ToUpper()||
                    dgvData.Columns[i].HeaderText.ToUpper() == VJColumnName.CONST_MODIFIED_BY.ToUpper())
                {
                    dgvData.Columns[i].Visible = false;
                }
            }
        }
        private void LoadInventoryItem(int itemid)
        {
            BSInventoryItem bs = new BSInventoryItem();
            InventoryItem data = new InventoryItem();

            data = bs.getInventoryItem(itemid);

            if (data != null)
            {
                txtItemName.Text = data.ItemName;
                cmbCategory.SelectedValue = data.CategoryId;
                cmbAvailable.SelectedValue = data.Available;
                npdQuantity.Value = data.Quantity;
                txtPrice.Text = data.Price.ToString();
                txtRemarks.Text = data.Remarks;
            }
        }
        private void GetItemList(int catid)
        {
            BSInventoryItem bs = new BSInventoryItem();
            List<InventoryItemData> itemList = new List<InventoryItemData>();

            //itemList = bs.GetItemList(catid);

            //if (itemList != null || itemList.Count > 0)
            //{
            //    cmbItemName.DisplayMember = "ItemName";
            //    cmbItemName.ValueMember = "ItemId";
            //    cmbItemName.DataSource = itemList;
            //    cmbItemName.Enabled = true;

            //}
        }
        private void GetItemDetails(int itemid)
        {
            BSInventoryItem bs = new BSInventoryItem();
            InventoryItemData item = new InventoryItemData();

            //item = bs.GetItemByID(itemid);

            //if (item != null)
            //{

            //    txtAvailableStock.Text = item.Quantity.ToString();
            //    txtPrice.Text = String.Format("{0:0.00}",item.Price);
            //    txtQuantity.Text = "0";

            //}
            //else
            //{
            //    txtAvailableStock.Text = "0";
            //    txtPrice.Text = String.Format("{0:0.00}",0);
            //    txtQuantity.Text = "0";
            //}
        }