public NavUser(User user)
 {
     No = user.No;
     Name = user.Nazwa;
     Address = user.Adres;
     Balance = user.Portfel;
     City = user.Miasto;
     Company = user.Firma;
     CountryCode = user.Kraj;
     Email = user.E_Mail;
     PostalCode = user.Kod_Pocztowy;
 }
        public bool AddUser(NavUser user, string pass)
        {
            try
            {
                User_Filter[] filterEmail = { new User_Filter() { Criteria = "=" + user.Email, Field = User_Fields.E_Mail } };
                User_Filter[] filterName = { new User_Filter() { Criteria = "=" + user.Name, Field = User_Fields.Nazwa } };

                var checkUserEmail = _user_service.ReadMultiple(filterEmail, "", 1);
                var checkUserName = _user_service.ReadMultiple(filterName, "", 1);

                if (checkUserEmail.Length > 0)
                {
                    throw new FaultException("E-mail already exists !");
                }

                else if (checkUserName.Length > 0)
                {
                    throw new FaultException("Name already exists !");
                }

                User u = new User()
                {
                    Adres = user.Address,
                    E_Mail = user.Email,
                    Firma = user.Company,
                    Kod_Pocztowy = user.PostalCode,
                    Kraj = user.CountryCode,
                    Miasto = user.City,
                    Nazwa = user.Name,
                    Portfel = 0,
                    FirmaSpecified = true
                };

                _user_service.Create(ref u);

                var usr = _user_service.ReadMultiple(filterEmail, "", 1);

                _user_service.UpdatePassword(usr[0].Key, pass);

                return true;
            }
            catch
            {
                throw;
            }
        }
        public bool EditUser(NavUser user, string pass)
        {
            try
            {
                User u = new User()
                {
                    No = user.No,
                    Adres = user.Address,
                    E_Mail = user.Email,
                    Firma = user.Company,
                    Kod_Pocztowy = user.PostalCode,
                    Kraj = user.CountryCode,
                    Miasto = user.City,
                    Nazwa = user.Name,
                    Portfel = 0
                };

                _user_service.Update(ref u);

                return true;
            }
            catch
            {
                return false;
            }
        }
Beispiel #4
0
 /// <remarks/>
 public void UpdateMultipleAsync(User[] User_List) {
     this.UpdateMultipleAsync(User_List, null);
 }
Beispiel #5
0
 /// <remarks/>
 public void UpdateMultipleAsync(User[] User_List, object userState) {
     if ((this.UpdateMultipleOperationCompleted == null)) {
         this.UpdateMultipleOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateMultipleOperationCompleted);
     }
     this.InvokeAsync("UpdateMultiple", new object[] {
                 User_List}, this.UpdateMultipleOperationCompleted, userState);
 }
Beispiel #6
0
 /// <remarks/>
 public void UpdateAsync(User User) {
     this.UpdateAsync(User, null);
 }
Beispiel #7
0
 public void Update(ref User User) {
     object[] results = this.Invoke("Update", new object[] {
                 User});
     User = ((User)(results[0]));
 }
Beispiel #8
0
 /// <remarks/>
 public void CreateMultipleAsync(User[] User_List) {
     this.CreateMultipleAsync(User_List, null);
 }
Beispiel #9
0
 /// <remarks/>
 public void CreateAsync(User User, object userState) {
     if ((this.CreateOperationCompleted == null)) {
         this.CreateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateOperationCompleted);
     }
     this.InvokeAsync("Create", new object[] {
                 User}, this.CreateOperationCompleted, userState);
 }
Beispiel #10
0
 /// <remarks/>
 public void CreateAsync(User User) {
     this.CreateAsync(User, null);
 }