Exemplo n.º 1
0
        public string validateMSID(string msid)
        {
            string result = string.Empty;;

            string con = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            using (SqlConnection conn = new SqlConnection(con))
            {
                conn.Open();
                SqlCommand    cmd      = new SqlCommand("select MSID from LTLogin where MSID='" + msid + "'", conn);
                SqlDataReader sr       = cmd.ExecuteReader();
                login         objLogin = new login();
                if (sr.Read())
                {
                    result = sr["MSID"].ToString();
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        public bool getPassword(string msid)
        {
            bool   result    = false;
            string checkPass = string.Empty;
            string con       = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            using (SqlConnection conn = new SqlConnection(con))
            {
                conn.Open();
                SqlCommand    cmd      = new SqlCommand("select pwd from LTLogin where MSID ='" + msid + "'", conn);
                SqlDataReader sr       = cmd.ExecuteReader();
                login         objLogin = new login();
                if (sr.Read())
                {
                    checkPass = sr["pwd"].ToString();
                    result    = (checkPass.Equals("")) ? false : true;
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        public login toGetDetails(string msid)
        {
            string con = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            using (SqlConnection conn = new SqlConnection(con))
            {
                conn.Open();
                SqlCommand    cmdToSelect = new SqlCommand("select MSID,FirstName,LastName,Project,Location,Branch,SupervisorName from LTLogin where MSID='" + msid + "'", conn);
                SqlDataReader sr          = cmdToSelect.ExecuteReader();
                login         objLogin    = new login();
                if (sr.Read())
                {
                    objLogin.MSID           = sr["MSID"].ToString();
                    objLogin.FirstName      = sr["FirstName"].ToString();
                    objLogin.LastName       = sr["LastName"].ToString();
                    objLogin.Project        = sr["Project"].ToString();
                    objLogin.Location       = sr["Location"].ToString();
                    objLogin.Branch         = sr["Branch"].ToString();
                    objLogin.supervisorName = sr["SupervisorName"].ToString();
                }
                return(objLogin);
            }
        }
Exemplo n.º 4
0
        public int extraHrsLog(string MSID, string hrs, DateTime dateLogHrsFormat, string Reason)
        {
            int     rowAffected = 0;
            decimal hrsExtra    = 0;
            decimal totalHrs    = 0;
            login   objLogin    = new login();

            hrsExtra = Convert.ToDecimal(hrs);
            totalHrs = 8 + hrsExtra;
            objLogin = toGetDetails(MSID);
            string con = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

            using (SqlConnection conn = new SqlConnection(con))
            {
                conn.Open();
                SqlCommand cmdToInsert = new SqlCommand("insert into LTLogHrs values(@MSID,@FirstName,@LastName,@logDate,@extraHours,@totalHrs,@Project,@Location,@Branch,@SupervisorName,@Reason)", conn);
                cmdToInsert.Parameters.AddWithValue("@MSID", MSID);
                cmdToInsert.Parameters.AddWithValue("@FirstName", objLogin.FirstName);
                cmdToInsert.Parameters.AddWithValue("@LastName", objLogin.LastName);
                cmdToInsert.Parameters.AddWithValue("@logDate", dateLogHrsFormat);
                cmdToInsert.Parameters.AddWithValue("@extraHours", hrsExtra);
                cmdToInsert.Parameters.AddWithValue("@totalHrs", totalHrs);
                cmdToInsert.Parameters.AddWithValue("@Project", objLogin.Project);
                cmdToInsert.Parameters.AddWithValue("@Location", objLogin.Location);
                cmdToInsert.Parameters.AddWithValue("@Branch", objLogin.Branch);
                cmdToInsert.Parameters.AddWithValue("@Reason", Reason);
                cmdToInsert.Parameters.AddWithValue("@SupervisorName", objLogin.supervisorName);

                //cmd.Parameters.AddWithValue("@Reason", Reason);



                rowAffected = cmdToInsert.ExecuteNonQuery();
            }
            return(rowAffected);
        }