Beispiel #1
0
        void SaveModel()
        {
            MainBar.Focus();
            if (string.IsNullOrEmpty(txtName.Text))
            {
                MessageBox.Show("请填写国家英文名");
                return;
            }

            if (string.IsNullOrEmpty(txtEnName.Text))
            {
                MessageBox.Show("请填写国家英文名");
                return;
            }



            if (model.FID == 0 || model.FID.ToString() == "")
            {
                visaORM.TCountry.AddObject(model);

                visaORM.SaveChanges();
                countryCollection.Add(model);
            }
            else
            {
                visaORM.ObjectStateManager.ChangeObjectState(model, System.Data.EntityState.Modified);
                visaORM.SaveChanges();
            }
            MessageBox.Show("保存成功");
        }
Beispiel #2
0
        /// <summary>
        /// 保存为已打印
        /// </summary>
        private void SaveSysPrint()
        {
            foreach (var SendModel in sendCollection.Where(s => s.FSelectItem == true))
            {
                SendInfo sObj = visaORM.SendInfo.FirstOrDefault(s => s.FQZID == SendModel.FQZID);
                if (sObj != null)
                {
                    if (sObj.FSysPrintNum == null)
                    {
                        sObj.FSysPrintNum = 1;
                    }
                    else
                    {
                        sObj.FSysPrintNum = sObj.FSysPrintNum + 1;
                    }

                    sObj.FSysPrint     = true;
                    sObj.FSysPrintDate = DateTime.Now;
                    sObj.FSysPrintUser = MainContext.UserID;
                    visaORM.ObjectStateManager.ChangeObjectState(sObj, System.Data.EntityState.Modified);

                    Customer cObj = visaORM.Customer.FirstOrDefault(c => c.FID == sObj.FCustomerID);
                    if (cObj != null)
                    {
                        cObj.FSysPrint     = true;
                        cObj.FSysPrintDate = DateTime.Now;
                        cObj.FSysPutUser   = MainContext.UserID;
                        visaORM.ObjectStateManager.ChangeObjectState(cObj, System.Data.EntityState.Modified);
                    }
                }
            }
            visaORM.SaveChanges();
        }
Beispiel #3
0
        private void btnZFVisa_Click(object sender, RoutedEventArgs e)
        {
            if (gridMain.SelectedItem == null)
            {
                MessageBox.Show("请选择一条数据");
                return;
            }

            try
            {
                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;
                    }

                    visaORM.Customer.Attach(cObj);
                    cObj.FsysZF    = true;
                    cObj.FSysSend  = false;
                    cObj.FSysPut   = false;
                    cObj.FSysChk   = false;
                    cObj.FSysPrint = false;
                    visaORM.ObjectStateManager.ChangeObjectState(cObj, System.Data.EntityState.Modified);

                    TB_TableSubmit submitObj = visaORM.TB_TableSubmit.FirstOrDefault(s1 => s1.FAutoID == cObj.FAutoID);
                    if (submitObj != null)
                    {
                        visaORM.DeleteObject(submitObj);
                    }
                    SendInfo sendObj = visaORM.SendInfo.FirstOrDefault(s2 => s2.FCustomerID == cObj.FID);
                    if (sendObj != null)
                    {
                        visaORM.DeleteObject(sendObj);
                    }

                    visaORM.SaveChanges();

                    MessageBox.Show("已经作废签证号为 " + cObj.FPassportNo + " 的签证");
                    dateFrom_EditValueChanged(null, null);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log.WriteLog.WriteErorrLog(ex);
            }
        }
Beispiel #4
0
 private void UserDel()
 {
     if (DXMessageBox.Show("是否确定删除?", "删除确认", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         User tempModel = LeftGrid.SelectedItem as User;
         if (tempModel == null)
         {
             return;
         }
         model           = tempModel;
         model.FIsDelete = true;
         visaORM.ObjectStateManager.ChangeObjectState(model, EntityState.Modified);
         visaORM.SaveChanges();
         userList.Remove(model);
         InitData();
     }
 }
Beispiel #5
0
        void DelModel()
        {
            if (MainGrid.SelectedItem == null)
            {
                MessageBox.Show("请选择一行");
                return;
            }

            if (MessageBox.Show("是否确认删除?", "删除确认", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                model         = MainGrid.SelectedItem as TB_AuditPosition;
                model.FStatus = false;
                visaORM.ObjectStateManager.ChangeObjectState(model, System.Data.EntityState.Modified);
                visaORM.SaveChanges();
                vietnamCollection.Remove(model);
            }
        }
Beispiel #6
0
        private void CustomerSave()
        {
            try
            {
                this.MainBar.Focus();

                if (!ValidateControl(txtNameEn, "英文姓名"))
                {
                    return;
                }
                if (!ValidateControl(txtPassportNo, "护照号码"))
                {
                    return;
                }

                this.model.FModifyDate = DateTime.Now;
                this.model.FModifyUser = MainContext.UserID;


                if (this.model.FID == 0 || this.model.FID.ToString() == "")
                {
                    visaORM.CustomerT.AddObject(this.model);
                    this.model.FCreateDate = DateTime.Now;
                    this.model.FCreateUser = MainContext.UserID;

                    visaORM.SaveChanges();
                    //InitData();
                    customerCollection.Add(model);
                    this.LeftGrid.SelectedItem = model;
                }
                else
                {
                    visaORM.ObjectStateManager.ChangeObjectState(this.model, System.Data.EntityState.Modified);
                    visaORM.SaveChanges();
                }
                MessageBox.Show("保存成功");
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log.WriteLog.WriteErorrLog(ex);
            }
        }
Beispiel #7
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                modelPort.FParaValue = txtPort.Text;
                visaORM.ObjectStateManager.ChangeObjectState(modelPort, System.Data.EntityState.Modified);
                visaORM.SaveChanges();

                modelProtocol.FParaValue = txtProtocol.Text;
                visaORM.ObjectStateManager.ChangeObjectState(modelProtocol, System.Data.EntityState.Modified);
                visaORM.SaveChanges();

                MessageBox.Show("保存成功");
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("保存失败,原因:" + ex.ToString());
            }
        }
Beispiel #8
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            List <TB_Position> pList = visaORM.TB_Position.Where(p => p.FGroupID == gourpIDAll && p.FStatus == true).ToList();

            foreach (var p in pList)
            {
                visaORM.ObjectStateManager.ChangeObjectState(p, System.Data.EntityState.Modified);
            }
            visaORM.SaveChanges();
            MessageBox.Show("保存成功");
            dg.Close();
        }
Beispiel #9
0
        //
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("将添加" + txtNumber.Text + "个号码,是否确定?", "添加确认", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                if (!ValidateControl())
                {
                    return;
                }

                string stringStart = txtStartNum.Text;
                string stringEnd   = txtEndNum.Text;


                numStart = Convert.ToInt32(txtStartNum.Text);
                numEnd   = Convert.ToInt32(txtEndNum.Text);
                string FirstLetter = txtLetter.Text.ToUpper();

                int StringLenght = stringStart.Length;

                for (int i = numStart; i <= numEnd; i++)
                {
                    int    NumberLenght = i.ToString().Length;
                    string QZID         = GetVisaNumberString(FirstLetter, NumberLenght, i);
                    QZKC   qzObj        = visaORM.QZKC.FirstOrDefault(q => q.FQZID == QZID);
                    if (qzObj == null)
                    {
                        QZKC tempObj = new QZKC();
                        visaORM.QZKC.AddObject(tempObj);
                        tempObj.FQZID  = QZID;
                        tempObj.FIsUse = false;
                        visaORM.SaveChanges();
                    }
                }
                visaORM.SaveChanges();
                MessageBox.Show("添加完成");
                InitSumInfo();
                stateAll_Checked(sender, null);
                btnPrev_Click(null, null);
            }
        }
Beispiel #10
0
        void auditList()
        {
            MainBar.Focus();

            if (cbSentVisa.SelectedIndex == -1)
            {
                MessageBox.Show("请选择需要审核的名单");
                return;
            }



            //string SentNo = cbSentVisa.SelectedItem.ToString();

            //var modelCollection = from c in visaORM.Customer
            //                     join s in visaORM.SendInfo
            //                     on c.FID equals s.FCustomerID
            //                     where s.FSendNo == SentNo
            //                     select c;



            string todayStringShort = DateTime.Now.ToString("yyMMdd");
            string todayStringAll   = DateTime.Now.ToShortDateString();

            int i = 0;

            foreach (var model in sendCollection)
            {
                sp_SelectTable3ForExcel_Result rowObj = gridMain.GetRow(i) as sp_SelectTable3ForExcel_Result;
                i++;
                if (rowObj.SelectChk == false)
                {
                    continue;
                }

                Customer cModel = visaORM.Customer.FirstOrDefault(c => c.FID == model.QID);
                if (cModel != null)
                {
                    visaORM.Customer.Attach(cModel);
                    cModel.FSysChk     = true;
                    cModel.FSysChkDate = DateTime.Now;
                    cModel.FSysChkUser = MainContext.UserID;

                    visaORM.ObjectStateManager.ChangeObjectState(cModel, System.Data.EntityState.Modified);

                    var modelSend = visaORM.SendInfo.FirstOrDefault(s => s.FCustomerID == cModel.FID);

                    if (modelSend != null)
                    {
                        modelSend.FModifyDate = DateTime.Now;
                        modelSend.FModifyUser = MainContext.UserID;

                        modelSend.FSysChk     = true;
                        modelSend.FSysChkDate = cModel.FSysChkDate;
                        modelSend.FSysChkUser = MainContext.UserID;
                        visaORM.ObjectStateManager.ChangeObjectState(modelSend, System.Data.EntityState.Modified);
                    }
                }
            }
            visaORM.SaveChanges();

            MessageBox.Show("审核成功");

            InitData();
        }
Beispiel #11
0
        /// <summary>
        /// 提交签证
        /// </summary>
        void submitVisa()
        {
            try
            {
                var modelCollection = visaORM.Customer.Where(c => c.FSysPut == false && c.FCreateUser == MainContext.UserID && c.FsysZF != true && c.FStopSend != true);


                string todayStringShort = DateTime.Now.ToString("yyMMdd");
                string todayStringAll   = DateTime.Now.ToShortDateString();

                string NoSeq = "001";

                var lastSeqModelList = visaORM.TB_TableSubmit.Where(s => s.FCDate == todayStringShort).OrderByDescending(s => s.FID).Take(1);
                if (lastSeqModelList != null)
                {
                    foreach (TB_TableSubmit lastSeqModel in lastSeqModelList)
                    {
                        string tempString = "00" + (Convert.ToInt32(lastSeqModel.FSubmitNo.Substring(lastSeqModel.FSubmitNo.Length - 3)) + 1).ToString();
                        NoSeq = tempString.Substring(tempString.Length - 3);
                        break;
                    }
                }


                foreach (var model in modelCollection)
                {
                    visaORM.Customer.Attach(model);
                    visaORM.ObjectStateManager.ChangeObjectState(model, System.Data.EntityState.Modified);
                    model.FSysPut     = true;
                    model.FSysPutDate = DateTime.Now;
                    model.FSysPutUser = MainContext.UserID;


                    var modelSubmit = new TB_TableSubmit();

                    modelSubmit.FCDate    = todayStringShort;
                    modelSubmit.FCompany  = MainContext.UserCompanyName;
                    modelSubmit.FSubmitNo = "TJ-" + todayStringShort + "-" + NoSeq;
                    modelSubmit.FAutoID   = model.FAutoID;
                    modelSubmit.FSysMemo  = txtSubmitMemo.Text;

                    modelSubmit.FCreateDate = DateTime.Now;
                    modelSubmit.FCreateUser = MainContext.UserID;
                    modelSubmit.FModifyDate = DateTime.Now;
                    modelSubmit.FModifyUser = MainContext.UserID;
                    modelSubmit.FStatus     = true;

                    visaORM.TB_TableSubmit.AddObject(modelSubmit);
                }
                visaORM.SaveChanges();

                newSubmitNo = "TJ-" + todayStringShort + "-" + NoSeq;

                MessageBox.Show("提交成功");
                if (System.Windows.MessageBox.Show("提交成功,是否打印表二", "保存成功", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    //printVisa();
                    (App.Current.Windows[1] as MainWindow).MainFrame.Navigate(new Report2(MainContext.UserCompanyName, newSubmitNo));
                }
                refreshSubmit();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log.WriteLog.WriteErorrLog(ex);
            }
        }
Beispiel #12
0
        /// <summary>
        /// 提交送审名单
        /// </summary>
        void SendList()
        {
            // var modelCollection = visaORM.Customer.Where(c => c.FSysPut == false);
            try
            {
                if (cbVietnamCompany.SelectedItem == null)
                {
                    MessageBox.Show("请先选择越南公司");
                    return;
                }

                string todayStringShort = DateTime.Now.ToString("yyMMdd");
                string todayStringAll   = DateTime.Now.ToShortDateString();

                string selectietnamCompany = cbVietnamCompany.SelectedItem.ToString();

                int orderNum = 1;

                foreach (var model in Sendoc)
                {
                    var BlackListObj = visaORM.CustomerT.FirstOrDefault(c => c.FPassportNo == model.FPassportNo);
                    if (BlackListObj != null)
                    {
                        if (MessageBox.Show(string.Format("护照号{0}是特殊人物,是否让其提交?", model.FPassportNo), "特殊人物确认", MessageBoxButton.YesNo) == MessageBoxResult.No)
                        {
                            continue;
                        }
                    }


                    if (model.FSysSend == true)
                    {
                        MessageBox.Show(" 此签证已经送审过,不能再次送审:" + model.FPassportNo);
                        continue;
                    }



                    //visaORM.Customer.Attach(model);
                    Customer modelC = visaORM.Customer.FirstOrDefault(c => c.FID == model.FID);
                    if (modelC == null)
                    {
                        MessageBox.Show("该签证不存在或者已经被删除:" + model.FPassportNo);
                        continue;
                    }
                    visaORM.ObjectStateManager.ChangeObjectState(modelC, System.Data.EntityState.Modified);
                    modelC.FSysSend     = true;
                    modelC.FSysSendDate = DateTime.Now;
                    modelC.FSysSendUser = MainContext.UserID;
                    modelC.FYNCom       = selectietnamCompany;


                    var modelSend = new SendInfo();



                    modelSend.FCustomerID     = model.FID;
                    modelSend.FQZID           = model.FQZID;
                    modelSend.FSendDate       = modelC.FSysSendDate;
                    modelSend.FDSN            = txtDSN.Text;
                    modelSend.FVietnamCompany = selectietnamCompany;
                    modelSend.FCreateCompany  = MainContext.UserCompanyName;
                    modelSend.FSendNo         = modelSend.FDSN;
                    modelSend.FOrder          = orderNum;
                    modelSend.FCDate          = todayStringShort;
                    modelSend.FSysPrintNum    = 0;

                    modelSend.FCreateDate = DateTime.Now;
                    modelSend.FCreateUser = MainContext.UserID;
                    modelSend.FModifyDate = DateTime.Now;
                    modelSend.FModifyUser = MainContext.UserID;
                    modelSend.FStatus     = true;


                    modelSend.FSysSend     = true;
                    modelSend.FSysSendDate = modelC.FSysSendDate;
                    modelSend.FSysSendUser = 1;

                    modelSend.FSysChk   = false;
                    modelSend.FSysPrint = false;

                    visaORM.SendInfo.AddObject(modelSend);

                    orderNum++;
                }
                visaORM.SaveChanges();

                Sendoc.Clear();
                MessageBox.Show("送审成功");

                //重新初始化DSN下拉
                InitSendComboBox();
                this.sendNoString = txtDSN.Text;
                //cbListSend.SelectedItem = txtDSN.Text;
                //导出
                exportList();
                //((TableView)gridMain.View).Print();

                //越南公司清空
                this.cbVietnamCompany.SelectedIndex = -1;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log.WriteLog.WriteErorrLog(ex);
            }
        }