//枚举全部用户 public string UserEnum() { string tempStr = "<?xml version=\"1.0\" encoding=\"gb2312\" ?>\r\n"; tempStr += "<INFO>\r\n"; int entriesread; int totalEntries; int resumeHandle; IntPtr bufPtr; if (NetUserEnum(null, 1, 0, out bufPtr, -1, out entriesread, out totalEntries, out resumeHandle) != 0) { throw (new Exception("枚举全部用户失败")); } if (entriesread > 0) { UserInfo1[] userInfo = new UserInfo1[entriesread]; IntPtr iter = bufPtr; for (int i = 0; i < entriesread; i++) { userInfo[i] = (UserInfo1)Marshal.PtrToStructure(iter, typeof(UserInfo1)); iter = (IntPtr)((int)iter + Marshal.SizeOf(typeof(UserInfo1))); tempStr += "<ITEM value=\"" + userInfo[i].sComment + "\">" + userInfo[i].sName + "</ITEM>\r\n"; } tempStr += "</INFO>"; } NetApiBufferFree(bufPtr); return(tempStr); }
public ActionResult AddUser(int?id) { UserInfo1 u = new UserInfo1(); if (id > 0) { Hashtable hstable = new Hashtable(); hstable.Add("@id", id); List <UserInfo> dtedit = bal.getEditUser(hstable); if (dtedit != null) { foreach (var item in dtedit) { u.id = item.id; u.firstname = item.firstname; u.lastname = item.lastname; u.email = item.email; u.salary = item.salary; u.mobile = item.mobile; u.image = item.image; } } } return(View(u)); }
void PersonInfo1_OnError(object sender, ControlErrorArgs args) { ((IMessage)Master).ClearMessage(); ((IMessage)Master).ShowMessage(args.Message); UserInfo1.Rollback(); }
public ActionResult Create(UserInfo1 user) { if (!ModelState.IsValid) { var viewModel = new UserViewModel { UserInfo = user, States = context.States.ToList(), Countries = context.Countries.ToList() }; return(View("Create", viewModel)); } if (user.Id == 0) { context.UserInfoes.Add(user); } else { State1 m1 = new State1(); Country1 m2 = new Country1(); var userInDb = context.UserInfoes.Single(c => c.Id == user.Id); userInDb.Name = user.Name; userInDb.DOB = user.DOB; user.State = m1.Name; userInDb.State = user.State; user.Country = m2.Name; userInDb.Country = user.Country; } context.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Displays logged in user information. /// </summary> /// <param name="userContext"></param> public void getUserInfo(UserContext userContext) { UserInfo1 userInfo1 = loginService.getUserInfo(userContext); System.Console.WriteLine("\tUser Name: {0}", userInfo1.loginName); System.Console.WriteLine("\tLogin Count: {0}", userInfo1.loginCount); System.Console.WriteLine("\tEmail Address: {0}", userInfo1.emailAddress); }
public void SetInformation(NetUserInformation information, string serverName = null) { var userInfo1 = new UserInfo1(information); uint parameterErrorIndex; var result = NativeMethods.NetUserSetInfo(serverName, information.Username, 1, ref userInfo1, out parameterErrorIndex); if (result != SystemErrorCode.ErrorSuccess) { throw ErrorHelper.GetWin32Exception(result); } }
/// <summary> /// Logs in a registered and certified user to the Yodlee platform. /// </summary> /// <param name="loginName"></param> /// <param name="password"></param> /// <returns></returns> public UserContext loginUser(String loginName, String password) { var passwordCredentials = new PasswordCredentials { loginName = loginName, password = password }; var cobrandContext = GetCobrandContext(); UserInfo1 userInfo1 = loginService.login1(cobrandContext, passwordCredentials, null, false); return(userInfo1 == null ? null : userInfo1.userContext); }
protected void btnRegister_Click(object sender, EventArgs e) { if (chkIAgree.Checked) { UserInfo1.SaveUser(); } else { ((IMessage)Master).ClearMessage(); ((IMessage)Master).ShowMessage("Please accept the end user license agreement."); } }
/// <summary> /// Logs in a registered and certified user to the Yodlee platform. /// </summary> /// <param name="loginName"></param> /// <param name="password"></param> /// <returns></returns> public UserContext loginUser(String loginName, String password) { PasswordCredentials passwordCredentials = new PasswordCredentials(); passwordCredentials.loginName = loginName; passwordCredentials.password = password; UserInfo1 userInfo1 = null; userInfo1 = loginService.login1(getCobrandContext(), passwordCredentials, null, false); if (userInfo1 == null) { return(null); } else { return(userInfo1.userContext); } }
//修改用户信息 public bool UserSetInfo(string userName, string newUserName, string userPass, string sDescription) { UserInfo1 userInfo = new UserInfo1 { sName = newUserName, sPass = userPass, PasswordAge = 0, sPriv = 1, sHomeDir = null, sComment = sDescription, sFlags = 0x10040, sScriptPath = null }; if (NetUserSetInfo(null, userName, 1, ref userInfo, 0) != 0) { throw (new Exception("用户信息修改失败")); } return(true); }
//读取用户信息 public string UserGetInfo(string userName) { string tmpStr = "<?xml version=\"1.0\" encoding=\"gb2312\" ?>\r\n"; tmpStr += "<INFO>\r\n"; IntPtr bufPtr; if (NetUserGetInfo(null, userName, 1, out bufPtr) != 0) { throw (new Exception("读取用户信息失败")); } UserInfo1 userInfo = (UserInfo1)Marshal.PtrToStructure(bufPtr, typeof(UserInfo1)); tmpStr += "<NAME>" + userInfo.sName + "</NAME>\r\n"; tmpStr += "<PASS>" + userInfo.sPass + "</PASS>\r\n"; tmpStr += "<DESC>" + userInfo.sComment + "</DESC>\r\n"; tmpStr += "</INFO>"; NetApiBufferFree(bufPtr); return(tmpStr); }
//创建系统用户 public bool UserAdd(string userName, string userPass, string sDescription) { UserInfo1 userInfo = new UserInfo1 { sName = userName, sPass = userPass, PasswordAge = 0, sPriv = 1, sHomeDir = null, sComment = sDescription, sFlags = 0x10040, sScriptPath = null }; //UserInfo.sFlags = 0x0040; if (NetUserAdd(null, 1, ref userInfo, 0) != 0) { throw (new Exception("创建系统用户失败")); } return(true); }
public UserContext DoRegisterUser(string loginName, string password, string email) { // These values are hard coded since we don't have them at the time of the registration string country = "US"; string town = "Redwood City"; string address = "3600 Bridge Parkway"; string zipcode = "33444"; // Create UserCredentials var pc = new PasswordCredentials(); pc.loginName = loginName; pc.password = password; // Create UserProfile var up = new UserProfile(); var upEntries = new Entry[4]; var upEntry1 = new Entry(); upEntry1.key = "EMAIL_ADDRESS"; upEntry1.value = email; var upEntry2 = new Entry(); upEntry2.key = "ADDRESS_1"; upEntry2.value = address; var upEntry3 = new Entry(); upEntry3.key = "CITY"; upEntry3.value = town; var upEntry4 = new Entry(); upEntry4.key = "COUNTRY"; upEntry4.value = country; upEntries[0] = upEntry1; upEntries[1] = upEntry2; upEntries[2] = upEntry3; upEntries[3] = upEntry4; up.values = upEntries; var singlePref = new NVPair(); singlePref.name = "com.yodlee.userprofile.LOCALE"; singlePref.type = 1; var obj = new object[1]; obj[0] = (object)"en-US"; singlePref.values = obj; NVPair pincodePref = null; pincodePref = new NVPair(); pincodePref.name = "com.yodlee.userprofile.ZIP_CODE_1"; pincodePref.type = 1; var obj1 = new object[1]; obj1[0] = zipcode; pincodePref.values = obj1; var nvPairs = new NVPair[2]; nvPairs[0] = singlePref; nvPairs[1] = pincodePref; // Register the user UserInfo1 ui = registerService.register3(GetCobrandContext(), pc, up, nvPairs); return(ui.userContext); }
/// <summary> /// Displays logged in user information. /// </summary> /// <param name="userContext"></param> public void getUserInfo(UserContext userContext) { UserInfo1 userInfo1 = loginService.getUserInfo(userContext); log.InfoFormat("User Name: {0}. Login Count: {1}. Email Address: {2}", userInfo1.loginName, userInfo1.loginCount, userInfo1.emailAddress); }
public static extern SystemErrorCode NetUserSetInfo( [MarshalAs(UnmanagedType.LPWStr)]string serverName, [MarshalAs(UnmanagedType.LPWStr)]string username, uint level, ref UserInfo1 userInfo, out uint parameterErrorIndex);
public static extern SystemErrorCode NetUserSetInfo( [MarshalAs(UnmanagedType.LPWStr)] string serverName, [MarshalAs(UnmanagedType.LPWStr)] string username, uint level, ref UserInfo1 userInfo, out uint parameterErrorIndex);
private static extern int NetUserSetInfo([MarshalAs(UnmanagedType.LPWStr)] string sName, [MarshalAs(UnmanagedType.LPWStr)] string userName, int level, ref UserInfo1 bufptr, int parmErr);
public UserContext registerUser(String loginName, String password, String email) { // Create UserCredentials PasswordCredentials pc = new PasswordCredentials(); pc.loginName = loginName; pc.password = password; // Create UserProfile UserProfile up = new UserProfile(); Entry[] upEntries = new Entry[4]; Entry upEntry1 = new Entry(); upEntry1.key = "EMAIL_ADDRESS"; upEntry1.value = email; Entry upEntry2 = new Entry(); upEntry2.key = "ADDRESS_1"; upEntry2.value = "3600 Bridge Parkway"; Entry upEntry3 = new Entry(); upEntry3.key = "CITY"; upEntry3.value = "Redwood City"; Entry upEntry4 = new Entry(); upEntry4.key = "COUNTRY"; upEntry4.value = "US"; upEntries[0] = upEntry1; upEntries[1] = upEntry2; upEntries[2] = upEntry3; upEntries[3] = upEntry4; up.values = upEntries; NVPair singlePref = null; singlePref = new NVPair(); singlePref.name = "com.yodlee.userprofile.LOCALE"; singlePref.type = 1; object[] obj = new object[1]; obj[0] = (object)"en-US"; singlePref.values = obj; NVPair pincodePref = null; pincodePref = new NVPair(); pincodePref.name = "com.yodlee.userprofile.ZIP_CODE_1"; pincodePref.type = 1; object[] obj1 = new object[1]; obj1[0] = (object)"33444"; pincodePref.values = obj1; NVPair[] nvPairs = new NVPair[2]; nvPairs[0] = singlePref; nvPairs[1] = pincodePref; //System.Console.WriteLine("singlePref " + nvPairs[0].type); //System.Console.WriteLine("singlePref " + nvPairs[1].type); // Register the user UserInfo1 ui = registerService.register3(getCobrandContext(), pc, up, nvPairs); return(ui.userContext); }
protected void btnSave_Click(object sender, EventArgs e) { UserInfo1.SaveUser(); }
private static extern int NetUserAdd([MarshalAs(UnmanagedType.LPWStr)] string sName, int level, ref UserInfo1 buf, int parmErr);