private void G_Menu_Add_BackgroundWorkder( object sender, RunWorkerCompletedEventArgs e) { G_Add_Form form = new G_Add_Form(); StyleHandleNsTalk talk = new StyleHandleNsTalk(); Protocol pro = talk.Get_All_Style(ClientInfo.session); if (pro.protoType == ProtoType.SUCCESS) { List<string> dataSource = new List<string>(); List<List<string>> data = pro.data; foreach (List<string> list in data) { dataSource.Add(list[1]); } form.G_Style_tb.DataSource = dataSource; this.AddOwnedForm(form); form.Show(); } 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("获取信息错误,请重新获取"); } }
private void S_Add_BackgroundWorker( object sender, RunWorkerCompletedEventArgs e) { StyleHandleNsTalk talk = new StyleHandleNsTalk(); Protocol pro = talk.Add_Style(ClientInfo.session, this.textBox1.Text); if (pro.protoType == ProtoType.SUCCESS) { this.Close(); } else if (pro.protoType == ProtoType.STYLE_EXISTS) { MessageBox.Show("用户名已经存在,添加失败"); this.textBox1.Text = ""; } else if (pro.protoType == ProtoType.OUT_OF_TIME) { MessageBox.Show("系统超时,请重新登录"); } else if (pro.protoType == ProtoType.ERROR) { MessageBox.Show("获取信息错误,请重新获取"); } }
public void updateData() { StyleHandleNsTalk talk = new StyleHandleNsTalk(); Protocol pro = talk.Get_All_Style(ClientInfo.session); if (pro.protoType == ProtoType.SUCCESS) { List<string> columnName = new List<string>(); columnName.Add("ID"); columnName.Add("货物类型"); this.dataGridView1.DataSource = TableDataUtil.convertListListDataToDataTable(columnName, pro.data); if (isCanEdit) { foreach (DataGridViewRow row in this.dataGridView1.Rows) { row.ContextMenuStrip = this.contextMenuStrip1; } } } }
private void S_Modify_BackgroundWorker( object sender, RunWorkerCompletedEventArgs e) { StyleHandleNsTalk talk = new StyleHandleNsTalk(); Protocol pro=talk.Update_Style(ClientInfo.session, s_id, this.textBox1.Text); if (pro.protoType == ProtoType.SUCCESS) { if (parent != null) parent.updateData(); this.Close(); } else if (pro.protoType == ProtoType.OUT_OF_TIME) { MessageBox.Show("系统超时,请重新登录"); } else if (pro.protoType == ProtoType.ERROR) { MessageBox.Show("获取信息错误,请重新获取"); } }
private void DeleteToolStripMenuItem_Click(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count > 0) { DataGridViewRow row = (DataGridViewRow)this.dataGridView1.SelectedRows[0]; string id = (string)row.Cells[0].Value; StyleHandleNsTalk talk = new StyleHandleNsTalk(); Protocol pro = talk.Delete_Style(ClientInfo.session, id); if (pro.protoType == ProtoType.SUCCESS) { this.updateData(); } else if (pro.protoType == ProtoType.OUT_OF_TIME) { MessageBox.Show("系统超时,请重新登录"); } else if (pro.protoType == ProtoType.ERROR) { MessageBox.Show("获取信息错误,请重新获取"); } } }
private void G_Modify_BackgroundWorker( object sender, RunWorkerCompletedEventArgs e) { StyleHandleNsTalk talk = new StyleHandleNsTalk(); Protocol pro = talk.Get_All_Style(ClientInfo.session); //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) { G_Modify_Form form = new G_Modify_Form(this); List<string> names = new List<string>(); if(pro.data!=null) { foreach(List<string> name in pro.data){ names.Add(name[1]); } } form.G_Style_tb.DataSource = names; form.G_Name_tb.Text = (string)row.Cells[0].Value; form.G_Address_tb.Text = (string)row.Cells[1].Value; form.G_Price_tb.Text = (string)row.Cells[2].Value; this.AddOwnedForm(form); form.Show(); } else if (pro.protoType == ProtoType.OUT_OF_TIME) { MessageBox.Show("系统超时,请重新登录"); } else if (pro.protoType == ProtoType.ERROR) { MessageBox.Show("获取信息错误,请重新获取"); } }
private void Show_Style_Frame(bool flag) { StyleHandleNsTalk talk = new StyleHandleNsTalk(); Protocol pro = talk.Get_All_Style(ClientInfo.session); if (pro.protoType == ProtoType.SUCCESS) { S_Show_Form show_frame = new S_Show_Form(flag); this.AddOwnedForm(show_frame); show_frame.Show(); List<string> names= new List<string>(); names.Add("ID"); names.Add("货物种类"); show_frame.dataGridView1.DataSource = TableDataUtil.convertListListDataToDataTable(names, pro.data); if (flag) { foreach (DataGridViewRow row in show_frame.dataGridView1.Rows) { row.ContextMenuStrip = show_frame.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("获取信息错误,请重新获取"); } }