public async Task<ActionResult> ModifyMyInfo(BizWorkViewModel bizWorkViewModel) { ViewBag.LeftMenu = Global.MyInfo; var scUsr = await _scUsrService.SelectScUsr(Session[Global.LoginID].ToString()); scUsr.Name = bizWorkViewModel.Name; scUsr.DeptNm = bizWorkViewModel.DeptNm; scUsr.TelNo = bizWorkViewModel.TelNo1 + "-" + bizWorkViewModel.TelNo2 + "-" + bizWorkViewModel.TelNo3; scUsr.MbNo = bizWorkViewModel.MbNo1 + "-" + bizWorkViewModel.MbNo2 + "-" + bizWorkViewModel.MbNo3; scUsr.FaxNo = bizWorkViewModel.FaxNo1 + "-" + bizWorkViewModel.FaxNo2 + "-" + bizWorkViewModel.FaxNo3; scUsr.Email = bizWorkViewModel.Email1 + "@" + bizWorkViewModel.Email2; int result = await _scUsrService.SaveDbContextAsync(); if (result != -1) return RedirectToAction("MyInfo", "Main"); else { ModelState.AddModelError("", "내정보 수정 실패."); var scBizWork = await _scBizWorkService.GetBizWorkByloginId(Session[Global.LoginID].ToString()); var usrView = Mapper.Map<BizWorkViewModel>(scBizWork); return View(usrView); } }
public async Task<ActionResult> RegBizWork(BizWorkViewModel bizWorkViewModel) { ViewBag.LeftMenu = Global.BizWorkMng; if (ModelState.IsValid) { var scUsr = Mapper.Map<ScUsr>(bizWorkViewModel); var scBizWork = Mapper.Map<ScBizWork>(bizWorkViewModel); //회원정보 추가 정보 설정 scUsr.RegId = Session[Global.LoginID].ToString(); scUsr.RegDt = DateTime.Now; scUsr.Status = "N"; scUsr.UsrType = "B"; scUsr.UsrTypeDetail = "M"; scUsr.CompSn = int.Parse(Session[Global.CompSN].ToString()); SHACryptography sha2 = new SHACryptography(); scUsr.LoginPw = sha2.EncryptString(scUsr.LoginPw); //사업정보 추가 정보 설정 scBizWork.Status = "N"; scBizWork.MngCompSn = int.Parse(Session[Global.CompSN].ToString()); scBizWork.RegId = Session[Global.LoginID].ToString(); scBizWork.RegDt = DateTime.Now; //저장 IList<ScBizWork> scBizWorks = new List<ScBizWork>(); scUsr.ScBizWorks.Add(scBizWork); int result = await _scUsrService.AddBizManagerMemberAsync(scUsr); if (result != -1) return RedirectToAction("BizWorkList", "BizWorkMng"); else { ModelState.AddModelError("", "사업 등록 실패."); return View(bizWorkViewModel); } } ModelState.AddModelError("", "입력값 검증 실패."); return View(bizWorkViewModel); }
public async Task<ActionResult> ModifyBizWork(BizWorkViewModel bizWorkViewModel) { ViewBag.LeftMenu = Global.BizWorkMng; //var listScNtc = _scNtcService.GetNotices(SelectList, Query); var scBizWork = await _scBizWorkService.GetBizWorkByBizWorkSn(bizWorkViewModel.BizWorkSn); scBizWork.BizWorkNm = bizWorkViewModel.BizWorkNm; scBizWork.BizWorkSummary = bizWorkViewModel.BizWorkSummary; scBizWork.BizWorkStDt = DateTime.Parse(bizWorkViewModel.BizWorkStDt); scBizWork.BizWorkEdDt = DateTime.Parse(bizWorkViewModel.BizWorkEdDt); scBizWork.MngDept = bizWorkViewModel.MngDept; int result = await _scBizWorkService.SaveDbContextAsync(); if (result != -1) return RedirectToAction("BizWorkDetail", "BizWorkMng", new { bizWorkSn = scBizWork.BizWorkSn }); else { ModelState.AddModelError("", "사업 수정 실패."); return View(bizWorkViewModel); } }