![]()
public partial class Form_Jurisdiction : XtraForm
{
Command.BusinessCommand.ProjectExplorer.com_Project com = new Command.BusinessCommand.ProjectExplorer.com_Project();
string p_id;
public Form_Jurisdiction(string _p_id)
{
p_id = _p_id;
InitializeComponent();
this.Load += (s, e) =>
{
Task.Factory.StartNew(() =>
{
this.BeginInvoke(new Action(() =>
{
SetTextAndClick();
BandData();
}));
});
};
}
private void BandData() //无论是否有值,都绑定之前的窗口
{
List<Model.BusinessSelectModel.ProjectExplorer.Project_Jurisdiction> list = com.selectJuridictionById(p_id);
this.ckb_staff.EditValue = string.Join(",", list.Where(w => w.j_type.Equals(false)).Select(w => w.j_id));
this.ckb_group.EditValue = string.Join(",", list.Where(w => w.j_type.Equals(true)).Select(w => w.j_id));
this.ckb_staff.RefreshEditValue();
this.ckb_group.RefreshEditValue();
}
public void SetTextAndClick()//保存按钮绑定的信息
{
this.ckb_staff.Properties.DataSource = com.ReturnStaffList();
this.ckb_staff.Properties.DisplayMember = "lookname";
this.ckb_staff.Properties.ValueMember = "lookvalue";
this.ckb_staff.Properties.NullText = "";
this.ckb_group.Properties.DataSource = com.ReturnGroupList();
this.ckb_group.Properties.DisplayMember = "lookname";
this.ckb_group.Properties.ValueMember = "lookvalue";
this.ckb_group.Properties.NullText = "";
this.btn_save.Click += (s, e) =>
{
string staffs = this.ckb_staff.EditValue.ToSaleString();
string groups = this.ckb_group.EditValue.ToSaleString();
if (com.SetAndAddJurisdiction(p_id, staffs, groups))
{
XtraMessageBox.Show("设置成功", "提示消息");
this.Close();
}
else
{
XtraMessageBox.Show("设置失败", "提示消息");
}
};
}
}