예제 #1
0
 /// <summary>
 /// 用于向 CustomerT EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToCustomerT(CustomerT customerT)
 {
     base.AddObject("CustomerT", customerT);
 }
예제 #2
0
        private void btnAddBlackList_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (gridMain.SelectedItem == null)
                {
                    MessageBox.Show("请选择一条数据");
                    return;
                }

                if (MessageBox.Show("是否确认加入黑名单?", "确认加入黑名单", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {

                    int CID = (gridMain.SelectedItem as sp_Customer_Select_ByDate_Result).FID;
                    Customer cObj = visaORM.Customer.FirstOrDefault(c => c.FID == CID);
                    if (cObj == null)
                    {
                        MessageBox.Show("找不到对应签证数据,加入黑名单失败");
                        return;
                    }

                    if (visaORM.CustomerT.FirstOrDefault(c => c.FPassportNo == cObj.FPassportNo) != null)
                    {
                        MessageBox.Show("该护照已经加入了黑名单。");
                        return;
                    }

                    CustomerT model = new CustomerT();
                    model.FCreateDate = DateTime.Now;
                    model.FCreateUser  = MainContext.UserID;
                    model.FModifyDate = DateTime.Now;
                    model.FModifyUser = MainContext.UserID;
                    model.FCreateCompany = MainContext.UserCompanyName;

                    model.FName = cObj.FName;
                    model.FNameEn = cObj.FNameEn;
                    model.FPassportNo = cObj.FPassportNo;
                    model.FBirthDay = cObj.FBirthDay;
                    model.FSex = cObj.FSex;
                    model.FBirthPlace = cObj.FBirthPlace;
                    model.FBirthPlaceEn = cObj.FBirthPlaceEn;
                    model.FBirthNationlity = cObj.FBirthNationlity;
                    model.FBirthNationlityEn = cObj.FBirthNationlityEn;
                    model.FBirthNationlityPresent = cObj.FBirthNationlityPresent;
                    model.FBirthNationlityPresentEn = cObj.FBirthNationlityPresentEn;
                    model.FPassportType = cObj.FPassportType;
                    model.FPassportMake = cObj.FPassportMake;
                    model.FPassportMakeDate = cObj.FPassportMakeDate;
                    model.FPassportValidDate = cObj.FPassportValidDate;
                    model.FProfessionWork = cObj.FProfessionWork;
                    model.FProfessionCompany = cObj.FProfessionCompany;
                    model.FProfessionTele = cObj.FProfessionTele;
                    model.FAddressNow = cObj.FAddressNow;
                    model.FAddressTele = cObj.FAddressTele;
                    model.FPurpose = cObj.FPurpose;
                    model.FSysMemo = cObj.FSysMemo;

                    visaORM.CustomerT.AddObject(model);

                    visaORM.SaveChanges();
                    MessageBox.Show("加入黑名单成功");

                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log.WriteLog.WriteErorrLog(ex);

            }
        }
예제 #3
0
 /// <summary>
 /// 创建新的 CustomerT 对象。
 /// </summary>
 /// <param name="fID">FID 属性的初始值。</param>
 public static CustomerT CreateCustomerT(global::System.Int32 fID)
 {
     CustomerT customerT = new CustomerT();
     customerT.FID = fID;
     return customerT;
 }
예제 #4
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txtName.Text) && string.IsNullOrEmpty(txtPassportNoForSearch.Text))
            {
                MessageBox.Show("请填写条件");
                return;
            }

            if (!string.IsNullOrEmpty(txtName.Text))
            {
                CustomerT tempObj = visaORM.CustomerT.FirstOrDefault(c => c.FName == txtName.Text || c.FNameEn == txtName.Text);
                if (tempObj != null)
                {
                    model = tempObj;
                    MainTab.DataContext = model;

                    return;
                }
            }

            if (!string.IsNullOrEmpty(txtPassportNoForSearch.Text))
            {
                CustomerT tempObj = visaORM.CustomerT.FirstOrDefault(c => c.FPassportNo == txtPassportNoForSearch.Text);
                if (tempObj != null)
                {
                    model = tempObj;
                    MainTab.DataContext = model;

                    return;
                }
            }
            MessageBox.Show("找不到对应签证");
        }
예제 #5
0
        private void LeftGrid_SelectedItemChanged(object sender, DevExpress.Xpf.Grid.SelectedItemChangedEventArgs e)
        {
            if (e.OldItem == null || e.NewItem == null)
                return;

            CustomerT custModel = e.NewItem as CustomerT;

            var tempModel = visaORM.CustomerT.FirstOrDefault(c => c.FID == custModel.FID);
            if (tempModel == null)
                return;
            else
            {
                this.model = tempModel;
                isCanChangeTime = false;
                MainTab.DataContext = this.model;

            }
        }
예제 #6
0
        /// <summary>
        /// 左侧表单双击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LeftGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            CustomerT custModel = LeftGrid.CurrentItem as CustomerT;

            var tempModel = visaORM.CustomerT.FirstOrDefault(c => c.FID == custModel.FID);
            if (tempModel == null)
                return;
            else
            {
                this.model = tempModel;
                isCanChangeTime = false;
                MainTab.DataContext = this.model;

            }
        }
예제 #7
0
 private void CustomerDel()
 {
     CustomerT delObj = visaORM.CustomerT.FirstOrDefault(c => c.FID == model.FID);
     if (delObj == null)
     {
         MessageBox.Show("该数据尚未保存,无需删除");
         return;
     }
     else
     {
         if (MessageBox.Show("是否确认删除?", "删除确认", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
         {
             visaORM.DeleteObject(delObj);
             visaORM.SaveChanges();
             customerCollection.Remove(delObj);
             this.model = LeftGrid.SelectedItem as CustomerT;
             if (this.model == null)
                 this.model = new CustomerT();
         }
     }
 }
예제 #8
0
 private void CustomerAdd()
 {
     try
     {
         this.model = new CustomerT();
         MainTab.DataContext = this.model;
         InitSelectValue();
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
         Log.WriteLog.WriteErorrLog(ex);
     }
 }