Example #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            bool hasError = false;
            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                var item = new ItemBO();

                item.ItemID = int.Parse(row.Cells[0].Value.ToString());
                item.QtyInHand = decimal.Parse(row.Cells[4].Value.ToString());

                var result =new ItemDAL().UpdateQuantityInHand(item);

                if (!result)
                {
                    MessageBoxClass.ShowMessage(CommonMethods.GetError("INV_021"), false);
                    hasError = true;
                    return;
                }

            }
            if (!hasError)
            {
                MessageBoxClass.ShowMessage(CommonMethods.GetError("INV_022"), false);
            }
        }
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            try
            {
                var result = new ItemDAL().DeleteItemByID(ItemID);

                if (result)
                {
                    MessageBoxClass.ShowMessage(CommonMethods.GetError("INV_017"), false);
                    button1_Click(null, null);
                }
                else
                {
                    MessageBoxClass.ShowMessage(CommonMethods.GetError("INV_016"), false);
                }
            }
            catch (SqlException ex)
            {
                MessageBoxClass.ShowMessage(ex.Message, false);
            }
            catch
            {
                MessageBoxClass.ShowMessage(CommonMethods.GetError("U_007"), true);
            }
        }
Example #3
0
 private void timerInventoryCheck_Tick(object sender, EventArgs e)
 {
     try
     {
         var list = new ItemDAL().CheckInventory();
         if (list.Count > 0)
         {
             toolStripStatusLabelInventory.Text = list.Count + " items have have reached the break even point click hear for more details";
         }
         else
         {
             toolStripStatusLabelInventory.Text = string.Empty;
         }
     }
     catch
     {
         MessageBoxClass.ShowMessage(CommonMethods.GetError("U_007"), true);
     }
 }
Example #4
0
        private void statusStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (e.ClickedItem.Name.Equals("toolStripStatusLabelInventory"))
            {
                var list = new ItemDAL().CheckInventory();

                if (!FormOpen(new ItemInventory(null)))
                {
                    ItemInventory formItemInventory = new ItemInventory(list);
                    formItemInventory.MdiParent = this;
                    FormMain = this;
                    formItemInventory.Show();
                }

            }
        }
 private void textBoxItemNo_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         var item = new ItemDAL().GetItemByItemNo(textBoxItemNo.Text.Trim());
         ItemID = item.ItemID;
         if (ItemID > 0)
         {
             FillItemByItemID(ItemID);
         }
         else
         {
             buttonItemLookUp_Click(null, null);
         }
     }
     else if (e.KeyCode == Keys.F1)
     {
         buttonItemLookUp_Click(null, null);
     }
     SaveKeysPresed(e);
 }
        private void FillItemByItemID(int id)
        {
            var item =new ItemDAL().GetItemByID(id);

            ItemID = id;
            MeasuringUnit = item.MeasuringUnit;
            textBoxItemNo.Text = item.ItemSerial;
            textBoxItemDescription.Text = item.Description;
            //Get From the lookup method
            textBoxMeasuringUnit.Text = new MeasuringUnitDAL().GetAllMeasuringUnitsForLookUp().Find(mu => mu.UnitID==MeasuringUnit).UnitDescription;

            numericUpDownBreakEvenPoint.Value = item.BreakEven;
            numericUpDownQtyInHand.Value = item.QtyInHand;
            numericUpDownUnitPrice.Value = item.UnitPrice;
        }
        private void buttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (ItemID > 0 && !ScreenFunctions.Update)
                {
                    MessageBoxClass.ShowMessage(CommonMethods.GetError("INV_020"), false);
                    return;
                }

                DialogResult dialogResult = MessageBoxClass.ShowDialog(CommonMethods.GetError("INV_018"));
                if (dialogResult == DialogResult.Yes)
                {
                    if (CommonMethods.IsEmpty(textBoxItemDescription.Text))
                    {
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("INV_001"), false);
                        return;
                    }
                    if (CommonMethods.IsEmpty(textBoxItemNo.Text))
                    {
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("INV_002"), false);
                        return;
                    }
                    if (CommonMethods.IsEmpty(textBoxMeasuringUnit.Text))
                    {
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("INV_003"), false);
                        return;
                    }

                    var item = new ItemBO();
                    if (ItemID > 0)
                        item.ItemID = ItemID;
                    else
                        item.ItemID = -1;
                    item.ItemSerial = textBoxItemNo.Text.Trim();
                    item.MeasuringUnit = MeasuringUnit;
                    item.QtyInHand = numericUpDownQtyInHand.Value;
                    item.UnitPrice = numericUpDownUnitPrice.Value;
                    item.BreakEven = numericUpDownBreakEvenPoint.Value;
                    item.CreatedUser = 0;
                    item.Description = textBoxItemDescription.Text.Trim();

                    var objItemDAL = new ItemDAL();

                    bool result = objItemDAL.AddItem(item);
                    if (result)
                    {
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("INV_004"), false);
                        button1_Click(null, null);
                    }
                    else
                    {
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("INV_005"), false);
                    }
                }
            }
            catch
            {
                MessageBoxClass.ShowMessage(CommonMethods.GetError("U_007"), true);
            }
        }
Example #8
0
        private void treeViewReports_AfterSelect(object sender, TreeViewEventArgs e)
        {
            reportViewerMain.Clear();
            reportViewerMain.LocalReport.DataSources.Clear();
            reportViewerMain.RefreshReport();
            reportViewerMain.Reset();

            panelRefundReport.Visible = false;
            panelSalesByPlu.Visible = false;

            if (e.Node.Name == "dailySalesNode")
            {
                tableLayoutPanelReport.RowStyles[0].Height = 0;

                DateTime sysDate = new DayProcessDAL().GetCurrentDayProcessDate();
                DataSet ds = new InvoiceDAL().GetDailySalesReport(sysDate, sysDate);

                tableLayoutPanelReport.Visible = true;
                LoadDailySalesReport(ds, sysDate, sysDate);
            }
            if (e.Node.Name == "DailyInventoryNode")
            {
                tableLayoutPanelReport.RowStyles[0].Height = 0;

                DataSet ds = new ItemDAL().GetAllItemsReport();

                tableLayoutPanelReport.Visible = true;
                LoadInventoryReport(ds);
            }
            if (e.Node.Name == "SalesbyPLUNode")
            {
                tableLayoutPanelReport.RowStyles[0].Height = 10;

                panelReportForm.Controls.Add(panelSalesByPlu);
                panelSalesByPlu.Dock = DockStyle.Fill;
                panelSalesByPlu.Visible = true;

                LoadSubItems(comboBoxSubItems);
                tableLayoutPanelReport.Visible = true;
            }
            if (e.Node.Name == "RefundNode")
            {
                tableLayoutPanelReport.RowStyles[0].Height = 20;

                panelReportForm.Controls.Add(panelRefundReport);
                panelRefundReport.Dock = DockStyle.Fill;
                panelRefundReport.Visible = true;

                LoadSubItems(comboBoxRefundItem);
                tableLayoutPanelReport.Visible = true;
            }
        }
Example #9
0
        private void SetLookUp(string lookupName)
        {
            try
            {
                Name = lookupName.Trim();

                if (LookUpType.Equals(CommonEnums.LookUps.Item))
                {
                    ItemList = new ItemDAL().GetAllItemsForLookUp();
                    dataGridViewLookUpData.DataSource = ItemList;
                }
                else if (LookUpType.Equals(CommonEnums.LookUps.MeasuringUnit))
                {
                    measuringUnitList = new MeasuringUnitDAL().GetAllMeasuringUnitsForLookUp();
                    dataGridViewLookUpData.DataSource = measuringUnitList;
                }
                else if (LookUpType.Equals(CommonEnums.LookUps.user))
                {
                    userList = new UserDAL().GetAllUsersForLookUp();
                    dataGridViewLookUpData.DataSource = userList;
                }
                else if (LookUpType.Equals(CommonEnums.LookUps.subItem))
                {
                    subItemList = new SubItemDAL().GetAllSubItemsForLookUp();
                    dataGridViewLookUpData.DataSource = subItemList;

                }
                else if (LookUpType.Equals(CommonEnums.LookUps.role))
                {
                    roleList = new RoleDAL().GetRolesLookUp();
                    dataGridViewLookUpData.DataSource = roleList;

                }
                else if (LookUpType.Equals(CommonEnums.LookUps.screen))
                {
                    screenList = new ScreenDAL().LoadScreensForLookUp();
                    dataGridViewLookUpData.DataSource = screenList;

                }
                else if (LookUpType.Equals(CommonEnums.LookUps.invoice))
                {
                    invoiceList = new InvoiceDAL().LoadAllInvoicesForLookUp();
                    dataGridViewLookUpData.DataSource = invoiceList;

                }
                CellResize();
                PopulateCombo();

                if (!string.IsNullOrEmpty(InitialValue))
                {
                    textBoxValue.Text = InitialValue;
                    buttonFind_Click(null, null);
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #10
0
 private void textBoxItemNo_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.F1)
         {
             buttonItemLookUp_Click(null, null);
         }
         else if (e.KeyCode == Keys.Enter)
         {
             var item = new ItemDAL().GetItemByItemNo(textBoxItemNo.Text.Trim());
             ItemID = item.ItemID;
             FillItemByItemID(ItemID);
         }
         SaveKeysPresed(e);
     }
     catch
     {
         MessageBoxClass.ShowMessage(CommonMethods.GetError("U_007"), true);
     }
 }
Example #11
0
        private void FillItemByItemID(int id)
        {
            try
            {
                var item = new ItemDAL().GetItemByID(id);

                ItemID = id;
                ItemMeasuringUnit = item.MeasuringUnit;
                textBoxItemNo.Text = item.ItemSerial;
                textBoxItemDescription.Text = item.Description;
                //Get From the lookup method
                textBoxItemMesuringUnit.Text = new MeasuringUnitDAL().GetAllMeasuringUnitsForLookUp().Find(mu => mu.UnitID == ItemMeasuringUnit).UnitDescription;
                numericUpDownQtyAllocated.Value = 1;
            }
            catch
            {
                MessageBoxClass.ShowMessage(CommonMethods.GetError("U_007"), true);
            }
        }