private void initForm(OrderRecordInfo info) { if (info != null) { DBModelBase.Clone<OrderRecordInfo>(info, ref newRecordInfo); recordInfo = info; } this.Text += IsNew ? "-新增" : "-修改"; this.Btn_OK.Click += Btn_OK_Click; this.txtCPhone.Text = customerInfo.Phone; this.txtCName.Text = customerInfo.Name; //this.txtCPhone.DataBindings.Add("Text", customerInfo, "Phone"); //this.txtCName.DataBindings.Add("Text", customerInfo, "Name"); this.txtRemark.DataBindings.Add("Text", newRecordInfo, "Remark"); //this.txtPrice.DataBindings.Add("Text", newRecordInfo, "Price"); //this.txtDisPrice.DataBindings.Add("Text", newRecordInfo, "DisPrice"); //this.txtPrevPay.DataBindings.Add("Text", newRecordInfo, "PrevPay"); this.txtPrice.EditValue = newRecordInfo.Price ?? 0; this.txtDisPrice.EditValue = newRecordInfo.DisPrice ?? 0; this.txtPrevPay.EditValue = newRecordInfo.PrevPay ?? 0; this.cbCarType.Properties.Items.AddRange(GlobalCaches.Instance.CarTypes); this.cbConsultant.Properties.Items.AddRange(GlobalCaches.Instance.ConsultantInfos); if (!IsNew && newRecordInfo.CarType.HasValue) this.cbCarType.SelectedItem = GlobalCaches.Instance.CarTypes.FirstOrDefault(e => e.Id == newRecordInfo.CarType); else this.cbCarType.SelectedIndex = 0; if (!IsNew && newRecordInfo.ConsultantId.HasValue) this.cbConsultant.SelectedItem = GlobalCaches.Instance.ConsultantInfos.FirstOrDefault(e => e.Id == newRecordInfo.ConsultantId); else this.cbConsultant.SelectedIndex = 0; this.txtCPhone.Properties.ReadOnly = !string.IsNullOrEmpty(customerInfo.Phone); // 只有店内经理可以修改客户的销售顾问 this.cbConsultant.Enabled = GlobalCaches.Instance.CurUser.RoleId <= GlobalConstants.RoleIdSysManager; }
/// <summary> /// 下单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e) { // 切换 ribbon page if (RibbonSwitch != null) RibbonSwitch(this, EventArgs.Empty); int rowHandle = this.gridViewFrontRecord.GetSelectedRows()[0]; var rowInfo = this.gridViewFrontRecord.GetRow(rowHandle) as FrontCustomerRecordInfo; OrderRecordInfo orderInfo = new OrderRecordInfo() { ShopId = GlobalCaches.Instance.CurUser.ShopId, ConsultantId = rowInfo.ConsultantUser.Id, CustomerId = rowInfo.Customer.Id, CarType = rowInfo.FrontRecord.PurposeCar, Type = "FRONT" }; new FmOrderInfo(orderInfo, rowInfo.Customer).ShowDialog(); }
public FmOrderInfo(OrderRecordInfo info = null, CustomerInfo cInfo = null) { InitializeComponent(); customerInfo = cInfo == null ? new CustomerInfo() : cInfo; initForm(info); }