示例#1
0
        private void bbiAddBulk_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            dlg.AddListDlg dlgFrm = new dlg.AddListDlg("You must enter City:Short:Region");
            if (dlgFrm.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            int EffectedData = 0;

            foreach (string item in dlgFrm.ItemList)
            {
                try
                {
                    string[] cells = item.Split(':');
                    if (cells.Length < 2)
                    {
                        MessageBox.Show("Wrong data formate" + Environment.NewLine + "You must enter City:Short:Region", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    EffectedData += cityTableAdapter.Insert(cells[0], cells[1], cells[2]);
                }
                catch { }
            }
            LoadData();
            MessageBox.Show("Data added :" + EffectedData, "data saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#2
0
        private void bbiAddBulk_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            dlg.AddListDlg dlgFrm = new dlg.AddListDlg("You must enter Catogry followed by Enter");
            if (dlgFrm.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            int EffectedData = 0;

            foreach (string item in dlgFrm.ItemList)
            {
                try
                {
                    EffectedData += categoryItemTableAdapter.Insert(item);
                }
                catch { }
            }
            LoadData();
            MessageBox.Show("Data added :" + EffectedData, "data saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }