public ActionResult GetSubProjectList(int projectId)
        {
            CSubproject2 cs2         = new CSubproject2();
            SelectList   subProjList = cs2.getSubProjects(projectId);

            ViewBag.subProjList = subProjList;
            return(PartialView("GetSubProjectList"));
        }
        public ActionResult AddEditTimeTrack2(int timeTrackRowID, int customerID, int projectID)
        {
            pdsTidRedLiveEntities db = new pdsTidRedLiveEntities();

            int userId = Convert.ToInt32(Session["userId"]);

            SelectList   custList    = null;
            SelectList   projList    = null;
            SelectList   subProjList = null;
            CTimeTrack   model       = new CTimeTrack();
            CSubproject2 cs2         = new CSubproject2();

            if (timeTrackRowID == 0)
            {
                model.timeTrackRowID = timeTrackRowID;
                model.tDate          = System.DateTime.Today;
                model.customerID     = customerID;
                //model.projectId = projectID;
                CTimeTrack ct = new CTimeTrack();
                custList = ct.getMyCustomers(userId);
                //projList = ctc.getMyCustProjects(userId, customerID);
                //subProjList = cs2.getSubProjects(0);
            }
            else
            {
                timeTrackRow ttr = db.timeTrackRow.FirstOrDefault(x => x.timeTrackRowID == timeTrackRowID);
                if (ttr != null)
                {
                    model.timeTrackHeadID = ttr.timeTrackHeadID;
                    model.customerID      = ttr.timeTrackHead.customerID;
                    model.tDate           = ttr.timeTrackHead.tDate;
                    model.userId          = ttr.timeTrackHead.userId;
                    model.timeTrackRowID  = ttr.timeTrackRowID;
                    model.subProjectID    = ttr.subProjectID;
                    model.hours           = ttr.hours;
                    model.regDate         = ttr.regDate;
                    model.note            = ttr.note;
                    model.projectId       = ttr.subProject2.projectID;
                    model.projectName     = ttr.subProject2.project.projectName;
                    model.customerName    = ttr.timeTrackHead.customer.custName;
                    model.timeTrackHeadID = ttr.timeTrackHeadID;
                }
                // First get the timeTrackHead

                /* custList = ctc.getMyCustomers(0, model.customerID);
                 * projList = ctc.getMyCustProjects(userId, ttr.timeTrackHead.customerID); */
            }
            ViewBag.custList    = custList;
            ViewBag.projList    = projList;
            subProjList         = cs2.getSubProjects(model.projectId);
            ViewBag.subProjList = subProjList;
            return(PartialView("AddEditTimeTrack", model));
        }
        public ActionResult AddEditTimeTrack(int timeTrackRowID, int customerID, int projectID)
        {
            pdsTidRedLiveEntities db    = new pdsTidRedLiveEntities();
            CTimeTrack            model = new CTimeTrack();
            int userId = Convert.ToInt32(Session["userId"]);

            if (timeTrackRowID == 0)
            {
                model.timeTrackRowID = 0;
                model.userId         = userId;
                model.customerID     = customerID;
                model.projectId      = projectID;
                model.tDate          = System.DateTime.Today;
                CTimeTrack ct = new CTimeTrack();
                ViewBag.custList = ct.getMyCustomers(userId);
                ViewBag.projList = ct.getMyCustProjects(userId, customerID);
                CSubproject2 cs2 = new CSubproject2();
                ViewBag.subProjList = cs2.getSubProjects(projectID);
                return(PartialView("AddTimeTrack", model));
            }
            else
            {
                timeTrackRow ttr = db.timeTrackRow.FirstOrDefault(x => x.timeTrackRowID == timeTrackRowID);
                if (ttr != null)
                {
                    model.tDate           = ttr.timeTrackHead.tDate;
                    model.subProjectID    = ttr.subProjectID;
                    model.hours           = ttr.hours;
                    model.note            = ttr.note;
                    model.projectName     = ttr.subProject2.project.projectName;
                    model.customerName    = ttr.timeTrackHead.customer.custName;
                    model.tDateStr        = ttr.timeTrackHead.tDate.ToShortDateString();
                    model.timeTrackHeadID = ttr.timeTrackHeadID;
                    model.customerID      = ttr.timeTrackHead.customerID;
                    CSubproject2 cs2 = new CSubproject2();
                    ViewBag.subProjList = cs2.getSubProjects(ttr.subProject2.projectID);
                }
            }
            return(PartialView("EditTimeTrack", model));
        }