Esempio n. 1
0
        public Report1()
        {
            InitializeComponent();

            cc = visaORM.Customer.FirstOrDefault(c => c.FID == 1);

            InitData();
            //DataContext = this;
            //VisaEdit ReportModel = new VisaEdit();
        }
Esempio n. 2
0
        /// <summary>
        /// 保存签证号
        /// </summary>
        void saveQZID()
        {
            try
            {
                this.MainBar.Focus();

                if (sendCollection.Count() == 0)
                {
                    MessageBox.Show("没有签证");
                    return;
                }

                foreach (var SendModel in sendCollection)
                {
                    if (string.IsNullOrEmpty(SendModel.FQZID))
                    {
                        if (QZIDnum == "" || QZIDstring == "")
                        {
                            MessageBox.Show("请先设置起始签证号码");
                            return;
                        }
                    }
                }

                string QZID = "";

                SendInfo sObj = new SendInfo();
                Customer cObj = new Customer();
                QZKC QZNOObj = new QZKC();

                int i = 0;
                if (!string.IsNullOrEmpty(QZIDnum))
                    i = Convert.ToInt32(QZIDnum);

                foreach (var SendModel in sendCollection)
                {
                    cObj = visaORM.Customer.FirstOrDefault(c => c.FID == SendModel.QID);
                    if (cObj != null)
                    {
                        if (string.IsNullOrEmpty(cObj.FQZID)) //如果没有签证号,就保存签证号
                        {

                            if (!string.IsNullOrEmpty(SendModel.FQZID))
                                QZID = SendModel.FQZID;
                            else
                                QZID = GetVisaNumberString(QZIDstring, i.ToString().Length, ref i);

                            QZNOObj = visaORM.QZKC.FirstOrDefault(q => q.FIsUse == false && q.FQZID == QZID);
                            if (QZNOObj == null)
                            {
                                MessageBox.Show(string.Format("签证号码{0}已经被使用或不存在,请添加或使用其他起始号码", QZID));
                                return;
                            }
                            cObj.FQZID = QZNOObj.FQZID;
                            QZNOObj.FIsUse = true;

                            sObj = visaORM.SendInfo.FirstOrDefault(s => s.FCustomerID == cObj.FID);

                            if (sObj != null) sObj.FQZID = QZNOObj.FQZID;

                            visaORM.ObjectStateManager.ChangeObjectState(sObj, System.Data.EntityState.Modified);
                            visaORM.ObjectStateManager.ChangeObjectState(cObj, System.Data.EntityState.Modified);
                            visaORM.ObjectStateManager.ChangeObjectState(QZNOObj, System.Data.EntityState.Modified);
                            visaORM.SaveChanges();
                            i++;
                        }
                        else //如果已有签证号,提示是否覆盖
                        {
                            if (
                                System.Windows.MessageBox.Show(
                                    string.Format("护照号为{0}已存在签证号(可能是上一次录入或者本次手动录入),是否覆盖当前号码?", SendModel.PID), "已存在签证号",
                                    MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                            {
                                //更新表一的签证号码
                                cObj.FQZID = SendModel.FQZID;

                                //更新签证号码表中的使用情况
                                QZNOObj = visaORM.QZKC.FirstOrDefault(q => q.FIsUse == false && q.FQZID == SendModel.FQZID);
                                if (QZNOObj == null)
                                {
                                    MessageBox.Show(string.Format("签证号码{0}已经被使用或不存在,请添加或使用其他起始号码", SendModel.FQZID));
                                    return;
                                }
                                cObj.FQZID = QZNOObj.FQZID;
                                QZNOObj.FIsUse = true;

                                //更新表三的签证号码
                                sObj = visaORM.SendInfo.FirstOrDefault(s => s.FCustomerID == cObj.FID);
                                if (sObj != null)
                                {
                                    sObj.FQZID = QZNOObj.FQZID;
                                    visaORM.ObjectStateManager.ChangeObjectState(sObj, System.Data.EntityState.Modified);
                                }
                                visaORM.ObjectStateManager.ChangeObjectState(cObj, System.Data.EntityState.Modified);
                                visaORM.ObjectStateManager.ChangeObjectState(QZNOObj, System.Data.EntityState.Modified);
                                visaORM.SaveChanges();
                            }
                        }

                    }

                }

                MessageBox.Show("保存成功");
                if (System.Windows.MessageBox.Show("保存签证成功,是否继续打印表四", "保存成功", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    printTable4();
                }
                //保存时设置为保存为已打印
                SaveSysPrint();
                //初始化未打印的名单列表
                InitNotPrintSource(false);
                sendCollection.Clear();
                cbNotPrint.EditValue = "";

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

            }
        }
Esempio n. 3
0
 /// <summary>
 /// 创建新的 Customer 对象。
 /// </summary>
 /// <param name="fID">FID 属性的初始值。</param>
 public static Customer CreateCustomer(global::System.Int32 fID)
 {
     Customer customer = new Customer();
     customer.FID = fID;
     return customer;
 }
Esempio n. 4
0
 /// <summary>
 /// 用于向 Customer EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToCustomer(Customer customer)
 {
     base.AddObject("Customer", customer);
 }
Esempio n. 5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (txtVisaExcelPath.Text == "")
            {
                textBox.AppendText("请先上传excel文件。");
                return;
            }

            try
            {
                string sheetname = "Sheet1";
                string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + txtVisaExcelPath.Text + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1';";
                OleDbConnection conn = new OleDbConnection(strConn);
                OleDbDataAdapter oada = new OleDbDataAdapter("select * from [" + sheetname + "$]", conn);
                DataSet ds = new DataSet();
                oada.Fill(ds);

                DateTimeFormatInfo dtFormat = new System.Globalization.DateTimeFormatInfo();
                dtFormat.ShortDatePattern = "dd/MM/yyyy";

                DataTable dt = ds.Tables[0];

                int rowIndex = 1;
                int sss = 0;
                int bbb = 0;
                int count = 0;

                textBox.AppendText("开始导入数据。");

                foreach (DataRow dr in dt.Rows)
                {

                    try
                    {
                        var model = new Customer();

                        visaORM.Customer.AddObject(model);

                        //model.FQZID = dr[0].ToString();
                        #region Name
                        string Name = dr[1].ToString();
                        if (String.IsNullOrEmpty(Name))
                        {
                            throw new Exception("“姓名”不能为空。");
                        }
                        #endregion
                        #region NameEn
                        string NameEn = dr[2].ToString();
                        if (String.IsNullOrEmpty(NameEn))
                        {
                            throw new Exception("“Name”不能为空。");
                        }
                        #endregion
                        #region BirthDay
                        string sBirthDay = dr[3].ToString();
                        DateTime BirthDay;
                        if (String.IsNullOrEmpty(sBirthDay))
                        {
                            throw new Exception("“出生日期”不能为空。");
                        }
                        else
                        {
                            try
                            {
                                BirthDay = Convert.ToDateTime(sBirthDay, dtFormat);
                            }
                            catch
                            {
                                throw new Exception("“出生日期”格式不正确。");
                            }
                        }
                        #endregion

                        #region Sex
                        string Sex = dr[4].ToString();

                        if (Sex != "男" && Sex != "女")
                            throw new Exception("“性别”格式不正确。");
                        #endregion

                        #region BirthPlace
                        string BirthPlace = dr[5].ToString();
                        if (String.IsNullOrEmpty(BirthPlace))
                        {
                            throw new Exception("“出生地点”不能为空。");
                        }
                        #endregion
                        #region BirthPlaceEn
                        string BirthPlaceEn = dr[6].ToString();
                        if (String.IsNullOrEmpty(BirthPlaceEn))
                        {
                            throw new Exception("“Place of birth”不能为空。");
                        }

                        #endregion
                        #region BirthNationlity
                        string BirthNationlity = dr[7].ToString();
                        if (String.IsNullOrEmpty(BirthNationlity))
                        {
                            throw new Exception("“原国籍”不能为空。");
                        }
                        #endregion
                        #region BirthNationlityEn
                        string BirthNationlityEn = dr[8].ToString();
                        if (String.IsNullOrEmpty(BirthNationlityEn))
                        {
                            throw new Exception("“Nationality at birth”不能为空。");
                        }
                        #endregion
                        #region BirthNationlityPresent
                        string BirthNationlityPresent = dr[9].ToString();
                        if (String.IsNullOrEmpty(BirthNationlityPresent))
                        {
                            throw new Exception("“现国籍”不能为空。");
                        }
                        #endregion
                        #region BirthNationlityPresentEn
                        string BirthNationlityPresentEn = dr[10].ToString();
                        if (String.IsNullOrEmpty(BirthNationlityPresentEn))
                        {
                            throw new Exception("“Present Nationality”不能为空。");
                        }
                        #endregion

                        #region PassportNo
                        string PassportNo = dr[11].ToString();
                        if (String.IsNullOrEmpty(PassportNo))
                        {
                            throw new Exception("“护照号码”不能为空。");
                        }
                        #endregion
                        #region PassportType
                        string PassportType = dr[12].ToString();
                        if (String.IsNullOrEmpty(PassportType))
                        {
                            throw new Exception("“护照类型”不能为空。");
                        }
                        #endregion
                        #region PassportMake
                        string PassportMake = dr[13].ToString();
                        if (String.IsNullOrEmpty(PassportMake))
                        {
                            throw new Exception("“发照机关”不能为空。");
                        }
                        #endregion
                        #region PassportMakeDate
                        string sPassportMakeDate = dr[14].ToString();
                        DateTime PassportMakeDate;
                        if (String.IsNullOrEmpty(sPassportMakeDate))
                        {
                            throw new Exception("“发照日期”不能为空。");
                        }
                        else
                        {
                            try
                            {
                                PassportMakeDate = Convert.ToDateTime(sPassportMakeDate, dtFormat);
                            }
                            catch
                            {
                                throw new Exception("“发照日期”格式不正确。");
                            }
                        }
                        #endregion
                        #region PassportValidDate
                        string sPassportValidDate = dr[15].ToString();
                        DateTime PassportValidDate;
                        if (String.IsNullOrEmpty(sPassportValidDate))
                        {
                            throw new Exception("“护照有效期”不能为空。");
                        }
                        else
                        {
                            try
                            {
                                PassportValidDate = Convert.ToDateTime(sPassportValidDate, dtFormat);
                            }
                            catch
                            {
                                throw new Exception("“护照有效期”格式不正确。");
                            }
                        }
                        #endregion

                        #region ProfessionWork
                        string ProfessionWork = dr[16].ToString();
                        #endregion
                        #region ProfessionCompany
                        string ProfessionCompany = dr[17].ToString();
                        #endregion
                        #region ProfessionTele
                        string ProfessionTele = dr[18].ToString();
                        #endregion
                        #region AddressNow
                        string AddressNow = dr[19].ToString();
                        #endregion
                        #region AddressTele
                        string AddressTele = dr[20].ToString();
                        #endregion
                        #region ChildrenName1
                        string ChildrenName1 = dr[21].ToString();
                        #endregion
                        #region ChildrenBirthDay1
                        string sChildrenBirthDay1 = dr[22].ToString();
                        DateTime? ChildrenBirthDay1;
                        if (String.IsNullOrEmpty(sChildrenBirthDay1))
                        {
                            ChildrenBirthDay1 = null;
                        }
                        else
                        {
                            try
                            {
                                ChildrenBirthDay1 = Convert.ToDateTime(sChildrenBirthDay1, dtFormat);
                            }
                            catch
                            {
                                ChildrenBirthDay1 = null;
                            }
                        }
                        #endregion
                        #region ChildrenBirthLink1
                        string ChildrenBirthLink1 = dr[23].ToString();
                        #endregion
                        #region ChildrenName2
                        string ChildrenName2 = dr[24].ToString();
                        #endregion
                        #region ChildrenBirthDay2
                        string sChildrenBirthDay2 = dr[25].ToString();
                        DateTime? ChildrenBirthDay2;
                        if (String.IsNullOrEmpty(sChildrenBirthDay2))
                        {
                            ChildrenBirthDay2 = null;
                        }
                        else
                        {
                            try
                            {
                                ChildrenBirthDay2 = Convert.ToDateTime(sChildrenBirthDay2, dtFormat);
                            }
                            catch
                            {
                                ChildrenBirthDay2 = null;
                            }
                        }
                        #endregion
                        #region ChildrenBirthLink2
                        string ChildrenBirthLink2 = dr[26].ToString();
                        #endregion
                        #region ChildrenName3
                        string ChildrenName3 = dr[27].ToString();
                        #endregion
                        #region ChildBirthDay3
                        string sChildrenBirthDay3 = dr[28].ToString();
                        DateTime? ChildrenBirthDay3;
                        if (String.IsNullOrEmpty(sChildrenBirthDay3))
                        {
                            ChildrenBirthDay3 = null;
                        }
                        else
                        {
                            try
                            {
                                ChildrenBirthDay3 = Convert.ToDateTime(sChildrenBirthDay3, dtFormat);
                            }
                            catch
                            {
                                ChildrenBirthDay3 = null;
                            }
                        }
                        #endregion
                        #region ChildrenBirthLink3
                        string ChildrenBirthLink3 = dr[29].ToString();
                        #endregion
                        #region Purpose
                        string Purpose = dr[30].ToString();
                        if (String.IsNullOrEmpty(Purpose))
                        {
                            throw new Exception("“出境目的”不能为空。");
                        }
                        #endregion

                        #region VisitCompany
                        string VisitCompany = dr[31].ToString();
                        #endregion
                        #region VisitnamName
                        string VisitnamName = dr[32].ToString();
                        #endregion
                        #region VisitnamAddress
                        string VisitnamAddress = dr[33].ToString();
                        #endregion
                        #region DurationBegin
                        string sDurationBegin = dr[34].ToString();
                        DateTime DurationBegin;
                        if (String.IsNullOrEmpty(sDurationBegin))
                        {
                            throw new Exception("“预计出入境开始日期”不能为空。");
                        }
                        else
                        {
                            try
                            {
                                DurationBegin = Convert.ToDateTime(sDurationBegin, dtFormat);
                            }
                            catch
                            {
                                throw new Exception("“预计出入境开始日期”格式不正确。");
                            }
                        }
                        #endregion
                        #region DurationEnd
                        string sDurationEnd = dr[35].ToString();
                        DateTime DurationEnd;
                        if (String.IsNullOrEmpty(sDurationEnd))
                        {
                            throw new Exception("“预计出入境结束日期”不能为空。");
                        }
                        else
                        {
                            try
                            {
                                DurationEnd = Convert.ToDateTime(sDurationEnd, dtFormat);
                            }
                            catch
                            {
                                throw new Exception("“预计出入境结束日期”格式不正确。");
                            }
                        }
                        #endregion
                        #region DurationDay
                        int DurationDay;
                        try
                        {
                            switch (Convert.ToInt32(dr[36].ToString()))
                            {
                                case 1:
                                    DurationDay = 1;
                                    break;
                                case 3:
                                    DurationDay = 2;
                                    break;
                                case 6:
                                    DurationDay = 3;
                                    break;
                                case 12:
                                    DurationDay = 4;
                                    break;
                                case 24:
                                    DurationDay = 5;
                                    break;
                                case 36:
                                    DurationDay = 6;
                                    break;
                                case 48:
                                    DurationDay = 7;
                                    break;
                                case 60:
                                    DurationDay = 8;
                                    break;
                                default:
                                    DurationDay = 1;
                                    break;
                            }
                        }
                        catch
                        {
                            throw new Exception("“在国外停留时间”格式不正确。");
                        }
                        #endregion
                        #region Times
                        int Times;
                        try
                        {
                            Times = dr[37].ToString() == "1" ? 1 : 2;
                        }
                        catch
                        {
                            throw new Exception("“出入境次数”格式不正确。");
                        }
                        #endregion
                        #region SpeedType
                        int SpeedType;
                        try
                        {
                            SpeedType = dr[38].ToString() == "N-" ? 3 : dr[38].ToString() == "N+" ? 1 : 2;
                        }
                        catch
                        {
                            throw new Exception("“办理速度”格式不正确。");
                        }
                        #endregion
                        #region SysMemo
                        string SysMemo = dr[39].ToString();
                        #endregion

                        #region CreateDate
                        //string sCreateDate = dr[40].ToString();
                        //DateTime? CreateDate;
                        //if (String.IsNullOrEmpty(sCreateDate))
                        //{
                        //    CreateDate = null;
                        //}
                        //else
                        //{
                        //    try
                        //    {
                        //        CreateDate = Convert.ToDateTime(sCreateDate, dtFormat);
                        //    }
                        //    catch
                        //    {
                        //        CreateDate = null;
                        //    }
                        //}
                        #endregion
                        #region CreateCompany
                        string CreateCompany = dr[41].ToString();
                        if (String.IsNullOrEmpty(CreateCompany))
                        {
                            CreateCompany = MainContext.UserCompanyName;
                        }
                        #endregion
                        #region CreateUser
                        string CreateUser = dr[42].ToString();
                        #endregion

                        #region Check Data
                        if (CreateUser != MainContext.UserName)
                        {
                            throw new Exception("该签证数据不是由当前用户导出。");
                        }

                        if (PassportValidDate <= DurationEnd)
                        {
                            throw new Exception("“预计出入境结束日期(离开当地日期)”不在“护照有效期”内,不能保存数据。");
                        }
                        if (PassportMakeDate > DateTime.Today)
                        {
                            throw new Exception("“发证日期”大于今天,这是不允许的。");
                        }
                        if (DurationBegin < DateTime.Today)
                        {
                            throw new Exception("“预计出入境开始日期”不能小于今天。");
                        }
                        if (DurationEnd < DurationBegin)
                        {
                            throw new Exception("“预计出入境结束日期”不能小于“开始日期”。");
                        }

                        if (visaORM.CustomerT.FirstOrDefault(c => c.FPassportNo == PassportNo) != null)
                        {
                            throw new Exception("该护照在特殊人物数据中,不能保存。");
                        }

                        if (visaORM.Customer.FirstOrDefault(c => c.FPassportNo == PassportNo && c.FSysSend == false && c.FsysZF != true && c.FStopSend != true) != null)
                        {
                            throw new Exception("该护照已接受申请,正在办理中。");
                        }

                        if (visaORM.Customer.FirstOrDefault(c => c.FPassportNo == PassportNo && c.FsysZF != true && c.FStopSend != true && c.FDurationEnd > DateTime.Now) != null)
                        {
                            if (MessageBox.Show("该客户上一次签证尚未过期,是否确认保存?", "保存确认", MessageBoxButton.YesNo) == MessageBoxResult.No)
                            {
                                throw new Exception("次签证尚未过期,没有被允许通过。");
                            }

                        }

                        if (Purpose == "旅游" &&DurationDay > 2)
                        {
                            throw new Exception("该旅游最多只能停留3个月。");
                        }
                        if (Purpose == "企业" && DurationDay > 5)
                        {
                            throw new Exception("企业活动最多只能停留2年。");
                        }
                        if (Purpose == "劳务" && DurationDay > 6)
                        {
                            throw new Exception("劳务活动最多只能停留3年。");
                        }

                        //if (BirthDay.AddYears(80).Date < DateTime.Today)
                        //{
                        //    if (MessageBox.Show("此人年龄大约80岁,是否通过保存?\r\n(自动编号:" + ID + ",姓名:" + Name + ",护照号:" + PassportNo + ",出生日期:" + BirthDay.ToString("dd\\/MM\\/yyyy") + ")"
                        //        , Common.GetText("Tips"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        //    {
                        //        throw new Exception("此人年龄大约80岁,没有被允许通过。");
                        //    }
                        //}
                        //if (BirthDay.AddYears(4).Date > DateTime.Today)
                        //{
                        //    if (MessageBox.Show(Common.GetText("Send11AgeX"), Common.GetText("Tips"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        //    {
                        //        return;
                        //    }
                        //}

                        //if (!(String.IsNullOrEmpty(DataAccess.DaDDD.GetValue<String>("CustomerT", "'aaaa'", "PassportNo = '" + PassportNo + "' "))))
                        //{
                        //    if (MessageBox.Show("此签证申请人物已经被设置为了特殊人物,是否可以通过?\r\n(自动编号:" + ID + ",姓名:" + Name + ",护照号:" + PassportNo + ")"
                        //        , Common.GetText("Tips"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        //    {
                        //        throw new Exception("此签证申请人物已经被设置为了特殊人物,没有被允许通过。");
                        //    }
                        //}

                        //if (!(String.IsNullOrEmpty(DataAccess.DaDDD.GetValue<String>("Customer", "'aaaa'", "PassportNo = '" + PassportNo + "' and StopSend = 1 "))))
                        //{
                        //    if (MessageBox.Show("此签证申请使用的护照曾经被拒签过,是否可以通过?\r\n(自动编号:" + ID + ",姓名:" + Name + ",护照号:" + PassportNo + ")"
                        //        , Common.GetText("Tips"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        //    {
                        //        throw new Exception("此签证申请使用的护照曾经被拒签过,没有被允许通过。");
                        //    }
                        //    else
                        //    {
                        //        DataAccess.DaCheck.ResetCustomerStop1(PassportNo);
                        //    }
                        //}

                        //string tempstr2 = String.IsNullOrEmpty(ID) ? "" : ID;
                        //string tempstr1 = DataAccess.DaDDD.GetValue<String>("Customer", "ID"
                        //    , " ID != '" + tempstr2 + "' and PassportNo = '" + PassportNo + "' and isnull(SysZF,0) = 0 and StopSend = 0 and ( convert(char(10),DurationEnd,102) >= '" + DurationBegin.ToString("yyyy.MM.dd") + "' or convert(char(10),DurationEnd,102) >= '" + DateTime.Today.ToString("yyyy.MM.dd") + "') ");
                        //string tempstr3 = DataAccess.DaDDD.GetValue<String>("Customer", "ID"
                        //    , " ID != '" + tempstr2 + "' and PassportNo = '" + PassportNo + "' and isnull(SysZF,0) = 0 and StopSend = 0 and ( convert(char(10),DurationBegin,102) >= '" + DurationBegin.AddDays(-7).ToString("yyyy.MM.dd") + "' or convert(char(10),DurationBegin,102) >= '" + DateTime.Today.AddDays(-7).ToString("yyyy.MM.dd") + "') ");

                        //if (!(String.IsNullOrEmpty(tempstr3)))
                        //{
                        //    throw new Exception("此护照号已被自动编号为[" + tempstr3 + "]的签证使用,在签证出境开始日期一周内,不能重复使用护照。");
                        //}
                        //if (!(String.IsNullOrEmpty(tempstr1)))
                        //{
                        //    if (MessageBox.Show("此护照号已被自动编号为[" + tempstr1 + "]的签证使用,在签证有效期内出现重复使用护照,是否允许通过?", Common.GetText("Tips"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        //    {
                        //        throw new Exception("此护照号已被自动编号为[" + tempstr1 + "]的签证使用,在签证有效期内出现重复使用护照,没有被允许通过。");
                        //    }
                        //}
                        #endregion

                        model.FName = Name;
                        model.FNameEn = NameEn;
                        model.FBirthDay = BirthDay;
                        model.FSex = Sex;
                        model.FBirthPlace = BirthPlace;
                        model.FBirthPlaceEn = BirthPlaceEn;
                        model.FBirthNationlity = BirthNationlity;
                        model.FBirthNationlityEn = BirthNationlityEn;
                        model.FBirthNationlityPresent = BirthNationlityPresent;
                        model.FBirthNationlityPresentEn = BirthNationlityPresentEn;

                        model.FPassportNo = PassportNo;
                        model.FPassportType = PassportType;
                        model.FPassportMake = PassportMake;
                        model.FPassportMakeDate = PassportMakeDate;
                        model.FPassportValidDate = PassportValidDate;

                        model.FProfessionWork = ProfessionWork;
                        model.FProfessionCompany = ProfessionCompany;
                        model.FProfessionTele = ProfessionTele;
                        model.FAddressNow = AddressNow;
                        model.FAddressTele = AddressTele;

                        model.FChildrenName1 = ChildrenName1;
                        model.FChildrenBirthDay1 = ChildrenBirthDay1;
                        model.FChildrenBirthLink1 = ChildrenBirthLink1;
                        model.FChildrenName2 = ChildrenName2;
                        model.FChildrenBirthDay2 = ChildrenBirthDay2;
                        model.FChildrenBirthLink3 = ChildrenBirthLink2;
                        model.FChildrenName3 = ChildrenName3;
                        model.FChildrenBirthDay3 = ChildrenBirthDay3;
                        model.FChildrenBirthLink3 = ChildrenBirthLink3;

                        model.FPurpose = Purpose;
                        model.FVisitCompany = VisitCompany;
                        model.FVisitnamName = VisitnamName;
                        model.FVisitnamAddress = VisitnamAddress;
                        model.FDurationBegin = DurationBegin;
                        model.FDurationEnd = DurationEnd;
                        model.FDurationDay = DurationDay;
                        model.FTimes = Times;

                        model.FSpeedType = SpeedType;
                        model.FSysMemo = SysMemo;

                        model.FSysPut = false;
                        model.FSysSend = false;
                        model.FSysPrint = false;
                        model.FSysChk = false;
                        model.FSysSure = false;

                        model.FQZID = "";

                        model.FCreateCompany = CreateCompany;
                        model.FCreateDate = DateTime.Now;
                        model.FCreateUser = MainContext.UserID;
                        model.FModifyDate = DateTime.Now;
                        model.FModifyUser = MainContext.UserID;
                        model.FStopSend = false;
                        model.FsysZF = false;
                        model.FAutoID = GetAutoID(DateTime.Now.ToString("yyMMdd"), model.FDurationDay.ToString(), model.FTimes.ToString());

                        visaORM.SaveChanges();
                        sss++;
                        textBox.AppendText(String.Format("\r\n第{0}行数据导入成功。", count+1));
                    }
                    catch (Exception err)
                    {
                        bbb++;
                        textBox.AppendText(String.Format("\r\n第{0}行数据导入失败。--" + err.Message, count + 1));
                    }

                    count++;

                    textBox.AppendText(String.Format("\r\n导入完成,进行导入的数据有{0}条。导入成功{1}条,导入失败{2}条。", count, sss, bbb));

                }

                ds.Dispose();
                ds = null;
                oada.Dispose();
                oada = null;
                conn.Close();
                conn.Dispose();
                conn = null;

            }
            catch (Exception ex)
            {
                textBox.AppendText(ex.ToString());
            }
        }
Esempio n. 6
0
        private void CustomerAdd()
        {
            try
            {

                int selectPurpose = 0;
                string tempVisitCompany = "";
                string tempVisitnamName = "";
                string tempVisitnamAddress = "";
                int selectTimes = 0;
                int selectDuration = 0;
                DateTime? tempDurationBegin = DateTime.Now;
                DateTime? tempDurationEnd = DateTime.Now;
                int selectSpeedType = 0;

                string tempWorkTel = ""; //工作电话
                string tempWorkCompany = ""; //工作单位

                if (model != null)
                {
                    tempWorkTel = model.FProfessionTele;
                    tempWorkCompany = model.FProfessionCompany;
                }
                if (chbLock.IsChecked == true)
                {
                    selectPurpose = cbPurpose.SelectedIndex;
                    tempVisitCompany = this.model.FVisitCompany;
                    tempVisitnamName = this.model.FVisitnamName;
                    tempVisitnamAddress = this.model.FVisitnamAddress;
                    selectTimes = cbTimes.SelectedIndex;
                    selectDuration = cbDuration.SelectedIndex;
                    tempDurationBegin = this.model.FDurationBegin;
                    tempDurationEnd = this.model.FDurationEnd;
                    selectSpeedType = cbSpeedType.SelectedIndex;

                }
                this.model = new Customer();
                InitSelectValue();
                MainTab.DataContext = this.model;

                model.FProfessionCompany = tempWorkCompany;
                model.FProfessionTele = tempWorkTel;

                if (chbLock.IsChecked == true)
                {
                    cbPurpose.SelectedIndex = selectPurpose;
                    model.FVisitCompany = tempVisitCompany;
                    model.FVisitnamName = tempVisitnamName;
                    model.FVisitnamAddress = tempVisitnamAddress;
                    cbTimes.SelectedIndex = selectTimes;
                    cbDuration.SelectedIndex = selectDuration;
                    model.FDurationBegin = tempDurationBegin;
                    model.FDurationEnd = tempDurationEnd;
                    cbSpeedType.SelectedIndex = selectSpeedType;
                }

                model.FPassportType = "P";
                model.FSpeedType = 2;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log.WriteLog.WriteErorrLog(ex);

            }
        }
Esempio n. 7
0
 private void AddCustomerLocked(Customer model)
 {
 }
Esempio n. 8
0
        private void ReadPoo(string name)
        {
            string name1;
            string passportType;
            string nowCount;
            string nowCountEn;
            string passportNo;
            string brithCountry;
            string brithCountryEn;
            DateTime brithday;
            DateTime validday;
            string sex;
            string city;

            ReadPassport(name, out name1, out passportType, out nowCount, out nowCountEn, out passportNo, out brithCountry, out brithCountryEn, out brithday, out validday, out sex, out city);

            int selectPurpose = 0;
            string tempVisitCompany = "";
            string tempVisitnamName = "";
            string tempVisitnamAddress = "";
            int selectTimes = 0;
            int selectDuration = 0;
            DateTime? tempDurationBegin = DateTime.Now;
            DateTime? tempDurationEnd = DateTime.Now;
            int selectSpeedType = 0;

            if (chbLock.IsChecked == true)
            {
                selectPurpose = cbPurpose.SelectedIndex;
                tempVisitCompany = this.model.FVisitCompany;
                tempVisitnamName = this.model.FVisitnamName;
                tempVisitnamAddress = this.model.FVisitnamAddress;
                selectTimes = cbTimes.SelectedIndex;
                selectDuration = cbDuration.SelectedIndex;
                tempDurationBegin = this.model.FDurationBegin;
                tempDurationEnd = this.model.FDurationEnd;
                selectSpeedType = cbSpeedType.SelectedIndex;

            }
            model = new Customer();
            model.FPassportType = "P";
            model.FSpeedType = 2;
            InitSelectValue();

            MainTab.DataContext = model;

            if (chbLock.IsChecked == true)
            {
                cbPurpose.SelectedIndex = selectPurpose;
                model.FVisitCompany = tempVisitCompany;
                model.FVisitnamName = tempVisitnamName;
                model.FVisitnamAddress = tempVisitnamAddress;
                cbTimes.SelectedIndex = selectTimes;
                cbDuration.SelectedIndex = selectDuration;
                model.FDurationBegin = tempDurationBegin;
                model.FDurationEnd = tempDurationEnd;
                cbSpeedType.SelectedIndex = selectSpeedType;
            }

            if (!(String.IsNullOrEmpty(name1))) model.FName = name1;
            if (!(String.IsNullOrEmpty(name1))) model.FNameEn = name1;

            if (!(String.IsNullOrEmpty(passportType))) model.FPassportType = passportType;
            if (!(String.IsNullOrEmpty(passportNo))) model.FPassportNo = passportNo;
            if (!(String.IsNullOrEmpty(brithCountry))) model.FBirthNationlity = brithCountry;
            if (!(String.IsNullOrEmpty(brithCountryEn))) model.FBirthNationlityEn = brithCountryEn;
            if (!(String.IsNullOrEmpty(nowCount))) model.FBirthNationlityPresent = nowCount;
            if (!(String.IsNullOrEmpty(nowCountEn))) model.FBirthNationlityPresentEn = brithCountryEn;
            if (brithday != DateTime.MinValue) model.FBirthDay = brithday;
            if (validday != DateTime.MinValue)
            {
                model.FPassportValidDate = validday;
                if (validday >= new DateTime(2012, 1, 1))
                {
                    model.FPassportMakeDate = validday.AddYears(-10).AddDays(1);
                }
                else
                {
                    model.FPassportMakeDate = validday.AddYears(-5).AddDays(1);
                }
            }
            if (sex != "") model.FSex = sex;
            if (!(String.IsNullOrEmpty(city)))
            {
                model.FBirthPlace = city;
                model.FBirthPlaceEn = ChineseToPinYin.Convert(city == null ? "" : city);
            }
        }
Esempio n. 9
0
        private void LeftGrid_SelectedItemChanged(object sender, DevExpress.Xpf.Grid.SelectedItemChangedEventArgs e)
        {
            if (e.OldItem == null || e.NewItem == null)
                return;

            Customer custModel = e.NewItem as Customer;

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

            }
        }
Esempio n. 10
0
        private void LeftGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Customer custModel = LeftGrid.CurrentItem as Customer;

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

            }
        }