Ejemplo n.º 1
0
        public ActionResult CompanyInsert(CompanyInfo rComp)
        {
            if (!SessionCheck(Define.Session.SESSION_CHECK))
            {
                return(ErrorPage("/Home/Error"));
            }
            if (!CheckAuth())
            {
                return(base.Logout());
            }
            LogWriter.Instance().LogWrite(UserSession.UserId, "/Web/CompanyInsert");

            rComp.Creater    = UserSession.UserId;
            rComp.CreateDate = DateTime.Now;

            LanguageType?lType = (LanguageType?)Session[Define.Session.LANGUAGE_TYPE];

            IList <String> pError = rComp.Validate(lType);

            if (pError.Count > 0)
            {
                String ErrMsg = "";
                foreach (String pBuffer in pError)
                {
                    ErrMsg += pBuffer + "<br>";
                }
                ViewBag.ErrMsg      = ErrMsg;
                ViewBag.companyInfo = rComp;
                Session["action"]   = "CompanyInfo";
                return(View("~/Views/Web/CompanyInfo.cshtml", Define.MASTER_VIEW));
            }

            String message = "";

            companyInfoDao.Modify(rComp, lType);
            if (Object.Equals(lType, LanguageType.Korea))
            {
                message = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 수정되었습니다.";
            }
            else
            {
                message = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 修正しました。";
            }
            rComp = CompanySession;
            Session[Define.Session.COMPANY_INFO] = rComp;

            ViewBag.ErrMsg                 = message;
            ViewBag.companyInfo            = rComp;
            Session[Define.Session.ACTION] = "CompanyInfo";
            return(View("~/Views/Web/CompanyInfo.cshtml", Define.MASTER_VIEW));
        }