Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            TQM_Details tQM_Details = db.TQM_Details.Find(id);

            db.TQM_Details.Remove(tQM_Details);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #2
0
        public ActionResult Create([Bind(Include = "SerialNo,EmpNo,EmpName,Dept,Idea,KPI_Dept, KPI,file,Status,TransactDate")] TQM_Details tQM_Details, HttpPostedFileBase file)
        {
            //System.Diagnostics.Debug.WriteLine(Request.Form);
            //Response.Write(Request.Form);
            if (ModelState.IsValid)
            {
                if (file == null)
                {
                    var Html = "<script> alert('" + file + " Did not upload.'); window.location.href = 'Create'</script> ";
                    return(Content(Html));
                }
                else if (file.ContentLength > 0)
                {
                    int      MaxContentLength      = 1024 * 1024 * 3; //3 MB
                    string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".pdf" };

                    if (!AllowedFileExtensions.Contains(file.FileName.Substring(file.FileName.LastIndexOf('.'))))
                    {
                        ModelState.AddModelError("File", "Please file of type: " + string.Join(", ", AllowedFileExtensions));
                    }

                    else if (file.ContentLength > MaxContentLength)
                    {
                        ModelState.AddModelError("File", "Your file is too large, maximum allowed size is: " + MaxContentLength + " MB");
                    }
                    else
                    {
                        //TO:DO
                        var fileName = Path.GetFileName(file.FileName);
                        var path     = Path.Combine(Server.MapPath("~/SynergyModels"), fileName);
                        file.SaveAs(path);
                        ModelState.Clear();
                        ViewBag.Message = "File uploaded successfully";

                        tQM_Details.Status       = "PreDH Approval";
                        tQM_Details.TransactDate = DateTime.Now;
                        tQM_Details.SynergyModel = file.FileName;
                        db.TQM_Details.Add(tQM_Details);

                        try
                        {
                            db.SaveChanges();
                            var Html = "<script> alert('" + Request.Form["SerialNo"] + " Registered Successfully.'); window.location.href = 'Index'</script> ";
                            return(Content(Html));
                        }
                        catch (Exception e)
                        {
                            var Html = "<script> alert('" + e.Message + " Please Try Again.'); window.location.href = 'Create'</script> ";
                            return(Content(Html));
                        }
                    }
                }

                return(RedirectToAction("Index"));
            }
            return(View());
        }
Example #3
0
        public ActionResult ApprovalDetail()
        {
            //System.Diagnostics.Debug.WriteLine(Request.Form);
            if (ModelState.IsValid)
            {
                string status = Request.Form["Status"];

                if (status == "2")
                {
                    TQM_Approval tqm_Approval = new TQM_Approval();

                    tqm_Approval.ApprovalStatus   = "A";
                    tqm_Approval.TQMID            = Int32.Parse(Request.Form["tqmID"]);
                    tqm_Approval.EmpNo            = Int32.Parse(Request.Form["empNo"]);
                    tqm_Approval.ApprovalComment  = Request.Form["approvalComment"];
                    tqm_Approval.ApprovalDatetime = DateTime.Now;
                    tqm_Approval.ApprovalStep     = '2';

                    TQM_Details tQM_Details = db.TQM_Details.Find(Int32.Parse(Request.Form["tqmID"]));

                    tQM_Details.Status = "3";

                    db.Entry(tQM_Details).State = EntityState.Modified;

                    db.TQM_Approval.Add(tqm_Approval);
                    db.SaveChanges();



                    return(RedirectToAction("Index"));
                }
                else
                {
                    TQM_Approval tqm_Approval = new TQM_Approval();

                    tqm_Approval.ApprovalStatus   = "A";
                    tqm_Approval.TQMID            = Int32.Parse(Request.Form["tqmID"]);
                    tqm_Approval.EmpNo            = Int32.Parse(Request.Form["empNo"]);
                    tqm_Approval.ApprovalComment  = Request.Form["approvalComment"];
                    tqm_Approval.ApprovalDatetime = DateTime.Now;
                    tqm_Approval.ApprovalStep     = '2';

                    TQM_Details tQM_Details = db.TQM_Details.Find(Int32.Parse(Request.Form["tqmID"]));

                    tQM_Details.Status = "7";

                    db.Entry(tQM_Details).State = EntityState.Modified;

                    db.TQM_Approval.Add(tqm_Approval);
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }
            }

            return(View());
        }
Example #4
0
 public ActionResult Edit([Bind(Include = "AutoID,SerialNo,EmpNo,EmpName,KPI_Dept,Dept,Idea,KPI,SynergyModel,Status,TransactDate,FacilitatorID")] TQM_Details tQM_Details)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tQM_Details).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tQM_Details));
 }
Example #5
0
        public ActionResult Create([Bind(Include = "AutoID,SerialNo,EmpNo,EmpName,Dept,Idea,KPI_Dept,KPI,SynergyModel,Status,TransactDate")] TQM_Details tQM_Details)
        {
            if (ModelState.IsValid)
            {
                db.TQM_Details.Add(tQM_Details);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tQM_Details));
        }
Example #6
0
        // GET: StorySubmit/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TQM_Details tQM_Details = db.TQM_Details.Find(id);

            if (tQM_Details == null)
            {
                return(HttpNotFound());
            }
            return(View(tQM_Details));
        }
Example #7
0
        public ActionResult Create([Bind(Include = "TQMID,Business_Case,Opportunity,Risk_Assessment,Goal,Scope,MethodologyID,CurrentStep")] Project_Charter project_Charter)
        {
            ViewBag.MethodologyID = new SelectList(db.TQM_Methodology, "AutoID", "MethodologyDescription");

            ViewBag.FinanceName = new SelectList(db.TQM_Officials.Where(x => x.RoleID == 1), "EmpName", "EmpName");

            ViewBag.EmployeeName = new SelectList(eleave.v_eLeave_EmployeeDetails, "empFullName", "empFullName");

            ViewBag.ChampionSelection = new SelectList(eleave.v_eLeave_EmployeeDetails, "empFullName", "empFullName");

            System.Diagnostics.Debug.WriteLine(Request.Form["FinanceName"]);

            project_Charter.Risk_Assessment = Request.Form["riskAssessment"];

            project_Charter.MethodologyID = Int32.Parse(Request.Form["projectMethod"]);

            if (ModelState.IsValid)
            {
                string[] stepList      = Request.Form.GetValues("stepNo");
                string[] dateStartList = Request.Form.GetValues("dateStart");
                string[] dateEndList   = Request.Form.GetValues("dateEnd");

                int i = 0;

                foreach (var row in stepList)
                {
                    var step  = stepList[i];
                    var sDate = dateStartList[i];
                    var eDate = dateEndList[i];

                    TQM_Project_Plan project_plan = new TQM_Project_Plan();
                    project_plan.TQMID             = Int32.Parse(Request.Form["TQMID"]);
                    project_plan.MethodologyStepID = Int32.Parse(step);
                    project_plan.PlanStart         = Convert.ToDateTime(sDate);
                    project_plan.PlanEnd           = Convert.ToDateTime(eDate);
                    db.TQM_Project_Plan.Add(project_plan);


                    i++;
                }

                db.Project_Charter.Add(project_Charter);


                string[] memberName  = Request.Form.GetValues("memberName");
                string[] memberID    = Request.Form.GetValues("memberID");
                string[] memberEmail = Request.Form.GetValues("memberEmail");

                int x = 0;

                foreach (var row in stepList)
                {
                    var mName  = memberName[x];
                    var mID    = memberID[x];
                    var mEmail = memberEmail[x];

                    TQM_Member tqm_member = new TQM_Member();
                    tqm_member.TQMID   = Int32.Parse(Request.Form["TQMID"]);
                    tqm_member.EmpName = mName;
                    tqm_member.EmpNo   = Int32.Parse(mID);
                    tqm_member.Email   = mEmail;
                    tqm_member.RoleID  = 7;
                    db.TQM_Member.Add(tqm_member);

                    x++;
                }
                string sponsorDropOptVal = Request.Form["sponsorDropOpt"];

                if (sponsorDropOptVal == "1")
                {
                    sponsorName = Request.Form["sponsorEmpNameDrop"];
                }
                else
                {
                    sponsorName = Request.Form["sponsorEmpName"];
                }

                TQM_Member tqm_member_sponsor = new TQM_Member();
                tqm_member_sponsor.TQMID   = Int32.Parse(Request.Form["TQMID"]);
                tqm_member_sponsor.EmpName = sponsorName;
                tqm_member_sponsor.EmpNo   = Int32.Parse(Request.Form["sponsorEmpID"]);
                tqm_member_sponsor.Email   = Request.Form["sponsorEmail"];
                tqm_member_sponsor.RoleID  = 2;
                db.TQM_Member.Add(tqm_member_sponsor);



                TQM_Member tqm_member_champion = new TQM_Member();
                tqm_member_champion.TQMID   = Int32.Parse(Request.Form["TQMID"]);
                tqm_member_champion.EmpName = Request.Form["ChampionSelection"];
                tqm_member_champion.EmpNo   = Int32.Parse(Request.Form["championEmpID"]);
                tqm_member_champion.Email   = Request.Form["championEmail"];
                tqm_member_champion.RoleID  = 4;
                db.TQM_Member.Add(tqm_member_champion);

                TQM_Member tqm_member_finance = new TQM_Member();
                tqm_member_finance.TQMID   = Int32.Parse(Request.Form["TQMID"]);
                tqm_member_finance.EmpName = Request.Form["FinanceEmail"];
                tqm_member_finance.EmpNo   = Int32.Parse(Request.Form["financeEmpID"]);
                tqm_member_finance.Email   = Request.Form["financeEmail"];
                tqm_member_finance.RoleID  = 1;
                db.TQM_Member.Add(tqm_member_finance);

                TQM_Member tqm_member_leader = new TQM_Member();
                tqm_member_leader.TQMID   = Int32.Parse(Request.Form["TQMID"]);
                tqm_member_leader.EmpName = Request.Form["leaderName"];
                tqm_member_leader.EmpNo   = Int32.Parse(Request.Form["leaderEmpID"]);
                tqm_member_leader.Email   = Request.Form["leaderEmail"];
                tqm_member_leader.RoleID  = 6;
                db.TQM_Member.Add(tqm_member_leader);


                TQM_Details tqm_details_edit = db.TQM_Details.Find(Int32.Parse(Request.Form["TQMID"]));
                tqm_details_edit.Status          = "4";
                db.Entry(tqm_details_edit).State = EntityState.Modified;



                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(project_Charter));
        }