Exemple #1
0
        public Userregistration Logincred(login dd)
        {
            Userregistration userreglst = new Userregistration();

            try
            {
                SqlCommand cmd = new SqlCommand("USER_LOGIN", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@USERID", dd.Username);
                cmd.Parameters.AddWithValue("@PASSWORD", dd.Password);
                Connection();
                SqlDataReader dr = cmd.ExecuteReader();
                // Userregistration ur;
                while (dr.Read())
                {
                    userreglst.STATUS = dr["STATUS"] != null ? dr["STATUS"].ToString() : "";
                    //userreglst.Add(ur);
                }
                return(userreglst);
            }
            catch (Exception ch)
            {
                return(userreglst);
            }
            finally
            {
                conn.Close();
            }
        }
Exemple #2
0
        public List <Userregistration> Login()
        {
            List <Userregistration> userreglist = new List <Userregistration>();

            try
            {
                SqlCommand cmd = new SqlCommand("GET_USERDATA", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                Connection();
                SqlDataReader    dr = cmd.ExecuteReader();
                Userregistration userreglst1;
                while (dr.Read())
                {
                    userreglst1        = new Userregistration();
                    userreglst1.Userid = dr["USER_ID"] != null?Convert.ToInt32(dr["USER_ID"]) : 0;

                    userreglst1.FIRSTNAME       = dr["Username"] != null ? dr["Username"].ToString() : "";
                    userreglst1.PASSWORD        = dr["PASSWORD"] != null ? dr["PASSWORD"].ToString() : "";
                    userreglst1.CONFORMPASSWORD = dr["CONFIRMPASSWORD"] != null ? dr["CONFIRMPASSWORD"].ToString() : "";
                    userreglst1.EMAILID         = dr["EMAIL_ID"] != null ? dr["EMAIL_ID"].ToString() : "";
                    userreglst1.MOBILENUMBER    = dr["MOBILE_NUMBER"] != null ? dr["MOBILE_NUMBER"].ToString() : "";
                    userreglst1.AAdharnumber    = dr["AADHARNUMBER"] != null ? dr["AADHARNUMBER"].ToString() : "";
                    userreglst1.LASTLOGINTIME   = dr["LASTLOGINTIME"] != null ? dr["LASTLOGINTIME"].ToString() : "";
                    userreglst1.STATUS          = dr["STATUS"] != null ? dr["STATUS"].ToString() : "";
                    userreglst1.uniqueid        = dr["UNIQUEID"] != null ? dr["UNIQUEID"].ToString() : "";
                    userreglst1.Role            = dr["ROLE"] != null ? dr["ROLE"].ToString() : "";
                    userreglst1.createdate      = dr["CREATED_DATE"] != null ? dr["CREATED_DATE"].ToString() : "";
                    userreglist.Add(userreglst1);
                }
                return(userreglist);
            }
            catch (Exception ch)
            {
                return(userreglist);
            }
            finally
            {
                conn.Close();
            }
        }
Exemple #3
0
        public Userregistration Create_user(Userregistration userreg)
        {
            Userregistration dd = new Userregistration();

            try
            {
                SqlCommand cmd = new SqlCommand("Insert_USERREGISTRATION", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@FINAME", userreg.FIRSTNAME);
                cmd.Parameters.AddWithValue("@LASTNAME ", userreg.LASTNAME);//it is related to aadharnumber property
                cmd.Parameters.AddWithValue("@PASSWORD", userreg.PASSWORD);
                cmd.Parameters.AddWithValue("@CONFORMPASSWORD", userreg.CONFORMPASSWORD);
                cmd.Parameters.AddWithValue("@EMAILID", userreg.EMAILID);
                cmd.Parameters.AddWithValue("@MOBILENUMBER", userreg.MOBILENUMBER);
                //cmd.Parameters.AddWithValue("@LASTLOGINTIME", "fsf");
                cmd.Parameters.AddWithValue("@STATUS", "ACTIVE");
                Connection();
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    //var dd = new Userregistration();
                    dd.FIRSTNAME = dr["USER_ID"].ToString();
                }
                dr.Close();

                return(dd);
            }
            catch (Exception ex)
            {
                dd.STATUS = ex.ToString();
                return(dd);
            }
            finally
            {
                conn.Close();
            }
        }