public int CheckForLogin(Users objUser) { try { object[] objParam ={ objUser.UserName.ToString(), objUser.Password.ToString() }; DataSet ds = GetDataSet("usp_ValidateUser", objParam); int userId = 0; if (ds.Tables[0].Rows.Count > 0) { userId = int.Parse(ds.Tables[0].Rows[0]["UserId"].ToString()); } if (userId > 0) return userId; else return -1; /*if (userId > 0) return true; else return false;*/ } catch (System.Data.SqlClient.SqlException sqlEx) { return -1; } catch (Exception ex) { return -1; } }
/*[WebMethod] public string Login(string strUsername, string strPassword) { string strPathName = @"D:\Userlogin.txt"; string resp="done"; try { // ServiceMethods obje = new ServiceMethods(); StreamWriter sw = new StreamWriter(strPathName, true); sw.WriteLine("UserName : "******"Password : "******"Time : " + DateTime.Now.ToLongTimeString()); sw.WriteLine("Date : " + DateTime.Now.ToShortDateString()); sw.WriteLine("-------------------------------------------------------------------"); sw.Flush(); sw.Close(); return resp; } catch (Exception ex) { return ex.Message; } // string val = obje.EnterUserPassword(strUsername, strPassword); // return val; //if ((strUsername == "sopra") && (strPassword == "123")) // return true; //else // return false; }*/ public string GetVideoPath(string userName, string password) { Users objUser = new Users(); UserManager objUserManager = new UserManager(); objUser.UserName = userName; objUser.Password = Security.EncryptSymmetric(password); if (objUserManager.CheckForLogin(objUser) > 0) { string path = GetPath(userName); DirectoryInfo objDir = new DirectoryInfo(path); if (!objDir.Exists) objDir.Create(); return path; //return "<tributeservice><path>c:\\</path><pid>100</pid></tributeservice>"; } else { return "error"; } }
/// <summary> /// Method to check username and password /// </summary> /// <param name="userName"></param> /// <param name="password"></param> /// <returns></returns> private int CheckUser(string userName, string password) { Users objUser = new Users(); UserManager objUserManager = new UserManager(); objUser.UserName = userName; objUser.Password = Security.EncryptSymmetric(password); return objUserManager.CheckForLogin(objUser); }
public int CheckForLogin(Users objUser) { UserResource objUserResource = new UserResource(); return objUserResource.CheckForLogin(objUser); }