Exemplo n.º 1
0
        private void BTN_OK_Click(object sender, EventArgs e)
        {
            string Account      = "";
            string Password     = "";
            string RealName     = "";
            string DistrictCode = "";
            string DistrictName = "";
            int    Type         = 0;

            if (!AddSimpleUsr())
            {
                return;
            }

            //判断重复
            if (DT_SimpleUser.DefaultView.ToTable(true, "Account").Rows.Count < DT_SimpleUser.Rows.Count)
            {
                MessageBox.Show("有重复账号,请重新录入");
                return;
            }
            for (int i = 0; i < DT_SimpleUser.Rows.Count; i++)
            {
                Account      = DT_SimpleUser.Rows[i]["Account"].ToString();
                Password     = DT_SimpleUser.Rows[i]["Password"].ToString();
                RealName     = DT_SimpleUser.Rows[i]["RealName"].ToString();
                DistrictCode = "";
                DistrictName = "";

                Type = int.Parse(DT_SimpleUser.Rows[i]["UsrType"].ToString());

                StartFinish.visitApi("SetUser?Account=" + Account + "&Password="******"&RealName=" + RealName + "&DistrictCode=" + DistrictCode + "&DistrictName=" + DistrictName + "&Type=" + Type + "&AddOrUpd=0");
            }
            MessageBox.Show("完成");
        }
Exemplo n.º 2
0
        private void Btn_Delete_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("确定要删除账号" + Dgv_SimpleUser.CurrentRow.Cells["Account"].Value.ToString() + "吗?", "删除", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                Dgv_SimpleUser.Rows.Remove(Dgv_SimpleUser.CurrentRow);
                DT_SimpleUser.Rows.Clear();

                StartFinish.visitApi("deleteUser?Account=" + Dgv_SimpleUser.CurrentRow.Cells["Account"].Value.ToString().Trim());
            }
        }