示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (TXT_EMP_NO.Text.Trim() != null && TXT_EMP_NO.Text.Trim() != "")
            {
                SqlCommand CMD = new SqlCommand();

                CMD.CommandText    = "SELECT * FROM dbo.EMPLOYEE_CARDS WHERE CRD_NO ='" + TXT_EMP_NO.Text + "'";
                CMD.CommandTimeout = 2000;
                CMD.CommandType    = CommandType.Text;
                CMD.Connection     = frmMainForm._MasterCon;
                SqlDataAdapter SDA = new SqlDataAdapter();
                SDA.SelectCommand = CMD;
                DataTable DT = new DataTable();
                SDA.Fill(DT);
                if (DT.Rows.Count == 0)
                {
                    MessageBox.Show("No Employee has this number.");
                    return;
                }
            }
            else
            {
                MessageBox.Show("Enter Employee Number.");
                return;
            }
            if (cmb_machine.SelectedItem == null)
            {
                MessageBox.Show("Enter Machine.");
                return;
            }
            string year = "", month = "", day = "", hour = "", minutes = "", seconds = "00";

            year  = dateTimePickerValid.Value.Year.ToString();
            month = dateTimePickerValid.Value.Month.ToString();
            day   = dateTimePickerValid.Value.Day.ToString();

            string[] time = txtfromTime.Text.Split(':');

            hour    = time[0];
            minutes = time[1];

            DeviceSetting dv        = new DeviceSetting();
            DateTime      transDate = new DateTime(int.Parse(year), int.Parse(month), int.Parse(day));
            DateTime      transTime = new DateTime(int.Parse(year), int.Parse(month), int.Parse(day), int.Parse(hour), int.Parse(minutes), int.Parse(seconds));

            if (radioButtonIn.Checked)
            {
                dv.savetimeattendance(TXT_EMP_NO.Text, transDate, transTime, false, 0, "In", cmb_machine.SelectedItem.ToString());
                MessageBox.Show("Data Saved.");
            }
            else
            {
                dv.savetimeattendance(TXT_EMP_NO.Text, transDate, transTime, false, 0, "Out", cmb_machine.SelectedItem.ToString());
                MessageBox.Show("Data Saved.");
            }
        }
示例#2
0
        private void ultraToolbarsManager1_ToolClick_1(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
        {
            if (ROLE == 1)
            {
                switch (e.Tool.Key)
                {
                case "Exit Application":
                    Application.Exit();
                    break;

                case "CARDS":
                    frmEmpMange rr = new frmEmpMange();
                    if (!CheckFormOpen(rr))
                    {
                        rr.MdiParent = this;
                        rr.Text      = "Employee";
                        rr.Show();
                    }
                    break;

                case "LoadTransation":
                    DeviceSetting rr2 = new DeviceSetting();
                    rr2.MdiParent = this;
                    rr2.Text      = "Load Transations";
                    //rr2.ShowDialog();
                    rr2.Show();
                    break;

                case "Transaction":
                    //if (frmMainForm._ConfigPlace == "cairo")
                    //{
                    FrmEmpTrans rr3 = new FrmEmpTrans();
                    if (!CheckFormOpen(rr3))
                    {
                        rr3.MdiParent = this;
                        rr3.Text      = "Transations";
                        rr3.Show();
                    }
                    //}
                    break;

                case "AllTransaction":
                    FrmAllEmpTrans rr4 = new FrmAllEmpTrans();
                    if (!CheckFormOpen(rr4))
                    {
                        rr4.MdiParent = this;
                        rr4.Text      = "All Transations";
                        rr4.Show();
                    }
                    break;

                case "Users":
                    frmUsers rr5 = new frmUsers();
                    if (!CheckFormOpen(rr5))
                    {
                        rr5.MdiParent = this;
                        rr5.Text      = "Users";
                        rr5.Show();
                    }
                    break;

                case "Department":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        FrmDepartments rr6 = new FrmDepartments();
                        if (!CheckFormOpen(rr6))
                        {
                            rr6.MdiParent = this;
                            rr6.Text      = "Department";
                            rr6.Show();
                        }
                    }
                    break;

                case "VisitorCard":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        frmVisitor rr7 = new frmVisitor();
                        //rr2.MdiParent = this;
                        rr7.Text = "Print Visitor Cards";
                        rr7.ShowDialog();
                    }
                    break;

                case "Shift":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        FrmShifts rr8 = new FrmShifts();
                        if (!CheckFormOpen(rr8))
                        {
                            rr8.MdiParent = this;
                            rr8.Text      = "Shifts";
                            rr8.Show();
                        }
                    }
                    break;

                case "ChangeID":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        FrmChangeID rr9 = new FrmChangeID();
                        //rr8.MdiParent = this;
                        rr9.Text = "Change ID";
                        rr9.ShowDialog();
                    }
                    break;

                case "NOW_IN":
                    //if (frmMainForm._ConfigPlace == "cairo")
                    //{
                    FrmNowIN rr10 = new FrmNowIN();
                    if (!CheckFormOpen(rr10))
                    {
                        rr10.MdiParent = this;
                        rr10.Text      = "In Company";
                        rr10.Show();
                    }
                    //}
                    break;

                case "DELAY":
                    //    if (frmMainForm._ConfigPlace == "cairo")
                    //    {
                    Frm_Delay rr11 = new Frm_Delay();
                    if (!CheckFormOpen(rr11))
                    {
                        rr11.MdiParent = this;
                        rr11.Text      = "Delays";
                        rr11.Show();
                    }
                    //    }
                    break;

                case "daylight":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        Frm_change rr12 = new Frm_change();
                        if (!CheckFormOpen(rr12))
                        {
                            //rr12.MdiParent = this;
                            rr12.Text = "Daylight";
                            rr12.ShowDialog();
                        }
                    }
                    break;

                case "SEND DATA":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        Frm_Copy_Pic rr100 = new Frm_Copy_Pic();
                        if (!CheckFormOpen(rr100))
                        {
                            //rr100.MdiParent = this;
                            rr100.Text = "SEND";
                            rr100.ShowDialog();
                        }
                    }
                    break;

                case "PERMIT":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        FrmPermit rr101 = new FrmPermit();
                        if (!CheckFormOpen(rr101))
                        {
                            rr101.MdiParent = this;
                            rr101.Text      = "Permit";
                            rr101.Show();
                        }
                    }
                    break;

                case "STATUS":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        FrmStatus rr102 = new FrmStatus();
                        if (!CheckFormOpen(rr102))
                        {
                            rr102.MdiParent = this;
                            rr102.Text      = "Status";
                            rr102.Show();
                        }
                    }
                    break;
                }
            }
            else if (ROLE == 2)
            {
                switch (e.Tool.Key)
                {
                case "Exit Application":
                    Application.Exit();
                    break;

                case "CARDS":
                    frmEmpMange rr = new frmEmpMange();
                    if (!CheckFormOpen(rr))
                    {
                        rr.MdiParent = this;
                        rr.Text      = "Employee";
                        rr.Show();
                    }
                    break;

                case "Department":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        FrmDepartments rr6 = new FrmDepartments();
                        if (!CheckFormOpen(rr6))
                        {
                            rr6.MdiParent = this;
                            rr6.Text      = "Department";
                            rr6.Show();
                        }
                    }
                    break;

                case "Shift":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        FrmShifts rr8 = new FrmShifts();
                        if (!CheckFormOpen(rr8))
                        {
                            rr8.MdiParent = this;
                            rr8.Text      = "Shifts";
                            rr8.Show();
                        }
                    }
                    break;

                case "PERMIT":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        FrmPermit rr101 = new FrmPermit();
                        if (!CheckFormOpen(rr101))
                        {
                            rr101.MdiParent = this;
                            rr101.Text      = "Permit";
                            rr101.Show();
                        }
                    }
                    break;

                case "STATUS":
                    if (frmMainForm._ConfigPlace == "cairo")
                    {
                        FrmStatus rr102 = new FrmStatus();
                        if (!CheckFormOpen(rr102))
                        {
                            rr102.MdiParent = this;
                            rr102.Text      = "Status";
                            rr102.Show();
                        }
                    }
                    break;
                }
            }
        }