Esempio n. 1
0
        private void btnAssignManager_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode == null || string.IsNullOrWhiteSpace(treeView1.SelectedNode.Text))
            {
                Commons.ShowInfoBox(this, "请选择一位新的客户经理");
                return;
            }

            var newMgr = treeView1.SelectedNode.Text;

            var dlg = new BatchProcessDlg(m_ids);

            dlg.StartPosition = FormStartPosition.CenterParent;
            dlg.RunSingle    += (id) => {
                if (m_type)
                {
                    var d = new Dictionary <string, object>();
                    d["au-id"]  = id;
                    d["u-name"] = newMgr;
                    return(CrmInvestor.BindMgrWithRegUser(d).Result);
                }
                else
                {
                    var d = new Dictionary <string, object>();
                    d["ci-id"]  = id;
                    d["u-name"] = newMgr;
                    return(CrmInvestor.BindMgr(d).Result);
                }
            };
            dlg.ShowDialog(this);

            DialogResult = DialogResult.OK;
        }
        private async void AssignManager()
        {
            if (treeView1.SelectedNode == null || string.IsNullOrWhiteSpace(treeView1.SelectedNode.Text))
            {
                Commons.ShowInfoBox(this, "请选择一位新的客户经理");
                return;
            }
            btnAssignManager.Enabled = false;
            var newMgr = treeView1.SelectedNode.Text;

            if (newMgr == CrmCommons.SELF_TEXT)
            {
                newMgr = CrmCommons.SELF_VALUE;
            }

            var d = new Dictionary <string, object>();

            Rpc.IResult p;
            if (m_type)
            {
                d["au-id"]  = m_id;
                d["u-name"] = newMgr;
                p           = await CrmInvestor.BindMgrWithRegUser(d);
            }
            else
            {
                d["ci-id"]  = m_id;
                d["u-name"] = newMgr;
                p           = await CrmInvestor.BindMgr(d);
            }

            if (p.IsOk)
            {
                if (p.AsInt == 0)
                {
                    Commons.ShowInfoBox(this, "绑定客户经理失败!");
                }
                else
                {
                    DialogResult = DialogResult.OK;
                }
            }
            else
            {
                Commons.ShowResultErrorBox(this, p);
            }
            btnAssignManager.Enabled = true;
        }