private void BtnSave_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtName.Text) && !string.IsNullOrEmpty(txtID.Text) && !string.IsNullOrEmpty(txtPwd.Text)) { UserInfoVO user = new UserInfoVO { User_Name = txtName.Text, User_ID = txtID.Text, User_PW = txtPwd.Text, Ins_Emp = lblManager.Text, Ins_Date = Convert.ToDateTime(lblDay.Text) }; UserInfo_Service service = new UserInfo_Service(); if (service.InsertUser(user)) { this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("이미 등록된 회원입니다.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("필수항목을 입력해주세요.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void MSS_SYS_004_Load(object sender, EventArgs e) { dtpEnd.MaxDate = DateTime.Now; userlist = new List <UserInfoVO>(); userlist = userservice.GetAllUser(); screenitemlist = new List <ScreenItem_MasterVO>(); screenitemlist = screenservice.GetALLScreenItem(); //모든스크린 UserInfoVO ufirst = new UserInfoVO(); userlist.Insert(0, ufirst); cbbUser.DisplayMember = "User_Name"; cbbUser.ValueMember = "User_ID"; cbbUser.DataSource = userlist; ScreenItem_MasterVO sfirst = new ScreenItem_MasterVO(); screenitemlist.Insert(0, sfirst); cbbScreen.DisplayMember = "Type"; cbbScreen.ValueMember = "Screen_Code"; cbbScreen.DataSource = screenitemlist; DatagridviewDesigns.SetDesign(dgvGroup); DatagridviewDesigns.AddNewColumnToDataGridView_Autosize(dgvGroup, "이름", "User_Name", true, 210, default, true);
/// <summary> /// 유저 저장 /// </summary> /// <param name="user"></param> /// <returns></returns> public bool InsertUser(UserInfoVO user) { try { using (SqlCommand com = new SqlCommand()) { com.Connection = new SqlConnection(Connstr); com.CommandText = "InsertUser"; com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("@User_ID", user.User_ID); com.Parameters.AddWithValue("@User_Name", user.User_Name); com.Parameters.AddWithValue("@User_PW", user.User_PW); com.Parameters.AddWithValue("@Ins_Date", user.Ins_Date); com.Parameters.AddWithValue("@Ins_Emp", user.Ins_Emp); com.Connection.Open(); int resault = Convert.ToInt32(com.ExecuteNonQuery()); com.Connection.Close(); return(resault > 0); } } catch (Exception) { return(false); } }
private void btnLogin_Click(object sender, EventArgs e) { UserInfo_Service uservice = new UserInfo_Service(); UserInfoVO logininfo = uservice.GetLoginInfo(txtID.Text, txtPwd.Text); if (logininfo == null) { MessageBox.Show("아이디 비밀번호를 확인해주세요"); return; } Emp_Wc_AllocationService service = new Emp_Wc_AllocationService(); if ((!service.IsAllocated(logininfo.User_ID, GlobalUsage.WcCode)) && !logininfo.User_ID.Equals("master")) { MessageBox.Show("할당되지 않은 작업자입니다."); return; } GlobalUsage.UserID = txtID.Text; GlobalUsage.UserName = logininfo.User_Name; // 세션 set Random r = new Random(); // 신규비밀번호 = 랜덤8자리(영문대문자 + 숫자) StringBuilder session = new StringBuilder(); for (int i = 0; i < 12; i++) { int rndVal = r.Next(0, 36); if (rndVal < 10) //숫자 { session.Append(rndVal); } else { session.Append((char)(rndVal + 55)); //65~90 : 영어대문자 } } Login_History loginhistory = new Login_History() { Session_ID = session.ToString(), User_ID = logininfo.User_ID, Login_Day = Convert.ToDateTime(DateTime.Now.ToShortDateString()), Login_Date = DateTime.Now, Login_Success = "Y" }; uservice.InsertLogin_History(loginhistory); this.DialogResult = DialogResult.OK; }
/// <summary> /// POP 로그인하기 return null : 실패 x : 성공 => User_Name, User_Type 리턴 /// </summary> /// <param name="userID"></param> /// <param name="userPassword"></param> /// <returns></returns> public UserInfoVO GetLoginInfo(string userID, string userPassword) { UserInfoVO item = null; using (SqlCommand comm = new SqlCommand()) { comm.Connection = new SqlConnection(Connstr); comm.CommandText = @" SELECT TOP(1) [User_ID] ,[User_Name] ,[User_PW] ,[Customer_Code] ,[DefaultLanguage] ,[User_Type] ,[Price_Visible_YN] ,[IP_Security_YN] ,[Pw_Reset_Count] ,[Default_Screen_Code] ,[Default_Process_Code] ,[Monitoring_YN] ,[Use_YN] ,[S01] ,[S02] ,[S03] ,[S04] ,[S05] ,[S06] ,[S07] ,[S08] ,[S09] ,[S10] ,[S11] ,[S12] ,[Ins_Date] ,[Ins_Emp] ,[Up_Date] ,[Up_Emp] FROM [dbo].[User_Master] WHERE User_ID = @User_ID AND User_PW = @User_PW ; "; comm.CommandType = CommandType.Text; comm.Parameters.AddWithValue("@User_ID", userID); comm.Parameters.AddWithValue("@User_PW", userPassword); comm.Connection.Open(); SqlDataReader reader = comm.ExecuteReader(); if (reader.Read()) { item = new UserInfoVO(); item.User_ID = reader[0].ToString(); item.User_Name = reader[1].ToString(); item.User_PW = reader[2].ToString(); item.Customer_Code = reader[3].ToString(); item.DefaultLanguage = reader[4].ToString(); item.User_Type = reader[5].ToString(); item.Price_Visible_YN = reader[6].ToString(); item.IP_Security_YN = reader[7].ToString(); item.Pw_Reset_Count = Convert.ToInt32(reader[8]); item.Default_Screen_Code = reader[9].ToString(); item.Default_Process_Code = reader[10].ToString(); item.Monitoring_YN = reader[11].ToString(); item.Use_YN = reader[12].ToString(); item.S01 = reader[13].ToString(); item.S02 = reader[14].ToString(); item.S03 = reader[15].ToString(); item.S04 = reader[16].ToString(); item.S05 = reader[17].ToString(); item.S06 = reader[18].ToString(); item.S07 = reader[19].ToString(); item.S08 = reader[20].ToString(); item.S09 = reader[21].ToString(); item.S10 = reader[22].ToString(); item.S11 = reader[23].ToString(); item.S12 = reader[24].ToString(); item.Ins_Date = Convert.ToDateTime(reader[25]); item.Ins_Emp = reader[26].ToString(); item.Up_Date = Convert.ToDateTime(reader[27]); item.Up_Emp = reader[28].ToString(); } comm.Connection.Close(); return(item); } }
private void wait() { UserInfo_Service service = new UserInfo_Service(); UserInfoVO userinfo = service.GetLoginInfo(txtID.Text, txtPwd.Text); if (userinfo == null) { MessageBox.Show("아이디 비밀번호를 확인해주세요"); return; } UserInfo.User_ID = userinfo.User_ID; UserInfo.User_Name = userinfo.User_Name; UserInfo.User_PW = userinfo.User_PW; UserInfo.Customer_Code = userinfo.Customer_Code; UserInfo.DefaultLanguage = userinfo.DefaultLanguage; UserInfo.User_Type = userinfo.User_Type; UserInfo.Price_Visible_YN = userinfo.Price_Visible_YN; UserInfo.IP_Security_YN = userinfo.IP_Security_YN; UserInfo.Pw_Reset_Count = userinfo.Pw_Reset_Count; UserInfo.Default_Screen_Code = userinfo.Default_Screen_Code; UserInfo.Default_Process_Code = userinfo.Default_Process_Code; UserInfo.Monitoring_YN = userinfo.Monitoring_YN; UserInfo.Use_YN = userinfo.Use_YN; UserInfo.S01 = userinfo.S01; UserInfo.S02 = userinfo.S02; UserInfo.S03 = userinfo.S03; UserInfo.S04 = userinfo.S04; UserInfo.S05 = userinfo.S05; UserInfo.S06 = userinfo.S06; UserInfo.S07 = userinfo.S07; UserInfo.S08 = userinfo.S08; UserInfo.S09 = userinfo.S09; UserInfo.S10 = userinfo.S10; UserInfo.S11 = userinfo.S11; UserInfo.S12 = userinfo.S12; UserInfo.Ins_Date = userinfo.Ins_Date; UserInfo.Ins_Emp = userinfo.Ins_Emp; UserInfo.Up_Date = userinfo.Up_Date; UserInfo.Up_Emp = userinfo.Up_Emp; Random r = new Random(); //신규비밀번호 = 랜덤8자리(영문대문자 + 숫자) string pwd = string.Empty; for (int i = 0; i < 12; i++) { int rndVal = r.Next(0, 36); if (rndVal < 10) //숫자 { pwd += rndVal; } else { pwd += (char)(rndVal + 55); //65~90 : 영어대문자 } } UserInfo.Session_ID = pwd; logininfo = new Login_History() { Session_ID = pwd, User_ID = userinfo.User_ID, Login_Day = Convert.ToDateTime(DateTime.Now.ToShortDateString()), Login_Date = DateTime.Now, Login_Success = "Y" }; service.InsertLogin_History(logininfo); this.DialogResult = DialogResult.OK; //userlist = service.GetAllUser(); //try //{ // if (userlist.Count(item => item.User_ID == txtID.Text) > 0) // { // if (userlist.Count(item => item.User_PW == txtPwd.Text) > 0) // { // uservo = userlist.Find(item => item.User_ID == txtID.Text && item.User_PW == txtPwd.Text); // UserInfo.User_ID = uservo.User_ID; // UserInfo.User_Name = uservo.User_Name; // UserInfo.User_PW = uservo.User_PW; // UserInfo.Customer_Code = uservo.Customer_Code; // UserInfo.DefaultLanguage = uservo.DefaultLanguage; // UserInfo.User_Type = uservo.User_Type; // UserInfo.Price_Visible_YN = uservo.Price_Visible_YN; // UserInfo.IP_Security_YN = uservo.IP_Security_YN; // UserInfo.Pw_Reset_Count = uservo.Pw_Reset_Count; // UserInfo.Default_Screen_Code = uservo.Default_Screen_Code; // UserInfo.Default_Process_Code = uservo.Default_Process_Code; // UserInfo.Monitoring_YN = uservo.Monitoring_YN; // UserInfo.Use_YN = uservo.Use_YN; // UserInfo.S01 = uservo.S01; // UserInfo.S02 = uservo.S02; // UserInfo.S03 = uservo.S03; // UserInfo.S04 = uservo.S04; // UserInfo.S05 = uservo.S05; // UserInfo.S06 = uservo.S06; // UserInfo.S07 = uservo.S07; // UserInfo.S08 = uservo.S08; // UserInfo.S09 = uservo.S09; // UserInfo.S10 = uservo.S10; // UserInfo.S11 = uservo.S11; // UserInfo.S12 = uservo.S12; // UserInfo.Ins_Date = uservo.Ins_Date; // UserInfo.Ins_Emp = uservo.Ins_Emp; // UserInfo.Up_Date = uservo.Up_Date; // UserInfo.Up_Emp = uservo.Up_Emp; // Random r = new Random(); // //신규비밀번호 = 랜덤8자리(영문대문자 + 숫자) // string pwd = string.Empty; // for (int i = 0; i < 12; i++) // { // int rndVal = r.Next(0, 36); // if (rndVal < 10) //숫자 // { // pwd += rndVal; // } // else // { // pwd += (char)(rndVal + 55); //65~90 : 영어대문자 // } // } // UserInfo.Session_ID = pwd; // logininfo = new Login_History() // { // Session_ID = pwd, // User_ID = uservo.User_ID, // Login_Day = Convert.ToDateTime(DateTime.Now.ToShortDateString()), // Login_Date = DateTime.Now, // Login_Success = "Y" // }; // service.InsertLogin_History(logininfo); // this.DialogResult = DialogResult.OK; // } // else // { // MessageBox.Show("비밀번호가 올바르지 않습니다.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); // return; // } // } // else // { // MessageBox.Show("등록되지 않은아이디입니다.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); // return; // } //} //catch (Exception) //{ // throw; //} }
public bool InsertUser(UserInfoVO user) { return(dac.InsertUser(user)); }
public UserInfoProxy() : base(NAME) { Data = new UserInfoVO(); }