Beispiel #1
0
 public IResult Delete(Car car)
 {
     ValidationTool.Validate(new CarValidator(), car);
     _carDal.Delete(car);
     return(new SuccessResult(Messages.CarDeleted));
 }
 public IResult Add(Customer customer)
 {
     ValidationTool.Validate(new CustomerValidator(), customer);
     _customerDal.Add(customer);
     return(new SuccessResult(Messages.CustomerAdded));
 }
 public void Update(TEntity entity)
 {
     ValidationTool.Validate(validator, entity);
     dal.Update(entity);
 }
Beispiel #4
0
 public IResult Add(Color color)
 {
     ValidationTool.Validate(new ColorValidator(), color);
     _colorDal.Add(color);
     return(new SuccessResult(Messages.ColorAdded));
 }
Beispiel #5
0
 public void Update(Product product)
 {
     ValidationTool.Validate(new ProductValidator(), product);
     _productDal.Update(product);
 }
 public void Add(Student student)
 {
     ValidationTool.Validate(new StudentValidator(), student);
     _studentDal.Add(student);
 }
 public IResult Add(Car car)
 {
     ValidationTool.Validate(new CarValidator(), car);
     _carDal.Add(car);
     return(new SuccessResult(Messages.CarAdded));
 }
 public IResult Add(Brand brand)
 {
     ValidationTool.Validate(new BrandValidator(), brand);
     _brandDal.Add(brand);
     return(new SuccessResult(Messages.DescriptionNameInvalid));
 }
 public void Add(Category category)
 {
     ValidationTool.Validate(new CategoryValidator(), category);
     dal.Add(category);
 }
Beispiel #10
0
 public IResult Add(User user)
 {
     ValidationTool.Validate(new UserValidator(), user);
     _userDal.Add(user);
     return(new SuccessResult(Messages.UserAdded));
 }
Beispiel #11
0
 public void add(ProductsElectronics productsElectronics)
 {
     ValidationTool.Validate(new ProductsElectronicsValidator(), productsElectronics);
     _productsElectronicsDal.Add(productsElectronics);
 }
Beispiel #12
0
 public IResult Add(Car car)
 {
     ValidationTool.Validate(new CarValidator(), car);
     return(_carDal.Add(car));
 }
        public bool SocialUserOperation(int socialType, string socialID, string email, string username, string firstname, string lastname, string methodName)
        {
            //bu kullanıcı daha once kayıt olmuşmu
            SocialUser socialUser = _socialUserDal.Get(t => t.SOCIALID == socialID && t.SocialType == socialType);

            //daha önce kayıt olmamış ise
            if (socialUser == null)
            {
                //bir kullanıcı tanımlama
                User user = new User
                {
                    ActiveStatus      = (int)SystemConstannts.Situation.SOCİALUSER,
                    Name              = firstname,
                    Surname           = lastname,
                    isActive          = true,
                    Password          = Common.RandomSfr.Generate(8),
                    AccountCreateDate = DateTime.Now,
                    AccountActiveDate = DateTime.Now,
                    Address           = "hdfdjfdk jdhdfjd",
                    PhoneNumber       = "12344555"
                };
                user.Tokens = new List <Token>();

                //o kullanıcıyı socialUser olarak atama
                socialUser = new SocialUser
                {
                    CreateDate = DateTime.Now,
                    SocialType = socialType,
                    SOCIALID   = socialID,
                    UserID     = user.ID
                };

                //o kullanıcıya token oluşturma
                Token token = new Token
                {
                    StartDate  = DateTime.Now,
                    ExpireDate = DateTime.Now.AddHours(6),
                    TokenValue = Security.sha512encrypt(RandomSfr.Generate(20)),
                };
                //user.Tokens.Add(token);
                HttpCookie c*k = new HttpCookie("userAuth", token.TokenValue);
                c*k.Expires = DateTime.Now.AddHours(6);
                HttpContext.Current.Response.Cookies.Add(c*k);
                HttpContext.Current.Session["User"] = user;

                //oluşturulan user ve socialuser ı database e kayıt etme
                //  int eklenenUserID = _userDal.UserAddReturnUserId(user);
                //var userr = _userDal.Get(t => t.Name == user.Name && t.Surname == user.Surname && t.Password == user.Password);
                //  socialUser.UserID = eklenenUserID;

                if (String.IsNullOrEmpty(methodName))
                {
                    //ValidationTool.Validate(new UserValidator(), user);
                    UserValidator    validator = new UserValidator();
                    ValidationResult result    = validator.Validate(user);

                    // TANSU BURAYA DUSMESI LAZIM CODUN
                    // Kullaniciyi eklemeden buraya breakpoint koyar misin bakalim buraya dusucek mi
                    // Tam _socialUserDal.Add(socialUser); un oraya koy ekleme yapmasin ama oraya dustugunu gorelim
                    //oluşturulan user ve socialuser ı database e kayıt etme
                    user.Tokens.Add(token);
                    int eklenenUserID = _userDal.UserAddReturnUserId(user);
                    //var userr = _userDal.Get(t => t.Name == user.Name && t.Surname == user.Surname && t.Password == user.Password);
                    socialUser.UserID = eklenenUserID;



                    _socialUserDal.Add(socialUser);
                }
                else
                {
                    ValidationTool.Validate(new UserValidatorNotNull(), user);
                    UserValidatorNotNull validator = new UserValidatorNotNull();
                    ValidationResult     result    = validator.Validate(user);
                }
                // _socialUserDal.Add(socialUser); buradaydi If icerisine aldim


                try
                {
                    return(true);
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }
            else
            {
                int               id  = socialUser.UserID;
                Token             tkn = _tokenDal.Get(t => t.User_ID == id);
                List <SocialUser> socialUserEager;
                if (tkn.ExpireDate < DateTime.Now)
                {
                    //bu kullanıcı daha once kayıt olmuş ise ve token expiredate zamanı geçmiş ise Token ekle
                    Token token = new Token
                    {
                        StartDate  = DateTime.Now,
                        ExpireDate = DateTime.Now.AddHours(6),
                        TokenValue = Security.sha512encrypt(RandomSfr.Generate(20)),
                    };
                    //socialUser.User.Tokens.Add(token); işlemi için oluşturulan EagerLoadingUser() mettodundan socialuser alma
                    socialUserEager = EagerLoadingUser();
                    foreach (var item in socialUserEager)
                    {
                        item.User.Tokens.Add(token);
                    }

                    HttpCookie c*k = new HttpCookie("userAuth", token.TokenValue);
                    c*k.Expires = DateTime.Now.AddHours(6);
                    HttpContext.Current.Response.Cookies.Add(c*k);
                }
                socialUserEager = EagerLoadingUser();
                foreach (var item in socialUserEager)
                {
                    HttpContext.Current.Session["User"] = item.User;
                }

                try
                {
                    return(true);
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }

            return(false);
        }
 public void update(ProductsMovies productsMovies)
 {
     ValidationTool.Validate(new ProductsMoviesValidator(), productsMovies);
     _productsMoviesDal.Update(productsMovies);
 }
 public void Update(User user)
 {
     ValidationTool.Validate(new UserValidator(), user);
     _userDal.Update(user);
 }
Beispiel #16
0
 public IResult Add(Car car)
 {
     ValidationTool.Validate(new CarValidator(), car);
     _iCarDal.Add(car);
     return(new SuccessResult());
 }
 public void Add(Management management)
 {
     ValidationTool.Validate(new ManagementValidator(), management);
     _managementDal.Add(management);
 }
Beispiel #18
0
 public IResult Add(Color color)
 {
     ValidationTool.Validate(new ColorValidator(), color);
     _colorDAL.Add(color);
     return(new Result(true, Messages.ColorAdded));
 }
 public void Update(Student student)
 {
     ValidationTool.Validate(new StudentValidator(), student);
     _studentDal.Update(student);
 }
Beispiel #20
0
 public IResult Add(User user)
 {
     ValidationTool.Validate(new UserValidator(), user);
     _userDal.Add(user);
     return(new SuccessResult(Messages.DescriptionNameInvalid));
 }
Beispiel #21
0
 public void Update(MoviesSeries moviesSeries)
 {
     ValidationTool.Validate(new MoviesSeriesValidator(), moviesSeries);
     _moviesSeriesDal.Update(moviesSeries);
 }
 public void Add(Word word)
 {
     ValidationTool.Validate(new WordValidation(), word);
     _wordDal.Add(word);
 }
Beispiel #23
0
 public void Add(Product product)
 {
     ValidationTool.Validate(new ProductValidator(), product);
     _productDal.Add(product);
 }
 public void Update(Word word)
 {
     ValidationTool.Validate(new WordValidation(), word);
     _wordDal.Update(word);
 }
Beispiel #25
0
 public IResult Add(Rental rental)
 {
     ValidationTool.Validate(new RentalValidator(), rental);
     _rentalDal.Add(rental);
     return(new ErrorResult(Messages.RantalAddingError));
 }
Beispiel #26
0
 public IResult Add(Brand brand)
 {
     ValidationTool.Validate(new BrandValidator(), brand);
     _brand.Add(brand);
     return(new SuccessResult(Messages.BrandAdded));
 }
 public void Add(TEntity entity)
 {
     ValidationTool.Validate(validator, entity);
     dal.Add(entity);
 }
 public void Add(User user)
 {
     ValidationTool.Validate(new UserValidator(), user);
     _userDal.Add(user);
 }
 public void Update(Categories category)
 {
     ValidationTool.Validate(new CategoryValidator(), category);
     _categoryDal.Update(category);
 }
Beispiel #30
0
 public void Update(Car car)
 {
     ValidationTool.Validate(new CarValidator(), car);
     _carDal.Update(car);
 }