Ejemplo n.º 1
0
        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");
            }
        }
Ejemplo n.º 2
0
        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);
                        }
                    }
                }
        }