Ejemplo n.º 1
0
        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 DataSet GetUsersFromDB()
    {
        AccessDataBase reader      = new AccessDataBase();
        string         selectquery = "SELECT * FROM Registration";

        return(reader.readDB(selectquery));
    }
        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();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Check if the last day absence selected falls before the next absence already set
        /// </summary>
        /// <param name="employee">Employee (object) selected</param>
        /// <param name="firstDaySelected">First day selected in the DateTimePicker</param>
        /// <param name="lastDaySelected">Last day selected in the DateTimePicker</param>
        /// <returns>boolean (true if last day absence selected falls before the next absence already set, false if not)</returns>
        public bool LastDayIsBeforeNextAbsence(Employee employee,
                                               DateTime firstDaySelected,
                                               DateTime lastDaySelected)
        {
            DateTime firstDayNextAbsence = AccessDataBase.LastDayIsBeforeNextAbsence(employee, firstDaySelected);

            return(lastDaySelected < firstDayNextAbsence);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Check if the first day selected falls after the previous absence already set
        /// </summary>
        /// <param name="employee">Employee (object) selected</param>
        /// <param name="firstDaySelected">First day selected in the DateTimePicker</param>
        /// <returns>boolean (true if first day absence selected falls after the previous absence already set, false if not)</returns>
        public bool FirstDayIsAfterPreviousAbsence(Employee employee,
                                                   DateTime firstDaySelected
                                                   )
        {
            DateTime lastDayPreviousAbsence = AccessDataBase.FirstDayIsAfterPreviousAbsence(employee, firstDaySelected);

            return(lastDayPreviousAbsence < firstDaySelected);
        }
        public FormController(AccessDataBase.Model.ControllerInfo ModelControllerInfo, OpenMode openMode)
        {
            InitializeComponent();

            doorUnit1.KryptonButtonReaderAdd1.Click += KryptonButtonReaderAddClick1;
            doorUnit1.KryptonButtonReaderAdd2.Click += KryptonButtonReaderAddClick1;
            doorUnit1.KryptonButtonReaderUpdate1.Click += KryptonButtonReaderUpdateClick1;
            doorUnit1.KryptonButtonReaderUpdate2.Click += KryptonButtonReaderUpdateClick1;
            doorUnit1.KryptonCheckBoxReader1.CheckedChanged += KryptonCheckBoxReaderCheckedChanged1;
            doorUnit1.KryptonCheckBoxReader2.CheckedChanged += KryptonCheckBoxReaderCheckedChanged1;

            doorUnit2.KryptonButtonReaderAdd1.Click += KryptonButtonReaderAddClick1;
            doorUnit2.KryptonButtonReaderAdd2.Click += KryptonButtonReaderAddClick1;
            doorUnit2.KryptonButtonReaderUpdate1.Click += KryptonButtonReaderUpdateClick2;
            doorUnit2.KryptonButtonReaderUpdate2.Click += KryptonButtonReaderUpdateClick2;
            doorUnit2.KryptonCheckBoxReader1.CheckedChanged += KryptonCheckBoxReaderCheckedChanged2;
            doorUnit2.KryptonCheckBoxReader2.CheckedChanged += KryptonCheckBoxReaderCheckedChanged2;

            doorUnit3.KryptonButtonReaderAdd1.Click += KryptonButtonReaderAddClick1;
            doorUnit3.KryptonButtonReaderAdd2.Click += KryptonButtonReaderAddClick1;
            doorUnit3.KryptonButtonReaderUpdate1.Click += KryptonButtonReaderUpdateClick3;
            doorUnit3.KryptonButtonReaderUpdate2.Click += KryptonButtonReaderUpdateClick3;
            doorUnit3.KryptonCheckBoxReader1.CheckedChanged += KryptonCheckBoxReaderCheckedChanged3;
            doorUnit3.KryptonCheckBoxReader2.CheckedChanged += KryptonCheckBoxReaderCheckedChanged3;

            doorUnit4.KryptonButtonReaderAdd1.Click += KryptonButtonReaderAddClick4;
            doorUnit4.KryptonButtonReaderAdd2.Click += KryptonButtonReaderAddClick4;
            doorUnit4.KryptonButtonReaderUpdate1.Click += KryptonButtonReaderUpdateClick4;
            doorUnit4.KryptonButtonReaderUpdate2.Click += KryptonButtonReaderUpdateClick4;
            doorUnit4.KryptonCheckBoxReader1.CheckedChanged += KryptonCheckBoxReaderCheckedChanged4;
            doorUnit4.KryptonCheckBoxReader2.CheckedChanged += KryptonCheckBoxReaderCheckedChanged4;

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

            this.modelControllerInfo = ModelControllerInfo;
            this.openMode = openMode;
            for (int i = 0; i < 4;i++ )
                arrayDoorUnitInfo[i] = new AccessDataBase.Model.DoorUnitInfo();

            if (openMode == OpenMode.Add)
            {
                showAddPara();
            }
            else if (openMode == OpenMode.Update)
            {
                showUpdatePara();
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Control that the input given by the manager fits with the input stored in the database
 /// </summary>
 /// <param name="login">user login</param>
 /// <param name="password">user password</param>
 /// <returns>true if the authentification is successfull</returns>
 public Boolean ControlAuthentification(string login, string password)
 {
     if (AccessDataBase.ControlAuthentification(login, password))
     {
         FrmAuthentification.Hide();
         (new FrmEmployee(this)).ShowDialog();
         return(true);
     }
     else
     {
         return(false);
     }
 }
        private void addReaderInfo(ref AccessDataBase.Model.ReaderInfo modelReaderInfo)
        {
            if (bllReaderInfo.Exists(modelReaderInfo.ReaderID))
            {
                MyMessageBox.MessageBoxOK("������ID�Ѿ�����");
                return;
            }
            modelReaderTimeAccess.ReaderTimeAccessID = bllReaderTimeAccess.GetMaxId();
            addReaderTimeAccess(ref modelReaderTimeAccess);

            modelReaderInfo.ReadTimeAccessID = modelReaderTimeAccess.ReaderTimeAccessID;
            bllReaderInfo.Add(modelReaderInfo);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Method to update an employee in the database
 /// </summary>
 /// <param name="employee">Employee (objet) previously selected</param>
 /// <param name="familyName">family name selected in its corresponding TextBox</param>
 /// <param name="firstName">first name selected in its corresponding TextBox</param>
 /// <param name="phone">phone selected in its corresponding TextBox</param>
 /// <param name="mail">mail selected in its corresponding TextBox</param>
 /// <param name="idDepartment">ID number of the selected department in the ComboBox</param>
 public void UpdateEmployee(Employee employee,
                            string familyName,
                            string firstName,
                            string phone,
                            string mail,
                            int idDepartment)
 {
     employee.FamilyName   = familyName;
     employee.FirstName    = firstName;
     employee.Phone        = phone;
     employee.Mail         = mail;
     employee.IdDepartment = idDepartment;
     AccessDataBase.UpdateEmployee(employee);
 }
Ejemplo n.º 10
0
 /// <summary>
 ///  Method to update an absence from an employee in the database
 /// </summary>
 /// <param name="employee">Employee (objet) previously selected</param>
 /// <param name="previousDateSelected">first day selected (primary key) before the modification</param>
 /// <param name="firstDay">first day selected in the DateTimePicker</param>
 /// <param name="lastDay">last day selected in the DateTimePicker</param>
 /// <param name="idReason">ID reason of the absence</param>
 public void UpdateAbsence(Employee employee,
                           DateTime previousDateSelected,
                           DateTime firstDay,
                           DateTime lastDay,
                           int idReason
                           )
 {
     AccessDataBase.UpdateAbsence(employee,
                                  previousDateSelected,
                                  firstDay,
                                  lastDay,
                                  idReason
                                  );
 }
Ejemplo n.º 11
0
        public FormManager(AccessDataBase.Model.Manager modelManager,OpenMode openMode)
        {
            InitializeComponent();

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

            this.modelManager = modelManager;
            this.openMode = openMode;
            if (openMode == OpenMode.Update)
            {
                kryptonTextBoxName.Text = modelManager.ManagerName;
                kryptonTextBoxName.Enabled = false;
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Method to add an employee in the database
        /// </summary>
        /// <param name="idEmployee">id number of the employee</param>
        /// <param name="familyName">family name</param>
        /// <param name="firstName">first name</param>
        /// <param name="phone">phone number</param>
        /// <param name="mail">mail</param>
        /// <param name="idDepartment">id number of the department</param>
        /// <param name="departmentName">name of the department</param>
        public void AddEmployee(int idEmployee,
                                string familyName,
                                string firstName,
                                string phone,
                                string mail,
                                int idDepartment,
                                string departmentName
                                )
        {
            Employee employee = new Employee(idEmployee,
                                             familyName,
                                             firstName,
                                             phone,
                                             mail,
                                             idDepartment,
                                             departmentName);

            AccessDataBase.AddEmployee(employee);
        }
Ejemplo n.º 13
0
        public FormCard(AccessDataBase.Model.CardInfo cardInfo, OpenMode openMode)
        {
            InitializeComponent();
            this.CenterToScreen();
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Icon = GetResourcesFile.getSystemIco();
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;

            this.modelCardInfo = cardInfo;
            this.openMode = openMode;
            if (openMode == OpenMode.Add)
            {
                showAddPara();
            }
            else if (openMode == OpenMode.Update)
            {
                showUpdatePara();
            }
        }
        public FormReaderHoliday(OpenMode openMode, AccessDataBase.Model.ReaderInfo modelReaderInfo, AccessDataBase.Model.ReaderHoliday modelHoliay)
        {
            InitializeComponent();
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = GetResourcesFile.getSystemIco();
            this.CenterToScreen();

            this.openMode = openMode;
            this.modelReaderInfo = modelReaderInfo;
            this.modelHoliay = modelHoliay;
            if (openMode == OpenMode.Update)
            {
                kryptonDateTimePickerStartDate.Value = Convert.ToDateTime(modelHoliay.ReaderHolidayStartDate);
                kryptonDateTimePickerEndDate.Value = Convert.ToDateTime(modelHoliay.ReaderHolidayEndDate);
            }
            else if(openMode == OpenMode.Add)
            { }
        }
Ejemplo n.º 15
0
        public FormMain(AccessDataBase.Model.Manager model)
        {
            InitializeComponent();
            this.model = model;
            this.CenterToScreen();
            this.WindowState = FormWindowState.Maximized;
            this.Icon = GetResourcesFile.getSystemIco();
            this.notifyIcon1.Icon = GetResourcesFile.getSystemIco();
            this.notifyIcon1.Text = this.Text;

            this.toolStripStatusLabel2.Text = "";
            this.toolStripStatusLabel3.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            this.timer1.Interval = 1000;
            this.timer1.Start();

            initUserInterface();

            //WidgetThread.WidgetThread.displayFormOnPanel(this.splitContainer1.Panel2.Controls, webServer);
            //webServer.BringToFrontAndRefresh();

            toolStripMenuItemController_Click(null, null);
        }
        public FormReaderInfo(AccessDataBase.Model.ReaderInfo modelReaderInfo, OpenMode openMode)
        {
            InitializeComponent();
            this.CenterToScreen();
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = GetResourcesFile.getSystemIco();

            this.modelReaderInfo = modelReaderInfo;
            this.openMode = openMode;
            for (int i = 0; i < 7; i++)
                arrarymodelReaderTimeZone[i] = new AccessDataBase.Model.ReaderTimeZone();

            if (openMode == OpenMode.Add)
            {
                showAddPara();
            }
            else if (openMode == OpenMode.Update)
            {
                this.modelReaderInfo = bllReaderInfo.GetModel(modelReaderInfo.ReaderID);
                showUpdatePara();
            }
        }
        private void getReaderInfo(ref AccessDataBase.Model.ReaderInfo modelReaderInfo)
        {
            modelReaderInfo.CommunicateType = kryptonComboBoxCommunicateType.SelectedIndex;

            #region TCPͨ�Ų���
            modelReaderInfo.ReaderIP = textBoxDeviceIP.Text.ToString();
            modelReaderInfo.ReaderSubnet = textBoxMask.Text.ToString();
            modelReaderInfo.ReaderGateway = textBoxGateway.Text.ToString();
            modelReaderInfo.ReaderDNS = textBoxDNS.Text.ToString();
            modelReaderInfo.ReaderBuDNS = kryptonTextBoxBackUpDNS.Text.ToString();
            #endregion

            #region 485ͨ�Ų���
            modelReaderInfo.ReaderAddr483 = int.Parse(kryptonTextBoxControllerAddr485.Text.ToString());
            modelReaderInfo.ReaderBaudrate = int.Parse(kryptonTextBoxControllerBaudrate.Text.ToString());
            modelReaderInfo.ReaderDataBits = int.Parse(kryptonTextBoxControllerDataBits.Text.ToString());
            modelReaderInfo.ReaderStopBits = int.Parse(kryptonTextBoxControllerStopBits.Text.ToString());
            modelReaderInfo.ReaderParityCheck = kryptonComboBoxControllerParityCheck.Text.ToString();
            modelReaderInfo.ReaderFlowControl = kryptonTextBoxControllerFlowControl.Text.ToString();
            #endregion
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Check if the absence selected falls at the end of the absence list
        /// </summary>
        /// <param name="employee">Employee (object) selected</param>
        /// <param name="firstDay">first day selected in the DateTimePicker</param>
        /// <returns>boolean (true if the absence falls at the end of all previous absence, false if not)</returns>
        public bool AbsenceAtTheEndOfTheCalendar(Employee employee, DateTime firstDay)
        {
            DateTime maxDay = AccessDataBase.AbsenceAtTheEndOfTheCalendar(employee);

            return(firstDay > maxDay);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Remove an absence for an employee
 /// </summary>
 /// <param name="absence">Absence (object)</param>
 /// <param name="_employee">Employee (object)</param>
 public void RemoveAbsenceFromEmployee(Absence absence, Employee _employee)
 {
     AccessDataBase.RemoveAbsenceFromEmployee(absence, _employee);
 }
        private void getReaderTimeZone( AccessDataBase.Model.ReaderTimeAccess modelReaderTimeAccess)
        {
            if (modelReaderTimeAccess.Mon.HasValue)
            {
                arrarymodelReaderTimeZone[0] = bllReaderTimeZone.GetModel(modelReaderTimeAccess.Mon.Value);
                showDateTimePickerFormReaderTimeZone(ref timeModeAccessTime1, arrarymodelReaderTimeZone[0]);
            }
            if (modelReaderTimeAccess.Tue.HasValue)
            {
                arrarymodelReaderTimeZone[1] = bllReaderTimeZone.GetModel(modelReaderTimeAccess.Thu.Value);
                showDateTimePickerFormReaderTimeZone(ref timeModeAccessTime2, arrarymodelReaderTimeZone[1]);
            }
            if (modelReaderTimeAccess.Tue.HasValue)
            {
                arrarymodelReaderTimeZone[2] = bllReaderTimeZone.GetModel(modelReaderTimeAccess.Tue.Value);
                showDateTimePickerFormReaderTimeZone(ref timeModeAccessTime3, arrarymodelReaderTimeZone[2]);
            }
            if (modelReaderTimeAccess.Wed.HasValue)
            {
                arrarymodelReaderTimeZone[3] = bllReaderTimeZone.GetModel(modelReaderTimeAccess.Wed.Value);
                showDateTimePickerFormReaderTimeZone(ref timeModeAccessTime4, arrarymodelReaderTimeZone[3]);
            }
            if (modelReaderTimeAccess.Fri.HasValue)
            {
                arrarymodelReaderTimeZone[4] = bllReaderTimeZone.GetModel(modelReaderTimeAccess.Fri.Value);
                showDateTimePickerFormReaderTimeZone(ref timeModeAccessTime5, arrarymodelReaderTimeZone[4]);
            }
            if (modelReaderTimeAccess.Sat.HasValue)
            {
                arrarymodelReaderTimeZone[5] = bllReaderTimeZone.GetModel(modelReaderTimeAccess.Sat.Value);
                showDateTimePickerFormReaderTimeZone(ref timeModeAccessTime6, arrarymodelReaderTimeZone[5]);
            }

            if (modelReaderTimeAccess.Sun.HasValue)
            {
                arrarymodelReaderTimeZone[6] = bllReaderTimeZone.GetModel(modelReaderTimeAccess.Sun.Value);
                showDateTimePickerFormReaderTimeZone(ref timeModeAccessTime7, arrarymodelReaderTimeZone[6]);
            }
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Method to add an absence from an employee to the database
 /// </summary>
 /// <param name="employee">Employee (objet) previously selected</param>
 /// <param name="firstDay">first day of the absence selected in the DateTimePicker</param>
 /// <param name="lastDay">last day of the absence selected in the DateTimePicker</param>
 /// <param name="idReason">ID reason of the absence</param>
 public void AddAbsence(Employee employee, DateTime firstDay, DateTime lastDay, int idReason)
 {
     AccessDataBase.AddAbsence(employee, firstDay, lastDay, idReason);
 }
        private void updateReaderInfo(ref AccessDataBase.Model.ReaderInfo modelReaderInfo)
        {
            modelReaderTimeAccess.ReaderTimeAccessID = bllReaderInfo.GetModel(modelReaderInfo.ReaderID).ReadTimeAccessID.HasValue ?
                bllReaderInfo.GetModel(modelReaderInfo.ReaderID).ReadTimeAccessID.Value : bllReaderTimeAccess.GetMaxId();
            modelReaderTimeAccess.ReaderTimeAccessName = "";
            updateReaderTimeAccess(ref modelReaderTimeAccess);

            modelReaderInfo.ReadTimeAccessID = modelReaderTimeAccess.ReaderTimeAccessID;

            bllReaderInfo.Update(modelReaderInfo);
        }
 private void showDateTimePickerFormReaderTimeZone(ref MyComponents.TimeMode ModeAccessTime , AccessDataBase.Model.ReaderTimeZone modelReaderTimeZone)
 {
     if (modelReaderTimeZone == null)
         return;
     ModeAccessTime.KryptonDateTimePickerAccessTime1.Value = Convert.ToDateTime(modelReaderTimeZone.TimeZone1);
     ModeAccessTime.KryptonDateTimePickerAccessTime2.Value = Convert.ToDateTime(modelReaderTimeZone.TimeZone2);
     ModeAccessTime.KryptonDateTimePickerAccessTime3.Value = Convert.ToDateTime(modelReaderTimeZone.TimeZone3);
     ModeAccessTime.KryptonDateTimePickerAccessTime4.Value = Convert.ToDateTime(modelReaderTimeZone.TimeZone4);
     ModeAccessTime.KryptonDateTimePickerAccessTime5.Value = Convert.ToDateTime(modelReaderTimeZone.TimeZone5);
     ModeAccessTime.KryptonDateTimePickerAccessTime6.Value = Convert.ToDateTime(modelReaderTimeZone.TimeZone6);
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Get and return the data from the employee coming from the database
 /// </summary>
 /// <returns>list of employees</returns>
 public List <Employee> GetTheEmployees()
 {
     return(AccessDataBase.GetTheEmployees());
 }
 private Time1 getTimeFormReaderTimeZone(AccessDataBase.Model.ReaderTimeZone modelReaderTimeZone)
 {
     Time1 time = new Time1(0,0,0);
     int.TryParse(modelReaderTimeZone.TimeZone1.Substring(0, 2), out time.hour);
     int.TryParse(modelReaderTimeZone.TimeZone1.Substring(2, 2), out time.minute);
     return time;
 }
Ejemplo n.º 26
0
        private void Button1_Click(object sender, EventArgs e)
        {
            AccessDataBase db = new AccessDataBase();

            db.createConn();
            string gioiTinh, maphongBan, maloaiHopDong, machucVu, maNhanVien, maLuong, maTrinhDo;

            //Mã nhân viên
            maNhanVien = "BA" + txbCMND.Text;


            //phòng ban
            if (comboBoxPhongBan.Text.Equals("Phòng Kỹ Thuật") == true)
            {
                maphongBan = "PB02";
            }
            else
            {
                maphongBan = "PB03";
            }

            //chức vụ

            if (comboBoxChuVu.Text.Equals("Ban Giám Đốc") == true)
            {
                machucVu = "GD";
            }
            else if (comboBoxChuVu.Text.Equals("Trưởng phòng") == true)
            {
                machucVu = "TP";
            }
            else
            {
                machucVu = "NV";
            }

            //Loại hợp đồng

            if (comboBoxLoaiHD.Text.Equals("Hợp đồng CTV") == true)
            {
                maloaiHopDong = "CTV";
            }
            else
            {
                maloaiHopDong = "HDLD";
            }

            //giới tính
            if (radioButtonNam.Checked == true)
            {
                gioiTinh = "Nam";
            }
            else
            {
                gioiTinh = "Nữ";
            }

            //trình độ
            if (comboBoxTrinhDo.Text.Equals("Manager") == true)
            {
                maTrinhDo = "1";
            }
            else if (comboBoxTrinhDo.Text.Equals("Development") == true)
            {
                maTrinhDo = "2";
            }
            else
            {
                maTrinhDo = "3";
            }
            if (txbhoTen.Text.Trim().Equals("") == true || txbLuong.Text.Trim().Equals("") == true || txbSDT.Text.Trim().Equals("") == true ||
                txbDiaChi.Text.Trim().Equals("") == true || txbDanToc.Text.Trim().Equals("") == true || txbCMND.Text.Trim().Equals("") == true ||
                comboBoxChuVu.Text.Trim().Equals("") == true || comboBoxLoaiHD.Text.Trim().Equals("") == true || comboBoxPhongBan.Text.Trim().Equals("") == true ||
                comboBoxTrinhDo.Text.Trim().Equals("") == true || gioiTinh.Equals("") == true)
            {
                XtraMessageBox.Show("Mời nhập đầy đủ thông tin!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                int        dem        = 0;
                SqlCommand query_name = new SqlCommand("SELECT CMTND FROM NhanVien WHERE CMTND LIKE '" + txbCMND.Text + "'", AccessDataBase.connection);
                using (SqlDataReader reader = query_name.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        // Đọc kết quả
                        while (reader.Read())
                        {
                            Console.WriteLine("{0}", reader[0].ToString());
                            if (reader[0].ToString().Equals(txbCMND.Text))
                            {
                                dem = 1;
                            }
                        }
                    }
                }
                if (dem == 1)
                {
                    XtraMessageBox.Show("Nhân viên đã tồn tại!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    //lương
                    if (IsNumber(txbLuong.Text) == true && IsNumber(txbCMND.Text) == true && IsNumber(txbSDT.Text) == true
                        )
                    {
                        int luong = Convert.ToInt32(txbLuong.Text);
                        if (luong <= 1000000)
                        {
                            maLuong = "LuongCTV" + txbCMND.Text;
                        }
                        else
                        {
                            maLuong = "LuongHDLD" + txbCMND.Text;
                        }
                        //chạy lệnh update Lương
                        SqlCommand query0 = new SqlCommand("INSERT Luong values ('" + maLuong + "','1','" + txbLuong.Text + "')");
                        nhanvien.executeQuery(query0);
                        //chạy lệnh update nhân viên
                        SqlCommand query = new SqlCommand("INSERT NhanVien values('" + maNhanVien + "','" + StandardString(txbhoTen.Text) + "', '" + ngaySinh.Value.ToString() + "'," +
                                                          " '" + gioiTinh + "', '" + StandardString(txbDanToc.Text) + "', '" + txbCMND.Text + "','" + txbSDT.Text + "', '"
                                                          + txbDiaChi.Text + "', '" + maphongBan + "', '" + machucVu + "', '" + maloaiHopDong + "', '" + maTrinhDo + "', '" + maLuong + "')");
                        nhanvien.executeQuery(query);
                        XtraMessageBox.Show("Thêm mới nhân viên thành công!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        XtraMessageBox.Show("Thông tin nhập vào không đúng định dạng!", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
        /// <summary>
        /// ����ͼ�ؼ��л�ȡ�ŵ�Ԫ��Ϣ
        /// </summary>
        /// <param name="doorUnit"></param>
        /// <returns>�ŵ�Ԫ��Ϣ</returns>
        private void getModelDoorUnitInfo(ref AccessDataBase.Model.DoorUnitInfo modelDoorUnitInfo, MyComponents.DoorUnit doorUnit)
        {
            #region ������Ϣ
            modelDoorUnitInfo.DoorUnitID = bllDoorUnitInfo.GetMaxId();
            modelDoorUnitInfo.OutPutLockID = int.Parse(doorUnit.KryptonTextBoxOutPoint.Text.ToString());
            //modelDoorUnitInfo.OutPutTimeLeng;
            //modelDoorUnitInfo.OpenDoorOverTimeLen;
            //modelDoorUnitInfo.AccessCapacityEnable;
            //modelDoorUnitInfo.AccessCapacityMax;
            //modelDoorUnitInfo.AccessCapacityMin;
            #endregion

            #region ��������Ϣ
            modelDoorUnitInfo.ReadID1 = int.Parse(doorUnit.KryptonTextBoxReader1.Text.ToString());
            modelDoorUnitInfo.ReadIDEnable1 = doorUnit.KryptonCheckBoxReader1.Checked;
            modelDoorUnitInfo.ReadID2 = int.Parse(doorUnit.KryptonTextBoxReader2.Text.ToString());
            modelDoorUnitInfo.ReadIDEnable2 = doorUnit.KryptonCheckBoxReader2.Checked;
            #endregion

            #region �������Ϣ
            modelDoorUnitInfo.InputStateType = doorUnit.KryptonComboBoxInputStateType.SelectedIndex;

            modelDoorUnitInfo.ExitButtonID = int.Parse(doorUnit.KryptonTextBoxExitButton.Text.ToString());
            //modelDoorUnitInfo.ExitButtonMode;
            //modelDoorUnitInfo.ExtiButtonEnable;

            modelDoorUnitInfo.DoorContactID = int.Parse(doorUnit.KryptonTextBoxDoorContact.Text.ToString());
            //modelDoorUnitInfo.DoorContactMode;
            //modelDoorUnitInfo.DoorPositionEnable;

            modelDoorUnitInfo.DoorPositionID = int.Parse(doorUnit.KryptonTextBoxDoorPosition.Text.ToString());
            //modelDoorUnitInfo.DoorPositionMode;
            //modelDoorUnitInfo.DoorPositionEnable;

            modelDoorUnitInfo.BreakGlassID = int.Parse(doorUnit.KryptonTextBoxBreakGlass.Text.ToString());
            //modelDoorUnitInfo.BreakGlassMode;
            //modelDoorUnitInfo.BreakGlassEnable;
            #endregion

            #region ���ӵ�ͼ
            //modelDoorUnitInfo.ElectronicMapID;
            //modelDoorUnitInfo.PositionX;
            //modelDoorUnitInfo.PositionY;
            //modelDoorUnitInfo.StateImageOpen;
            //modelDoorUnitInfo.StateImageClose;
            //modelDoorUnitInfo.StateImageAlarmOpen;
            //modelDoorUnitInfo.StateImageAlarmClose;
            #endregion
        }
        private void getModelReaderTimeZone(ref AccessDataBase.Model.ReaderTimeZone modelReaderTimeZone,ref MyComponents.TimeMode timeModeAccessTime)
        {
            modelReaderTimeZone.TimeZone1 = timeModeAccessTime.KryptonDateTimePickerAccessTime1.Value.ToShortTimeString();
            modelReaderTimeZone.OperateMode1 = timeModeAccessTime.KryptonComboBoxAccessTime1.SelectedIndex;

            modelReaderTimeZone.TimeZone2 = timeModeAccessTime.KryptonDateTimePickerAccessTime2.Value.ToShortTimeString();
            modelReaderTimeZone.OperateMode2 = timeModeAccessTime.KryptonComboBoxAccessTime2.SelectedIndex;

            modelReaderTimeZone.TimeZone3 = timeModeAccessTime.KryptonDateTimePickerAccessTime3.Value.ToShortTimeString();
            modelReaderTimeZone.OperateMode3 = timeModeAccessTime.KryptonComboBoxAccessTime3.SelectedIndex;

            modelReaderTimeZone.TimeZone4 = timeModeAccessTime.KryptonDateTimePickerAccessTime4.Value.ToShortTimeString();
            modelReaderTimeZone.OperateMode4 = timeModeAccessTime.KryptonComboBoxAccessTime4.SelectedIndex;

            modelReaderTimeZone.TimeZone5 = timeModeAccessTime.KryptonDateTimePickerAccessTime5.Value.ToShortTimeString();
            modelReaderTimeZone.OperateMode5 = timeModeAccessTime.KryptonComboBoxAccessTime5.SelectedIndex;

            modelReaderTimeZone.TimeZone6 = timeModeAccessTime.KryptonDateTimePickerAccessTime6.Value.ToShortTimeString();
            modelReaderTimeZone.OperateMode6 = timeModeAccessTime.KryptonComboBoxAccessTime6.SelectedIndex;
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Get the maximum ID for the employee table
 /// </summary>
 /// <returns>integer (ID) corresponding to the last employee</returns>
 public static int GetMaxEmployeeID()
 {
     return(AccessDataBase.GetMaxEmployeeID());
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Method to remove an employee in the database for the table ABSENCE
 /// </summary>
 /// <param name="employee">Employee (objet) previously selected</param>
 public void RemoveEmployeeFromAbsence(Employee employee)
 {
     AccessDataBase.RemoveEmployeeFromAbsence(employee);
 }
        private void addReaderTimeAccess(ref AccessDataBase.Model.ReaderTimeAccess modelReaderTimeAccess)
        {
            modelReaderTimeAccess.ReaderTimeAccessName = "�ܹ���ģʽ" + modelReaderTimeAccess.ReaderTimeAccessID;

            getModelReaderTimeZoneGroup();

            foreach (AccessDataBase.Model.ReaderTimeZone readerTimeZone in arrarymodelReaderTimeZone)
            {
                readerTimeZone.ReaderTimeZoneID = bllReaderTimeZone.GetMaxId();
                bllReaderTimeZone.Add(readerTimeZone);
            }
            modelReaderTimeAccess.Mon = arrarymodelReaderTimeZone[0].ReaderTimeZoneID;
            modelReaderTimeAccess.Tue = arrarymodelReaderTimeZone[1].ReaderTimeZoneID;
            modelReaderTimeAccess.Wed = arrarymodelReaderTimeZone[2].ReaderTimeZoneID;
            modelReaderTimeAccess.Thu = arrarymodelReaderTimeZone[3].ReaderTimeZoneID;
            modelReaderTimeAccess.Fri = arrarymodelReaderTimeZone[4].ReaderTimeZoneID;
            modelReaderTimeAccess.Sat = arrarymodelReaderTimeZone[5].ReaderTimeZoneID;
            modelReaderTimeAccess.Sun = arrarymodelReaderTimeZone[6].ReaderTimeZoneID;
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Get and return the list of departments stored in the database
 /// </summary>
 /// <returns>list of department</returns>
 public List <Department> GetTheDepartments()
 {
     return(AccessDataBase.GetTheDepartments());
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Get the list of absences corresponding to a specific employee
 /// </summary>
 /// <param name="employee">Employee (objet) previously selected</param>
 /// <returns>List of the absences</returns>
 public List <Absence> GetTheAbsences(Employee employee)
 {
     return(AccessDataBase.GetTheAbsences(employee));
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Get the list of absence reasons for the ComboBox
 /// </summary>
 /// <returns>List of the reasons of the absence</returns>
 public List <Reason> GetTheReasons()
 {
     return(AccessDataBase.GetTheReasons());
 }
        private void updateReaderTimeAccess(ref AccessDataBase.Model.ReaderTimeAccess modelReaderTimeAccess)
        {
            if (bllReaderTimeAccess.Exists(modelReaderTimeAccess.ReaderTimeAccessID))
            {
                modelReaderTimeAccess = bllReaderTimeAccess.GetModel(modelReaderTimeAccess.ReaderTimeAccessID);
            }
            else
            {
                bllReaderTimeAccess.Add(modelReaderTimeAccess);
            }
            getModelReaderTimeZoneGroup();
            if (modelReaderTimeAccess.Mon.HasValue)
            {
                arrarymodelReaderTimeZone[0].ReaderTimeZoneID = modelReaderTimeAccess.Mon.Value;
                bllReaderTimeZone.Update(arrarymodelReaderTimeZone[0]);
            }
            else
            {
                modelReaderTimeAccess.Mon = arrarymodelReaderTimeZone[0].ReaderTimeZoneID =  bllReaderTimeZone.GetMaxId();
                bllReaderTimeZone.Add(arrarymodelReaderTimeZone[0]);
            }

            if (modelReaderTimeAccess.Thu.HasValue)
            {
                arrarymodelReaderTimeZone[1].ReaderTimeZoneID = modelReaderTimeAccess.Thu.Value;
                bllReaderTimeZone.Update(arrarymodelReaderTimeZone[1]);
            }
            else
            {
                modelReaderTimeAccess.Thu = arrarymodelReaderTimeZone[1].ReaderTimeZoneID = bllReaderTimeZone.GetMaxId();
                bllReaderTimeZone.Add(arrarymodelReaderTimeZone[1]);
            }

            if (modelReaderTimeAccess.Tue.HasValue)
            {
                arrarymodelReaderTimeZone[2].ReaderTimeZoneID = modelReaderTimeAccess.Tue.Value;
                bllReaderTimeZone.Update(arrarymodelReaderTimeZone[2]);
            }
            else
            {
                modelReaderTimeAccess.Tue = arrarymodelReaderTimeZone[2].ReaderTimeZoneID = bllReaderTimeZone.GetMaxId();
                bllReaderTimeZone.Add(arrarymodelReaderTimeZone[2]);
            }
            if (modelReaderTimeAccess.Wed.HasValue)
            {
                arrarymodelReaderTimeZone[3].ReaderTimeZoneID = modelReaderTimeAccess.Wed.Value;
                bllReaderTimeZone.Update(arrarymodelReaderTimeZone[3]);
            }
            else
            {
                modelReaderTimeAccess.Wed = arrarymodelReaderTimeZone[3].ReaderTimeZoneID = bllReaderTimeZone.GetMaxId();
                bllReaderTimeZone.Add(arrarymodelReaderTimeZone[3]);
            }
            if (modelReaderTimeAccess.Fri.HasValue)
            {
                arrarymodelReaderTimeZone[4].ReaderTimeZoneID = modelReaderTimeAccess.Fri.Value;
                bllReaderTimeZone.Update(arrarymodelReaderTimeZone[4]);
            }
            else
            {
                modelReaderTimeAccess.Fri = arrarymodelReaderTimeZone[4].ReaderTimeZoneID = bllReaderTimeZone.GetMaxId();
                bllReaderTimeZone.Add(arrarymodelReaderTimeZone[4]);
            }
            if (modelReaderTimeAccess.Sat.HasValue)
            {
                arrarymodelReaderTimeZone[5].ReaderTimeZoneID = modelReaderTimeAccess.Sat.Value;
                bllReaderTimeZone.Update(arrarymodelReaderTimeZone[5]);
            }
            else
            {
                modelReaderTimeAccess.Sat = arrarymodelReaderTimeZone[5].ReaderTimeZoneID = bllReaderTimeZone.GetMaxId();
                bllReaderTimeZone.Add(arrarymodelReaderTimeZone[5]);
            }
            if (modelReaderTimeAccess.Sun.HasValue)
            {
                arrarymodelReaderTimeZone[6].ReaderTimeZoneID = modelReaderTimeAccess.Sun.Value;
                bllReaderTimeZone.Update(arrarymodelReaderTimeZone[6]);
            }
            else
            {
                modelReaderTimeAccess.Sun = arrarymodelReaderTimeZone[6].ReaderTimeZoneID = bllReaderTimeZone.GetMaxId();
                bllReaderTimeZone.Add(arrarymodelReaderTimeZone[6]);
            }
            bllReaderTimeAccess.Update(modelReaderTimeAccess);
        }