Пример #1
0
        public void InsertUser(string username, string password, string email, int provinceID, int districtID, int detailprovinceID, int roleID, string question, string answear, string companyname, string businesscode, string phone, string mobile, string CMND, string name, int age, string address, string subaddress, out MembershipCreateStatus status) // Tao user
        {
            try
            {
                TTTV__Users           user = new TTTV__Users();
                TTTV__UserInformation info = new TTTV__UserInformation();

                user.Username           = username;
                user.Password           = password;
                user.Email              = email;
                user.RoleId             = roleID;
                user.ForgotPassQuestion = question;
                user.ForgotPassAnswer   = answear;
                info.Username           = username;
                info.ProvinceID         = provinceID;
                info.DistrictID         = districtID;
                info.ProvinceDetailID   = detailprovinceID;
                info.CompanyName        = companyname;
                info.BusinessCode       = businesscode;
                info.Phone              = phone;
                info.Mobile             = mobile;
                info.PersonCode         = CMND;
                info.UserFullName       = name;
                info.Age        = age;
                info.Address    = address;
                info.SubAddress = subaddress;
                db.TTTV__Users.AddObject(user);
                db.TTTV__UserInformation.AddObject(info);
                db.SaveChanges();
                status = MembershipCreateStatus.Success;
            }
            catch (Exception ex)
            {
                CustomException cex = new CustomException();
                cex.Details = ex.Message;
                cex.Issue   = "Trùng tên đăng nhập";
                //status = MembershipCreateStatus.ProviderError;
                throw new FaultException <CustomException>(cex, new FaultReason(cex.Issue));
            }
        }
Пример #2
0
        // Tao user
        public void InsertUser(string username, string password, string email, int provinceID, int districtID, int detailprovinceID, int roleID, string question, string answear, string companyname, string businesscode, string phone, string mobile, string CMND, string name, int age, string address, string subaddress, out MembershipCreateStatus status)
        {
            try
            {

                TTTV__Users user = new TTTV__Users();
                TTTV__UserInformation info = new TTTV__UserInformation();

                user.Username = username;
                user.Password = password;
                user.Email = email;
                user.RoleId = roleID;
                user.ForgotPassQuestion = question;
                user.ForgotPassAnswer = answear;
                info.Username = username;
                info.ProvinceID = provinceID;
                info.DistrictID = districtID;
                info.ProvinceDetailID = detailprovinceID;
                info.CompanyName = companyname;
                info.BusinessCode = businesscode;
                info.Phone = phone;
                info.Mobile = mobile;
                info.PersonCode = CMND;
                info.UserFullName = name;
                info.Age = age;
                info.Address = address;
                info.SubAddress = subaddress;
                db.TTTV__Users.AddObject(user);
                db.TTTV__UserInformation.AddObject(info);
                db.SaveChanges();
                status = MembershipCreateStatus.Success;

            }
            catch (Exception ex)
            {
                CustomException cex = new CustomException();
                cex.Details = ex.Message;
                cex.Issue = "Trùng tên đăng nhập";
                //status = MembershipCreateStatus.ProviderError;
                throw new FaultException<CustomException>(cex, new FaultReason(cex.Issue));

            }
        }