Ejemplo n.º 1
0
        private void D_Modify_BackgroundWorker(
          object sender,
          RunWorkerCompletedEventArgs e)
        {
            DepotHandleNsTalk talk = new DepotHandleNsTalk();
            string id = this.hid;
            string name = this.textBox1.Text;

            Protocol pro = talk.Update_Depot(ClientInfo.session,id,name);
            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("获取信息错误,请重新获取");
            }
        }
Ejemplo n.º 2
0
 public void Update_View()
 {
     DepotHandleNsTalk talk = new DepotHandleNsTalk();
     Protocol pro = talk.Get_All_Depot(ClientInfo.session);
     if (pro.protoType == ProtoType.SUCCESS)
     {
         List<string> names = new List<string>();
         names.Add("ID");
         names.Add("仓库名称");
         this.dataGridView1.DataSource = TableDataUtil.convertListListDataToDataTable(names, pro.data);
         if (isCanEdit)
         {
             foreach (DataGridViewRow row in this.dataGridView1.Rows)
             {
                 row.ContextMenuStrip = this.contextMenuStrip1;
             }
         }
     }
 }
Ejemplo n.º 3
0
        private void D_Delete_BackgroundWorker(
          object sender,
          RunWorkerCompletedEventArgs e)
        {
            DepotHandleNsTalk talk = new DepotHandleNsTalk();
            DataGridViewRow row = (DataGridViewRow)this.dataGridView1.SelectedRows[0];
            string id = (string)row.Cells[0].Value;
            Protocol pro = talk.Delete_Depot(ClientInfo.session, id);
            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("获取信息错误,请重新获取");
            }
        }
Ejemplo n.º 4
0
 private void H_Add_BackgroundWorker(
    object sender,
    RunWorkerCompletedEventArgs e)
 {
     DepotHandleNsTalk talk = new DepotHandleNsTalk();
     Protocol pro = talk.Add_Depot(ClientInfo.session,this.textBox1.Text);
     if (pro.protoType == ProtoType.SUCCESS)
     {
         this.Close();
     }
     else if (pro.protoType == ProtoType.EXISTS)
     {
         MessageBox.Show("仓库信息已经存在");
     }
     else if (pro.protoType == ProtoType.OUT_OF_TIME)
     {
         MessageBox.Show("系统超时,请重新登录");
     }
     else if (pro.protoType == ProtoType.ERROR)
     {
         MessageBox.Show("获取信息错误,请重新获取");
     }
 }
Ejemplo n.º 5
0
        private void Show_Depot_Frame(bool isCanEdit)
        {
            D_Show_Form form = new D_Show_Form(isCanEdit);
            DepotHandleNsTalk talk = new DepotHandleNsTalk();
            this.AddOwnedForm(form);
            form.Show();
            Protocol pro = talk.Get_All_Depot(ClientInfo.session);
            if (pro.protoType == ProtoType.SUCCESS)
            {
                List<string> names = new List<string>();
                names.Add("ID");
                names.Add("仓库名称");
                form.dataGridView1.DataSource = TableDataUtil.convertListListDataToDataTable(names, pro.data);
                if (isCanEdit)
                {
                    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("获取信息错误,请重新获取");
            }
        }