Esempio n. 1
0
        private void OpenFileToolStripMenuItemClick(object sender, EventArgs e) // TODO: use thread
        {
            selectPathCommand = new SelectReadFileCommand(receiver, this);
            invoker.SetCommand(selectPathCommand, "");
            invoker.Run();

            FilePath = selectPathCommand.Path;

            invoker.SetCommand(readFileCommand, FilePath);
            invoker.Run();

            if (null != readFileCommand.AllDateValue)
            {
                foreach (KeyValuePair <string, double> entry in readFileCommand.AllDateValue.ToArray())
                {
                    string command = CommandEncoder(true, entry.Key, entry.Value.ToString());
                    invoker.SetCommand(modifyDateTableAndPriceCommand, command);
                    invoker.Run();
                }
            }

            if (null != readFileCommand.AllItemValue)
            {
                foreach (KeyValuePair <string, double> entry in readFileCommand.AllItemValue.ToArray())
                {
                    string command = CommandEncoder(true, entry.Key, entry.Value.ToString());
                    invoker.SetCommand(modifyItemTableNameAndPriceCommand, command);
                    invoker.Run();
                }
            }

            invoker.SetCommand(modifyTotalCommand, "");
            invoker.Run();
        }
Esempio n. 2
0
        private void ButtonCheckSaveToExcelClick(object sender, EventArgs e) // TODO: use thread
        {
            selectPathCommand = new SaveExecelFileCommand(receiver, this);
            invoker.SetCommand(selectPathCommand, "");
            invoker.Run();

            invoker.SetCommand(saveToExcelCommand, selectPathCommand.Path);
            invoker.Run();
        }
Esempio n. 3
0
 private void SaveFileToolStripMenuItemClick(object sender, EventArgs e)
 {
     selectPathCommand = new SaveFileCommand(receiver, this);
     invoker.SetCommand(selectPathCommand, "");
     invoker.Run();
     FilePath = selectPathCommand.Path;
     invoker.SetCommand(saveAllCommand, FilePath);
     invoker.Run();
 }
Esempio n. 4
0
        private void ButtonSaveFileClick(object sender, EventArgs e)
        {
            if ("" == FilePath)
            {
                selectPathCommand = new SaveFileCommand(receiver, this);
                invoker.SetCommand(selectPathCommand, "");
                invoker.Run();
                FilePath = selectPathCommand.Path;
            }

            invoker.SetCommand(saveAllCommand, FilePath);
            invoker.Run();
        }
Esempio n. 5
0
        public FormMain()
        {
            InitializeComponent();

            invoker  = new AccountingInvoker();
            receiver = new InfoAccountingReceiver();

            modifyDateCommnad                  = new ModifyDateNameCommand(receiver, this);
            modifyDatePriceCommand             = new ModifyDatePriceCommand(receiver, this);
            modifyDateTableAndPriceCommand     = new ModifyDateTableAndPriceCommand(receiver, this);
            modifyItemNameCommand              = new ModifyItemNameCommand(receiver, this);
            modifyItemPriceCommand             = new ModifyItemPriceCommand(receiver, this);
            modifyItemTableNameAndPriceCommand = new ModifyItemTableNameAndPriceCommand(receiver, this);
            modifyTotalCommand                 = new ModifyTotalCommand(receiver, this);
            getDateMoneyCommand                = new GetDateMoneyCommand(receiver, this);
            getItemMoneyCommnad                = new GetItemMoneyCommnad(receiver, this);
            deleteItemCommand                  = new DeleteItemCommand(receiver, this);
            selectPathCommand                  = new SelectPathCommand(receiver, this);
            saveAllCommand     = new SaveAllCommand(receiver, this);
            readFileCommand    = new ReadFileCommand(receiver, this);
            saveToExcelCommand = new SaveToExcelCommand(receiver, this);

            AccountingInvoker.ShowDialogEvent += SetDialogShow;

            label_Choose_Date.Text = MyMonthCalendar.TodayDate.ToString("yyyy/M/d");

            MyListView.GridLines     = true;
            MyListView.FullRowSelect = true;

            MyListView.View        = View.Details;
            MyListView.Scrollable  = true;
            MyListView.MultiSelect = false;

            MyListView.Columns.Add("Additional Item", 150, HorizontalAlignment.Center);
            MyListView.Columns.Add("Price", 50, HorizontalAlignment.Center);
        }