コード例 #1
0
        public ActionResult CreateDataCenterProject(DataCenters dataCenters)
        {
            var listProjectType = proType.ListProjectTypes();

            ViewBag.listProjectTypeDll = new SelectList(listProjectType, "Project_type_id", "Project_type_name");

            var listPhaseTypes = phaseType.ListPhaseTypes();

            ViewBag.listPhaseTypesDll = new SelectList(listPhaseTypes, "Phase_id", "Phase_name");

            var listSpeedConnectionsTypes = speedType.ListSpeedConnectionTypes();

            ViewBag.listSpeedConnectionsTypesDll = new SelectList(listSpeedConnectionsTypes, "Speed_connection_id", "Speed_connection_name");

            var listDcScopes = dcScope.ListDataCenterScopes();

            ViewBag.listDcScopesDll = new SelectList(listDcScopes, "Dc_scope_id", "Dc_scope_name");

            if (dataCenters.DataCenter_requestor_id != null)
            {
                //Changes the lab project null to 4=DataCenter
                dataCenters.Project_type = 4;
                try
                {
                    if (!ModelState.IsValid)
                    {
                        return(View());
                    }

                    var dcToAdd = Mapper.Map <DATA.DataCenters>(dataCenters);
                    dc.AddDataCenter(dcToAdd);
                    int x = (Int32)Session["UserType"];
                    switch (x)
                    {
                    case 1:
                        return(RedirectToAction("PmProjects", "User"));

                    case 2:
                        return(RedirectToAction("UserMyProjects", "User"));

                    case 3:
                        return(RedirectToAction("Index", "DataCenter"));

                    case 4:
                        return(RedirectToAction("Index", "DataCenter"));

                    default:
                        return(RedirectToAction("Index", "Home"));
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                return(View());
            }
        }
コード例 #2
0
        public ActionResult CreateDataCenterProject(DataCenters dataCenters)
        {
            var listProjectType = proType.ListProjectTypes();

            ViewBag.listProjectTypeDll = new SelectList(listProjectType, "Project_type_id", "Project_type_name");

            var listPhaseTypes = phaseType.ListPhaseTypes();

            ViewBag.listPhaseTypesDll = new SelectList(listPhaseTypes, "Phase_id", "Phase_name");

            var listSpeedConnectionsTypes = speedType.ListSpeedConnectionTypes();

            ViewBag.listSpeedConnectionsTypesDll = new SelectList(listSpeedConnectionsTypes, "Speed_connection_id", "Speed_connection_name");

            var listDcScopes = dcScope.ListDataCenterScopes();

            ViewBag.listDcScopesDll = new SelectList(listDcScopes, "Dc_scope_id", "Dc_scope_name");

            if (dataCenters.DataCenter_requestor_id != null)
            {
                //Changes the lab project null to 4=DataCenter
                dataCenters.Project_type = 4;
                try
                {
                    if (!ModelState.IsValid)
                    {
                        return(View());
                    }

                    var dcToAdd = Mapper.Map <DATA.DataCenters>(dataCenters);
                    dc.AddDataCenter(dcToAdd);
                    return(RedirectToAction("CreateDataCenterProject"));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                return(View());
            }
        }