public UserModel UserData(object UserID) { List <SqlParameter> ProcParam = new List <SqlParameter>(); EducationDataContext sqldb = new EducationDataContext(); ProcParam.Add(new SqlParameter("UserID", UserID.handleDBNull())); return(new EducationDataContext().Database.SqlQuery <UserModel>("GetUserData".getSql(ProcParam), ProcParam.Cast <object>().ToArray()).FirstOrDefault()); }
//public string UploadDB() //{ // SqlConnection con = new SqlConnection(); // return null; //} public void LogOut(object UserID = null, string Email = null, string pass = null) { EducationDataContext sqldb = new EducationDataContext(); List <SqlParameter> ProcParam = new List <SqlParameter>(); ProcParam.Add(new SqlParameter("UserID", UserID.handleDBNull())); ProcParam.Add(new SqlParameter("Email", Email.handleDBNull())); ProcParam.Add(new SqlParameter("pass", pass.handleDBNull())); new EducationDataContext().Database.ExecuteSqlCommand("EXEC LogOutUser @UserID,@Email,@pass", ProcParam.ToArray()); }
public Boolean GetUserName(string lsUserName) { EducationDataContext sqldb = new EducationDataContext(); List <SqlParameter> ProcParam = new List <SqlParameter>(); ProcParam.Add(new SqlParameter("UserName", lsUserName.handleDBNull())); var u = new EducationDataContext().Database.SqlQuery <string>("EXEC GetUserNameForValidation @UserName", ProcParam.ToArray()).FirstOrDefault(); if (u == null) { return(true); } else { return(false); } }
public Boolean GetEmail(string lsEmailID) { EducationDataContext sqldb = new EducationDataContext(); List <SqlParameter> ProcParam = new List <SqlParameter>(); ProcParam.Add(new SqlParameter("EmailID", lsEmailID.handleDBNull())); var e = new EducationDataContext().Database.SqlQuery <string>("EXEC GetEmailForValidation @EmailID", ProcParam.ToArray()).FirstOrDefault(); if (e == null) { return(false); } else { return(true); } }
public string EditProfile(UserModel loEdit) { EducationDataContext sqldb = new EducationDataContext(); List <SqlParameter> ProcParam = new List <SqlParameter>(); //string FileName; //if (loEdit.ProfileImg==null) //{ // FileName = System.Configuration.ConfigurationManager.AppSettings["Default_Profile"]; //} //else //{ // FileName = loEdit.ProfileImg.FileName; //} string FileName = loEdit.ProfImg; if (loEdit.ProfileImg != null) { FileName = loEdit.FName + " " + loEdit.LName + loEdit.UserID + Path.GetExtension(loEdit.ProfileImg.FileName); } else { FileName = System.Configuration.ConfigurationManager.AppSettings["Default_Profile"]; } ProcParam.Add(new SqlParameter("UserID", loEdit.UserID.handleDBNull())); ProcParam.Add(new SqlParameter("FName", loEdit.FName.handleDBNull())); ProcParam.Add(new SqlParameter("LName", loEdit.LName.handleDBNull())); ProcParam.Add(new SqlParameter("MobileNo", loEdit.MobileNo.handleDBNull())); ProcParam.Add(new SqlParameter("Email", loEdit.Email.handleDBNull())); ProcParam.Add(new SqlParameter("DoB", loEdit.DoB.handleDBNull())); ProcParam.Add(new SqlParameter("City", loEdit.City.handleDBNull())); ProcParam.Add(new SqlParameter("profileImg", FileName.handleDBNull())); ProcParam.Add(new SqlParameter("UPassword", loEdit.UPassword.handleDBNull())); if (Convert.ToBoolean(sqldb.Database.ExecuteSqlCommand("exec UpdateProfile @UserID,@FName,@LName,@MobileNo,@Email,@DoB,@City,@profileImg,@UPassword", ProcParam.ToArray()))) { return("Successfully Registered"); } else { return("Error Occured While Registering"); } }
public Boolean GetMobile(string lsMobile) { EducationDataContext sqldb = new EducationDataContext(); List <SqlParameter> ProcParam = new List <SqlParameter>(); ProcParam.Add(new SqlParameter("Mobile", lsMobile.handleDBNull())); var e = new EducationDataContext().Database.SqlQuery <Decimal>("GetMobileForValidation".getSql(ProcParam), ProcParam.Cast <object>().ToArray()).FirstOrDefault(); if (e < 1) { return(false); } else { return(true); } }
public string UserInsert(UserModel loRegistration) { List <SqlParameter> ProcParam = new List <SqlParameter>(); EducationDataContext sqldb = new EducationDataContext(); ProcParam.Add(new SqlParameter("FName", loRegistration.FName.handleDBNull())); ProcParam.Add(new SqlParameter("LName", loRegistration.LName.handleDBNull())); ProcParam.Add(new SqlParameter("MobileNo", loRegistration.MobileNo.handleDBNull())); ProcParam.Add(new SqlParameter("Email", loRegistration.Email.handleDBNull())); ProcParam.Add(new SqlParameter("Gender", loRegistration.Gender.handleDBNull())); ProcParam.Add(new SqlParameter("UserType", "user")); ProcParam.Add(new SqlParameter("ProfImg", System.Configuration.ConfigurationManager.AppSettings["Default_Profile"].handleDBNull())); ProcParam.Add(new SqlParameter("RegDate", DateTime.Now.Date.ToString())); ProcParam.Add(new SqlParameter("ISActive", "InActive")); ProcParam.Add(new SqlParameter("UPassword", loRegistration.UPassword.handleDBNull())); ProcParam.Add(new SqlParameter("SecQue", "security question")); //ProcParam.Add(new SqlParameter("SecQue", loRegistration.SecQue)); ProcParam.Add(new SqlParameter("SecAns", loRegistration.SecAns.handleDBNull())); ProcParam.Add(new SqlParameter("LearnedTime", 1)); //procparam.add(new SqlParameter("dob", loRegistration.dob)); //procparam.add(new SqlParameter("cityid", loRegistration.cityid)); //if (Convert.ToBoolean(ins.Database.SqlQuery<Reg>("Rginsert".getSql(ProcParam.ToList())))) // if (Convert.ToBoolean(ins.Database.ExecuteSqlCommand("Rginsert".getSql(ProcParam.ToList())))) if (Convert.ToBoolean(sqldb.Database.ExecuteSqlCommand("exec Registration @FName,@LName,@MobileNo,@Email,@Gender,@UserType,@ProfImg,@RegDate,@ISActive,@UPassword,@SecQue,@SecAns,@LearnedTime", ProcParam.ToArray()))) { return("Successfully Registered"); } else { return("Error Occured While Registering"); } }