예제 #1
0
        public void SaveEnterpriseInfo()
        {
            var    fs = _request.Files;
            var    file = fs[0];
            int    registTypeId = 0, regFinance = 0, regFinanceMt = 0, business = 0;
            string mainProduction = "", juridicalPerson = "", desc = "";
            string enterpriseName = _request.Form["EnterpriseName"].Trim();
            string userName       = _request.Form["UserNametxt"];

            if (_request.Form["RegistTypeCmb"].Trim() != "" && _request.Form["RegistTypeCmb"] != null)
            {
                registTypeId = Convert.ToInt32(_request.Form["RegistTypeCmb"]);
            }
            if (_request.Form["RegFinanceCmb"].Trim() != "" && _request.Form["RegFinanceCmb"] != null)
            {
                regFinance = Convert.ToInt32(_request.Form["RegFinanceCmb"]);
            }
            if (_request.Form["RegFinanceMtCmb"].Trim() != "" && _request.Form["RegFinanceMtCmb"] != null)
            {
                regFinanceMt = Convert.ToInt32(_request.Form["RegFinanceMtCmb"]);
            }
            if (_request.Form["BusinessCmb"].Trim() != "" && _request.Form["BusinessCmb"] != null)
            {
                business = Convert.ToInt32(_request.Form["BusinessCmb"]);
            }
            if (_request.Form["MainProduction"].Trim() != "" && _request.Form["MainProduction"] != null)
            {
                mainProduction = _request.Form["MainProduction"];
            }
            if (_request.Form["JuridicalPerson"].Trim() != "" && _request.Form["JuridicalPerson"] != null)
            {
                juridicalPerson = _request.Form["JuridicalPerson"];
            }
            if (_request.Form["EnterpriseDesc"].Trim() != "" && _request.Form["EnterpriseDesc"] != null)
            {
                desc = _request.Form["EnterpriseDesc"];
            }

            var enterprise = new Enterprise
            {
                Name                = _request.Form["EnterpriseName"].Trim(),
                Code                = _request.Form["Code"].Trim(),
                BusinessLicense     = StreamToBytes(file.InputStream),
                RegistTypeId        = registTypeId,
                ProfessionId        = Convert.ToInt32(_request.Form["ProfessionCmb"]),
                EnterpriseTypeId    = Convert.ToInt32(_request.Form["EnterpriseTypeCmb"]),
                RegistRegionId      = Convert.ToInt32(_request.Form["RegistRegionCmb"]),
                HuanpingId          = Convert.ToInt32(_request.Form["HuanpingCmb"]),
                RegFinance          = regFinance,
                RegFinanceMt        = regFinanceMt,
                Business            = business,
                MainProduction      = mainProduction,
                CreateTime          = DateTime.Parse(_request.Form["CreateTime"]),
                JuridicalPerson     = juridicalPerson,
                ConectionPerson     = _request.Form["ConectionPerson"].Trim(),
                ConnectionTelephone = _request.Form["ConnectionTelephone"],
                Desc                = desc
            };
            string err;
            bool   isSaveOk = _em.Save(enterprise, out err);

            if (isSaveOk == true)
            {
                _em.GetEntetpriseForName(enterpriseName, userName);
            }
            _response.Write(isSaveOk);
        }