Пример #1
0
        private void G_Modify_BackgroundWorker(
          object sender,
          RunWorkerCompletedEventArgs e)
        {
            GoodsHandleNsTalk talk = new GoodsHandleNsTalk();
            string name = this.G_Name_tb.Text;
            string addr = this.G_Address_tb.Text;
            string price = this.G_Price_tb.Text;
            string style = this.G_Style_tb.Text;
            Protocol pro = talk.Update_User_Info(ClientInfo.session, name,addr,price,style);
            if (pro.protoType == ProtoType.SUCCESS)
            {
                if (parent != null)
                    parent.Update_View();
                this.Close();
            }
            else if (pro.protoType == ProtoType.OUT_OF_TIME)
            {
                MessageBox.Show("系统超时,请重新登录");

            }
            else if (pro.protoType == ProtoType.ERROR)
            {
                MessageBox.Show("获取信息错误,请重新获取");
            }
        }
Пример #2
0
        private void G_Add_BackgroundWorker(
           object sender,
           RunWorkerCompletedEventArgs e)
        {
            GoodsHandleNsTalk talk = new GoodsHandleNsTalk();
            string name = this.G_Name_tb.Text;
            string addr = this.G_Address_tb.Text;
            string price = this.G_Price_tb.Text;
            string s_name = this.G_Style_tb.Text;
            Protocol pro = talk.Add_User_info(ClientInfo.session,name,addr,price,s_name);
            if (pro.protoType == ProtoType.SUCCESS)
            {
                this.Close();
            }
            else if (pro.protoType == ProtoType.STYLE_EXISTS)
            {
                MessageBox.Show("货物信息已经存在,添加失败");
                this.G_Name_tb.Text = "";
                this.G_Address_tb.Text = "";
                this.G_Price_tb.Text = "";
                this.G_Style_tb.SelectedIndex = 1;
            }
            else if (pro.protoType == ProtoType.OUT_OF_TIME)
            {
                MessageBox.Show("系统超时,请重新登录");

            }
            else if (pro.protoType == ProtoType.ERROR)
            {
                MessageBox.Show("获取信息错误,请重新获取");
            }
        }
Пример #3
0
 public void Update_View()
 {
     GoodsHandleNsTalk talk = new GoodsHandleNsTalk();
     Protocol pro = talk.Get_All_User_Info(ClientInfo.session);
     if (pro.protoType == ProtoType.SUCCESS)
     {
         List<string> names = new List<string>();
         names.Add("货物名称");
         names.Add("货物产地");
         names.Add("货物价格");
         names.Add("货物类型");
         this.dataGridView1.DataSource = TableDataUtil.convertListListDataToDataTable(names, pro.data);
         if (isCanEdit)
         {
             foreach (DataGridViewRow row in this.dataGridView1.Rows)
             {
                 row.ContextMenuStrip = this.contextMenuStrip1;
             }
         }
     }
 }
Пример #4
0
        private void G_Delete_BackgroundWorker(
           object sender,
           RunWorkerCompletedEventArgs e)
        {
            GoodsHandleNsTalk talk = new GoodsHandleNsTalk();
            DataGridViewRow row = (DataGridViewRow)this.dataGridView1.SelectedRows[0];
            string name = (string)row.Cells[0].Value;
            Protocol pro = talk.Delete_User_Info(ClientInfo.session, name);
            if (pro.protoType == ProtoType.SUCCESS)
            {
                this.Update_View();
            }
            else if (pro.protoType == ProtoType.OUT_OF_TIME)
            {
                MessageBox.Show("系统超时,请重新登录");

            }
            else if (pro.protoType == ProtoType.ERROR)
            {
                MessageBox.Show("获取信息错误,请重新获取");
            }
        }
Пример #5
0
        private void Show_Goods_Frame(bool flag)
        {
            G_Show_Form form = new G_Show_Form(flag);
            GoodsHandleNsTalk talk = new GoodsHandleNsTalk();
            this.AddOwnedForm(form);
            form.Show();
            Protocol pro = talk.Get_All_User_Info(ClientInfo.session);
            if (pro.protoType == ProtoType.SUCCESS)
            {
                List<string> names = new List<string>();
                names.Add("货物名称");
                names.Add("货物产地");
                names.Add("货物价格");
                names.Add("货物类型");
                form.dataGridView1.DataSource = TableDataUtil.convertListListDataToDataTable(names, pro.data);
                if (flag)
                {
                    foreach (DataGridViewRow row in form.dataGridView1.Rows)
                    {
                        row.ContextMenuStrip = form.contextMenuStrip1;
                    }
                }

            }
            else if (pro.protoType == ProtoType.OUT_OF_TIME)
            {
                MessageBox.Show("系统超时,请重新登录");
                LoginForm lg = new LoginForm();
                lg.Show();
                this.Hide();
            }
            else if (pro.protoType == ProtoType.ERROR)
            {
                MessageBox.Show("获取信息错误,请重新获取");
            }
        }