コード例 #1
0
        private void glassButton3_Click(object sender, EventArgs e)
        {
            _cmd = new SqlCommand("select PHOTO from T_IMAGE", frmMainForm._MasterCon);
            _da  = new SqlDataAdapter(_cmd);
            DataTable dt2 = new DataTable();

            _da.Fill(dt2);
            frmEmpMange r = new frmEmpMange();

            byte[] imageData;

            imageData            = r.ReadFile(Application.StartupPath + @"\back.BMP");
            dt2.Rows[0]["PHOTO"] = imageData;

            if (!checkBox2.Checked)
            {
                rptCardBack      card       = new rptCardBack();
                frmReportViewer2 viewreport = new frmReportViewer2();
                card.Database.Tables["T_IMAGE"].SetDataSource(dt2);
                viewreport.crystalReportViewer1.ReportSource = card;
                viewreport.ShowDialog();
            }
            else
            {
                rptCardBack_PS   card       = new rptCardBack_PS();
                frmReportViewer2 viewreport = new frmReportViewer2();
                card.Database.Tables["T_IMAGE"].SetDataSource(dt2);
                viewreport.crystalReportViewer1.ReportSource = card;
                viewreport.ShowDialog();
            }
        }
コード例 #2
0
        private void frmMainForm_Load(object sender, EventArgs e)
        {
            frmEmpMange rr = new frmEmpMange();

            if (!CheckFormOpen(rr))
            {
                rr.MdiParent = this;
                rr.Text      = "Monitor";
                rr.Show();
            }

            /*frmLogin frm = new frmLogin();
             * frm.frm = this;
             * frm.ShowDialog();
             * try
             * {
             *  StreamReader sr = new StreamReader("LastUpdate.txt");
             *  lblLastUpdate.Text = sr.ReadLine();
             *  sr.Close();
             * }
             * catch
             * {
             *  lblLastUpdate.Text = "";
             * }
             *
             * SqlCommand com = new SqlCommand("SELECT convert(char(10),MAX(TRN_TIME),103) AS Date , convert(char(19),MAX(TRN_TIME),8) AS Time FROM EMPLOYEE_TRANSACTIONS", _MasterCon);
             * com.CommandType = CommandType.Text;
             * SqlDataAdapter sda = new SqlDataAdapter(com);
             * DataTable dt = new DataTable();
             * sda.Fill(dt);
             * if (dt.Rows.Count > 0)
             * {
             *
             *  lblMaxUpdate.Text = dt.Rows[0][0].ToString() + " " + dt.Rows[0][1].ToString();
             * }
             * else
             * {
             *  lblMaxUpdate.Text = "";
             * }
             */
        }
コード例 #3
0
        /*public static int GetIDIndex(string id, string colName, DataTable NavDt)
         * {
         *  for (int i = 0; i < NavDt.Rows.Count; i++)
         *  {
         *      if (id == NavDt.Rows[i][colName].ToString().Trim())
         *          return i;
         *  }
         *  return -1;
         * }*/



        private void ultraToolbarsManager1_ToolClick_1(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
        {
            if (main_door == "All")
            {
                switch (e.Tool.Key)
                {
                case "Exit Application":
                    Application.Exit();
                    break;

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

                case "ALL_TRANS":
                    FrmAllEmpTrans rr2 = new FrmAllEmpTrans();
                    if (!CheckFormOpen(rr2))
                    {
                        rr2.MdiParent = this;
                        rr2.Text      = "All Transactions";
                        rr2.Show();
                    }
                    break;

                case "TRANS":
                    FrmEmpTrans rr3 = new FrmEmpTrans();
                    if (!CheckFormOpen(rr3))
                    {
                        rr3.MdiParent = this;
                        rr3.Text      = "Transactions";
                        rr3.Show();
                    }
                    break;

                case "IN_COMPANY":
                    FrmNowIN rr4 = new FrmNowIN();
                    if (!CheckFormOpen(rr4))
                    {
                        rr4.MdiParent = this;
                        rr4.Text      = "In Company";
                        rr4.Show();
                    }
                    break;

                case "DELAYY":
                    Frm_Delay rr5 = new Frm_Delay();
                    if (!CheckFormOpen(rr5))
                    {
                        rr5.MdiParent = this;
                        rr5.Text      = "Delay";
                        rr5.Show();
                    }
                    break;
                }
            }
            else
            {
                switch (e.Tool.Key)
                {
                case "Exit Application":
                    Application.Exit();
                    break;

                case "Monitor":
                    frmEmpMange rr = new frmEmpMange();
                    if (!CheckFormOpen(rr))
                    {
                        rr.MdiParent = this;
                        rr.Text      = "Monitor";
                        rr.Show();
                    }
                    break;
                }
            }
        }
コード例 #4
0
        private void glassButton2_Click(object sender, EventArgs e)
        {
            rptVisitorCard card = new rptVisitorCard();

            frmReportViewer2 viewreport = new frmReportViewer2();
            DataTable        dt         = new DataTable();
            string           floor;

            try
            {
                _cmd = new SqlCommand("select * from EMPLOYEE_CARDS where CRD_NO='" + txtCardNo.Text + "'", frmMainForm._MasterCon);
                _da  = new SqlDataAdapter(_cmd);
                _da.Fill(dt);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            frmEmpMange r = new frmEmpMange();

            byte[] imageData;

            if (radioButton1.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor1.jpg");
                floor     = radioButton1.Text;
            }
            else if (radioButton2.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor2.jpg");
                floor     = radioButton2.Text;
            }
            else if (radioButton3.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor3.jpg");
                floor     = radioButton3.Text;
            }
            else if (radioButton4.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor4.jpg");
                floor     = radioButton4.Text;
            }
            else if (radioButton5.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor5.jpg");
                floor     = radioButton5.Text;
            }
            else if (radioButton6.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor6.jpg");
                floor     = radioButton6.Text;
            }
            else if (radioButton7.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor7.jpg");
                floor     = radioButton7.Text;
            }
            else if (radioButton8.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor8.jpg");
                floor     = radioButton8.Text;
            }
            else if (radioButton9.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Visitor9.jpg");
                floor     = radioButton9.Text;
            }
            else //if (radioButton10.Checked)
            {
                imageData = r.ReadFile(Application.StartupPath + @"\Blank_Visitor.jpg");
                floor     = "";
            }
            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("There is no member");
                return;
            }


            dt.Rows[0]["PhotoBytes"] = imageData;
            card.Database.Tables["EMPLOYEE_CARDS"].SetDataSource(dt);

            card.SetParameterValue(card.Parameter_Num.ParameterFieldName, txtCardNo.Text);

            card.SetParameterValue(card.Parameter_Floor.ParameterFieldName, floor);
            if (checkBox1.Checked)
            {
                card.SetParameterValue(card.Parameter_Visitor.ParameterFieldName, txtCompanyName.Text);
            }
            else
            {
                card.SetParameterValue(card.Parameter_Visitor.ParameterFieldName, "Visitor");
            }
            viewreport.crystalReportViewer1.ReportSource = card;

            viewreport.ShowDialog();
        }
コード例 #5
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;
                }
            }
        }