예제 #1
0
        /// <summary>
        /// 更新客户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button3_Click(object sender, EventArgs e)
        {
            ExtractInventoryTool_Client       client        = null;
            DataGridViewSelectedRowCollection rowCollection = dataGridView1.SelectedRows;
            DataGridViewRow row = null;

            if (rowCollection.Count != 1)
            {
                MessageBox.Show("只能选中一条记录进行更新", "Warning");
                return;
            }
            row = rowCollection[0];
            if (row != null && row.Cells[0].Value != null)
            {
                client = new ExtractInventoryTool_Client();
                int oid = 0;
                client.Oid        = int.TryParse(row.Cells[0].Value.ToString().Trim(), out oid) ? oid : 0;
                client.Name       = row.Cells[1].Value.ToString().Trim();
                client.UniqueCode = row.Cells[2].Value.ToString().Trim();
                client.Remark     = row.Cells[3].Value.ToString().Trim();
                client.RegexRule  = row.Cells[4].Value.ToString().Trim();
            }
            Form_ClientEditor editor = new Form_ClientEditor(client);

            editor.ShowDialog(this);
            if (editor.DialogResult == DialogResult.OK)
            {
                string limit  = pagerControl1.PageSize.ToString();
                string offset = (pagerControl1.PageIndex - 1).ToString();
                Task.Run(() => QueryClient(limit, offset));
            }
            return;
        }
예제 #2
0
        /// <summary>
        /// 新增客户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            Form_ClientEditor editor = new Form_ClientEditor(null);

            editor.ShowDialog(this);
            if (editor.DialogResult == DialogResult.OK)
            {
                string limit  = pagerControl1.PageSize.ToString();
                string offset = (pagerControl1.PageIndex - 1).ToString();
                Task.Run(() => QueryClient(limit, offset));
            }
            return;
        }