Ejemplo n.º 1
0
        public async Task<ActionResult> CompanyJoin(JoinCompanyViewModel joinCompanyViewModel, string BizList)
        {
            if (ModelState.IsValid)
            {
                if(string.IsNullOrEmpty(BizList))
                {
                    ModelState.AddModelError("", "사업명을 선택하지 않았습니다.");
                    return View(joinCompanyViewModel);
                }
                var scUsr = Mapper.Map<ScUsr>(joinCompanyViewModel);
                var syUser = Mapper.Map<SHUSER_SyUser>(joinCompanyViewModel);
                var scCompInfo = Mapper.Map<ScCompInfo>(joinCompanyViewModel);

                //회원정보 추가 정보 설정
                scUsr.RegId = scUsr.LoginId;
                scUsr.RegDt = DateTime.Now;
                scUsr.Status = "N";
                scUsr.UsrType = "C";
                scUsr.UsrTypeDetail = "A";
                scUsr.AgreeYn = "Y";

                if (joinCompanyViewModel.UseErp.Equals(true))
                {
                    scUsr.UseErp = "1";
                }
                else
                {
                    scUsr.UseErp = "0";
                }

                SHACryptography sha2 = new SHACryptography();
                scUsr.LoginPw = sha2.EncryptString(scUsr.LoginPw);

                //회사정보 추가 정보 설정
                scCompInfo.Status = "N";
                scCompInfo.RegId = scUsr.LoginId;
                scCompInfo.RegDt = DateTime.Now;

                //개인, 법인사업자 구분 설정
                int bizCode = Convert.ToInt32(scCompInfo.RegistrationNo.Substring(3, 2));
                string bizType = string.Empty; //법인 : L, 개인 : C

                if ((bizCode >= 1 && bizCode <= 79) || (bizCode >= 90 && bizCode <= 99) || bizCode == 89 || bizCode == 80)
                {
                    scCompInfo.CompType = "I"; //개인
                }
                else 
                {
                    scCompInfo.CompType = "C"; //법인
                }

                //사업관리 및 사업등록 요청 설절
                ScCompMapping scm = new ScCompMapping();
                scm.BizWorkSn = int.Parse(BizList);
                scm.Status = "R";
                scm.RegId = scUsr.LoginId;
                scm.RegDt = DateTime.Now;



                //다래 추가정보 설정
                // 기업회원 : 1, 세무회계사 : 2
                syUser.UsrGbn = "1";
                //사용가능 : 1, 사용불가 : 0
                if (joinCompanyViewModel.UseErp.Equals(true))
                {
                    syUser.UserStatus = "1";
                }
                else
                {
                    syUser.UserStatus = "0";
                }
                // 무료사용자 : 3, 유료사용자 : 1
                syUser.WebUsrGbn = "3";
                syUser.SmartPwd = scUsr.LoginPw;

                //저장
                scCompInfo.ScUsrs.Add(scUsr);
                scCompInfo.ScCompMappings.Add(scm);

                //업종,종목처리
                if (joinCompanyViewModel.BizTypes.Count > 0)
                {
                    //._scBizTypeService.DeleteScBizTypeByCompSn(compSn);

                    foreach (var item in joinCompanyViewModel.BizTypes)
                    {
                        var scBizType = new ScBizType
                        {
                            BizTypeCd = item.BizTypeCd,
                            BizTypeNm = item.BizTypeNm
                        };

                        scCompInfo.ScBizTypes.Add(scBizType);
                    }

                }

                //bool result = _scUsrService.AddCompanyUser(scCompInfo, scUsr, syUser);
                int result = await _scUsrService.AddCompanyUserAsync(scCompInfo, scUsr, syUser);

                ////업종,종목처리
                //int compSn = int.Parse(Session[Global.CompSN].ToString());
                //if (joinCompanyViewModel.BizTypes.Count > 0)
                //{
                //    //._scBizTypeService.DeleteScBizTypeByCompSn(compSn);

                //    foreach (var item in joinCompanyViewModel.BizTypes)
                //    {
                //        var scBizType = new ScBizType
                //        {
                //            CompSn = compSn,
                //            BizTypeCd = item.BizTypeCd,
                //            BizTypeNm = item.BizTypeNm
                //        };

                //        _scBizTypeService.AddScBizType(scBizType);
                //    }

                //    await _scBizTypeService.SaveDbContextAsync();
                //}

              

                if (result != -1)
                    return RedirectToAction("CompanyJoinComplete", "Account");
                else
                    return View(joinCompanyViewModel);

                //if (result)
                //    return RedirectToAction("CompanyJoinComplete", "Account");
                //else
                //    return View(joinCompanyViewModel);
            }
            // 이 경우 오류가 발생한 것이므로 폼을 다시 표시하십시오.
            return View(joinCompanyViewModel);
        }
Ejemplo n.º 2
0
        public static CompnayStatsViewModel MakeYearCompnayStatsViewModel(ScCompMapping scCompMapping, SHUSER_SboFinancialTab3SalesSelectReturnModel yearSales)
        {
            CompnayStatsViewModel model = new CompnayStatsViewModel();
            model.CompNm = scCompMapping.ScCompInfo.CompNm;
            model.AvgSales = Math.Truncate(yearSales.TERM_SALE_AVR.Value / 1000).ToString();
            model.BeforeSales = Math.Truncate(yearSales.PRE_TO_SALE.Value / 1000).ToString();
            model.CntEmploy = Math.Truncate(yearSales.QT_EMP.Value).ToString();
            model.LastSales = Math.Truncate(yearSales.TO_SALE.Value).ToString();
            model.SumSales = Math.Truncate(yearSales.TERM_SALE.Value).ToString();

            return model;
        }