private MobiChat.Data.Customer GetCustomer(Guid externalCustomerGuid, MobiChat.Data.Service service, Country country, MobiChat.Data.MobileOperator mobileOperator, string msisdn)
        {
            MobiChat.Data.Customer customer = MobiChat.Data.Customer.CreateManager().Load(externalCustomerGuid);
            if (customer == null)
            {
                User user = new User(-1,
                                     Guid.NewGuid(),
                                     UserType.CreateManager().Load(1),
                                     UserStatus.Active,
                                     string.Empty,
                                     new byte[] { 0 },
                                     DateTime.Now, DateTime.Now);
                user.Insert();

                customer = new MobiChat.Data.Customer(-1,
                                                      externalCustomerGuid,
                                                      user,
                                                      service,
                                                      country,
                                                      country.Language,
                                                      mobileOperator,
                                                      msisdn,
                                                      string.Empty,
                                                      DateTime.Now, DateTime.Now);
                customer.Insert();
            }

            return(customer);
        }
Beispiel #2
0
        public ActionResult EditUser(string id, string name, string status, string type)
        {
            //add code so user can change password
            MobiChat.Data.User user       = MobiChat.Data.User.CreateManager().Load(int.Parse(id));
            UserStatus         userStatus = UserStatus.Active;

            Enum.TryParse(status, out userStatus);

            user.Username   = name;
            user.UserStatus = userStatus;
            user.UserType   = UserType.CreateManager().Load(int.Parse(type));
            // user.Update();

            return(this.Json(new
            {
                status = true
            }));
        }
Beispiel #3
0
        public ActionResult CreateUser(string name, string status, string type, string password)
        {
            MobiChat.Data.User user       = new MobiChat.Data.User();
            UserStatus         userStatus = UserStatus.Active;
            UserType           userType   = UserType.CreateManager().Load(int.Parse(type));

            Enum.TryParse(status, out userStatus);

            user.Username   = name;
            user.Guid       = Guid.NewGuid();
            user.UserStatus = userStatus;
            user.UserType   = userType;
            user.Password   = PasswordEncryption.Create(password).EncryptedPasswordAndSalt;
            //   user.Insert();

            return(this.Json(new
            {
                status = true
            }));
        }