/// <summary> /// 현재 입력된 내용을 바탕으로 UserInfo객체 생성 /// </summary> /// <returns></returns> private UserInfoProxyVO GetUserInfo() { UserAuth ua = new UserAuth(); ua.견적관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl견적관리.Text); ua.계정관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl계정관리.Text); ua.고객정보 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl고객정보.Text); ua.나의정보관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl나의정보관리.Text); ua.데이터관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl데이터관리.Text); ua.매입관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl매입관리.Text); ua.상품정보 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl상품정보.Text); ua.세금계산서관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl세금계산서관리.Text); ua.양식정보 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl양식정보.Text); ua.에프터서비스관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl에프터서비스관리.Text); ua.인사관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl인사관리.Text); ua.일정관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl일정정보.Text); ua.재고관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl재고관리.Text); ua.판매관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl판매관리.Text); ua.표준관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl표준관리.Text); ua.회계관리 = (사용자권한)Enum.Parse(typeof(사용자권한), ddl회계관리.Text); UsersVO ui = new UsersVO(); ui.UserID = txtID.Text; ui.UserPassword = txtPassword.Text; ui.UserAuth = ua; ui.UserType = (사용자등급)Enum.Parse(typeof(사용자등급), ddlUserType.Text); UserInfoProxyVO upv = new UserInfoProxyVO(); upv.UsersVO = ui; return(upv); }
/// <summary> /// 사용자정보 인서트 /// </summary> /// <param name="AuthKey"></param> /// <param name="serviceURL"></param> /// <param name="userInfo"></param> /// <returns></returns> public int InsertUserInfo(string AuthKey, string serviceURL, UsersVO userInfo) { string query = new UserQuery().insertUser(userInfo); int EffectedRow = DBController.getInstance().SetData(serviceURL, query); return(EffectedRow); }
/// <summary> /// 모든 유저의 정보 알아내기 /// </summary> /// <param name="AuthKey"></param> /// <param name="serviceURL"></param> /// <returns></returns> public UsersVO[] GetUsersInfo(string AuthKey, string serviceURL) { if (!securityManager.CheckSecurityToken(AuthKey)) { throw new Exception("인증된 사용자가 아닙니다"); } string query = new UserQuery().GetAllUsers(); DataTable dtUser = DBController.getInstance().GetData(serviceURL, query); IList <UsersVO> userList = new List <UsersVO>(); for (int i = 0; i < dtUser.Rows.Count; i++) { UsersVO uvo = new UsersVO(); uvo.UserID = dtUser.Rows[i]["userid"].ToString(); uvo.UserPassword = dtUser.Rows[i]["userpassword"].ToString(); uvo.UserAuth = JsonConvert.DeserializeObject <UserAuth>(dtUser.Rows[0]["userauth"].ToString()); uvo.UserType = (사용자등급)Enum.Parse(typeof(사용자등급), dtUser.Rows[0]["usertype"].ToString()); userList.Add(uvo); } UsersVO[] arrUV = new UsersVO[userList.Count]; for (int i = 0; i < userList.Count; i++) { arrUV[i] = userList[i]; } return(arrUV); }
public UserInfoProxyVO GetUserInfo(string id, string password) { try { UsersVO uv = sqlProxy.UserLogIn ( new EncryptionService().GetEncryptedKey(this.EncryptionSeed, this.sqlProxy.GetTime()), this.ServiceURL, id, password ); if (uv == null) { throw new InvalidLogin(); } else { UserInfoProxyVO up = new UserInfoProxyVO(); up.UsersVO = uv; return(up); } } catch (Exception) { throw; } }
public override MasterVO BiuldVO(DataRow row) { UsersVO user = new UsersVO(); user.Id = Convert.ToInt32(row["id"]); user.Name = row["name"].ToString(); user.Picture = (row["picture"] as byte[]); user.DateBirth = Convert.ToDateTime(row["dtBirth"]); user.Password = row["password"].ToString(); return(user); }
public UserInfoProxyVO GetUserInfo(string id) { try { UsersVO uv = sqlProxy.GetUserInfo ( new EncryptionService().GetEncryptedKey(this.EncryptionSeed, this.sqlProxy.GetTime()), this.ServiceURL, id ); UserInfoProxyVO up = new UserInfoProxyVO(); up.UsersVO = uv; return(up); } catch (Exception) { throw; } }
private void btn_login_Click(object sender, EventArgs e) { try { UsersVO currentUser = new UsersVO(); using (SqlConnection connection = ConnectionDB.GetConnection()) { SqlParameter[] parameters = { new SqlParameter("@name", txt_LoginUsername.Text), new SqlParameter("@password", txt_LoginPassword.Text) }; DataTable table = Methods.SQLSelectProcedure("usp_ValidadeUser", parameters); if (table.Rows.Count == 0) { MessageBox.Show("Nenhum usuário encontrado com esse nome e senha.", "Erro.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } foreach (DataRow row in table.Rows) { currentUser.Id = Convert.ToInt32(row["id"].ToString()); currentUser.Name = row["name"].ToString(); currentUser.DateBirth = Convert.ToDateTime(row["dateBirth"]); currentUser.Picture = (row["picture"] as byte[]); } } fr_Default _Default = new fr_Default(currentUser); _Default.StartPosition = FormStartPosition.CenterParent; _Default.Show(); Hide(); } catch { MessageBox.Show("Erro ao conectar no Banco de Dados.", "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error); ChangeButtonColor(btn_Database, Color.Red); } }
private void btn_Save_Click(object sender, EventArgs e) { errorProvider.Clear(); bool foundError = false; if (String.IsNullOrEmpty(txt_RegisterUsername.Text)) { foundError = true; errorProvider.SetError(txt_RegisterUsername, "Digite um nome válido."); } if (String.IsNullOrEmpty(txt_RegisterPassword.Text)) { foundError = true; errorProvider.SetError(txt_RegisterPassword, "Digite ema senha válida."); } if (!foundError) { try { ImageConverter converter = new ImageConverter(); byte[] imageArray = (byte[])converter.ConvertTo(pic_userPicture.Image, typeof(byte[])); UsersDAO userDAO = new UsersDAO(); UsersVO user = new UsersVO(); user.Name = txt_RegisterUsername.Text; user.Password = txt_RegisterPassword.Text; user.DateBirth = Convert.ToDateTime(dtp_DateBirth.Value.ToShortDateString()); user.Picture = imageArray; userDAO.SQLInsert(user); MessageBox.Show("Usuário cadastrado com sucesso.", "Cadastrado.", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("Problemas para cadastrar usuário.", "Erro.", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
/// <summary> /// 특정 id 유저정보 알아내기 /// </summary> /// <param name="AuthKey"></param> /// <param name="serviceURL"></param> /// <param name="id"></param> /// <returns></returns> public UsersVO GetUserInfo(string AuthKey, string serviceURL, string id) { if (!securityManager.CheckSecurityToken(AuthKey)) { throw new Exception("인증된 사용자가 아닙니다"); } string query = new UserQuery().GetUserInfo(id); DataTable dtUser = DBController.getInstance().GetData(serviceURL, query); if (dtUser.Rows.Count > 0) { UsersVO uvo = new UsersVO(); uvo.UserID = dtUser.Rows[0]["USERid"].ToString().Replace("{", ""); uvo.UserAuth = JsonConvert.DeserializeObject <UserAuth>(dtUser.Rows[0]["UserAuth"].ToString()); uvo.UserType = (사용자등급)Enum.Parse(typeof(사용자등급), dtUser.Rows[0]["usertype"].ToString()); return(uvo); } else { return(null); } }
/// <summary> ///뷰단을 세팅 /// </summary> private void SetView() { //드롭다운리스트의 데이터 바운딩 ddlUserType.DataSource = Enum.GetNames(typeof(사용자등급)); ddl견적관리.DataSource = Enum.GetNames(typeof(사용자권한)); ddl계정관리.DataSource = Enum.GetNames(typeof(사용자권한)); ddl고객정보.DataSource = Enum.GetNames(typeof(사용자권한)); ddl나의정보관리.DataSource = Enum.GetNames(typeof(사용자권한)); ddl데이터관리.DataSource = Enum.GetNames(typeof(사용자권한)); ddl매입관리.DataSource = Enum.GetNames(typeof(사용자권한)); ddl상품정보.DataSource = Enum.GetNames(typeof(사용자권한)); ddl세금계산서관리.DataSource = Enum.GetNames(typeof(사용자권한)); ddl양식정보.DataSource = Enum.GetNames(typeof(사용자권한)); ddl에프터서비스관리.DataSource = Enum.GetNames(typeof(사용자권한)); ddl인사관리.DataSource = Enum.GetNames(typeof(사용자권한)); ddl일정정보.DataSource = Enum.GetNames(typeof(사용자권한)); ddl재고관리.DataSource = Enum.GetNames(typeof(사용자권한)); ddl판매관리.DataSource = Enum.GetNames(typeof(사용자권한)); ddl표준관리.DataSource = Enum.GetNames(typeof(사용자권한)); ddl회계관리.DataSource = Enum.GetNames(typeof(사용자권한)); //유저정보 목록 보여주기 lvUserList.Items.Clear(); this.userList = (IList <UserInfoProxyVO>) new SelectUser(null).GetData(); if (userList != null) { foreach (UserInfoProxyVO up in userList) { UsersVO uv = up.UsersVO; string id = uv.UserID; 사용자등급 userType = ((사용자등급)uv.UserType); string strUserType = Enum.GetName(typeof(사용자등급), userType); string[] strData = new string[] { id, strUserType }; lvUserList.Items.Add(new ListViewItem(strData)); } } }
public string UpdateUser(UsersVO userInfo) { string UserAuth = JsonConvert.SerializeObject(userInfo.UserAuth); string UserType = Enum.GetName(typeof(사용자등급), userInfo.UserType); StringBuilder sbUser = new StringBuilder(); sbUser.Append("update Users set "); sbUser.Append("userid='"); sbUser.Append(userInfo.UserID); sbUser.Append("',"); sbUser.Append("userpassword = '******',"); sbUser.Append("UserAuth = '"); sbUser.Append(UserAuth); sbUser.Append("',"); sbUser.Append("UserType = '"); sbUser.Append(UserType); sbUser.Append("' where "); sbUser.Append(" userid='"); sbUser.Append(userInfo.UserID); sbUser.Append("'"); return(sbUser.ToString()); }
public string insertUser(UsersVO userInfo) { string UserAuth = JsonConvert.SerializeObject(userInfo.UserAuth); string UserType = Enum.GetName(typeof(사용자등급), userInfo.UserType); StringBuilder sbUser = new StringBuilder(); sbUser.Append("insert into USERS("); sbUser.Append(" userid,"); sbUser.Append("userpassword,"); sbUser.Append("UserAuth,"); sbUser.Append("UserType)"); sbUser.Append(" values("); sbUser.Append("'"); sbUser.Append(userInfo.UserID); sbUser.Append("','"); sbUser.Append(userInfo.UserPassword); sbUser.Append("','"); sbUser.Append(UserAuth); sbUser.Append("','"); sbUser.Append(UserType); sbUser.Append("'"); sbUser.Append(")"); return(sbUser.ToString()); }
public UserInfoProxyVO() { this.UsersVO = new UsersVO(); this.UsersVO.UserAuth = new UserAuth(); }
public fr_Default(UsersVO parCurrentUser) { this.currentUser = parCurrentUser; InitializeComponent(); }