コード例 #1
0
        private void saveToolStripButton_Click(object sender, EventArgs e)
        {
            //CommandSaveRotiList saveRoti = new CommandSaveRotiList(m_List);
            //m_AppController.ExecuteCommand(saveRoti);
            if (m_List == null)
            {
                return;
            }
            RotiToChooseItem changeItem = (RotiToChooseItem)bindingSource1.Current;

            if (changeItem == null)
            {
                return;
            }

            if (isNewRecord)
            {
                CommandInsertRoti newRoti = new CommandInsertRoti(changeItem);
                m_AppController.ExecuteCommand(newRoti);
            }
            else
            {
                CommandUpdateRoti updateRoti = new CommandUpdateRoti(changeItem);
                m_AppController.ExecuteCommand(updateRoti);
            }
        }
コード例 #2
0
        private void importBtn_Click(object sender, EventArgs e)
        {
            if (dataGridView1.DataSource == null)
            {
                return;
            }
            if (sourceTxt.Text == "" && sheetTxt.Text == "")
            {
                return;
            }

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                if (row.Cells[7].Value.ToString() != null)
                {
                    RotiToChooseItem myItem = new RotiToChooseItem();
                    myItem.ItemCode    = row.Cells[0].Value.ToString();
                    myItem.ItemName    = row.Cells[1].Value.ToString();
                    myItem.ItemSort    = row.Cells[2].Value.ToString();
                    myItem.Brand       = row.Cells[3].Value.ToString();
                    myItem.Jenis       = row.Cells[4].Value.ToString();
                    myItem.Category    = row.Cells[5].Value.ToString();
                    myItem.SubCategory = row.Cells[6].Value.ToString();
                    myItem.Price       = Convert.ToDecimal(row.Cells[7].Value);

                    CommandInsertRoti importData = new CommandInsertRoti(myItem);
                    m_AppController.ExecuteCommand(importData);
                }
            }
        }