private void button4_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text))
            {
                MessageBox.Show("备注不能为空!");
                textBox1.Focus();
                return;
            }
            int index = dataGridView1.CurrentRow.Index; //获取选中行的行号
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("id", dataGridView1.Rows[index].Cells[0].Value.ToString());
            parameters.Add("mark", textBox1.Text);
            YouGeWebApi yg = new YouGeWebApi();

            if (yg.UpdateYijian(parameters))
            {
                MessageBox.Show("添加备注成功!");
                LoadYijian();
            }
            else
            {
                MessageBox.Show("添加备注失败!");
            }
            textBox1.Enabled = false;
        }
示例#2
0
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            YouGeWebApi   yg       = new YouGeWebApi();
            List <string> username = new List <string>();

            username = yg.GetOnlineUser();
            listBox1.Items.Clear();
            foreach (string n in username)
            {
                listBox1.Items.Add(n);
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            YouGeWebApi yg = new YouGeWebApi();

            if (yg.ResetReviewBookInfo())
            {
                MessageBox.Show("重置成功");
            }
            else
            {
                MessageBox.Show("重置失败");
            }
        }
示例#4
0
            public void ThreadProc()
            {
                DBOperation dbo = new DBOperation();
                YouGeWebApi ygw = new YouGeWebApi();

                if (string.IsNullOrEmpty(_book_id))
                {
                    throw new Exception("book_id is null!");
                }
                if (string.IsNullOrEmpty(_price))
                {
                    throw new Exception("price is null!");
                }
                //判断本地是否有相同book_id和price的交易记录,如果有就全部同步成一个mallid,不要再上报给喵校园主库
                string sql = string.Format("SELECT tt_bookinfo.id,tt_sellinfo.mallid FROM tt_bookinfo ,tt_sellinfo WHERE tt_bookinfo.id " +
                                           "= tt_sellinfo.bookid AND tt_bookinfo.gbookid ='{0}' AND ABS(tt_sellinfo.price- {1}) < 1e-5  AND tt_sellinfo.mallid IS NOT NULL",
                                           _book_id, _price);
                DataTable dt = dbo.Selectinfo(sql);

                //如果有,则直接全部更新一次mallid,不用上报给喵校园主库
                if (dt.Rows.Count > 0)
                {
                    sql = string.Format("UPDATE tt_sellinfo SET mallid = '{0}' WHERE bookid = '{1}' AND ABS(price- {2}) < 1e-5",
                                        dt.Rows[0]["mallid"].ToString(), dt.Rows[0]["id"].ToString(), _price);
                    dbo.AddDelUpdate(sql);
                    return;
                }
                //如果没有,则添加到喵校园主库,返回交易ID后,同步到每一条符合条件的交易中
                string sellinfoid;//喵校园交易ID
                IDictionary <string, string> parameters = new Dictionary <string, string>();

                parameters.Add("book_id", _book_id);
                parameters.Add("price", _price);
                parameters.Add("seller_id", Properties.Settings.Default.sellerid);
                if (ygw.InsertNewSellInfo(parameters, out sellinfoid))
                {
                    sql = string.Format("UPDATE tt_sellinfo SET mallid = '{0}' WHERE bookid = '{1}' AND ABS(price- {2}) < 1e-5",
                                        sellinfoid, _local_book_id, _price);
                    dbo.AddDelUpdate(sql);
                    MessageBox.Show("执行完成");
                    return;
                }
                else
                {
                    MyOperation.DebugPrint("Insert Error!", 3);
                    throw new Exception("Insert Error!");
                }
            }
示例#5
0
        private void login()
        {
            if (string.IsNullOrEmpty(tb_username.Text))
            {
                MessageBox.Show("请输入用户名");
                tb_username.Focus();
                return;
            }
            if (string.IsNullOrEmpty(textBox1.Text))
            {
                MessageBox.Show("请输入密码");
                textBox1.Focus();
                return;
            }

            YouGeWebApi yg = new YouGeWebApi();
            JObject     userinfo;

            if (yg.UserAccess(tb_username.Text, textBox1.Text, out userinfo))
            {
                try
                {
                    GlobalVar.name     = userinfo["data"]["realname"].ToString();
                    GlobalVar.id       = userinfo["data"]["id"].ToString();
                    GlobalVar.username = userinfo["data"]["username"].ToString();
                    GlobalVar.email    = userinfo["data"]["email"].ToString();
                    GlobalVar.tel      = userinfo["data"]["tel"].ToString();
                    GlobalVar.group    = userinfo["data"]["group"].ToString();
                    GlobalVar.lasttime = userinfo["data"]["lasttime"].ToString();
                    this.Hide();
                    主页面 formmain = new 主页面();
                    formmain.Show();
                }
                catch (Exception ex)
                {
                    GlobalVar.ClearAll();
                    MessageBox.Show("UserAccess:解析返回的userinfo时出现了异常" + ex.Message);
                    return;
                }
            }
            else
            {
                MessageBox.Show("用户名或者密码错误");
                return;
            }
        }
        private void LoadYijian()
        {
            JObject     jo;
            YouGeWebApi yg = new YouGeWebApi();

            try
            {
                if (yg.GetYijian(out jo))
                {
                    int i = 0;
                    gdt.Rows.Clear();
                    while (!string.IsNullOrEmpty(jo["data"][i]["id"].ToString()))
                    {
                        DataRow dr = gdt.NewRow();
                        dr["id"]      = Convert.ToInt32(jo["data"][i]["id"].ToString());
                        dr["content"] = jo["data"][i]["content"].ToString();
                        dr["time"]    = MyOperation.Unix2Datetime(jo["data"][i]["time"].ToString());
                        dr["status"]  = jo["data"][i]["status"].ToString();
                        dr["staff"]   = jo["data"][i]["staff"].ToString();
                        if (string.IsNullOrEmpty(jo["data"][i]["stime"].ToString()))
                        {
                            dr["stime"] = jo["data"][i]["stime"].ToString();
                        }
                        else
                        {
                            dr["stime"] = MyOperation.Unix2Datetime(jo["data"][i]["stime"].ToString());
                        }
                        dr["mark"] = jo["data"][i]["mark"].ToString();
                        gdt.Rows.Add(dr);
                        i++;
                    }
                }
                else
                {
                    MessageBox.Show("初始化意见列表失败");
                }
            }
            catch (Exception e)
            {
                MyOperation.DebugPrint("LoadYijian出现catch异常:" + e.Message);
            }
            finally
            {
                dataGridView1.DataSource = gdt.DefaultView;
            }
        }
示例#7
0
            public void ThreadProc()
            {
                DBOperation     dbo = new DBOperation();
                YouGeWebApi     yg  = new YouGeWebApi();
                YouGeWinformApi ygw = new YouGeWinformApi();

                if (string.IsNullOrEmpty(_local_book_id))
                {
                    throw new Exception("local_book_id is null!");
                }
                string sql = string.Format("SELECT b.gbookid,b.id,o.mallid FROM yg_oldbookdetail AS o ,yg_bookinfo AS b " +
                                           " WHERE o.bookid = b.id AND o.bookid = '{0}' AND ABS(o.price-{1}) < 1e-5 AND " +
                                           "o.mallid IS NOT NULL", _local_book_id, _price);
                DataTable dt = dbo.Selectinfo(sql);

                if (dt.Rows.Count > 0)
                {
                    //说明已经有相同图书ID以及价格的交易信息,直接把mallid同步过来
                    sql = string.Format("UPDATE yg_oldbookdetail SET mallid = '{0}' WHERE bookid = '{1}'  AND ABS(price- {2}) < 1e-5 ", dt.Rows[0]["mallid"].ToString(), _local_book_id, _price);
                    dbo.AddDelUpdate(sql);
                    MyOperation.DebugPrint("本地已经有相同交易信息");
                    return;
                }
                sql = string.Format("SELECT b.gbookid,b.id,o.mallid FROM yg_oldbookdetail AS o ,yg_bookinfo AS b " +
                                    " WHERE o.bookid = b.id AND o.bookid = '{0}' AND ABS(o.price-{1}) < 1e-5", _local_book_id, _price);
                dt = dbo.Selectinfo(sql);
                //如果没有,则添加到喵校园主库,返回交易ID后,同步到每一条符合条件的交易中
                IDictionary <string, string> parameters = new Dictionary <string, string>();

                parameters.Add("book_id", dt.Rows[0]["gbookid"].ToString());
                parameters.Add("seller_id", ygw.GetLocalShopId());
                parameters.Add("price", _price);
                string gsellinfoid;//喵校园交易ID

                if (yg.InsertNewSellInfo(parameters, out gsellinfoid))
                {
                    sql = string.Format("UPDATE yg_oldbookdetail SET mallid = '{0}' WHERE bookid = '{1}'  AND ABS(price- {2}) < 1e-5 ", gsellinfoid, _local_book_id, _price);
                    dbo.AddDelUpdate(sql);
                }
                else
                {
                    MyOperation.DebugPrint("Insert Error!", 3);
                    throw new Exception("Insert Error!");
                }
            }
        private void button3_Click(object sender, EventArgs e)
        {
            int index = dataGridView1.CurrentRow.Index; //获取选中行的行号
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("id", dataGridView1.Rows[index].Cells[0].Value.ToString());
            parameters.Add("status", "已完成");
            YouGeWebApi yg = new YouGeWebApi();

            if (yg.UpdateYijian(parameters))
            {
                MessageBox.Show("操作成功!");
                LoadYijian();
            }
            else
            {
                MessageBox.Show("操作失败!");
            }
            textBox1.Enabled = false;
        }
        private void button2_Click(object sender, EventArgs e)
        {
            int index = dataGridView1.CurrentRow.Index; //获取选中行的行号
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("id", dataGridView1.Rows[index].Cells[0].Value.ToString());
            parameters.Add("staff", GlobalVar.name);
            parameters.Add("status", "处理中");
            parameters.Add("stime", MyOperation.Datetime2Unix(DateTime.Now.ToString()));
            YouGeWebApi yg = new YouGeWebApi();

            if (yg.UpdateYijian(parameters))
            {
                MessageBox.Show("接单成功!");
                LoadYijian();
            }
            else
            {
                MessageBox.Show("接单失败!");
            }
        }
示例#10
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tb_username.Text))
            {
                MessageBox.Show("请输入用户名");
                tb_username.Focus();
                return;
            }

            if (string.IsNullOrEmpty(textBox1.Text))
            {
                MessageBox.Show("请输入密码");
                textBox1.Focus();
                return;
            }

            if (string.IsNullOrEmpty(textBox2.Text))
            {
                MessageBox.Show("请再次输入密码");
                textBox2.Focus();
                return;
            }

            if (string.IsNullOrEmpty(textBox3.Text))
            {
                MessageBox.Show("请输入姓名");
                textBox3.Focus();
                return;
            }

            if (string.IsNullOrEmpty(textBox4.Text))
            {
                MessageBox.Show("请输入邮箱");
                textBox4.Focus();
                return;
            }

            if (string.IsNullOrEmpty(textBox5.Text))
            {
                MessageBox.Show("请输入手机");
                textBox5.Focus();
                return;
            }

            if (textBox1.Text != textBox2.Text)
            {
                MessageBox.Show("两次输入的密码不一致");
                textBox2.Focus();
                return;
            }
            //开始注册

            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("type", "new");
            parameters.Add("username", tb_username.Text);
            parameters.Add("password", textBox2.Text);
            parameters.Add("realname", textBox3.Text);
            parameters.Add("email", textBox4.Text);
            parameters.Add("tel", textBox5.Text);
            YouGeWebApi yg = new YouGeWebApi();

            if (0 == yg.Register(parameters))
            {
                MessageBox.Show("注册成功!请登陆");
                this.Dispose();
            }
            else if (2 == yg.Register(parameters))
            {
                MessageBox.Show("用户名重复,请更换用户名!");
            }
            else
            {
                MessageBox.Show("注册失败!");
            }
        }
示例#11
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tb_bookname.Text))
            {
                MessageBox.Show("请输入书名");
                tb_bookname.Focus();
                return;
            }

            if (string.IsNullOrEmpty(textBox1.Text))
            {
                MessageBox.Show("请输入作者");
                textBox1.Focus();
                return;
            }

            if (string.IsNullOrEmpty(textBox2.Text))
            {
                MessageBox.Show("请再次输入出版社");
                textBox2.Focus();
                return;
            }

            if (string.IsNullOrEmpty(textBox3.Text))
            {
                MessageBox.Show("请输入定价");
                textBox3.Focus();
                return;
            }

            if (string.IsNullOrEmpty(textBox4.Text))
            {
                MessageBox.Show("请输入图片路径");
                textBox4.Focus();
                return;
            }

            if (string.IsNullOrEmpty(textBox5.Text))
            {
                MessageBox.Show("请输入ISBN");
                textBox5.Focus();
                return;
            }
            IDictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("id", bookid);
            parameters.Add("name", tb_bookname.Text);
            parameters.Add("author", textBox1.Text);
            parameters.Add("press", textBox3.Text);
            parameters.Add("fixedPrice", textBox2.Text);
            parameters.Add("isbn", textBox5.Text);
            parameters.Add("imgpath", textBox4.Text);
            YouGeWebApi yg = new YouGeWebApi();

            if (yg.PostReviewBookInfo(parameters))
            {
                MessageBox.Show("修改成功!");
                LoadBookInfo();
            }
            else
            {
                MessageBox.Show("修改失败!");
            }
        }
示例#12
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            YouGeWebApi yg = new YouGeWebApi();

            yg.UpdateUserStatus(GlobalVar.id, GlobalVar.name);
        }