Exemplo n.º 1
0
        public ActionResult InitIndividualSavingData()
        {
            using (FATContainer dataContainer = new FATContainer())
            {
                int             tchRoutineID = Convert.ToInt32(RouteData.Values["tchRoutineID"]);
                TeachingRoutine routine      = SharedCasePool.GetCasePool().GetRoutine(tchRoutineID);

                //all tags: DWHQ_Deposit DWHQ_Withdraw DWHQ_Interest DWHQ_Clear DWZZ_Deposit DWZZ_Withdraw DWLZ_Deposit DWLZ_Withdraw DWZL_Deposit DWZL_Withdraw DWZL_Interest DWTI_Deposit DWTI_Interest DWTI_Withdraw
                //Section controls which section should be displayed and filled
                ViewBag.Section = routine.RelTmpRoutine.RoutineTag.Split('_')[1];

                IndividualSaving info = dataContainer.IndividualSaving.FirstOrDefault(item => (item.TchRoutineID == tchRoutineID));
                if (info == null)
                {
                    info = dataContainer.IndividualSaving.Create();
                    info.TchRoutineID      = tchRoutineID;
                    info.AccountCreateTime = DateTime.Now;
                    info.DepositTime       = DateTime.Now;
                    info.WithdrawTime      = DateTime.Now;
                    info.InterestTime      = DateTime.Now;
                    dataContainer.IndividualSaving.Add(info);
                    dataContainer.SaveChanges();
                }
                return(View("IndividualSaving", info));
            }
        }
Exemplo n.º 2
0
        public ActionResult StartRoutine(int teachingRoutineID)
        {
            DateTime currDate   = DateTime.Now.Date;
            int      currUserID = CurrentUser.GetUserID();

            using (FATContainer dataContainer = new FATContainer())
            {
                TeachingRoutine tchRoutine = SharedCasePool.GetCasePool().GetRoutine(teachingRoutineID);
                TeachingNode    firstNode  = tchRoutine.NodeList[tchRoutine.NodeList.Keys[0]];
                StudentActivity activity   = dataContainer.StudentActivity.FirstOrDefault(act => (act.UserID == currUserID) && (act.TimeMark >= currDate) && (act.TchRoutineID == teachingRoutineID));
                if (activity == null)
                {
                    activity = dataContainer.StudentActivity.Create();
                }
                activity.TchNodeID    = firstNode.Row_ID;
                activity.IsFinished   = 0;
                activity.TchRoutineID = teachingRoutineID;
                activity.UserID       = CurrentUser.GetUserID();
                activity.TimeMark     = DateTime.Now.Date;
                if (activity.Row_ID == 0)
                {
                    dataContainer.StudentActivity.Add(activity);
                    dataContainer.SaveChanges();
                }
                else
                {
                    dataContainer.Entry <StudentActivity>(activity).CurrentValues.SetValues(activity);
                    dataContainer.SaveChanges();
                }

                JsonResult result = new JsonResult();
                result.Data = string.Format("{0}/{1}/{2}", firstNode.NodeType, firstNode.NodeTag, firstNode.Row_ID);
                return(result);
            }
        }
Exemplo n.º 3
0
        public ActionResult ListStudiedRoutine()
        {
            using (FATContainer dataContainer = new FATContainer())
            {
                JsonResult             result       = new JsonResult();
                DateTime               currDate     = DateTime.Now.Date;
                List <StudentActivity> activityList = dataContainer.StudentActivity.Where(act => act.TimeMark >= currDate).OrderBy(act => act.IsFinished).ToList();
                SharedCasePool         casePool     = SharedCasePool.GetCasePool();
                foreach (StudentActivity activity in activityList)
                {
                    TeachingRoutine routine = casePool.GetRoutine(activity.TchRoutineID);
                    if (routine == null)
                    {
                        result.Data = CommFunctions.WrapClientGridData(new List <StudentActivity>());
                        return(result);
                    }
                    activity.CaseName       = routine.CaseName;
                    activity.TmpRoutineName = routine.RelTmpRoutine.RoutineName;

                    if (activity.TchNodeID == -1)
                    {
                        activity.TmpNodeName = "(已完成)";
                    }
                    else
                    {
                        activity.TmpNodeName = routine.NodeList[activity.TchNodeID].RelTmpNode.NodeName;
                        activity.NodeType    = routine.NodeList[activity.TchNodeID].RelTmpNode.NodeType;
                        activity.NodeTag     = routine.NodeList[activity.TchNodeID].RelTmpNode.Tag;
                    }
                }
                activityList.Clear();
                result.Data = CommFunctions.WrapClientGridData(activityList);
                return(result);
            }
        }
Exemplo n.º 4
0
        public ActionResult LoadSubNode(int teachingRoutineID)
        {
            TeachingRoutine routine = SharedCasePool.GetCasePool().GetRoutine(teachingRoutineID);
            JsonResult      result  = new JsonResult();

            result.Data = CommFunctions.WrapClientGridData(routine.NodeList.Values.OrderBy(node => node.Index).ToList());
            return(result);
        }
Exemplo n.º 5
0
        public ActionResult AppendCase(TeachingRoutine routine)
        {
            using (FATContainer dataContainer = new FATContainer())
            {
                dataContainer.TeachingRoutine.Add(routine);
                dataContainer.SaveChanges();
            }
            JsonResult result = new JsonResult();

            result.Data = routine;
            return(result);
        }
Exemplo n.º 6
0
        public ActionResult SubjectFiller()
        {
            int             tchRoutineID = Convert.ToInt32(RouteData.Values["rid"]);
            int             tchNodeID    = Convert.ToInt32(RouteData.Values["nid"]);
            TeachingRoutine routine      = SharedCasePool.GetCasePool().GetRoutine(tchRoutineID);

            using (FATContainer dataContainer = new FATContainer())
            {
                List <SubjectItem> subjectList = dataContainer.SubjectItem.Where(s => s.TchNodeID == tchNodeID && s.TchRoutineID == tchRoutineID).OrderBy(s => s.SubjectOrient).ToList();
                ViewBag.ResourceFile = "T1_DebitTransferCheck_S12";
                return(View(subjectList));
            }
        }
Exemplo n.º 7
0
 public ActionResult Guide()
 {
     using (FATContainer dataContainer = new FATContainer())
     {
         TeachingNode    node       = dataContainer.TeachingNode.Find(Convert.ToInt32(RouteData.Values["id"]));
         TeachingRoutine tchRoutine = SharedCasePool.GetCasePool().GetRoutine(node.RoutineID);
         ViewBag.CurrGroup    = tchRoutine.NodeList[node.Row_ID].GroupIdx;
         ViewBag.TchNodeID    = node.Row_ID;
         ViewBag.CaseName     = tchRoutine.CaseName;
         ViewBag.RoutineIntro = tchRoutine.GroupList[tchRoutine.NodeList[node.Row_ID].GroupIdx].RoutineIntro;
         return(View("RoutineStepProgress", tchRoutine));
     }
 }
Exemplo n.º 8
0
 public ActionResult GeneralLedger()
 {
     using (FATContainer dataContainer = new FATContainer())
     {
         TeachingNode         node    = dataContainer.TeachingNode.Find(Convert.ToInt32(RouteData.Values["id"]));
         List <GeneralLedger> glList  = dataContainer.GeneralLedger.Where(info => (info.TchNodeID == node.Row_ID) && (info.TchRoutineID == node.RoutineID)).ToList();
         TeachingRoutine      routine = SharedCasePool.GetCasePool().GetRoutine(node.RoutineID);
         ViewBag.RoutineName = routine.RelTmpRoutine.RoutineName;
         node             = routine.FindNode(node.Row_ID);
         ViewBag.NodeName = node.NodeName;
         ViewData[ConstDefine.ViewData_CaseText] = SharedCasePool.GetCasePool().GetRoutine(node.RoutineID).GroupList[node.GroupIdx].GroupText;
         return(View(glList));
     }
 }
Exemplo n.º 9
0
        public ActionResult UpdateCase(int tchRoutineID, string caseName, string caseText)
        {
            using (FATContainer dataContainer = new FATContainer())
            {
                TeachingRoutine cachedRoutine = SharedCasePool.GetCasePool().GetRoutine(tchRoutineID);
                cachedRoutine.CaseName = caseName;

                TeachingRoutine dbRoutine = dataContainer.TeachingRoutine.Find(tchRoutineID);
                dataContainer.Entry <TeachingRoutine>(dbRoutine).CurrentValues.SetValues(cachedRoutine);

                dataContainer.SaveChanges();
            }
            return(null);
        }
Exemplo n.º 10
0
        public ActionResult ChangeCaseStatus(bool isEnabled, int tchRoutineID)
        {
            using (FATContainer dataContainer = new FATContainer())
            {
                TeachingRoutine cachedRoutine = SharedCasePool.GetCasePool().GetRoutine(tchRoutineID);
                cachedRoutine.CurrStatus = Convert.ToInt16(isEnabled ? 1 : 0);

                TeachingRoutine dbRoutine = dataContainer.TeachingRoutine.Find(tchRoutineID);
                dbRoutine.CurrStatus = cachedRoutine.CurrStatus;

                dataContainer.SaveChanges();
            }
            return(null);
        }
Exemplo n.º 11
0
        public TeachingNode NavigateToNextNode(int currTchRoutineID, int currTchNodeID)
        {
            TeachingRoutine tchRoutine = GetRoutine(currTchRoutineID);
            TeachingNode    currNode   = tchRoutine.NodeList[currTchNodeID];
            int             nodeIndex  = tchRoutine.NodeList.Keys.IndexOf(currNode.Row_ID);

            if (nodeIndex == tchRoutine.NodeList.Count - 1)
            {
                return(null);
            }
            else
            {
                return(tchRoutine.NodeList[nodeIndex + 1]);
            }
        }
Exemplo n.º 12
0
 public ActionResult ResetRoutine(int activityID)
 {
     using (FATContainer dataContainer = new FATContainer())
     {
         StudentActivity activity   = dataContainer.StudentActivity.First(act => act.Row_ID == activityID);
         TeachingRoutine tchRoutine = SharedCasePool.GetCasePool().GetRoutine(activity.TchRoutineID);
         activity.IsFinished = 0;
         activity.TchNodeID  = tchRoutine.NodeList[tchRoutine.NodeList.Keys[0]].Row_ID;
         dataContainer.SaveChanges();
         JsonResult   result    = new JsonResult();
         TeachingNode firstNode = tchRoutine.NodeList[tchRoutine.NodeList.Keys[0]];
         result.Data = string.Format("{0}/{1}/{2}", firstNode.NodeType, firstNode.NodeTag, firstNode.Row_ID);
         return(result);
     }
 }
Exemplo n.º 13
0
 public ActionResult BankDraft()
 {
     using (FATContainer dataContainer = new FATContainer())
     {
         int             tchRoutineID = dataContainer.TeachingNode.Find(Convert.ToInt32(RouteData.Values["id"])).RoutineID;
         TeachingRoutine routine      = SharedCasePool.GetCasePool().GetRoutine(tchRoutineID);
         TeachingNode    node         = routine.NodeList[Convert.ToInt32(RouteData.Values["id"])];
         BankDraft       tcInfo       = dataContainer.BankDraft.FirstOrDefault(info => (info.TchRoutineID == node.RoutineID));
         ViewData[ConstDefine.ViewData_CaseText] = SharedCasePool.GetCasePool().GetRoutine(node.RoutineID).GroupList[node.GroupIdx].GroupText;
         ViewBag.RoutineName = routine.RelTmpRoutine.RoutineName;
         ViewBag.NodeName    = node.RelTmpNode.NodeName;
         ViewBag.TchNodeID   = node.Row_ID;
         return(View("BankDraft_" + node.Index, tcInfo));
     }
 }
Exemplo n.º 14
0
 public ActionResult GetNextNode(int teachingRoutineID, int teachingNodeID)
 {
     using (FATContainer dataContainer = new FATContainer())
     {
         TeachingNode    nextNode = SharedCasePool.GetCasePool().NavigateToNextNode(teachingRoutineID, teachingNodeID);
         StudentActivity activity = dataContainer.StudentActivity.FirstOrDefault(act => act.UserID == CurrentUser.GetUserID() && act.TimeMark == DateTime.Now.Date && act.TchRoutineID == teachingRoutineID);
         if (activity == null)
         {
             activity = dataContainer.StudentActivity.Create();
         }
         JsonResult result = new JsonResult();
         if (nextNode == null)
         {
             CurrentUser.SetLastFinishedRoutineID(teachingRoutineID);
             result.Data = "/Teachings/TeachingInit/SelectT1Case";
             if (activity.Row_ID == 0)
             {
                 activity.TchNodeID    = -1;
                 activity.IsFinished   = 1;
                 activity.TchRoutineID = teachingRoutineID;
                 activity.UserID       = CurrentUser.GetUserID();
                 activity.TimeMark     = DateTime.Now.Date;
                 dataContainer.StudentActivity.Add(activity);
                 dataContainer.SaveChanges();
             }
             else
             {
                 activity.TchNodeID  = -1;
                 activity.IsFinished = 1;
                 dataContainer.Entry <StudentActivity>(activity).CurrentValues.SetValues(activity);
                 dataContainer.SaveChanges();
             }
         }
         else
         {
             TeachingRoutine routine = SharedCasePool.GetCasePool().GetRoutine(teachingNodeID);
             if (routine.NodeList.Keys.IndexOf(activity.TchNodeID) < routine.NodeList.Keys.IndexOf(nextNode.Row_ID))
             {
                 activity.TchNodeID  = nextNode.Row_ID;
                 activity.IsFinished = 0;
                 //dataContainer.Entry<StudentActivity>(activity).CurrentValues.SetValues(activity);
                 dataContainer.SaveChanges();
             }
             result.Data = string.Format("{0}/{1}/{2}", nextNode.NodeType, nextNode.NodeTag, nextNode.Row_ID);
         }
         return(result);
     }
 }
Exemplo n.º 15
0
        public ActionResult UpdateCase(int tchRoutineID, string caseName)
        {
            using (FATContainer dataContainer = new FATContainer())
            {
                TeachingRoutine cachedRoutine = SharedCasePool.GetCasePool().GetRoutine(tchRoutineID);
                cachedRoutine.CaseName = caseName;

                TeachingRoutine dbRoutine = dataContainer.TeachingRoutine.Find(tchRoutineID);
                dataContainer.Entry <TeachingRoutine>(dbRoutine).CurrentValues.SetValues(cachedRoutine);

                dataContainer.SaveChanges();
            }
            SharedCasePool.GetCasePool().ReloadRoutine(tchRoutineID);
            JsonResult result = new JsonResult();

            result.Data = string.Empty;
            return(result);
        }
Exemplo n.º 16
0
        public ActionResult InterestVoucher()
        {
            using (FATContainer dataContainer = new FATContainer())
            {
                int              tchRoutineID = dataContainer.TeachingNode.Find(Convert.ToInt32(RouteData.Values["id"])).RoutineID;
                TeachingRoutine  routine      = SharedCasePool.GetCasePool().GetRoutine(tchRoutineID);
                TeachingNode     node         = routine.NodeList[Convert.ToInt32(RouteData.Values["id"])];
                IndividualSaving targetObj    = dataContainer.IndividualSaving.FirstOrDefault(info => (info.TchRoutineID == node.RoutineID));
                ViewData[ConstDefine.ViewData_CaseText] = SharedCasePool.GetCasePool().GetRoutine(node.RoutineID).GroupList[node.GroupIdx].GroupText;
                ViewBag.RoutineName  = routine.RelTmpRoutine.RoutineName;
                ViewBag.NodeName     = node.RelTmpNode.NodeName;
                ViewBag.TchNodeID    = node.Row_ID;
                ViewBag.TchRoutineID = routine.Row_ID;

                Type       type   = Type.GetType("FATS.BusinessObject.Converters.InterestVoucherConverter");
                MethodInfo method = type.GetMethod(routine.RelTmpRoutine.RoutineTag, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);

                V_InterestVoucher modalInfo = (V_InterestVoucher)method.Invoke(null, new Object[] { targetObj });

                return(View("IndividualSaving_Interest", modalInfo));
            }
        }
Exemplo n.º 17
0
        public TeachingRoutine GetRoutine(int routineID)
        {
            if (TeachingRoutinePool.ContainsKey(routineID))
            {
                return(TeachingRoutinePool[routineID]);
            }
            using (FATContainer dbContainer = new FATContainer())
            {
                TeachingRoutine resultRoutine = dbContainer.TeachingRoutine.Find(routineID);

                if (resultRoutine == null)
                {
                    return(null);
                }

                if (TeachingRoutinePool.ContainsKey(routineID))
                {
                    return(TeachingRoutinePool[routineID]);
                }
                else
                {
                    TeachingRoutinePool.Add(routineID, resultRoutine);
                }

                if (resultRoutine.RelTmpRoutine == null)
                {
                    Console.WriteLine("RelatedTemplateRoutine loaded from db");
                    resultRoutine.RelTmpRoutine = dbContainer.TemplateRoutine.FirstOrDefault(routine => routine.Row_ID == resultRoutine.TmpRoutineID);
                    var nodeList = from node in dbContainer.TemplateNode
                                   where node.RoutineID == resultRoutine.RelTmpRoutine.Row_ID
                                   select node;
                    foreach (TemplateNode node in nodeList)
                    {
                        resultRoutine.RelTmpRoutine.NodeDict.Add(node.Row_ID, node);
                    }
                }

                if ((resultRoutine.RelTmpRoutine.RoutineType == ConstDefine.RoutineType_Teaching1) && (resultRoutine.NodeList == null))
                {
                    resultRoutine.NodeList = new SortedList <int, TeachingNode>();
                    Console.WriteLine("Load sub teaching node from db");
                    var nodeList = from node in dbContainer.TeachingNode
                                   orderby node.Row_ID
                                   where node.RoutineID == resultRoutine.Row_ID
                                   select node;
                    foreach (TeachingNode node in nodeList)
                    {
                        resultRoutine.NodeList.Add(node.Row_ID, node);
                        node.RelTmpNode = resultRoutine.RelTmpRoutine.NodeDict[node.TmpNodeID];
                    }
                }
                if (resultRoutine.GroupList == null)
                {
                    resultRoutine.GroupList = new SortedList <int, RoutineGroup>();
                    var groupList = from groupVar in dbContainer.RoutineGroup
                                    orderby groupVar.GroupIdx
                                    where groupVar.TchRoutineID == resultRoutine.Row_ID
                                    select groupVar;
                    foreach (RoutineGroup group in groupList)
                    {
                        resultRoutine.GroupList.Add(group.GroupIdx, group);
                    }
                }
                return(resultRoutine);
            }
        }
Exemplo n.º 18
0
        public ActionResult GetNavigationContext(int teachingRoutineID, int teachingNodeID)
        {
            using (FATContainer dataContainer = new FATContainer())
            {
                TeachingRoutine routine      = SharedCasePool.GetCasePool().GetRoutine(teachingRoutineID);
                int             currNodeIdx  = routine.NodeList.Keys.IndexOf(teachingNodeID);
                int             maxNodeCount = routine.NodeList.Count;
                DateTime        currDate     = DateTime.Now.Date;
                int             currUserID   = CurrentUser.GetUserID();
                StudentActivity activity     = dataContainer.StudentActivity.FirstOrDefault(act => act.UserID == currUserID && act.TimeMark >= currDate && act.TchRoutineID == teachingRoutineID);
                ClientContext   context      = new ClientContext();
                context.IsTeacher = CurrentUser.GetUserInfo().IsTeacher;
                if (currNodeIdx == 0)
                {
                    context.PrevTchNodeID   = -1;
                    context.PrevTchNodeTag  = string.Empty;
                    context.PrevTchNodeType = string.Empty;
                }
                else
                {
                    TeachingNode prevNode = routine.NodeList[routine.NodeList.Keys[currNodeIdx - 1]];
                    context.PrevTchNodeID  = prevNode.Row_ID;
                    context.PrevTchNodeTag = prevNode.NodeTag;
                    context.PrevTchNodeTag = prevNode.NodeType;
                }
                if (currNodeIdx == maxNodeCount - 1)
                {
                    context.NextTchNodeID   = -1;
                    context.NextTchNodeTag  = string.Empty;
                    context.NextTchNodeType = string.Empty;
                }
                else
                {
                    TeachingNode nextNode = routine.NodeList[routine.NodeList.Keys[currNodeIdx + 1]];
                    context.NextTchNodeID   = nextNode.Row_ID;
                    context.NextTchNodeTag  = nextNode.NodeTag;
                    context.NextTchNodeType = nextNode.NodeType;
                }
                context.TchRoutineID = routine.Row_ID;

                //normally it won't occur
                //i wonder if the code is necessary, just the protection for the unexpected bug?
                if (activity == null)
                {
                    context.IsFinished    = 0;
                    activity              = dataContainer.StudentActivity.Create();
                    activity.TchNodeID    = teachingNodeID;
                    activity.IsFinished   = 0;
                    activity.TchRoutineID = teachingRoutineID;
                    activity.UserID       = CurrentUser.GetUserID();
                    activity.TimeMark     = DateTime.Now.Date;
                    dataContainer.StudentActivity.Add(activity);
                    dataContainer.SaveChanges();
                }
                else
                {
                    if (activity.IsFinished == 1)
                    {
                        context.IsFinished = 1;
                    }
                    else
                    {
                        int currActivityIdx = routine.NodeList.Keys.IndexOf(activity.TchNodeID);
                        context.IsFinished = (currNodeIdx < currActivityIdx) ? 1 : 0;
                        if (currNodeIdx > currActivityIdx)
                        {
                            activity.TchNodeID = routine.NodeList[teachingNodeID].Row_ID;
                            dataContainer.SaveChanges();
                        }
                    }
                }

                JsonResult result = new JsonResult();
                result.Data = context;
                return(result);
            }
        }
Exemplo n.º 19
0
        public ActionResult SelectNode()
        {
            TeachingRoutine routine = SharedCasePool.GetCasePool().GetRoutine(Convert.ToInt32(RouteData.Values["id"]));

            return(View(routine));
        }
Exemplo n.º 20
0
        public ActionResult AppendCase(TeachingRoutine routine)
        {
            using (FATContainer dataContainer = new FATContainer())
            {
                dataContainer.TeachingRoutine.Add(routine);
                dataContainer.SaveChanges();

                var tempateNodeList = from node in dataContainer.TemplateNode
                                      where node.RoutineID == routine.TmpRoutineID
                                      orderby node.NodeIndex
                                      select node;
                List <TeachingNode> tchNodeList = new List <TeachingNode>();
                foreach (TemplateNode tmpNode in tempateNodeList)
                {
                    TeachingNode newNode = new TeachingNode()
                    {
                        CurrStatus = 0, RelTmpNode = tmpNode, RoutineID = routine.Row_ID, TmpNodeID = tmpNode.Row_ID
                    };
                    tchNodeList.Add(newNode);
                    dataContainer.TeachingNode.Add(newNode);
                }
                dataContainer.SaveChanges();

                string currPhaseName = string.Empty;
                foreach (TeachingNode tchNode in tchNodeList)
                {
                    switch (tchNode.NodeTag)
                    {
                    case "Guide":
                    {
                        currPhaseName = tchNode.NodeName;
                        RoutineGroup group = dataContainer.RoutineGroup.Create();
                        group.GroupText    = string.Empty;
                        group.GroupIdx     = tchNode.GroupIdx;
                        group.TchRoutineID = routine.Row_ID;
                        group.RoutineDesc  = tchNode.GroupIdx + "." + currPhaseName;
                        group.RoutineIntro = string.Empty;
                        dataContainer.RoutineGroup.Add(group);
                        break;
                    }

                        #region common node
                    case "DetailedLedger":
                    {
                        for (int i = 0; i <= tchNode.RelTmpNode.RequireRecord - 1; i++)
                        {
                            DetailedLedger info = dataContainer.DetailedLedger.Create();
                            info.TchNodeID    = tchNode.Row_ID;
                            info.TchRoutineID = routine.Row_ID;
                            info.RoutineDesc  = tchNode.GroupIdx + "." + currPhaseName;
                            info.TimeMark     = DateTime.Now;
                            dataContainer.DetailedLedger.Add(info);
                        }
                        break;
                    }

                    case "CashJournal":
                    {
                        for (int i = 0; i <= tchNode.RelTmpNode.RequireRecord - 1; i++)
                        {
                            CashJournal info = dataContainer.CashJournal.Create();
                            info.TchNodeID    = tchNode.Row_ID;
                            info.TchRoutineID = routine.Row_ID;
                            info.RoutineDesc  = tchNode.GroupIdx + "." + currPhaseName;
                            info.TimeMark     = DateTime.Now;
                            dataContainer.CashJournal.Add(info);
                        }
                        break;
                    }

                    case "OuterSubject":
                    {
                        for (int i = 0; i <= tchNode.RelTmpNode.RequireRecord - 1; i++)
                        {
                            OuterSubject info = dataContainer.OuterSubject.Create();
                            info.TchNodeID    = tchNode.Row_ID;
                            info.TchRoutineID = routine.Row_ID;
                            info.RoutineDesc  = tchNode.GroupIdx + "." + currPhaseName;
                            info.TimeMark     = DateTime.Now;
                            dataContainer.OuterSubject.Add(info);
                        }
                        break;
                    }

                    case "CustomerLedger":
                    {
                        for (int i = 0; i <= tchNode.RelTmpNode.RequireRecord - 1; i++)
                        {
                            CustomerLedger info = dataContainer.CustomerLedger.Create();
                            info.TchNodeID    = tchNode.Row_ID;
                            info.TchRoutineID = routine.Row_ID;
                            info.RoutineDesc  = tchNode.GroupIdx + "." + currPhaseName;
                            info.TimeMark     = DateTime.Now;
                            info.BalanceTime  = DateTime.Now;
                            dataContainer.CustomerLedger.Add(info);
                        }
                        break;
                    }

                    case "GeneralLedger":
                    {
                        for (int i = 0; i <= tchNode.RelTmpNode.RequireRecord - 1; i++)
                        {
                            GeneralLedger info = dataContainer.GeneralLedger.Create();
                            info.TchNodeID    = tchNode.Row_ID;
                            info.TchRoutineID = routine.Row_ID;
                            info.RoutineDesc  = tchNode.GroupIdx + "." + currPhaseName;
                            info.TimeMark     = DateTime.Now;
                            dataContainer.GeneralLedger.Add(info);
                        }
                        break;
                    }

                    default:
                    {
                        if (tchNode.RelTmpNode.NodeType == "SpecialNode")
                        {
                            for (int i = 0; i <= tchNode.RelTmpNode.RequireRecord - 1; i++)
                            {
                                SubjectItem info = dataContainer.SubjectItem.Create();
                                info.TchNodeID    = tchNode.Row_ID;
                                info.TchRoutineID = routine.Row_ID;
                                info.RoutineDesc  = tchNode.GroupIdx + "." + currPhaseName;
                                dataContainer.SubjectItem.Add(info);
                            }
                        }
                        break;
                    }
                        #endregion
                        #region special node


                        #endregion
                    }
                }

                dataContainer.SaveChanges();
            }
            JsonResult result = new JsonResult();
            result.Data = routine;
            return(result);
        }
Exemplo n.º 21
0
        public ActionResult Edit()
        {
            TeachingRoutine routine = SharedCasePool.GetCasePool().GetRoutine(Convert.ToInt32(RouteData.Values["id"]));

            return(View("T1RoutineDetail", routine));
        }