private void CheckedExist(String name)
        {
            string @condition = YardEnum.name.ToString() + "=" + Constract.valueSplit + name + Constract.valueSplit
                                + " and "
                                + YardEnum.affiliated_company_id.ToString() + "+" + Constract.valueSplit + mYard.affiliatedCompanyId + Constract.valueSplit;
            string      sql  = DatabaseOPtionHelper.GetInstance().getSelectSqlNoSoftDeleteCondition(DataTabeName.yard.ToString(), null, condition, null, null, null, 1, 0);
            List <Yard> list = DatabaseOPtionHelper.GetInstance().select <Yard>(sql);

            if (list == null || list.Count <= 0)
            {
                this.AlertInfoTb.Text       = "该货场名称可以添加!";
                this.AlertInfoTb.Foreground = Brushes.Green;
                return;
            }
            else
            {
                mYard = list[0];
            }
            if (mYard != null)
            {
                if (mYard.isDelete != 1)
                {
                    this.AlertInfoTb.Text = "该货场已经存在,不需要再添加!";
                    this.nameTb.Focus();
                }
            }
        }
Ejemplo n.º 2
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            CreateNotifyIcon();

            CreateClientId();

            //devlepment
            new MainWindow().Show();

            // new TestExpender().Show();
            //Navigation();
            currentCompany = new Company()
            {
                id   = ConfigurationHelper.GetConfig(ConfigItemName.companyId.ToString()),
                name = ConfigurationHelper.GetConfig(ConfigItemName.companyName.ToString()),
            };
            currentUser = new User()
            {
                id                  = GetClientId(),
                name                = "陈龙飞",
                company             = currentCompany.name,
                affiliatedCompanyId = currentCompany.id
            };
            currentYard = YardModel.GetById(MyHelper.ConfigurationHelper.GetConfig(ConfigItemName.yardId.ToString()));
            //Scanner Gun
            StartKeyBoardHook();

            //UI线程未捕获异常处理事件(UI主线程)
            this.DispatcherUnhandledException += App_DispatcherUnhandledException;
            //非UI线程未捕获异常处理事件(例如自己创建的一个子线程)
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            //Task线程内未捕获异常处理事件
            TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
        }
 public YardAddW(Company company = null, Yard yard = null)
 {
     InitializeComponent();
     if (yard != null)
     {
         mYard = yard;
         isAdd = false;
     }
     else
     {
         mYard = new Yard()
         {
             id = Guid.NewGuid().ToString()
         };
     }
     mCompany = company;
 }
 private void SendYardCb_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.SendYardCb.SelectedIndex > -1)
     {
         Yard yard = (Yard)this.SendYardCb.SelectedItem;
         if (yard != null)
         {
             mWeighingBill.sendYardId   = yard.id;
             mWeighingBill.sendYardName = yard.name;
         }
         else
         {
             mWeighingBill.sendYardId   = String.Empty;
             mWeighingBill.sendYardName = String.Empty;
         }
     }
     else
     {
         mWeighingBill.sendYardId   = String.Empty;
         mWeighingBill.sendYardName = String.Empty;
     }
 }
 private void AffterAddYard(Yard yard)
 {
     if (yard != null)
     {
         if (isShowSendYard == true)
         {
             this.SendYardCb.ItemsSource = null;
             this.SendYardCb.ItemsSource = new List <Yard>()
             {
                 yard
             };
             this.SendYardCb.SelectedItem = 0;
         }
         else
         {
             this.ReceiverYardCb.ItemsSource = null;
             this.ReceiverYardCb.ItemsSource = new List <Yard>()
             {
                 yard
             };
             this.ReceiverYardCb.SelectedItem = 0;
         }
     }
 }
Ejemplo n.º 6
0
        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);
        }