private void EmployeeListGet() { try { Employee_Controller empGet = new Employee_Controller(); dgvEmployeeList.DataSource = empGet.EmployeeSelectAll(); this.dgvEmployeeList.Columns[0].Visible = false; // this.dgvEmployeeList.Columns[1].Visible = false; //foreach (DataRow row in empGet.EmployeeSelectAll().Rows) //{ //txtIDS.Text = row["IDS"].ToString(); //txtLastName.Text = row["lname"].ToString(); //txtFirstName.Text = row["fname"].ToString(); //txtMiddleName.Text = row["mname"].ToString(); //txtAddress.Text = row["AddressHome"].ToString(); //txtContactNumber.Text = row["ContactNo"].ToString(); //dtpDateOfBirth.Value = Convert.ToDateTime(row["DateOfBirth"].ToString()); //dtpDateOfEmployment.Value = Convert.ToDateTime(row["DateOfEmployment"].ToString()); //cboGender.SelectedIndex = Convert.ToInt32(row["CivilStatus"].ToString()); //cboCivilStatus.SelectedIndex = Convert.ToInt32(row["CivilStatus"].ToString()); //cboPosition.SelectedIndex = Convert.ToInt32(row["Position"].ToString()); //cboUnit.SelectedIndex = Convert.ToInt32(row["Unit"].ToString()); //txtSalary.Text = row["Salary"].ToString(); //chkStatus.Checked = Convert.ToBoolean(row["Stat"].ToString()); //} } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
// private void ChangeThemeName(Control control, string themeName) #endregion #region Employee private void EmployeeListGet() { try { DataGridViewRow row = this.dgvEmployeeList.RowTemplate; row.DefaultCellStyle.BackColor = Color.Aqua; row.Height = 100; row.MinimumHeight = 20; Employee_Controller empGet = new Employee_Controller(); dgvEmployeeList.DataSource = empGet.EmployeeSelectAll(); // this.dgvEmployeeList1.Columns[0].Visible = false; dgvEmployeeList.Columns[12].DefaultCellStyle.Format = "###,##0.00##"; dgvEmployeeList.Columns[14].DefaultCellStyle.Format = "###,##0.00##"; dgvEmployeeList.Columns[15].DefaultCellStyle.Format = "###,##0.00##"; dgvEmployeeList.Columns[16].DefaultCellStyle.Format = "###,##0.00##"; dgvEmployeeList.Columns[17].DefaultCellStyle.Format = "###,##0.00##"; dgvEmployeeList.Columns[18].DefaultCellStyle.Format = "###,##0.00##"; dgvEmployeeList.Columns[19].DefaultCellStyle.Format = "###,##0.00##"; dgvEmployeeList.Columns[20].DefaultCellStyle.Format = "###,##0.00##"; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void builEmployeeCbo() { Employee_Controller AttendanceGet = new Employee_Controller(); DataTable dt = AttendanceGet.EmployeeSelectAllCbo(); cboEmployeesName.DataSource = dt; cboEmployeesName.DisplayMember = "FullName"; cboEmployeesName.ValueMember = "IDS"; }
private void EmployeeUpdates() { byte[] pic; try { if (picImage.Image != null) { MemoryStream stream = new MemoryStream(); picImage.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp); pic = stream.ToArray(); } else { pic = null; } Employee_Controller empNew = new Employee_Controller(); empNew.EmployeeUpdate(Convert.ToDouble(txtIDS.Text), Convert.ToString(txtLastName.Text), Convert.ToString(txtFirstName.Text), Convert.ToString(txtMiddleName.Text), Convert.ToString(txtAddress.Text), Convert.ToString(txtContactNumber.Text), Convert.ToDateTime(dtpDateOfBirth.Value), Convert.ToDateTime(dtpDateOfEmployment.Value), Convert.ToInt32(cboGender.SelectedIndex), Convert.ToInt32(cboCivilStatus.SelectedIndex), Convert.ToString(cboPosition.Text), Convert.ToInt32(cboDepartment.SelectedValue), Convert.ToInt32(cboUnit.SelectedIndex), Convert.ToDecimal(txtSalary.Text), pic, Convert.ToInt32(chkStatus.CheckState), Convert.ToDecimal(txtSSSPrem.Text), Convert.ToDecimal(txtPHICPrem.Text), Convert.ToDecimal(txtPagIbigPrem.Text), Convert.ToDecimal(txtSSSLoan.Text), Convert.ToDecimal(txtPagIbigLoan.Text), Convert.ToDecimal(txtSavings.Text), Convert.ToDecimal(txtOTRate.Text) // Convert.ToString(cboShiftName.Text ) ); MessageBox.Show("Update Successfull"); // EmployeeGet(IDS); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public void EmployeeGet(double ids) { try { Employee_Controller empGet = new Employee_Controller(); foreach (DataRow row in empGet.EmployeeSelect(ids).Rows) { txtIDS.Text = row["IDS"].ToString(); txtLastName.Text = row["lname"].ToString(); txtFirstName.Text = row["fname"].ToString(); txtMiddleName.Text = row["mname"].ToString(); txtAddress.Text = row["AddressHome"].ToString(); txtContactNumber.Text = row["ContactNo"].ToString(); dtpDateOfBirth.Value = Convert.ToDateTime(row["DateOfBirth"].ToString()); dtpDateOfEmployment.Value = Convert.ToDateTime(row["DateOfEmployment"].ToString()); cboGender.SelectedIndex = Convert.ToInt32(row["CivilStatus"].ToString()); cboCivilStatus.SelectedIndex = Convert.ToInt32(row["CivilStatus"].ToString()); cboPosition.Text = row["Position"].ToString(); // cboShiftName.Text = row["ShiftName"].ToString(); byte[] MyData = new byte[0]; if (row["PersonImage"] != null) { ////if (IsValidImage((byte[])row["PersonImage"]) == true) ////{ MyData = (byte[])row["PersonImage"]; MemoryStream stream = new MemoryStream(MyData); picImage.Image = Image.FromStream(stream); // } } cboDepartment.SelectedValue = Convert.ToInt32(row["Department"].ToString()); cboUnit.SelectedIndex = Convert.ToInt32(row["Unit"].ToString()); chkStatus.Checked = Convert.ToBoolean(row["Stat"]); txtSalary.Text = row["Salary"].ToString(); txtSSSPrem.Text = row["SSSPrem"].ToString(); txtPHICPrem.Text = row["PHICPrem"].ToString(); txtPagIbigPrem.Text = row["PagIbigPrem"].ToString(); txtSSSLoan.Text = row["SSSLoan"].ToString(); txtPagIbigLoan.Text = row["PagIbigLoan"].ToString(); txtSavings.Text = row["Savings"].ToString(); txtOTRate.Text = row["OTRate"].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public void EmployeeGetPic(double ids) { try { Employee_Controller empGet = new Employee_Controller(); foreach (DataRow row in empGet.EmployeeSelect(ids).Rows) { byte[] MyData = new byte[0]; if (row["PersonImage"] != null) { ////if (IsValidImage((byte[])row["PersonImage"]) == true) ////{ MyData = (byte[])row["PersonImage"]; MemoryStream stream = new MemoryStream(MyData); picImage.Image = Image.FromStream(stream); // } } } } catch { } }
private void DownloadTemplate() { if (bIsConnected == false) { MessageBox.Show("Please connect the device first!", "Error"); return; } if (iCanSaveTmp == 0)//You haven't enrolled the templates. { MessageBox.Show("Please enroll the fingerprint templates first!", "Error"); return; } //String connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\..\data\Templates.mdb"; //Variables var = new Variables(); //conn = new SqlConnection(var.ConStringOleDB()); //OleDbConnection conn = new OleDbConnection(ConStringOleDB); int idwFingerIndex = 0; // Convert.ToInt32(cbFingerIndex.Text.Trim()); int iTmpLength = 0; string sdwEnrollNumber = dgvEmployeeList.SelectedRows[0].Cells["IDS"].Value.ToString(); int iFlag = 0; byte[] byTmpData = new byte[2000];//modify by darcy on Dec.9 2009 string sName = ""; string sPassword = ""; int iPrivilege = 0; bool bEnabled = false; axCZKEM1.EnableDevice(iMachineNumber, false); Cursor = Cursors.WaitCursor; axCZKEM1.ReadAllTemplate(iMachineNumber); while (axCZKEM1.SSR_GetUserInfo(iMachineNumber, sdwEnrollNumber, out sName, out sPassword, out iPrivilege, out bEnabled)) { if (axCZKEM1.GetUserTmpEx(iMachineNumber, sdwEnrollNumber, idwFingerIndex, out iFlag, out byTmpData[0], out iTmpLength)) { //If you need to select or delete the data in the database ,you can just define the sql sentences by youself //string sql = "insert into Template(UserID,FingerID,Template,TmpLen,Flag) values('" + sdwEnrollNumber + "','" + idwFingerIndex + "','" + byTmpData + "','" + iTmpLength + "','" + iFlag + "')";//modify by darcy on Dec.9 2009 //OleDbCommand cmd = new OleDbCommand(sql, conn); //conn.Open(); //cmd.ExecuteNonQuery(); Employee_Controller emp = new Employee_Controller(); // emp.EmployeeTemplateInsert(0, Convert.ToInt32(sdwEnrollNumber), Convert.ToInt32(idwFingerIndex), byTmpData[0], iTmpLength, iFlag); double ids = emp.EmployeeTemplateInsert(0, 1, 1, 0, 1, 1); MessageBox.Show("Successfully save templates to database ! ", "Success"); } else { MessageBox.Show("Saving templates to database failed !", "Error"); } } axCZKEM1.RefreshData(iMachineNumber);//the data in the device should be refreshed axCZKEM1.EnableDevice(iMachineNumber, true); Cursor = Cursors.Default; }