Exemplo n.º 1
0
 /// <summary>
 /// 增加客户,站点等
 /// </summary>
 private void menuItemAdd_Click(object sender, EventArgs e)
 {
     ListBoxControl control = contextMenu.SourceControl as ListBoxControl;
     if (control.Tag.ToString() == "寄件站点")
     {
         FrmSite frm = new FrmSite(true);
         frm.SelectedItem = lstSite;
         if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             lstSite = frm.SelectedItem as List<CoSite>;
             control.DataSource = lstSite;
         }
     }
     else if (control.Tag.ToString() == "派件区域")
     {
         FrmDestination frm = new FrmDestination();
         frm.SelectedItem = lstDestination;
         if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             lstDestination = frm.SelectedItem as List<CoDestination>;
             control.DataSource = lstDestination;
         }
     }
     else if (control.Tag.ToString() == "报价客户")
     {
         FrmCustomers frm = new FrmCustomers();
         frm.SelectedItem = lstCustomers;
         if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             lstCustomers = frm.SelectedItem as List<CoCustomers>;
             control.DataSource = lstCustomers;
         }
     }
 }
Exemplo n.º 2
0
 static void controlSite_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         if (frmSite == null)
             frmSite = new FrmSite();
         frmSite.SelectedItem = (sender as ButtonEdit).Tag;
         if (frmSite.ShowDialog() == DialogResult.OK)
         {
             CoSite obj = frmSite.SelectedItem as CoSite;
             (sender as ButtonEdit).Tag = obj;
             (sender as ButtonEdit).EditValue = obj.Name;
         }
     }
     catch (Exception ex)
     {
         ShowErrorMessage("错误", ex.Message);
     }
 }