예제 #1
0
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     txtOrganizationName.Text = txtOrganizationName.Text.Trim();
     if (String.IsNullOrEmpty(txtOrganizationName.Text))
     {
         MessageBox.Show("必须输入组织名称");
         txtOrganizationName.Focus();
         return;
     }
     try
     {
         OrganizationDto organization = OrganizationService.AddOrganization(txtOrganizationName.Text, Global.USER_TOKEN);
         ListViewItem    lvi          = new ListViewItem(organization.name);
         lvi.SubItems.Add(organization.createdTime.ToString("yyyy-MM-dd HH:mm:ss"));
         lvi.Tag = organization;
         txtOrganizationName.Text          = string.Empty;
         listView1.Items.Add(lvi).Selected = true;
     }
     catch (BusinessException ex)
     {
         MessageBox.Show(ex.Message);
     }
 }