예제 #1
0
        private void Main_Menu_Load(object sender, EventArgs e)
        {
            timer1.Start();
            string PrivilegeDescription;
            int    PrivilegeID;
            string Name;
            string Surname;

            lblDate.Text = System.DateTime.Now.ToLongDateString();

            //Get Privilege
            SqlConnection sqlcon = new SqlConnection(Globals.ConnectionString);

            sqlcon.Open();
            string        cmd    = "SELECT PrivilegeID, Name, Surname FROM Users WHERE UserID ='" + Globals.UserID.ToString() + "'";
            SqlCommand    sqlcom = new SqlCommand(cmd, sqlcon);
            SqlDataReader dr     = sqlcom.ExecuteReader();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    PrivilegeID = Convert.ToInt32((dr["PrivilegeID"]));
                    Name        = (dr["Name"].ToString());
                    Surname     = (dr["Surname"].ToString());

                    lblUser.Text = Name + " " + Surname;
                    //Get Description
                    SqlConnection sqlcon2 = new SqlConnection(Globals.ConnectionString);
                    sqlcon2.Open();
                    string        cmd2    = "SELECT PrivilegeDescription FROM Privilege WHERE PrivilegeID ='" + PrivilegeID.ToString() + "'";
                    SqlCommand    sqlcom2 = new SqlCommand(cmd2, sqlcon2);
                    SqlDataReader dr2     = sqlcom2.ExecuteReader();
                    if (dr2.HasRows)
                    {
                        while (dr2.Read())
                        {
                            PrivilegeDescription = (dr2["PrivilegeDescription"].ToString());

                            if (PrivilegeDescription == "Administrator" || PrivilegeDescription == "Manager")
                            {
                                mtManagerFeatures.Enabled = true;
                            }
                            else
                            {
                                mtManagerFeatures.Enabled = false;
                            }
                        }
                    }
                    dr2.Close();
                    sqlcon2.Close();
                }
            }
            dr.Close();
            sqlcon.Close();

            //Check if Daily First Login
            SqlConnection sqlcon3 = new SqlConnection(Globals.ConnectionString);

            sqlcon3.Open();
            string        cmd3    = "SELECT HasLoggedIn From DailyLogin WHERE Date ='" + lblDate.Text + "' AND UserID ='" + Globals.UserID.ToString() + "'";
            SqlCommand    sqlcom3 = new SqlCommand(cmd3, sqlcon3);
            SqlDataReader dr3     = sqlcom3.ExecuteReader();

            if (dr3.HasRows)
            {
                while (dr3.Read())
                {
                    int HasLoggedIn = Convert.ToInt32((dr3["HasLoggedIn"]));

                    if (HasLoggedIn == 2)
                    {
                    }
                    else
                    {
                        Capture_Float_Amount myform = new Capture_Float_Amount();
                        myform.ShowDialog();
                    }
                }
            }
            dr3.Close();
            sqlcon3.Close();
        }
예제 #2
0
        private void metroTile3_Click(object sender, EventArgs e)
        {
            Capture_Float_Amount myform = new Capture_Float_Amount();

            myform.ShowDialog();
        }