private void btnCreateBatch_Click(object sender, EventArgs e)
        {
            var dlg = new ImportWizardDlg(new List <Tuple <string, CellType, bool> >()
            {
                ImportWizardDlg.MakeColumn("登录名", CellType.Text, true),
                ImportWizardDlg.MakeColumn("姓名", CellType.Text, true),
                ImportWizardDlg.MakeColumn("金额", CellType.Text, true)
            });

            dlg.StartPosition = FormStartPosition.CenterParent;
            dlg.RunSingle    += (index, gridView) => {
                var d = new Dictionary <string, object>();
                d["tbd-id"]     = m_tbdId;
                d["login-name"] = gridView.Rows[index].Cells[0].Value.TrimStr();
                d["real-name"]  = gridView.Rows[index].Cells[1].Value.TrimStr();
                d["amt"]        = gridView.Rows[index].Cells[2].Value.TrimStr();
                var p = BusinessTransfers.SaveInvestBonus(d).Result;
                if (p.IsOk)
                {
                    myGridViewBinding1.BindTo(p, Commons.BindFlag.Update, "jvpId");
                }

                return(p);
            };
            dlg.ShowDialog(this);
        }
        private void btnBatchImport_Click(object sender, EventArgs e)
        {
            var dlg = new ImportWizardDlg(new List <Tuple <string, CellType, bool> >()
            {
                ImportWizardDlg.MakeColumn("登录名", CellType.Text, true),
                ImportWizardDlg.MakeColumn("手机号码", CellType.Mobile, true)
            });

            dlg.StartPosition = FormStartPosition.CenterParent;
            dlg.RunSingle    += (index, gridView) => {
                var d = new Dictionary <string, object>();
                d["pid"]        = m_pId;
                d["login-name"] = gridView.Rows[index].Cells[0].Value.TrimStr();
                d["mobile"]     = gridView.Rows[index].Cells[1].Value.TrimStr();
                var p = Projects.AddAllowInvest(d).Result;
                if (p.IsOk)
                {
                    myGridViewBinding1.BindTo(p, Commons.BindFlag.Update, "auId");
                }
                return(p);
            };
            dlg.ShowDialog(this);
        }
Beispiel #3
0
        private void btnBatchBind_Click(object sender, EventArgs e)
        {
            var dlg = new ImportWizardDlg(new List <Tuple <string, CellType, bool> >()
            {
                ImportWizardDlg.MakeColumn("姓名", CellType.Text, true),
                ImportWizardDlg.MakeColumn("手机", CellType.Text, true),
                ImportWizardDlg.MakeColumn("客户经理", CellType.Text, true)
            });

            dlg.StartPosition = FormStartPosition.CenterParent;
            dlg.RunSingle    += (index, gridView) => {
                var d = new Dictionary <string, object>();
                d["real-name"] = gridView.Rows[index].Cells[0].Value.TrimStr();
                d["mobile"]    = gridView.Rows[index].Cells[1].Value.TrimStr();
                d["u-name"]    = gridView.Rows[index].Cells[2].Value.TrimStr();

                return(CrmInvestor.CreateAssignOfRegUser(d).Result);
            };

            if (dlg.ShowDialog(this) == DialogResult.Cancel)
            {
                UpdateTable();
            }
        }
Beispiel #4
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            var dlg = new ImportWizardDlg(new List <Tuple <string, CellType, bool> >()
            {
                ImportWizardDlg.MakeColumn("姓名", CellType.Text),
                ImportWizardDlg.MakeColumn("手机", CellType.Mobile, true),
                ImportWizardDlg.MakeColumn("工作单位", CellType.Text),
                ImportWizardDlg.MakeColumn("职务", CellType.Text),
                ImportWizardDlg.MakeColumn("所在城市", CellType.Text),
                ImportWizardDlg.MakeColumn("年龄", CellType.Age),
                ImportWizardDlg.MakeColumn("性别", CellType.Text),
                ImportWizardDlg.MakeColumn("备注", CellType.Text),
                ImportWizardDlg.MakeColumn("客户来源", CellType.Text),
                ImportWizardDlg.MakeColumn("等级", CellType.Text)
            });

            dlg.StartPosition = FormStartPosition.CenterParent;
            dlg.RunSingle    += (index, gridView) => {
                var r = new Dictionary <string, object>();
                r["ci-id"]     = 0;
                r["real-name"] = gridView.Rows[index].Cells[0].Value.TrimStr();
                r["mobile"]    = gridView.Rows[index].Cells[1].Value.TrimStr();
                r["company"]   = gridView.Rows[index].Cells[2].Value.TrimStr();
                r["position"]  = gridView.Rows[index].Cells[3].Value.TrimStr();
                r["city"]      = gridView.Rows[index].Cells[4].Value.TrimStr();
                var ageStr = gridView.Rows[index].Cells[5].Value.TrimStr();
                if (ageStr != "")
                {
                    var age = Convert.ToInt32(ageStr);
                    if (age > 0)
                    {
                        r["birth"] = DateTime.Now.AddYears(-age).TruncToStart();
                    }
                }
                var gender = gridView.Rows[index].Cells[6].Value.TrimStr();
                if (gender == "男")
                {
                    r["gender"] = 1;
                }
                else if (gender == "女")
                {
                    r["gender"] = 2;
                }
                else
                {
                    r["gender"] = 0;
                }
                var remark = gridView.Rows[index].Cells[7].Value.TrimStr();
                r["remark"]      = remark.Substring(0, Math.Min(remark.Length, 200));
                r["origin-type"] = gridView.Rows[index].Cells[8].Value.TrimStr();
                var prLevelStr = CrmCommons.PrLevels.FindByText(gridView.Rows[index].Cells[9].Value.TrimStr());
                if (prLevelStr != "")
                {
                    var prLevel = Convert.ToInt32(prLevelStr);
                    if (prLevel > 0)
                    {
                        r["pr-level"] = prLevel;
                    }
                }

                var p = CrmInvestor.Create(r).Result;
                if (p.IsOk)
                {
                    myGridViewBinding1.BindTo(p, Commons.BindFlag.Update, "ciId");
                }
                return(p);
            };

            dlg.ShowDialog(this);
        }