public FormDepartment(AccessDataBase.Model.DepartmentInfo modelDepartmentInfo, OpenMode openMode)
        {
            InitializeComponent();
            InitComboBoxCompany();

            this.CenterToScreen();
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon            = GetResourcesFile.getSystemIco();

            this.modelDepartmentInfo = modelDepartmentInfo;
            this.openMode            = openMode;

            if (openMode == OpenMode.Add)
            {
                kryptonTextBoxDepartmentID.Text = modelDepartmentInfo.DepartmentID.ToString();
            }
            else if (openMode == OpenMode.Update)
            {
                string companyName = modelDepartmentInfo.CompanyName;//.CompanyID.HasValue?modelDepartmentInfo.CompanyID.Value:0;
                modelCompanyInfo = bllCompanyInfo.GetModelList("CompanyName = '" + companyName + "'")[0];

                kryptonTextBoxDepartmentID.Text   = modelDepartmentInfo.DepartmentID.ToString();
                kryptonComboBoxCompany.Text       = modelCompanyInfo.CompanyName.ToString();
                kryptonTextBoxDepartmentName.Text = modelDepartmentInfo.DepartmentName.ToString();
                kryptonTextBoxDepartmentTel1.Text = modelDepartmentInfo.DepartmentTel1.ToString();
                kryptonTextBoxDepartmentTel2.Text = modelDepartmentInfo.DepartmentTel2.ToString();
                kryptonTextBoxDepartmentDes.Text  = modelDepartmentInfo.DepartmentDes.ToString();
            }
        }
        public FormDepartment(AccessDataBase.Model.DepartmentInfo modelDepartmentInfo, OpenMode openMode)
        {
            InitializeComponent();
            InitComboBoxCompany();

            this.CenterToScreen();
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = GetResourcesFile.getSystemIco();

            this.modelDepartmentInfo = modelDepartmentInfo;
            this.openMode = openMode;

            if (openMode == OpenMode.Add)
            {
                kryptonTextBoxDepartmentID.Text = modelDepartmentInfo.DepartmentID.ToString();
            }
            else if (openMode == OpenMode.Update)
            {
                string companyName = modelDepartmentInfo.CompanyName;//.CompanyID.HasValue?modelDepartmentInfo.CompanyID.Value:0;
                modelCompanyInfo = bllCompanyInfo.GetModelList("CompanyName = '" + companyName + "'")[0];

                kryptonTextBoxDepartmentID.Text = modelDepartmentInfo.DepartmentID.ToString();
                kryptonComboBoxCompany.Text = modelCompanyInfo.CompanyName.ToString() ;
                kryptonTextBoxDepartmentName.Text = modelDepartmentInfo.DepartmentName.ToString();
                kryptonTextBoxDepartmentTel1.Text = modelDepartmentInfo.DepartmentTel1.ToString();
                kryptonTextBoxDepartmentTel2.Text = modelDepartmentInfo.DepartmentTel2.ToString();
                kryptonTextBoxDepartmentDes.Text = modelDepartmentInfo.DepartmentDes.ToString();
            }
        }
        public FormCompany(AccessDataBase.Model.CompanyInfo companyInfo, OpenMode openMode)
        {
            InitializeComponent();

            this.CenterToScreen();
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon            = GetResourcesFile.getSystemIco();

            this.modelCompanyInfo = companyInfo;
            this.openMode         = openMode;

            if (openMode == OpenMode.Add)
            {
                kryptonTextBoxCompanyID.Text = companyInfo.CompanyID.ToString();
            }
            else if (openMode == OpenMode.Update)
            {
                kryptonTextBoxCompanyID.Text   = companyInfo.CompanyID.ToString();
                kryptonTextBoxCompanyName.Text = companyInfo.CompanyName.ToString();
                kryptonTextBoxCompanyDes.Text  = companyInfo.CompanyDes.ToString();
                kryptonTextBoxCompanyAddr.Text = companyInfo.CompanyAddress.ToString();
                kryptonTextBoxTelPhone1.Text   = companyInfo.CompanyTel1.ToString();
                kryptonTextBoxTelPhone2.Text   = companyInfo.CompanyTel2.ToString();
            }
        }
        public FormCompany(AccessDataBase.Model.CompanyInfo companyInfo, OpenMode openMode)
        {
            InitializeComponent();

            this.CenterToScreen();
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = GetResourcesFile.getSystemIco();

            this.modelCompanyInfo = companyInfo;
            this.openMode = openMode;

            if (openMode == OpenMode.Add)
            {
                kryptonTextBoxCompanyID.Text = companyInfo.CompanyID.ToString();
            }
            else if (openMode == OpenMode.Update)
            {
                kryptonTextBoxCompanyID.Text = companyInfo.CompanyID.ToString();
                kryptonTextBoxCompanyName.Text = companyInfo.CompanyName.ToString();
                kryptonTextBoxCompanyDes.Text = companyInfo.CompanyDes.ToString();
                kryptonTextBoxCompanyAddr.Text = companyInfo.CompanyAddress.ToString();
                kryptonTextBoxTelPhone1.Text = companyInfo.CompanyTel1.ToString();
                kryptonTextBoxTelPhone2.Text = companyInfo.CompanyTel2.ToString();
            }
        }
        private void toolStripButtonAddCompanyInfo_Click(object sender, EventArgs e)
        {
            AccessDataBase.Model.CompanyInfo modeCompanyInfo = new AccessDataBase.Model.CompanyInfo();
            AccessDataBase.BLL.CompanyInfo   bllCompanyInfo  = new AccessDataBase.BLL.CompanyInfo();

            modeCompanyInfo.CompanyID = bllCompanyInfo.GetMaxId();

            FormCompany formCompany = new FormCompany(modeCompanyInfo, OpenMode.Add);

            formCompany.ShowDialog();
            this.refreshDataGridView();
        }
        private void toolStripButtonUpdateCompanyInfo_Click(object sender, EventArgs e)
        {
            if (kryptonDataGridViewCompany.CurrentRow == null)
            {
                return;
            }

            AccessDataBase.BLL.CompanyInfo bllCompanyInfo = new AccessDataBase.BLL.CompanyInfo();

            int    selectIndex = kryptonDataGridViewCompany.CurrentRow.Index;
            string companyID   = kryptonDataGridViewCompany["CompanyID", selectIndex].Value.ToString().Trim();

            AccessDataBase.Model.CompanyInfo modeCompanyInfo = bllCompanyInfo.GetModel(int.Parse(companyID));

            FormCompany formCompany = new FormCompany(modeCompanyInfo, OpenMode.Update);

            formCompany.ShowDialog();

            this.refreshDataGridView();
        }
        /// <summary>
        /// 显示更新参数
        /// </summary>
        private void showUpdatePara()
        {
            #region 基本信息
            kryptonTextBoxUserID.Text   = modelUserInfo.UserID.ToString();
            kryptonTextBoxUserName.Text = modelUserInfo.UserName.ToString();
            #endregion

            #region 个人信息
            int departmentID = modelUserInfo.DepartmentID.HasValue ? modelUserInfo.DepartmentID.Value : 0;
            modelDepartmentInfo = bllDepartmentInfo.GetModel(departmentID);
            kryptonComboBoxDepartment.SelectedText = modelDepartmentInfo.DepartmentName;

            modelCompanyInfo = bllCompanyInfo.GetModelList("CompanyName='" + modelDepartmentInfo.CompanyName + "'")[0];
            kryptonComboBoxCompany.SelectedText = modelCompanyInfo.CompanyName;

            #endregion

            #region 卡片信息1
            if (!string.IsNullOrEmpty(modelUserInfo.PrimaryCardID.Trim()))
            {
                modelCardInfo1 = bllCardInfo.GetModel(modelUserInfo.PrimaryCardID.Trim());
            }
            if (modelCardInfo1 != null)
            {
                kryptonTextBoxCardID1.Text      = modelUserInfo.PrimaryCardID;
                kryptonTextBoxCardVersion1.Text = modelCardInfo1.CardVersion != null?modelCardInfo1.CardVersion.Trim() : "";

                kryptonTextBoxCardType1.Text  = (modelCardInfo1.CardType.HasValue ?modelCardInfo1.CardType.Value: 0).ToString();
                kryptonTextBoxCardLevel1.Text = modelCardInfo1.CardLevel != null?modelCardInfo1.CardLevel.Trim() : "";

                kryptonTextBoxCardPassword1.Text = modelCardInfo1.CardPassword != null?modelCardInfo1.CardPassword.Trim() : "";

                if (RegexMatch.IsDate(modelCardInfo1.CardIssueDateTime))
                {
                    kryptonDateTimePickerCardIssueDateTime1.Value = Convert.ToDateTime(modelCardInfo1.CardIssueDateTime);
                }
                if (RegexMatch.IsDate(modelCardInfo1.CardValidDateTime))
                {
                    kryptonDateTimePickerCardValidDateTime1.Value = Convert.ToDateTime(modelCardInfo1.CardValidDateTime);
                }
            }
            #endregion

            #region 卡片信息2
            if (!string.IsNullOrEmpty(modelUserInfo.SecondCardID.Trim()))
            {
                modelCardInfo2 = bllCardInfo.GetModel(modelUserInfo.SecondCardID.Trim());
            }
            if (modelCardInfo2 != null)
            {
                kryptonTextBoxCardID2.Text      = modelUserInfo.SecondCardID;
                kryptonTextBoxCardVersion2.Text = modelCardInfo2.CardVersion != null?modelCardInfo2.CardVersion.Trim() : "";

                kryptonTextBoxCardType2.Text  = (modelCardInfo2.CardType.HasValue ? modelCardInfo2.CardType.Value : 0).ToString();
                kryptonTextBoxCardLevel2.Text = modelCardInfo2.CardLevel != null?modelCardInfo2.CardLevel.Trim() : "";

                kryptonTextBoxCardPassword2.Text = modelCardInfo2.CardPassword != null?modelCardInfo2.CardPassword.Trim() : "";

                if (RegexMatch.IsDate(modelCardInfo2.CardIssueDateTime))
                {
                    kryptonDateTimePickerCardIssueDateTime2.Value = Convert.ToDateTime(modelCardInfo2.CardIssueDateTime);
                }
                if (RegexMatch.IsDate(modelCardInfo2.CardValidDateTime))
                {
                    kryptonDateTimePickerCardValidDateTime2.Value = Convert.ToDateTime(modelCardInfo2.CardValidDateTime);
                }
            }
            #endregion

            #region 生物信息
            pictureBoxPhotograph.Image   = MyImageOperate.getImageByByte(modelUserInfo.Photograph);
            pictureBoxFingerPrint1.Image = MyImageOperate.getImageByByte(modelUserInfo.FingerPrint0);
            pictureBoxFingerPrint2.Image = MyImageOperate.getImageByByte(modelUserInfo.FingerPrint1);
            #endregion
        }
        /// <summary>
        /// ��ʾ���²���
        /// </summary>
        private void showUpdatePara()
        {
            #region ������Ϣ
            kryptonTextBoxUserID.Text = modelUserInfo.UserID.ToString();
            kryptonTextBoxUserName.Text = modelUserInfo.UserName.ToString();
            #endregion

            #region ������Ϣ
            int departmentID = modelUserInfo.DepartmentID.HasValue ? modelUserInfo.DepartmentID.Value : 0;
            modelDepartmentInfo = bllDepartmentInfo.GetModel(departmentID);
            kryptonComboBoxDepartment.SelectedText = modelDepartmentInfo.DepartmentName;

            modelCompanyInfo = bllCompanyInfo.GetModelList("CompanyName='" + modelDepartmentInfo.CompanyName + "'")[0];
            kryptonComboBoxCompany.SelectedText = modelCompanyInfo.CompanyName;

            #endregion

            #region ��Ƭ��Ϣ1
            if (!string.IsNullOrEmpty(modelUserInfo.PrimaryCardID.Trim()))
                modelCardInfo1 = bllCardInfo.GetModel(modelUserInfo.PrimaryCardID.Trim());
            if (modelCardInfo1 != null)
            {
                kryptonTextBoxCardID1.Text = modelUserInfo.PrimaryCardID;
                kryptonTextBoxCardVersion1.Text = modelCardInfo1.CardVersion != null ? modelCardInfo1.CardVersion.Trim() :"";
                kryptonTextBoxCardType1.Text = (modelCardInfo1.CardType.HasValue ?modelCardInfo1.CardType.Value: 0).ToString()  ;
                kryptonTextBoxCardLevel1.Text = modelCardInfo1.CardLevel != null ? modelCardInfo1.CardLevel.Trim() : "";
                kryptonTextBoxCardPassword1.Text = modelCardInfo1.CardPassword != null ? modelCardInfo1.CardPassword.Trim() : "";
                if (RegexMatch.IsDate(modelCardInfo1.CardIssueDateTime))
                    kryptonDateTimePickerCardIssueDateTime1.Value = Convert.ToDateTime(modelCardInfo1.CardIssueDateTime);
                if (RegexMatch.IsDate(modelCardInfo1.CardValidDateTime))
                kryptonDateTimePickerCardValidDateTime1.Value = Convert.ToDateTime(modelCardInfo1.CardValidDateTime);

            }
            #endregion

            #region ��Ƭ��Ϣ2
            if (!string.IsNullOrEmpty(modelUserInfo.SecondCardID.Trim()))
                modelCardInfo2 = bllCardInfo.GetModel(modelUserInfo.SecondCardID.Trim());
            if (modelCardInfo2 != null)
            {
                kryptonTextBoxCardID2.Text = modelUserInfo.SecondCardID;
                kryptonTextBoxCardVersion2.Text = modelCardInfo2.CardVersion != null ? modelCardInfo2.CardVersion.Trim() : "";
                kryptonTextBoxCardType2.Text = (modelCardInfo2.CardType.HasValue ? modelCardInfo2.CardType.Value : 0).ToString();
                kryptonTextBoxCardLevel2.Text = modelCardInfo2.CardLevel != null ? modelCardInfo2.CardLevel.Trim() : "";
                kryptonTextBoxCardPassword2.Text = modelCardInfo2.CardPassword != null ? modelCardInfo2.CardPassword.Trim() : "";
                if (RegexMatch.IsDate(modelCardInfo2.CardIssueDateTime))
                    kryptonDateTimePickerCardIssueDateTime2.Value = Convert.ToDateTime(modelCardInfo2.CardIssueDateTime);
                if (RegexMatch.IsDate(modelCardInfo2.CardValidDateTime))
                    kryptonDateTimePickerCardValidDateTime2.Value = Convert.ToDateTime(modelCardInfo2.CardValidDateTime);

            }
            #endregion

            #region ������Ϣ
            pictureBoxPhotograph.Image = MyImageOperate.getImageByByte(modelUserInfo.Photograph);
            pictureBoxFingerPrint1.Image = MyImageOperate.getImageByByte(modelUserInfo.FingerPrint0);
            pictureBoxFingerPrint2.Image = MyImageOperate.getImageByByte(modelUserInfo.FingerPrint1);
            #endregion
        }