public DailyItemsClass()
 {
     clsServiceItems = new ServiceItems(CCFBGlobal.connectionString);
     clsServiceItems.openWhere("");
     svcItemsFood        = new List <ServiceItem>();
     svcItemsNonFood     = new List <ServiceItem>();
     svcItemsBabyService = new List <ServiceItem>();
 }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int itemKey = Convert.ToInt32(lvServiceItems.SelectedItems[0].SubItems[3].Text);
            int iResult = clsSvcItems.ItemUsedRecently(itemKey);

            if (iResult > 0)
            {
                if (MessageBox.Show(this, "ItemKey = " + itemKey.ToString() + " has " + iResult.ToString() + " Service Transactions logged .\r\n"
                                    + "Press Ok to Mark as Not Available.\r\n"
                                    + "Press Cancel to do nothing.", "Delete Service Item", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                {
                    chkNotAvailable.Checked = true;
                }
            }
            else
            {
                clsSvcItems.delete(itemKey);
                CCFBGlobal.ServiceItemsChanged = true;
                clsSvcItems.openWhere("");
                loadList("", false);

                if (lvServiceItems.Items.Count > 0)
                {
                    lvServiceItems.Items[0].Selected = true;
                }
                else
                {
                    foreach (TextBox tb in tbList)
                    {
                        tb.Text = "";
                    }

                    cboRules.Text         = "";
                    cboType.SelectedIndex = 0;
                }
            }
        }
Example #3
0
        public YearlyForm()
        {
            InitializeComponent();
            foreach (ComboBox cb in tabPage2.Controls.OfType <ComboBox>())
            {
                cbList.Add(cb);
            }
            ServiceItems clsServiceItems = new ServiceItems(CCFBGlobal.connectionString);

            clsServiceItems.openWhere("ItemRule = " + CCFBGlobal.itemRule_SpecialService.ToString());
            lvwSpclFood.Items.Clear();
            ListViewItem lvwItm;

            for (int i = 0; i < clsServiceItems.DSet.Tables[0].Rows.Count; i++)
            {
                lvwItm      = new ListViewItem();
                lvwItm.Text = clsServiceItems.DSet.Tables[0].Rows[i]["ItemDesc"].ToString();
                lvwItm.SubItems.Add(clsServiceItems.DSet.Tables[0].Rows[i]["ItemKey"].ToString());
                lvwSpclFood.Items.Add(lvwItm);
            }
            CurrentFiscalStart = CCFBGlobal.CurrentFiscalStartDate();
            CurrentFiscalEnd   = CCFBGlobal.CurrentFiscalEndDate();
            SetCalendarRange(CurrentFiscalStart, CurrentFiscalEnd);
        }
        public void Refresh(bool bAllowAll)
        {
            bool allowThisItem = false;
            bool isNonFoodItem = false;
            bool isBabyItem    = false;

            svcItemsFood.Clear();
            svcItemsNonFood.Clear();
            svcItemsBabyService.Clear();
            clsServiceItems.openWhere("NotAvailable = 0");
            foreach (DataRow drow in clsServiceItems.DSet.Tables[0].Rows)
            {
                isNonFoodItem = false;
                isBabyItem    = false;
                switch (Int32.Parse(drow["ItemType"].ToString()))
                {
                case CCFBGlobal.svcCat_Commodity:
                {
                    if (bAllowAll == true)
                    {
                        allowThisItem = true;
                    }
                    else
                    {
                        if (CCFBPrefs.MustBeACommodityDay == true)
                        {
                            allowThisItem = isCommodityDay;
                        }
                        else
                        {
                            allowThisItem = true;
                        }
                    }
                    break;
                }

                case CCFBGlobal.svcCat_NonFood:
                {
                    allowThisItem = true;
                    isNonFoodItem = true;
                    break;
                }

                case CCFBGlobal.svcCat_BabySvc:
                {
                    allowThisItem = true;
                    isBabyItem    = true;
                    break;
                }

                default:
                {
                    allowThisItem = true;
                    break;
                }
                }
                if (allowThisItem)
                {
                    switch (Convert.ToInt32(drow["ItemRule"]))
                    {
                    case CCFBGlobal.itemRule_SpecialService:
                    {
                        if (IsOnSpecialServiceList(drow["ItemKey"].ToString()))
                        {           //If not a non-food item
                            if (isNonFoodItem == true)
                            {
                                addItem(drow, svcItemsNonFood);
                            }
                            else if (isBabyItem == true)
                            {
                                addItem(drow, svcItemsBabyService);
                            }
                            else
                            {
                                addItem(drow, svcItemsFood);
                            }
                        }
                        break;
                    }

                    default:
                    {           //If not a non-food item
                        if (isNonFoodItem)
                        {
                            addItem(drow, svcItemsNonFood);
                        }
                        else if (isBabyItem == true)
                        {
                            addItem(drow, svcItemsBabyService);
                        }
                        else
                        {
                            addItem(drow, svcItemsFood);
                        }
                        break;
                    }
                    }
                }
            }
            CCFBGlobal.ServiceItemsChanged = false;
        }