Beispiel #1
0
        public ActionResult Edit(Project Project)
        {
            Project oProject = new Project();

            oProject.ProjectID = System.Convert.ToInt32(Project.ProjectID);
            oProject           = ProjectData.Select_Record(Project);

            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = ProjectData.Update(oProject, Project);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Update");
                }
            }
            // ComboBox
            ViewData["ProjectStatusID"] = new SelectList(Project_ProjectStatusData.List(), "ProjectStatusID", "ProjectStatusName", Project.ProjectStatusID);
            ViewData["ClientID"]        = new SelectList(Project_ClientData.List(), "ClientID", "ClientName", Project.ClientID);
            ViewData["ArchitectID"]     = new SelectList(Project_ArchitectData.List(), "ArchitectID", "ArchitectName", Project.ArchitectID);
            ViewData["CompanyID"]       = new SelectList(Project_CompanyData.List(), "CompanyID", "CompanyName", Project.CompanyID);

            return(View(Project));
        }
Beispiel #2
0
        // GET: /Project/Edit/<id>
        public ActionResult Edit(
            Int32?ProjectID
            )
        {
            if (
                ProjectID == null
                )
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Project Project = new Project();

            Project.ProjectID = System.Convert.ToInt32(ProjectID);
            Project           = ProjectData.Select_Record(Project);

            if (Project == null)
            {
                return(HttpNotFound());
            }
            // ComboBox
            ViewData["ProjectStatusID"] = new SelectList(Project_ProjectStatusData.List(), "ProjectStatusID", "ProjectStatusName", Project.ProjectStatusID);
            ViewData["ClientID"]        = new SelectList(Project_ClientData.List(), "ClientID", "ClientName", Project.ClientID);
            ViewData["ArchitectID"]     = new SelectList(Project_ArchitectData.List(), "ArchitectID", "ArchitectName", Project.ArchitectID);
            ViewData["CompanyID"]       = new SelectList(Project_CompanyData.List(), "CompanyID", "CompanyName", Project.CompanyID);

            return(View(Project));
        }
Beispiel #3
0
        // GET: /Project/Create
        public ActionResult Create()
        {
            // ComboBox
            ViewData["ProjectStatusID"] = new SelectList(Project_ProjectStatusData.List(), "ProjectStatusID", "ProjectStatusName");
            ViewData["ClientID"]        = new SelectList(Project_ClientData.List(), "ClientID", "ClientName");
            ViewData["ArchitectID"]     = new SelectList(Project_ArchitectData.List(), "ArchitectID", "ArchitectName");
            ViewData["CompanyID"]       = new SelectList(Project_CompanyData.List(), "CompanyID", "CompanyName");

            return(View());
        }
Beispiel #4
0
        public ActionResult Create([Bind(Include =
                                             "ProjectName"
                                             + "," + "BillingName"
                                             + "," + "Description"
                                             + "," + "Location"
                                             + "," + "StartDate"
                                             + "," + "EndDate"
                                             + "," + "ProjectStatusID"
                                             + "," + "ClientID"
                                             + "," + "ArchitectID"
                                             + "," + "CompanyID"
                                             + "," + "AddUserID"
                                             + "," + "AddDate"
                                             + "," + "ArchiveUserID"
                                             + "," + "ArchiveDate"
                                         )] Project Project)
        {
            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = ProjectData.Add(Project);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Insert");
                }
            }
            // ComboBox
            ViewData["ProjectStatusID"] = new SelectList(Project_ProjectStatusData.List(), "ProjectStatusID", "ProjectStatusName", Project.ProjectStatusID);
            ViewData["ClientID"]        = new SelectList(Project_ClientData.List(), "ClientID", "ClientName", Project.ClientID);
            ViewData["ArchitectID"]     = new SelectList(Project_ArchitectData.List(), "ArchitectID", "ArchitectName", Project.ArchitectID);
            ViewData["CompanyID"]       = new SelectList(Project_CompanyData.List(), "CompanyID", "CompanyName", Project.CompanyID);

            return(View(Project));
        }