Beispiel #1
0
        private void initForm(FrontCustomerRecordInfo info)
        {
            FrontRecordInfo frontInfo = new FrontRecordInfo();
            CustomerInfo customerInfo = new CustomerInfo();
            DBModelBase.Clone<FrontRecordInfo>(info.FrontRecord, ref frontInfo);
            DBModelBase.Clone<CustomerInfo>(info.Customer, ref customerInfo);
            newRecordInfo.FrontRecord = frontInfo;
            newRecordInfo.Customer = customerInfo;
            recordInfo = info;

            this.Btn_OK.Click += Btn_OK_Click;

            this.txtCName.DataBindings.Add("Text", customerInfo, "Name");
            this.txtCPhone.DataBindings.Add("Text", customerInfo, "Phone");
            this.txtCIndustry.DataBindings.Add("Text", customerInfo, "Industry");
            this.txtCAddress.DataBindings.Add("Text", customerInfo, "Address");
            this.txtCurCar.DataBindings.Add("Text", customerInfo, "CurCar");
            customerLevels = PurposeLevelBusiness.Instance.GetPurposeLevels();
            this.cbCLevel.Properties.Items.AddRange(customerLevels.ToArray());
            this.cbRegion.Properties.Items.AddRange(GlobalCaches.Instance.RegionInfos);
            this.cbCNature.Properties.Items.AddRange(GlobalCaches.Instance.ConstantInfos.Where(e => e.TypeValue == (int)BasicConstantType.CNature).ToArray());

            //this.cbCarLicence.Properties.Items.AddRange(GloablCaches.Instance.ConstantInfos.Where(e => e.TypeValue == (int)BasicConstantType.CarLicence).ToArray());
            this.cbCarType.Properties.Items.AddRange(GlobalCaches.Instance.CarTypes);
            this.cbFrontSource.Properties.Items.AddRange(GlobalCaches.Instance.ConstantInfos.Where(e => e.TypeValue == (int)BasicConstantType.FrontSource).ToArray());
            this.cbConsultant.Properties.Items.AddRange(GlobalCaches.Instance.ConsultantInfos);



            if (customerInfo.Id == 0)
                this.cbCNature.SelectedIndex = 0;
            else
                this.cbCNature.SelectedItem = GlobalCaches.Instance.ConstantInfos.FirstOrDefault(e => e.Id == customerInfo.Nature);
            if (customerInfo.RegionId.HasValue)
                this.cbRegion.SelectedItem = GlobalCaches.Instance.RegionInfos.FirstOrDefault(e => e.Id == customerInfo.RegionId);
            else
                this.cbRegion.SelectedIndex = 0;

            //if (frontInfo.CarLicence == null)
            //    this.cbCarLicence.SelectedIndex = 0;
            //else
            //    this.cbCarLicence.SelectedItem = GloablCaches.Instance.ConstantInfos.FirstOrDefault(e => e.Id == frontInfo.CarLicence);

            if (string.IsNullOrEmpty(frontInfo.LevelCode))
                this.cbCLevel.SelectedIndex = 0;
            else
                this.cbCLevel.SelectedItem = customerLevels.FirstOrDefault(e => e.Code == frontInfo.LevelCode);

            if (frontInfo.PurposeCar.HasValue)
                this.cbCarType.SelectedItem = GlobalCaches.Instance.CarTypes.FirstOrDefault(e => e.Id == frontInfo.PurposeCar);
            else
                this.cbCarType.SelectedIndex = 0;


            if (frontInfo.Source.HasValue)
                this.cbFrontSource.SelectedItem = GlobalCaches.Instance.ConstantInfos.FirstOrDefault(e => e.Id == frontInfo.Source);
            else
                this.cbFrontSource.SelectedIndex = 0;
            if (frontInfo.ConsultantId > 0)
                this.cbConsultant.SelectedItem = GlobalCaches.Instance.ConsultantInfos.FirstOrDefault(e => e.Id == frontInfo.ConsultantId);


            this.txtRemark.DataBindings.Add("Text", frontInfo, "Remark");
            this.txtCNum.EditValue = frontInfo.CustomerNum;
            this.rdDriveStatus.SelectedIndex = frontInfo.DriveStatus.HasValue ? frontInfo.DriveStatus.Value - 1 : -1;
            this.rdInstallment.SelectedIndex = frontInfo.Installment.HasValue ? frontInfo.Installment.Value - 1 : -1;
            this.rdReplace.SelectedIndex = frontInfo.Replace.HasValue ? frontInfo.Replace.Value - 1 : -1;

            // 只有店内经理可以修改客户的销售顾问
            this.cbConsultant.Enabled = GlobalCaches.Instance.CurUser.RoleId <= GlobalConstants.RoleIdSysManager;
        }
Beispiel #2
0
        public FmFrontOut(FrontCustomerRecordInfo info)
        {
            InitializeComponent();
            initForm(info);

        }