public UserModels GetUserByLogin(string login) { UserModels ret = new UserModels(); STUser data = new STUser(); string msg; CCondition clCondition = new CCondition(); CPermission clPermission = new CPermission(); try { CUser clUser = new CUser(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath()); int retvalue = clUser.GetRecordByUserLogin(login, out data, out msg); ret = new UserModels(); ret.UserId = data.userid; ret.UserName = data.username; ret.Login = data.login; ret.Comments = data.comments; ret.Condition = clCondition.GetName(data.condition); ret.Permission = clPermission.GetName(data.permission); // ret.Password = data.password; // ret.ConfirmPassword = ret.Password; ret.Email = data.email; ret.OwnerUserId = data.owneruserid; ret.OwnerUserName = data.ownerusername; } catch (Exception ex) { msg = ex.Message; } return(ret); }
public List <UserModels> GetListUser(STUserVP param) { List <UserModels> ret = new List <UserModels>(); UserModels item; List <STUser> data = new List <STUser>(); string msg; CCondition clCondition = new CCondition(); CPermission clPermission = new CPermission(); CUser clUser; try { clUser = new CUser(LocalData.UserId(), LocalData.CSDbUsers(), LocalData.LogPath()); int retvalue = clUser.GetData(param, out data, out msg); foreach (STUser row in data) { item = new UserModels(); item.UserId = row.userid; item.UserName = row.username; item.Login = row.login; item.Comments = row.comments; item.Condition = clCondition.GetName(row.condition); item.Permission = clPermission.GetName(row.permission); // item.Password = row.password; item.Email = row.email; item.OwnerUserId = row.owneruserid; item.OwnerUserName = row.ownerusername; if (!row.isactivated) { item.AccountState = "Not activated"; } else { item.AccountState = null; } ret.Add(item); } } catch (Exception ex) { msg = ex.Message; } return(ret); }
public UserModelsViewParam SetParam(STUserVP param) { UserModelsViewParam ret = new UserModelsViewParam(); string msg; CCondition clCondition = new CCondition(); CPermission clPermission = new CPermission(); try { if (param.condition != null) { ret.Condition = clCondition.GetName((int)param.condition); } else { ret.Condition = null; } ret.Email = param.maskemail; ret.Login = param.masklogin; if (param.permission != null) { ret.Permission = clPermission.GetName((int)param.permission); } else { ret.Permission = null; } ret.UserName = param.maskusername; if (!param.isall) { ret.IsAll = false; } else { ret.IsAll = true; } } catch (Exception ex) { msg = ex.Message; } return(ret); }