Esempio n. 1
0
 public Facmng()
 {
     conobj = connect.getconnect();
     fac    = new Faculty();
     acc    = new Account();
 }
Esempio n. 2
0
        public Tuple <string, string> forgetpass(int id)
        {
            bool flag = false;

            strQuery = "select user_pass from account where fac_id=" + id;
            cmd      = conobj.execute(this.strQuery);
            SqlDataReader dr;

            try
            {
                conobj.openconnect();
                dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    acc          = new Account();
                    acc.Password = (string)dr["user_pass"];
                    flag         = true;
                }
                dr.Close();

                if (!flag)
                {
                    throw new Exception("Invalid Id");
                }

                flag     = false;
                strQuery = "select fac_email from faculty where fac_id=" + id;
                cmd      = conobj.execute(this.strQuery);
                SqlDataReader dr1;

                try
                {
                    dr1 = cmd.ExecuteReader();
                    while (dr1.Read())
                    {
                        fac       = new Faculty();
                        fac.Email = (string)dr1["fac_email"];
                        flag      = true;
                    }
                    dr1.Close();
                    if (!flag)
                    {
                        throw new Exception("Invalid Id");
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            finally
            {
                conobj.closeconnect();
            }

            return(new Tuple <string, string>(fac.Email, acc.Password));
        }