private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtLoginEmail.Text)) { MessageBox.Show("이메일을 입력해주세요."); return; } if (string.IsNullOrEmpty(txtLoginPassword.Text)) { MessageBox.Show("비밀번호를 입력해주세요."); return; } var login = new LoginVO() { grant_type = "password", email = txtLoginEmail.Text, password = txtLoginPassword.Text }; string token = ANBTX.WebRequestCheck(BASE_URL[0] + BASE_SURV_URL[0], login); if (ANBTX.TokenValue(token) != null) { var frmRestHome = new FrmRestAPITest(); frmRestHome.ShowDialog(); this.Hide(); // var frmMainViewList = new FrmMainViewList(); // frmMainViewList.Show(); // this.Hide(); } }
private void btnUpdate_Click(object sender, EventArgs e) { UpdateEmployee.grant_type = "password"; UpdateEmployee.empNm = txtEmployeeName.Text; UpdateEmployee.empEngNm = txtEmployeeEngName.Text; UpdateEmployee.rank = RankInfo.Where(o => o.rankName.Equals(cboRank.Text)).First(); UpdateEmployee.empFlag = cboEmployeeType.SelectedItem.ToString(); UpdateEmployee.team = cboTeamName.SelectedItem.ToString(); UpdateEmployee.email = txtEmailFirst + "@" + cboEmailAddr.SelectedItem.ToString(); UpdateEmployee.empTel = txtEmployeeTel.Text; UpdateEmployee.empHp = txtEmployeeHtel.Text; UpdateEmployee.project = ProjectInfo.Where(o => o.prjNm.Equals(cboProject.Text)).First(); UpdateEmployee.maritalState = cboEmployeeMaritalState.SelectedItem.ToString() != "기혼" ? "false" : "true"; UpdateEmployee.birthState = cboEmployeeBrithState.SelectedItem.ToString(); UpdateEmployee.updateDate = DateTime.Now.ToUniversalTime().ToString("s") + "Z";; UpdateEmployee.enteringDate = employeeEnteringDate.Value.ToUniversalTime().ToString("s") + "Z"; UpdateEmployee.birthDate = employeeBirthDate.Value.ToUniversalTime().ToString("s") + "Z"; UpdateEmployee.maritalDate = employeeMarital_date.Value.ToUniversalTime().ToString("s") + "Z"; UpdateEmployee.leaveDate = cboEmployeeLeaveType.SelectedItem.ToString() != "퇴사" ? employeeLeaveDate.Value.ToUniversalTime().ToString("s") + "Z" : " "; ANBTX.Update("/api/employee", UpdateEmployee); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { try { var lstEmployee = ANBTX_Common.GetEmployee(API_URL); for (int i = 0; i < grdRpt.Rows.Count; i++) { var chk = grdRpt.Rows[i].Cells[1].FormattedValue.ToString(); if (chk.Equals("True")) { var chkEmpId = grdRpt.Rows[i].Cells[2].FormattedValue.ToString(); if (lstEmployee.Any(o => o.empId.Equals(chkEmpId))) { var emp = lstEmployee.Where(o => o.empId.Equals(chkEmpId)).ToArray()[0]; emp.email = "updateTest!!!!!!!!!"; //emp.project.prjId = FrmProjectP1.prjId; //emp.project.prjNm = "test"; //emp.project.prjStatus = "OK"; //emp.project.startDate = DateTime.Now; //emp.project.endDate = DateTime.Now; ANBTX.Update(API_URL, emp); } } } MessageBox.Show("성공적으로 등록되었습니다."); } catch (Exception ex) { MessageBox.Show("An exception occurred :" + ex.ToString()); } this.Close(); }
private void btnCreate_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtEmployeeName.Text)) { MessageBox.Show("등록 할 [직원 성명]을 입력해주세요."); return; } // creat var emp = new EmployeeVO() { empId = "",// 이거는 입력해도 의미 없음 birthDate = employeeBirthDate.Value.ToUniversalTime().ToString("s") + "Z", birthState = cboEmployeeBrithState.SelectedItem.ToString() == "양력" ? "0" : cboEmployeeBrithState.SelectedItem.ToString() == "음력" ? "1" : "", depart = null, email = txtEmailFirst.Text + "@" + cboEmailAddr.Text, empAddr = txtEmployeeAddr.Text, empAddrDtl = txtEmployeeAddrDtl.Text, empEngNm = txtEmployeeEngName.Text, empFlag = cboEmployeeType.SelectedItem.ToString() == "정규직" ? "0" : cboEmployeeType.SelectedItem.ToString() == "계약직" ? "1" : cboEmployeeType.SelectedItem.ToString() == "협력사직원" ? "2" : cboEmployeeType.SelectedItem.ToString() == "파트타임" ? "3" : "9", empHp = txtEmployeeHtel.Text, empNm = txtEmployeeName.Text, empPwd = null, empTel = txtEmployeeTel.Text, empZip = txtEmployeeZip.Text, enteringDate = employeeEnteringDate.Value.ToUniversalTime().ToString("s") + "Z", leaveDate = cboEmployeeLeaveType.Text != "퇴사" ? "" : employeeLeaveDate.Value.ToUniversalTime().ToString("s") + "Z", loginDate = DateTime.MaxValue.ToUniversalTime().ToString("s") + "Z", maritalDate = cboEmployeeMaritalState.SelectedItem.ToString() != "기혼" ? "" : employeeMarital_date.Value.ToUniversalTime().ToString("s") + "Z", maritalState = cboEmployeeMaritalState.SelectedItem.ToString() == "기혼" ? "1" : cboEmployeeMaritalState.SelectedItem.ToString() == "미혼" ? "0" : "", officeTel = null, photo = null, position = null, reason = null, regEmpId = null, regEmpNm = null, registDste = DateTime.Now.ToUniversalTime().ToString("s") + "Z", rank = RankInfo.Where(o => o.rankName.Equals(cboRank.SelectedItem.ToString())).First(), project = ProjectInfo.Where(o => o.prjNm.Equals(cboProject.SelectedItem.ToString())).First(), spouseTel = null, state = null, team = cboTeamName.Text, updateDate = DateTime.Now.ToUniversalTime().ToString("s") + "Z", workPosition = cboWorkPosition.Text, userInfo = "", rankDisp = "", prjInfo = null }; ANBTX.Create("/api/employee", emp); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
/// <summary> /// Holiday 항목을 가져옵니다. /// </summary> /// <param name="strAPI"></param> /// <returns></returns> public static List <HolidayVO> GetHoliday(string strAPI) { var lstHoliday = new List <HolidayVO>(); var response = ANBTX.Get(strAPI); if (response.IsSuccessStatusCode) { lstHoliday = response.Content.ReadAsAsync <List <HolidayVO> >().Result; } return(lstHoliday); }
/// <summary> /// Project 항목을 가져옵니다. /// </summary> /// <param name="strAPI"></param> /// <returns></returns> public static List <ProjectVO> GetProject(string strAPI) { var lstProject = new List <ProjectVO>(); var response = ANBTX.Get(strAPI); if (response.IsSuccessStatusCode) { lstProject = response.Content.ReadAsAsync <List <ProjectVO> >().Result; } return(lstProject); }
/// <summary> /// Employee 항목을 가져옵니다. /// </summary> /// <param name="strAPI"></param> /// <returns></returns> public static List <EmployeeVO> GetEmployee(string strAPI) { var lstEmployee = new List <EmployeeVO>(); var response = ANBTX.Get(strAPI); if (response.IsSuccessStatusCode) { lstEmployee = response.Content.ReadAsAsync <List <EmployeeVO> >().Result; } return(lstEmployee); }
/// <summary> /// 공통코드 항목을 가져옵니다. /// </summary> /// /// <returns></returns> public static List <CommonCodeVO> GetCodeCommon(string strAPI) { var lstCodeCommon = new List <CommonCodeVO>(); var response = ANBTX.Get(strAPI); if (response.IsSuccessStatusCode) { lstCodeCommon = response.Content.ReadAsAsync <List <CommonCodeVO> >().Result; } return(lstCodeCommon); }
/// <summary> /// Book Rental 항목을 가져옵니다. /// </summary> /// <param name="strAPI"></param> /// <returns></returns> public static List <BookRentalVO> GetBookRental(string strAPI) { var lstBookRental = new List <BookRentalVO>(); var response = ANBTX.Get(strAPI); if (response.IsSuccessStatusCode) { lstBookRental = response.Content.ReadAsAsync <List <BookRentalVO> >().Result; } return(lstBookRental); }
private void DeleteToolStripMenuItem1_Click(object sender, EventArgs e) { // delete var empId = gridResult.SelectedRows[0].Cells[1].Value.ToString(); var emp = _lstEmployeeTotal.Where(o => o.empId.Equals(empId)).FirstOrDefault(); if (MessageBox.Show(string.Format("이름 : {0}, 직급 : {1} \r\n 삭제하시겠습니까?", emp.empNm, emp.rank.rankName), string.Empty, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK) { ANBTX.Delete(API_EMPLOYEE_URL, empId); InitControl(); btnSearch_Click(null, null); } }
public static string TokenValue(string token) { try { char[] TokenCheck = { ',' }; string[] accessTokenCheck = token.Split(TokenCheck); string[] tokenSplit = accessTokenCheck[0].Split(':'); ANBTX.TokenSet(tokenSplit[1].Split('"')[1]); return(tokenSplit[1].Split('"')[1]); } catch { return(null); } }
private void btnSave_Click(object sender, EventArgs e) { try { var prj = new ProjectVO() { prjId = edPrjId.Text,// 이거는 입력해도 의미 없음 prjNm = edPrjName.Text, prjStatus = cboStatus.Text, startDate = dtpStartDate.Value.ToString("yyyy-MM-dd"), endDate = dtpEndDate.Value.ToString("yyyy-MM-dd") //startDate = DateTime.Now, }; if (edPrjId.Text.Length > 0) { ANBTX.Update(API_URL, prj); } else { ANBTX.Create(API_URL, prj); } } catch (Exception ex) { MessageBox.Show("An exception occurred :" + ex.ToString()); } if (edPrjId.Text.Length > 0) { MessageBox.Show("성공적으로 저장되었습니다."); } else { MessageBox.Show("프로젝트가 성공적으로 추가되었습니다."); } //FrmProject.commGetPrj(); this.Close(); }
private void btnAdd_Click(object sender, EventArgs e) { try { var prj = new ProjectVO() { prjId = edPrjId.Text }; if (edPrjId.Text != null) { ANBTX.Delete(API_URL, prjId); MessageBox.Show("성공적으로 삭제되었습니다."); } else { MessageBox.Show("이미 없는 데이터 입니다."); } } catch (Exception ex) { MessageBox.Show("An exception occurred :" + ex.ToString()); } }
private void btnUpdate_Click(object sender, EventArgs e) { // update var lstEmployee = ANBTX_Common.GetEmployee(API_URL); if (lstEmployee.Any(o => o.empId.Equals(textBox3.Text))) { var emp = lstEmployee.Where(o => o.empId.Equals(textBox3.Text)).ToArray()[0]; emp.email = "updateTest!!!!!!!!!"; ANBTX.Update(API_URL, emp); } // 이렇게 하고 업데이트하니 에러발생. // error info. //{ //"timestamp": 1489502978843, //"status": 500, //"error": "Internal Server Error", //"exception": "org.springframework.dao.InvalidDataAccessApiUsageException", //"message": "Target object must not be null; nested exception is java.lang.IllegalArgumentException: Target object must not be null", //"path": "/api/employee" //} }
// Create private void btnCreate_Click(object sender, EventArgs e) { var currentDate = DateTime.Now.ToLongDateString(); // creat var emp = new EmployeeVO() { empId = "", // 이거는 입력해도 의미 없음 birthDate = null, birthState = null, depart = null, email = "null empid test22", empAddr = null, empAddrDtl = null, empEngNm = null, empFlag = "CREATE22", empHp = "010CREATE22", empNm = textBox1.Text, empPwd = null, empTel = "010-0000-0000", empZip = null, enteringDate = currentDate, leaveDate = currentDate, loginDate = currentDate, maritalDate = null, maritalState = "true", officeTel = null, photo = null, position = null, reason = null, regEmpId = null, regEmpNm = null, registDste = currentDate, rank = new RankVO { rankCode = "RANK50", rankName = "대리", rankOrder = 50, useYn = "Y", regEmpId = null, regEmpNm = null, registDate = currentDate, updateDate = "" }, project = new ProjectVO { prjId = null, prjNm = null, prjStatus = null, startDate = null, endDate = null }, spouseTel = null, state = null, team = null, updateDate = currentDate, workPosition = null, userInfo = "CREATE,kim22", rankDisp = "CREATE", prjInfo = null }; ANBTX.Create(API_URL, emp); }
private void btnDelete_Click(object sender, EventArgs e) { // delete ANBTX.Delete(API_URL, textBox4.Text); btnRead_Click(null, null); }