public string GetUserID(string mail, string pass) { JavaScriptSerializer j = new JavaScriptSerializer(); UserT temp = new UserT(mail, pass); return(j.Serialize(temp.GetuserID())); }
public string GetUserDetails() { JavaScriptSerializer j = new JavaScriptSerializer(); UserT temp_user = new UserT(); HttpContext context = HttpContext.Current; if (context.Session["UserID"] == null) { return(j.Serialize("NOCOOKIE")); } temp_user.UserId = (string)(context.Session["UserID"]); int auth = temp_user.CheckAuthDesktop(); if (auth == -1) { return(j.Serialize("NOCOOKIE")); } else { temp_user.Address = auth.ToString(); } temp_user.GetUserDetails(); return(j.Serialize(temp_user)); }
public ReadUserM Login(string email, string password) { ReadUserM user = new ReadUserM(); //비밀번호 검증 bool verified = userService.VerifyUser(email, password); // 비밀번호 검증 완료 시 if (verified) { UserT userEntity = userService.GetUserByEmail(email); user = mapper.Map <UserT, ReadUserM>(userEntity); // 토큰생성 TokenT authEntity = authService.CreateToken(user); TokenM token = mapper.Map <TokenT, TokenM>(authEntity); user.Token = token; } else { throw new IncorrectDataException("비밀번호가 올바르지 않습니다.", "비밀번호 오류", LayerID.AuthController); } logger.Log(LogLevel.Info, string.Format("호출 성공 : {0}", MethodBase.GetCurrentMethod().Name)); return(user); }
public Response MakeUser(MakeUserM user) { int result = 0; Response response = new Response(); MakeUserMValidator validator = new MakeUserMValidator(); ValidationResult results = validator.Validate(user); if (results.Errors.Count > 0) { throw new ValidationException("입력값을 확인해주세요.", results.Errors.Join("\r\n"), LayerID.UserController); } UserT userEntity = mapper.Map <MakeUserM, UserT> (user); result = userService.CreateUser(userEntity); if (result > 0) { response.Status = ((int)HttpStatusCode.OK).ToString(); response.Message = "사용자 생성에 성공하였습니다."; logger.Log(LogLevel.Info, response.Message); } else { throw new BadRequestException("사용자 생성에 실패하였습니다.", "사용자 생성 오류", LayerID.UserController); } logger.Log(LogLevel.Info, string.Format("호출 성공 : {0}", MethodBase.GetCurrentMethod().Name)); return(response); }
public string ValidateUser(string mail, string pass) { JavaScriptSerializer j = new JavaScriptSerializer(); UserT temp = new UserT(mail, pass); return(j.Serialize(temp.CheckLogin())); }
public IHttpActionResult PutUserT(string id, UserT userT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } userT.UserID = "1024"; if (id != userT.UserID) { return(BadRequest()); } db.Entry(userT).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!UserTExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostUserT(UserT userT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { // Your code... // Could also be before try if you know the exception occurs in SaveChanges //string user = User.Identity.GetUserId(); //userT.UserApiID = user ; db.UserTs.Add(userT); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = userT.UserID }, userT)); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } }
/// <summary> /// מתודה להבאת פרטי יוזרים לטבלת ניהול משתמשים בדף אדמין /// </summary> /// <returns>מחזירה רשימה המכילה משתמשים</returns> internal static List <UserT> GetAllUsers() { List <UserT> li_rtn = new List <UserT>(); string sqlSelect = @"select V_full_users_rank_combo.user_id, users.first_name,users.last_name,users.active, V_full_users_rank_combo.Rank, V_association_access.association_access from V_full_users_rank_combo, V_association_access, users where V_full_users_rank_combo.user_id = V_association_access.user_id and V_full_users_rank_combo.user_id = users.user_id"; DbService db = new DbService(); DataTable usersDT = db.GetDataSetByQuery(sqlSelect).Tables[0]; List <Rank> ranksList = Rank.GetAllRanks(); foreach (DataRow row in usersDT.Rows) { string id = row["user_id"].Equals(DBNull.Value) ? "" : row["user_id"].ToString(); string fName = row["first_name"].Equals(DBNull.Value) ? "" : row["first_name"].ToString(); string lName = row["last_name"].Equals(DBNull.Value) ? "" : row["last_name"].ToString(); bool active = row["active"].Equals(DBNull.Value) ? false : bool.Parse(row["active"].ToString()); int rankSum = row["rank"].Equals(DBNull.Value) ? 0 : int.Parse(row["rank"].ToString()); Rank tempRank = new Rank(); foreach (Rank item in ranksList) { if ((rankSum >= item.Minimum) && (rankSum <= item.Max)) { tempRank = item; break; } } UserT temp_user = new UserT(id, fName, lName, active, tempRank); temp_user.Address = row["association_access"].Equals(DBNull.Value) ? "0" : row["association_access"].ToString();//שימוש חד פעמי בשדה כתובת להעברת מס' לדף הטמל li_rtn.Add(temp_user); } return(li_rtn); }
public ActionResult SendEmail(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OrderT orderT = db.OrderTs.Find(id); if (orderT == null) { return(HttpNotFound()); } var Prodectid = db.OrderTs.Find(id).ProdectID; ProdectT Prodect = db.ProdectTs.Find(Prodectid); var UserTid = db.OrderTs.Find(id).UserID; UserT UserT = db.UserTs.Find(UserTid); var FullName = UserT.FullName; var ProdectName = Prodect.ProdectName; var Price = Prodect.Price; var Phone = UserT.Phone; var Address = UserT.Address; var Country = UserT.Country; var City = UserT.City; var Email = UserT.Email; ViewBag.msg = "Hi Plese diver the Prodect :- " + ProdectName + " To the Cotomar :- " + FullName + " ,the Prodect Price is :- " + Price + " ,the Cotomar Phone :- " + Phone + " ,the Cotomar Email is:- " + Email + " and the Cotomar Address is:- " + Address + " , " + Country + " , " + City; return(View(orderT)); }
public string CheckInDatabaseAndAdd(string firstName, string lastName, string id, string mail) { JavaScriptSerializer j = new JavaScriptSerializer(); UserT temp_user = new UserT(); temp_user.FirstName = firstName; temp_user.LastName = lastName; temp_user.Mail = mail; temp_user.UserId = id; if (!temp_user.CheckIfExictById()) { temp_user.InsertUser(); temp_user.AddMursheManager(); //insert to users } else { //בודקת אם קיים באדמין או לא if (temp_user.CheckUserInAdmin()) { return("המשתמש כבר הוגדר בעבר כמנהל מערכת"); } //מוסיפה לטבלת אדמין else { temp_user.AddMursheManager(); } } return("המשתמש הוגדר כמנהל מערכת בהצלחה"); }
public void GetDataByCode() { string strSql = @"SELECT dbo.auction.auction_code, dbo.product_category.category_code, dbo.product_category.category_name, dbo.auction.end_date, dbo.auction.donation_percentage, dbo.product.product_description, dbo.product.product_Name, dbo.product.product_category_code, dbo.product.price, dbo.product.product_code, dbo.auction.seller_id, dbo.product.city_code FROM dbo.auction INNER JOIN dbo.product ON dbo.auction.product_code = dbo.product.product_code INNER JOIN dbo.product_category ON dbo.product.product_category_code = dbo.product_category.category_code GROUP BY dbo.product_category.category_code, dbo.product_category.category_name, dbo.auction.end_date, dbo.auction.donation_percentage, dbo.product.product_description, dbo.product.product_category_code, dbo.auction.auction_code, dbo.product.price, dbo.product.product_code, dbo.product.product_Name, dbo.auction.seller_id, dbo.product.city_code HAVING (dbo.auction.auction_code = @Code)"; SqlParameter parCode = new SqlParameter("@Code", AuctionID); DbService db = new DbService(); DataTable dt = new DataTable(); dt = db.GetDataSetByQuery(strSql, CommandType.Text, parCode).Tables[0]; DataRow row = dt.Rows[0]; if (row != null) { CatDesc = row["category_name"] != null ? row["category_name"].ToString() : ""; End_Date = row["end_date"] != null ? row["end_date"].ToString() : DateTime.Now.ToString(); Percentage = row["donation_percentage"] != null?int.Parse(row["donation_percentage"].ToString()) : 0; ProdDesc = row["product_description"] != null ? row["product_description"].ToString() : ""; ProdName = row["product_Name"] != null ? row["product_Name"].ToString() : ""; Seller = row["seller_id"] != null ? new UserT(row["seller_id"].ToString()) : new UserT("-1"); Price = row["price"] != null?int.Parse(row["price"].ToString()) : -1; //get the most updated price int tempPrice = GetLatestBid(); if (tempPrice != -1) { Price = tempPrice; } Location = row["city_code"] != null ? new City(int.Parse(row["city_code"].ToString())) : new City(-1); Seller.Rank = UserT.GetUserRank(Seller.UserId); //getting all product pics string picSql = @"SELECT dbo.product_pictures.path FROM dbo.product_pictures INNER JOIN dbo.product ON dbo.product_pictures.product_code = dbo.product.product_code WHERE(dbo.product_pictures.product_code = @prodCode)"; SqlParameter parProd = new SqlParameter("@prodCode", row["product_code"].ToString()); DataSet dsPic = db.GetDataSetByQuery(picSql, CommandType.Text, parProd); List <string> pics = new List <string>(); if (dsPic.Tables.Count > 0) { foreach (DataRow picRow in dsPic.Tables[0].Rows) { pics.Add(picRow["path"].ToString()); } } // ItemCode Images = pics.Count > 0 ? pics.ToArray() : null; } }
public ActionResult DeleteConfirmed(int id) { UserT userT = db.UserTs.Find(id); db.UserTs.Remove(userT); db.SaveChanges(); return(RedirectToAction("Index")); }
public string GetFavAssocById(string id) { JavaScriptSerializer j = new JavaScriptSerializer(); UserT temp = new UserT(id, true); return(j.Serialize(temp.GetFavAssocById())); }
public string GetUserDetailsMobile(string userId) { JavaScriptSerializer j = new JavaScriptSerializer(); UserT U = new UserT(); U.UserId = userId; return(j.Serialize(U.GetUserDetails())); }
public string ChangePass(string id, string newPass) { UserT temp_user = new UserT(); temp_user.UserId = id; temp_user.Password = newPass; temp_user.UpdatePassword(); return("true"); }
public async Task <IHttpActionResult> SearchUseremail(string email, string pasword) { UserT login = await db.UserTs.SingleOrDefaultAsync(x => x.Email == email && x.Password == pasword); if (login == null) { return(NotFound()); } return(Ok(login)); }
public ActionResult Edit([Bind(Include = "UserID,FullName,UserName,Email,Phone,Password,City,State,Country,Address")] UserT userT) { if (ModelState.IsValid) { db.Entry(userT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userT)); }
public async Task <IHttpActionResult> SearchUserUserApiID(string UserApiID) { UserT login = await db.UserTs.Where(x => x.UserApiID == UserApiID).SingleOrDefaultAsync(); if (login == null) { return(NotFound()); } return(Ok(login)); }
public ActionResult Create([Bind(Include = "UserID,FullName,UserName,Email,Phone,Password,City,State,Country,Address")] UserT userT) { if (ModelState.IsValid) { db.UserTs.Add(userT); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userT)); }
public IHttpActionResult GetUserT(int id) { UserT userT = db.UserTs.Find(id); if (userT == null) { return(NotFound()); } return(Ok(userT)); }
public bool VerifyUser(string email, string password) { UserT user = userRepository.SelectUserByEmail(email); if (user == null) { throw new NotFoundException("사용자가 존재하지 않습니다.", "사용자 없음", LayerID.UserService); } return(CryptoHelper.Crypto.VerifyHashedPassword(user.Password, password)); }
public string UpdateUser(string userId, string first, string last, string address, string phone) { JavaScriptSerializer j = new JavaScriptSerializer(); UserT U = new UserT(); U.UserId = userId; U.FirstName = first; U.LastName = last; U.Address = address; U.Number = phone; return(j.Serialize(U.UpdateExistingUser())); }
public IHttpActionResult PostUserT(UserT userT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.UserTs.Add(userT); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = userT.UserID }, userT)); }
public HttpResponseMessage GetUserT(string id) { UserT userT = db.UserTs.Find(id); if (userT == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); // could also throw a HttpResponseException(HttpStatusCode.NotFound) } return(Request.CreateResponse(HttpStatusCode.OK, userT)); }
public int UpdateUser(UserT user) { string sql = SQLHelper.GetSqlByMethodName(MethodBase.GetCurrentMethod().Name); var parameters = new { USER_NO = user.UserNo, NICKNAME = user.NickName, EMAIL = user.Email }; return(Connection.Execute(sql, parameters)); }
public string CheckValidUser(string id, string mail) { UserT temp_user = new UserT(); temp_user.Mail = mail; temp_user.UserId = id; if (temp_user.CheckForResetPass()) { temp_user.SendMail();//שליחת מייל return("true"); } return("false"); }
// GET: Usermcv/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserT userT = db.UserTs.Find(id); if (userT == null) { return(HttpNotFound()); } return(View(userT)); }
public IHttpActionResult DeleteUserT(int id) { UserT userT = db.UserTs.Find(id); if (userT == null) { return(NotFound()); } db.UserTs.Remove(userT); db.SaveChanges(); return(Ok(userT)); }
/// <summary> /// הבאת פרטי העמותה על פי קוד /// </summary> public void GetAssociationByCodeAmuta() { DbService db = new DbService(); DataSet DS = new DataSet(); //Voluntary_association A = new Voluntary_association(); string sql1 = "select * from association " + "where association_code= @code"; string sql2 = @" SELECT dbo.users.user_id,dbo.users.first_name, dbo.users.last_name,dbo.users.active FROM dbo.association_access LEFT JOIN dbo.users ON dbo.association_access.user_id = dbo.users.user_id WHERE(dbo.association_access.association_code = @code )"; string sql3 = @" SELECT dbo.tags.tag_code, dbo.tags.tag_desc FROM dbo.tag_of_association INNER JOIN dbo.tags ON dbo.tag_of_association.tag_code = dbo.tags.tag_code WHERE (dbo.tag_of_association.association_code = @code)"; SqlParameter parCode = new SqlParameter("@code", Association_Code); DS = db.GetDataSetByQuery(sql1 + sql2 + sql3, CommandType.Text, parCode); //מילוי פרטים foreach (DataRow row in DS.Tables[0].Rows) { Association_Code = row[0].ToString(); Association_Name = row[1].ToString(); Association_Desc = row[2].ToString(); Association_Account = row[3].ToString(); Association_WebSite = row[4].ToString(); Association_Image = row[5].ToString(); Association_Year = row[6].ToString(); } //מילוי רשימת מורשי גישה foreach (DataRow row in DS.Tables[1].Rows) { UserT permitted = new UserT(row[0].ToString(), row[1].ToString(), row[2].ToString(), bool.Parse(row[3].ToString())); List <Voluntary_association> temp_li = permitted.GetUserAssociations(); permitted.Address = temp_li.Count.ToString(); //שימוש חד פעמי בשדה כתובת להעברת מס' לדף הטמל PermittedUsers.Add(permitted); } //מילוי רשימת תגיות foreach (DataRow row in DS.Tables[2].Rows) { Association_Tag tag = new Association_Tag(int.Parse(row[0].ToString()), row[1].ToString()); Association_Tags.Add(tag); } }
public int InsertUser(UserT user) { string sql = SQLHelper.GetSqlByMethodName(MethodBase.GetCurrentMethod().Name); var parameters = new { NICKNAME = user.NickName, EMAIL = user.Email, SECRET = user.Password, AUTH_TYPE = user.AuthType, CONFIRM_YN = user.ConfirmYN }; return(Connection.Execute(sql, parameters)); }
public cUser(UserT user) { this.user = user; }