Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            User user = new User();

            user.name = textBox1.Text;
            user.pwd  = textBox2.Text;
            string str    = JsonConvert.SerializeObject(user);     //转为字符串
            string strRes = HttpHelp.PostJson(@"/api/User/Login", str);

            if (string.IsNullOrEmpty(strRes))
            {
                MessageBox.Show("网络请求有误,请重试!");
            }
            else
            {
                Res res = JsonConvert.DeserializeObject <Res>(strRes);
                MessageBox.Show(res.msg);
                if (res.code == 1)
                {
                    FrmMain frmMain = new FrmMain(this, user.name);
                    frmMain.Show();
                    this.Hide();
                }
            }
        }
Exemplo n.º 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            //如果没记录则不处理
            if (dataGridView1.RowCount <= 0)
            {
                return;
            }
            if ((dataGridView1.SelectedRows[0].Cells[0].Value) == null)
            {
                return;
            }
            Id id = new Id();

            id.id = long.Parse(dataGridView1.SelectedRows[0].Cells["id"].Value.ToString());
            string str    = JsonConvert.SerializeObject(id);     //转为字符串
            string strRes = HttpHelp.PostJson(@"/api/Goods/Del", str);

            if (string.IsNullOrEmpty(strRes))
            {
                MessageBox.Show("网络请求有误,请重试!");
            }
            else
            {
                Res res = JsonConvert.DeserializeObject <Res>(strRes);
                MessageBox.Show(res.msg);
                if (res.code == 1)
                {
                    //查询最新的数据
                    query();
                }
            }
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string newpwd2 = string.Empty;

            newpwd2 = t_newpwd2.Text;
            UserPwd user = new UserPwd();

            user.name   = name;
            user.oldpwd = t_oldpwd.Text;
            user.newpwd = t_newpwd.Text;
            if (string.IsNullOrEmpty(user.oldpwd) || string.IsNullOrEmpty(user.newpwd) || string.IsNullOrEmpty(newpwd2))
            {
                MessageBox.Show("所有项目必须输入");
                return;
            }
            else if (!user.newpwd.Equals(newpwd2))
            {
                MessageBox.Show("新密码和再次确认密码不一致");
                return;
            }
            string str    = JsonConvert.SerializeObject(user);     //转为字符串
            string strRes = HttpHelp.PostJson(@"/api/User/ModPwd", str);

            if (string.IsNullOrEmpty(strRes))
            {
                MessageBox.Show("网络请求有误,请重试!");
            }
            else
            {
                Res res = JsonConvert.DeserializeObject <Res>(strRes);
                MessageBox.Show(res.msg);
            }
        }
Exemplo n.º 4
0
        private void mod()
        {
            GoodsId goods = new GoodsId();

            goods.id            = _goods.id;
            goods.goods         = t_goods.Text;
            goods.describe      = t_describe.Text;
            goods.collect_addr  = t_collect_addr.Text;
            goods.collect_date  = dateTimePicker1.Value.Date;
            goods.contact_man   = t_contact_man.Text;
            goods.contact_phone = t_contact_phone.Text;
            goods.contact_email = t_contact_email.Text;
            string str    = JsonConvert.SerializeObject(goods);     //转为字符串
            string strRes = HttpHelp.PostJson(@"/api/Goods/Mod", str);

            if (string.IsNullOrEmpty(strRes))
            {
                MessageBox.Show("网络请求有误,请重试!");
            }
            else
            {
                Res res = JsonConvert.DeserializeObject <Res>(strRes);
                MessageBox.Show(res.msg);
                if (res.code == 1)
                {
                    this.Close();
                }
            }
        }
Exemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            User user = new User();

            user.name     = textBox1.Text;
            user.nikename = textBox3.Text;
            user.pwd      = textBox2.Text;
            string str    = JsonConvert.SerializeObject(user);     //转为字符串
            string strRes = HttpHelp.PostJson(@"/api/User/Register", str);

            if (string.IsNullOrEmpty(strRes))
            {
                MessageBox.Show("网络请求有误,请重试!");
            }
            else
            {
                Res res = JsonConvert.DeserializeObject <Res>(strRes);
                MessageBox.Show(res.msg);
            }
        }