public static List<Users> getusers() { EncryptDecryptUtil ecd = new EncryptDecryptUtil(); try { List<Users> userlist = new List<Users>(); Users user = null; using (SqlConnection conn = new SqlConnection()) { //conn.ConnectionString = "Server=its-ba-dc02\\MSSQL2008R2_DEV;Database=hick_poc;Trusted_Connection=false;User Id=itsdev;Password=itsdev"; //"Server=its-ba-dc02\\MSSQL2008R2_DEV;Database=hick_poc;Trusted_Connection=false;User Id=itsdev;Password=itsdev"; conn.ConnectionString = Utility.DBConnectionString; conn.Open(); using (SqlCommand command = new SqlCommand( "select * from Hick_Users where Status=1 ", conn)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { user = new Users(); //User=reader["asd"] } user.Username = ecd.DecryptData((reader["Username"].ToString()), ecd.GetEncryptType()); user.Firstname = ecd.DecryptData((reader["Firstname"].ToString()), ecd.GetEncryptType()); user.Status = Convert.ToInt32(reader["Status"]); user.Lastname = ecd.DecryptData((reader["Lastname"].ToString()), ecd.GetEncryptType()); user.ID = Convert.ToInt32(reader["ID"]); user.StatusMessage = reader["StatusMessage"].ToString(); user.Lastloggedin = reader["LastLoggedIN"].ToString(); userlist.Add(user); } return userlist; } } } } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { EncryptDecryptUtil enc = new EncryptDecryptUtil(); hdnPatientId.Value = Convert.ToString(Session["patientid"]); hdnUserId.Value = Convert.ToString(Session["userid"]); patientid = hdnPatientId.Value; userid = hdnUserId.Value; //For getting the Firstname and Lastname of the patient string constr = ConfigurationManager.ConnectionStrings["HickConnectionString"].ConnectionString.ToString(); SqlConnection conn = new SqlConnection(); conn.ConnectionString = constr; conn.Open(); SqlCommand command = new SqlCommand("sp_hick_FetchUserByID", conn); command.CommandType = CommandType.StoredProcedure; //Parameters.AddWithValue("@Username", ecd.EncryptData(uname, ecd.GetEncryptType())); command.Parameters.Add("@UserId", patientid); SqlDataReader sdr1 = command.ExecuteReader(); while (sdr1.Read()) { //string firstname =sdr1[enc.EncryptData(FirstName, enc.GetEncryptType())]; //lblfname.Text = sdr1["FirstName"].ToString(); string fn = sdr1["FirstName"].ToString(); lblfname.Text =enc.DecryptData(fn, enc.GetEncryptType()); string ln = sdr1["LastName"].ToString(); lbllname.Text = enc.DecryptData(ln, enc.GetEncryptType()); } BindTaskDetails(); lblmonth.Text = DateTime.UtcNow.ToString("MMM"); }
public void PostLoginProcess(IGNITE_MODEL.LoginViewData retObj, HttpResponse res) { if (retObj.Success) { EncryptDecryptUtil ecd = new EncryptDecryptUtil(); Session["userid"] = retObj.UserId; Session["username"] = ecd.DecryptData((retObj.UserName).ToString(), ecd.GetEncryptType()); Session["p_detail"] = retObj.Password; Session["LastLoggedIN"] = retObj.LastLoggedIN; Session["UserType"] = retObj.UserType; Session["PhysicianID"] = retObj.PhysicianID; Session["FirstName"] = ecd.DecryptData((retObj.FirstName).ToString(), ecd.GetEncryptType()); Session["LastName"] = ecd.DecryptData((retObj.LastName).ToString(), ecd.GetEncryptType()); Session["name"] = ecd.DecryptData((retObj.FirstName).ToString(), ecd.GetEncryptType()) + " " + ecd.DecryptData((retObj.LastName).ToString(), ecd.GetEncryptType()); Session["ReferenceID"] = retObj.ReferenceID.ToString(); if (retObj.UserType == "AuthorizedUser") { res.Redirect("AuthorizedUserForm.aspx"); } else { if (retObj.LastLoggedIN == null) { res.Redirect("TermsConditions.aspx"); } else { res.Redirect("Chat.aspx"); } } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "showmsg", "showMessage()", true); } }
public static string insertOnetimePassword(string userid, string pswd, string authorizeduserid) { EncryptDecryptUtil enc = new EncryptDecryptUtil(); SqlParameter[] sqlParms = new SqlParameter[]{ new SqlParameter("@UserId",userid), new SqlParameter("@Autherizeduserid",authorizeduserid), new SqlParameter("@password",enc.EncryptData(pswd,enc.GetEncryptType())) }; var obj = SqlHelper.ExecuteScalar(SqlHelper.ConnectionString, CommandType.StoredProcedure, "sp_hick_InsertOneTimeAccessCodeStatus", sqlParms); if ((int)obj == 1) { return "Sucessful"; } else { return "UnSucessful"; } }
public string AddAutherizedUsers(string action, long userid, long authorizeduserid, string firstname, string lastname, string dob, string relationship, string otherrelationship, string email, string password) { EncryptDecryptUtil enc = new EncryptDecryptUtil(); SqlParameter[] sqlParms = new SqlParameter[]{ //new SqlParameter("@Action",action), // new SqlParameter("@UserId",userid), // new SqlParameter("@Autherizeduserid",authorizeduserid), // new SqlParameter("@FirstName",firstname), // new SqlParameter("@LastName",lastname), // new SqlParameter("@Email",email), // new SqlParameter("@DOB",dob), // new SqlParameter("@Password",password), // new SqlParameter("@Relationship",relationship), // new SqlParameter("@OtherRelationship",otherrelationship), // new SqlParameter("@CreatedDate",DateTime.UtcNow) new SqlParameter("@Action",action), new SqlParameter("@UserId",userid), new SqlParameter("@Autherizeduserid",authorizeduserid), new SqlParameter("@FirstName",firstname), new SqlParameter("@LastName",lastname), new SqlParameter("@Email",email), new SqlParameter("@DOB",dob), new SqlParameter("@Password",password), new SqlParameter("@Relationship",relationship), new SqlParameter("@OtherRelationship",otherrelationship), new SqlParameter("@CreatedDate",DateTime.UtcNow) }; var obj = SqlHelper.ExecuteScalar(SqlHelper.ConnectionString, CommandType.StoredProcedure, "sp_hick_InsertAuthorizedUser", sqlParms); return (string)obj; }