/// <summary> /// Update Used Base Data run in the save success /// </summary> public static void TempUpdateUsedBase(object baseData) { BaseDataClassV baseDataClassV = (BaseDataClassV)baseData; Company supply = baseDataClassV.send; Company Customer = baseDataClassV.receive; Material material = baseDataClassV.material; CarInfo carInfo = baseDataClassV.carInfo; if (supply != null) { supply.syncTime = MyHelper.DateTimeHelper.GetTimeStamp(); if (App.tempSupplyCompanys.ContainsKey(supply.id)) { App.tempSupplyCompanys.Remove(supply.id); } App.tempSupplyCompanys.Add(supply.id, supply); App.tempSupplyCompanys.OrderBy(O => O.Value.syncTime); } if (Customer != null) { Customer.syncTime = MyHelper.DateTimeHelper.GetTimeStamp(); if (App.tempCustomerCompanys.ContainsKey(Customer.id)) { App.tempCustomerCompanys.Remove(Customer.id); } App.tempCustomerCompanys.Add(Customer.id, Customer); App.tempCustomerCompanys.OrderBy(O => O.Value.syncTime); } if (material != null) { material.syncTime = MyHelper.DateTimeHelper.GetTimeStamp(); if (App.tempMaterials.ContainsKey(material.id)) { App.tempMaterials.Remove(material.id); } App.tempMaterials.Add(material.id, material); App.tempMaterials.OrderBy(O => O.Value.syncTime); } if (carInfo != null) { carInfo.syncTime = MyHelper.DateTimeHelper.GetTimeStamp(); if (App.tempCars.ContainsKey(carInfo.id)) { App.tempCars.Remove(carInfo.id); } App.tempCars.Add(carInfo.id, carInfo); App.tempCars.OrderBy(O => O.Value.syncTime); } }
private void CarNumberCb_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (CarNumberCb.SelectedIndex != -1) { car = (CarInfo)CarNumberCb.SelectedItem; isCarInfoSelectioned = true; mWeighingBill.plateNumber = car.carNumber; mWeighingBill.carId = car.id; mWeighingBill.driver = car.driver; mWeighingBill.driverIdNumber = car.driverIdnumber; mWeighingBill.driverMobile = car.driverMobile; SetCarInfo(); } }
private void CarNumberCb_TextChanged(object sender, TextChangedEventArgs e) { String text = this.CarNumberCb.Text.Trim(); if (text.Length <= 0) { isCarInfoSelectioned = false; car = null; this.CarNumberCb.IsDropDownOpen = false; SetCarInfo(); return; } if (isBindingdata == true) { return; } if (isCarInfoSelectioned == true) { return; } if (text.Length >= 2) { List <CarInfo> list = CarInfoModel.FuzzySearch(text); if (list.Count > 0) { isCarInfoSelectioned = true; } this.tempCars.Clear(); foreach (var item in list) { this.tempCars.Add(item.id, item); } this.CarNumberCb.ItemsSource = this.tempCars.Values.ToList(); if (CarNumberCb.ItemsSource != null) { this.CarNumberCb.IsDropDownOpen = true; } } else { this.CarNumberCb.ItemsSource = App.tempCars.Values.ToList(); } }
private void CarlistView_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListView lv = sender as ListView; if (lv.SelectedIndex == -1) { return; } if (currentListView != lv) { if (currentListView != null) { currentListView.SelectedIndex = -1; } } currentListView = lv; currCarInfo = lv.SelectedItem as CarInfo; this.CarinfoDetailGrid.DataContext = currCarInfo; }
/// <summary> /// 检查车辆是否存在 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CarNumberTb_LostFocus(object sender, RoutedEventArgs e) { String carnumber = this.CarNumberTb.Text.Trim(); if (RegexHelper.IsVehicleNumber(carnumber)) { String condition = CarInfoEnum.car_number.ToString() + "=" + Constract.valueSplit + carnumber + Constract.valueSplit; String sql = DatabaseOPtionHelper.GetInstance().getSelectSql(DataTabeName.car_info.ToString(), null, condition); List <CarInfo> list = DatabaseOPtionHelper.GetInstance().select <CarInfo>(sql); if (list.Count > 0) { if (list[0].isDelete == 1) { mCarInfo = list[0]; mCarInfo.isDelete = 0; mCarInfo.deleteTime = null; isUpdate = true; getVchileLicense(); getDriver(); getDrivingLicense(); bindingVchileLicenseinfo(); bindingDrivingLicenseinfo(); } else { MessageBox.Show("该车辆信息已经存在!"); this.CarNumberTb.Text = null; this.CarNumberTb.Focus(); return; } } } else { MessageBox.Show("车牌号输入错误!"); return; } }
private string GetSeachCondition() { string condition = string.Empty; Company sendC = (Company)this.sendCompanyCB.SelectedItem; if (sendC != null) { if (string.IsNullOrEmpty(condition)) { condition += WeighingBillEnum.send_company_id.ToString() + " = " + Constract.valueSplit + sendC.id + Constract.valueSplit; } else { condition += " and " + WeighingBillEnum.send_company_id.ToString() + " = " + Constract.valueSplit + sendC.id + Constract.valueSplit; } } Yard sendY = (Yard)this.sendYandCB.SelectedItem; if (sendY != null) { if (String.IsNullOrEmpty(condition)) { condition += WeighingBillEnum.send_yard_id.ToString() + " = " + Constract.valueSplit + sendY.id + Constract.valueSplit; } else { condition += " and " + WeighingBillEnum.send_yard_id.ToString() + " = " + Constract.valueSplit + sendY.id + Constract.valueSplit; } } Company receiveC = (Company)this.receiveCompanyCB.SelectedItem; if (receiveC != null) { if (string.IsNullOrEmpty(condition)) { condition += WeighingBillEnum.receive_company_id.ToString() + " = " + Constract.valueSplit + receiveC.id + Constract.valueSplit; } else { condition += " and " + WeighingBillEnum.receive_company_id.ToString() + " = " + Constract.valueSplit + receiveC.id + Constract.valueSplit; } } Yard receiveY = (Yard)this.receiveYandCB.SelectedItem; if (receiveY != null) { if (String.IsNullOrEmpty(condition)) { condition += WeighingBillEnum.receive_yard_id.ToString() + " = " + Constract.valueSplit + receiveY.id + Constract.valueSplit; } else { condition += " and " + WeighingBillEnum.receive_yard_id.ToString() + " = " + Constract.valueSplit + receiveY.id + Constract.valueSplit; } } Material material = (Material)this.MaterialNameCB.SelectedItem; if (material != null) { if (this.TodayInTabBtn.IsChecked == true || this.InDetialReportTabBtn.IsChecked == true) { if (String.IsNullOrEmpty(condition)) { condition += WeighingBillEnum.receive_material_id.ToString() + " = " + Constract.valueSplit + material.id + Constract.valueSplit; } else { condition += " and " + WeighingBillEnum.receive_material_id.ToString() + " = " + Constract.valueSplit + material.id + Constract.valueSplit; } } else if (this.TodayOutTabBtn.IsChecked == true || this.OutDetialReportTabBtn.IsChecked == true) { if (String.IsNullOrEmpty(condition)) { condition += WeighingBillEnum.send_material_id.ToString() + " = " + Constract.valueSplit + material.id + Constract.valueSplit; } else { condition += " and " + WeighingBillEnum.send_material_id.ToString() + " = " + Constract.valueSplit + material.id + Constract.valueSplit; } } } CarInfo carInfo = (CarInfo)CarNumberCB.SelectedItem; if (carInfo != null) { if (String.IsNullOrEmpty(condition)) { condition += WeighingBillEnum.plate_number.ToString() + " = " + Constract.valueSplit + carInfo.carNumber + Constract.valueSplit; } else { condition += " and " + WeighingBillEnum.plate_number.ToString() + " = " + Constract.valueSplit + carInfo.carNumber + Constract.valueSplit; } } return(condition); }
public CarAddW(CarInfo carInfo = null) { InitializeComponent(); mCarInfo = carInfo; }