public void LoadAtt_BY_EMPID_InListView(ListView lv) { Attendance a = new Attendance(); DataTable dt = new DataTable(); //get empid from combobox a.empid = Global.CURRENT_USER.empid; dt = a.SELECT_BY_EMPID(); if (dt != null) { lv.Items.Clear(); int ctr = 1; foreach (DataRow r in dt.Rows) { ListViewItem li = new ListViewItem(); li.Text = ctr.ToString(); li.SubItems.Add(Convert.ToDateTime(r["date_"].ToString()).ToShortDateString()); li.SubItems.Add(r["attendance"].ToString()); // li.SubItems.Add(Convert.ToDateTime(r["date_updated"].ToString()).ToLongDateString()); lv.Items.Add(li); ctr++; } } else { MessageBox.Show("Error"); } }
public void LoadInListView(ListView lv) { Attendance a = new Attendance(); DataTable dt = new DataTable(); String month = DateTime.Now.ToString("MMMM"); String year = DateTime.Now.ToString("yyyy"); int firstday = 1; int lastday= DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); DateTime from_ = Convert.ToDateTime(month + " " + firstday.ToString() + ", " + year.ToString()); DateTime to_= Convert.ToDateTime(month + " " + lastday.ToString() + ", " + year.ToString()); dt = a.SELECT_BETWEEN_DATES(from_,to_); if (dt != null) { int ctr = 1; foreach (DataRow r in dt.Rows) { ListViewItem li = new ListViewItem(); li.Text = ctr.ToString(); li.SubItems.Add(r["fullname"].ToString()); li.SubItems.Add(r["position_"].ToString()); li.SubItems.Add(Convert.ToDateTime(r["date_"].ToString()).ToString("MMMM dd, yyyy")); li.SubItems.Add(Convert.ToDateTime(r["attendance"].ToString()).ToString("HH:mm:ss")); li.Tag = r["empid"].ToString(); // li.SubItems.Add(Convert.ToDateTime(r["date_updated"].ToString()).ToLongDateString()); lv.Items.Add(li); ctr++; } } }
private void btnsave_Click(object sender, EventArgs e) { Attendance a = new Attendance(); a.empid = emp.empid; DateTime date_ = dtdate_.Value; DateTime time_ = dttime_.Value; DateTime thisdatetime = new DateTime(date_.Year, date_.Month, date_.Day, time_.Hour, time_.Minute, time_.Second); a.date_time = thisdatetime; a.work_code = 1; if (a.save()) { MessageBox.Show("Successful", "Attendance Update"); } else { MessageBox.Show("There was a problem updating the attendance...", "Attendance Update"); } }
public void LoadAtt_BY_EMPID_BW_DATES_InListView(ListView lv) { Attendance a = new Attendance(); DataTable dt = new DataTable(); //get empid from combobox if (cboEmp.Text != "") { String[] eid = cboEmp.Text.Split('-'); a.empid = eid[1]; dt = a.SELECT_BY_EMPID_BW_DATES(dtpFrom.Value, dtpTo.Value); if (dt != null) { lv.Items.Clear(); int ctr = 1; foreach (DataRow r in dt.Rows) { ListViewItem li = new ListViewItem(); li.Text = ctr.ToString(); li.SubItems.Add(r["fullname"].ToString()); li.SubItems.Add(r["position_"].ToString()); li.SubItems.Add(Convert.ToDateTime(r["date_"].ToString()).ToLongDateString()); li.SubItems.Add(r["attendance"].ToString()); li.Tag = r["empid"].ToString(); // li.SubItems.Add(Convert.ToDateTime(r["date_updated"].ToString()).ToLongDateString()); lv.Items.Add(li); ctr++; } } else { MessageBox.Show("Error"); } } }
private void bgAnalyzer_DoWork(object sender, DoWorkEventArgs e) { filename = fd.FileName; StreamReader r = new StreamReader(filename); int ctr = 0; string line=""; while ((line = r.ReadLine()) != null) { if (bgAnalyzer.CancellationPending) { //bgAnalyzer.ReportProgress(100); e.Cancel = true; } else { //line = r.ReadLine(); String[] str = line.Split('\t'); String empid, date_time, state, work_code; empid = Convert.ToInt32(str[0]).ToString("0000"); date_time = str[1]; state = str[2]; work_code = str[3]; Attendance a = new Attendance(); a.empid = empid; a.date_time = Convert.ToDateTime(date_time); a.state = Convert.ToInt32(state); a.work_code = Convert.ToInt32(work_code); a.work_code = 1; if (a.save()) { ctr++; bgAnalyzer.ReportProgress(ctr); System.Threading.Thread.Sleep(10); } } } }
private void attendance_ctrl_Load(object sender, EventArgs e) { Employee emp = new Employee(); emp.LoadEmployee(cboEmp); Attendance a = new Attendance(); a.LoadInListView(lv); chkDate.Checked = true; chkEmp.Checked = true; }
//BACKGROUND WORKER TO GET THE ATTENDANCE //INSTANTIATE AN ATTENDANCE OBJECT //SET THE OBJECT.EMPID //GET ATTENDANCE BY_EMPID BETWEEN_DATES AND PUT IT IN A DATATABLE NAMED attendancedt private void bgwattendance_DoWork(object sender, DoWorkEventArgs e) { Attendance att = new Attendance(); att.empid = emp.empid; if (dbcon.CONNECT()) { attendancedt = att.SELECT_BY_EMPID_BW_DATES(cutoff.from_date, cutoff.to_date, dbcon); } }
private void lbTimeAttendance_SelectedIndexChanged(object sender, EventArgs e) { if (lbTimeAttendance.SelectedItems.Count > 0) { Attendance at = new Attendance(); at.empid = emp.empid; String h = lbTimeAttendance.SelectedItem.ToString(); DateTime t = Convert.ToDateTime(h); DateTime date_ = new DateTime(dtdate_.Value.Year, dtdate_.Value.Month, dtdate_.Value.Day, t.Hour, t.Minute, t.Second); at.date_time = date_; if (MessageBox.Show("Confirm delete this attendance :" + date_.ToString("MMMM dd, yyyy HH:mm:ss") + "?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (at.delete()) { LoadThisDatesAttendance(); } else { MessageBox.Show("There was a problem deleting this attendance", "Deleting Attendance"); } }// end if messagebox }//end if count >0 // MessageBox.Show(date_.ToString("MMMM dd, yyyy HH:mm:ss")); }
private void frmCutoffAttendanceReport_Load(object sender, EventArgs e) { this.rptViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local; this.rptViewer.LocalReport.DataSources.Clear(); string path = System.Reflection.Assembly.GetExecutingAssembly().Location.ToString(); var directory = System.IO.Path.GetDirectoryName(path); directory += "\\reports\\atttendance_cutoff.rdlc"; //C:\projects\MMG-PIAPS\MMG-PIAPS\bin\Debug\reports\cutoff_attendance.rdlc //C:\projects\MMG-PIAPS\MMG-PIAPS\bin\Debug\reports\atttendance_cutoff.rdlc this.rptViewer.LocalReport.ReportPath = directory; //MessageBox.Show(directory); Employee emp = new Employee(); emp.branch = "2"; DataTable dt = emp.SELECT_BY_BRANCH(); DataSet1 ds = new DataSet1(); cutoffdt = ds.Tables["cutoffattendance"]; //CREATE AN IMAGE COLUMN //SET THE IMAGE VALUE //THEN ADD TO DATASET FOR REPORT REFERENCE DataColumn colByteArray = new DataColumn("emp_img"); colByteArray.DataType = System.Type.GetType("System.Byte[]"); dt.Columns.Add(colByteArray); foreach (DataRow item in dt.Rows) { Employee e1 = new Employee(); e1.empid = item["empid"].ToString(); item["emp_img"] = e1.GET_IMAGE_BY_ID(); //===================================== //FOR SUBREPORT DATASOURCE //POPULATE THE DATASET, FOR SUBREPORT USAGE //WITH THE EMPLOYEE'S ATTENDANCE FROM BIOMETRICS //THEN CHECKS THE ATTENDANCE WHETHER GOOD (IN,OUT,IN,OUT) //OR INAPPROPRIATE (IN ONLY, OR (IN, OUT, IN), OR (IN,OUT,OUT,IN,OUT) //AND OTHER IMPROPER ATTENDANCE LOGS int x = 1; foreach (DataRow cutoffitem in cutoffdetailsdt.Rows) { DataRow c = cutoffdt.NewRow(); DateTime d = Convert.ToDateTime(cutoffitem["date_"].ToString()); c.BeginEdit(); c["empid"] = e1.empid; c["no"] = x; c["date_"] = d.ToString("MM/dd/yyyy"); //CRREATE A DYNAMIC CONNECTION TO DB non_static_dbcon cn = new non_static_dbcon(); //COMPARE CUTOFF DATE WITH ATTENDANCE HERE //============================================== String attendance; String status; if (cn.CONNECT()) { Attendance att = new Attendance(); att.empid = e1.empid; attendance = att.SELECT_STR_BY_EMPID_BY_DATE(d, cn); String[] attarr= attendance.Split(','); if (attendance != "") { if ((attarr.Length == 3) || (attarr.Length > 4)) { status = "INAPPROPRIATE"; } else if ((attarr.Length == 2) || attarr.Length == 4) { status = "GOOD"; } else { status = "INAPPROPRIATE"; } } else { status = ""; } } else { attendance = ""; status = ""; } cn.DISCONNECT(); c["attendance_"] = attendance; //=============================================== c["day_type"] = cutoffitem["day_type"].ToString(); c["status_"] = status; cutoffdt.Rows.Add(c); x++; } //===================================== }//end foreach item in dt.rows ReportDataSource r = new ReportDataSource("DataSet1", dt); this.rptViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(localReport_SubreportProcessing); //SET REPORT PARAMETER ReportParameter from_date = new ReportParameter("cutoff_date_from", cutoff_date_from.ToString("MM/dd/yyyy")); ReportParameter to_date = new ReportParameter("cutoff_date_to", cutoff_date_to.ToString("MM/dd/yyyy")); rptViewer.LocalReport.SetParameters(from_date); rptViewer.LocalReport.SetParameters(to_date); this.rptViewer.LocalReport.DataSources.Add(r); // this.rptViewer.SetDisplayMode(DisplayMode.PrintLayout); this.rptViewer.RefreshReport(); }
public void LoadAtt_BW_DATES_InListView(ListView lv) { Attendance a = new Attendance(); DataTable dt = new DataTable(); dt = a.SELECT_BETWEEN_DATES(dtpFrom.Value, dtpTo.Value); if (dt != null) { lv.Items.Clear(); int ctr = 1; foreach (DataRow r in dt.Rows) { ListViewItem li = new ListViewItem(); li.Text = ctr.ToString(); li.SubItems.Add(r["fullname"].ToString()); li.SubItems.Add(r["position_"].ToString()); li.SubItems.Add(Convert.ToDateTime(r["date_"].ToString()).ToString("MMMM dd, yyyy")); li.SubItems.Add(Convert.ToDateTime(r["attendance"].ToString()).ToString("hh:mm:ss tt")); li.Tag = r["empid"].ToString(); // li.SubItems.Add(Convert.ToDateTime(r["date_updated"].ToString()).ToLongDateString()); lv.Items.Add(li); ctr++; } } }