private void BtnAdd_Click(object sender, EventArgs e) { if (!Global.CURRENT_PROJECT_ID.HasValue) { MessageBox.Show("您登录时未选择当前操作项目,所以添加跟进记录,请重新登录选择项目或者跟管理员确认您可以操作的项目"); return; } txtName.Text = txtName.Text.Trim(); if (String.IsNullOrEmpty(txtName.Text)) { MessageBox.Show("客户姓名不能为空"); txtName.Focus(); return; } //txtMobile.Text = txtMobile.Text.Trim(); if (cmbCustomerTypes.Text == String.Empty) { MessageBox.Show("请指定客户类型"); cmbCustomerTypes.Focus(); return; } //if (cmbCustomerSources.Text == String.Empty) //{ // MessageBox.Show("请指定客户数据来源"); // cmbCustomerSources.Focus(); // return; //} if (cmbCustomerStatus.Text == String.Empty) { MessageBox.Show("请指定客户状态"); cmbCustomerTypes.Focus(); return; } if (cmbProvinces.Text == String.Empty) { MessageBox.Show("请指定客户所在区域"); cmbProvinces.Focus(); return; } DateTime nextCommTime = dtpNextFollowTime.Value; if (DateTime.Compare(nextCommTime, DateTime.Now) < 0) { MessageBox.Show("下次跟进时间不能早于当前时间!"); dtpNextFollowTime.Focus(); return; } txtFollowRemark.Text = txtFollowRemark.Text.Trim(); if (txtFollowRemark.Text == String.Empty) { MessageBox.Show("必须输入沟通记录"); txtFollowRemark.Focus(); return; } if (DateTime.Compare(dtpActuallyTime.Value, DateTime.Now) > 0) { MessageBox.Show("实际跟进时间不能晚于当前时间!"); dtpActuallyTime.Focus(); return; } try { AddFollowRecord vo = new AddFollowRecord(); vo.communicationTime = dtpActuallyTime.Value; vo.remark = txtFollowRemark.Text; vo.cityId = cmbCities.SelectedValue != null?cmbCities.SelectedValue.ToString() : null; vo.countyId = cmbCounties.SelectedValue != null?cmbCounties.SelectedValue.ToString() : null; vo.gender = cmbGender.SelectedValue == null ? 0 : Convert.ToInt32(cmbGender.SelectedValue.ToString()); vo.provinceId = cmbProvinces.SelectedValue.ToString(); //vo.mobile = txtMobile.Text; vo.name = txtName.Text; vo.nextFollowTime = dtpNextFollowTime.Value; //vo.source = Convert.ToInt32(cmbCustomerSources.SelectedValue.ToString()); vo.type = Convert.ToInt32(cmbCustomerTypes.SelectedValue.ToString()); vo.projectId = Global.CURRENT_PROJECT_ID.Value; vo.status = Convert.ToInt32(cmbCustomerStatus.SelectedValue.ToString()); CustomerDto thisCustomer = CustomerService.AddFllowRecord(CURRENT_CUSTOMER.id, Global.USER_TOKEN, vo); ListViewItem lvi = new ListViewItem(vo.communicationTime.ToString("yyyy-MM-dd HH:mm:ss")); lvi.SubItems.Add(Global.CURRENT_PROJECT_NAME); lvi.SubItems.Add(cmbCustomerStatus.Text); lvi.SubItems.Add(cmbCustomerTypes.Text); lvi.SubItems.Add(CURRENT_CUSTOMER.lastFollowUserName); lvi.SubItems.Add(dtpNextFollowTime.Value.ToString("MM-dd HH:mm")); lvi.SubItems.Add(txtFollowRemark.Text); CustomerFollowRecord record = new CustomerFollowRecord();//供查看详细信息时使用 record.projectName = Global.CURRENT_PROJECT_NAME; record.communicationTime = dtpActuallyTime.Value; record.followUserName = Global.USER_NAME; record.nextFollowTime = dtpNextFollowTime.Value; record.remark = txtFollowRemark.Text; lvi.Tag = record; listView1.Items.Insert(0, lvi); txtFollowRemark.Text = String.Empty; InformationChanged = true; ModifiedCustomers[CURRENT_INDEX] = thisCustomer; CURRENT_CUSTOMER = this.CURRENT_CUSTOMER; MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (BusinessException ex) { MessageBox.Show("添加跟进记录发生错误:" + ex.Message); return; } }
public FormFollowRecordInfo(CustomerFollowRecord record) { InitializeComponent(); this.record = record; }