Example #1
0
        public void SetUpdateValue(string updateRecordId)
        {
            _Action         = UpdateRecordAction.Update;
            _UpdateRecordID = updateRecordId;

            //DSResponse dsrsp = SmartSchool.Feature.QueryStudent.GetUpdateRecord(updateRecordId);
            DSResponse dsrsp   = QueryStudent.GetUpdateRecord(updateRecordId);
            XmlElement element = dsrsp.GetContent().GetElement("UpdateRecord");

            foreach (XmlNode node in element.ChildNodes)
            {
                if (node.Name != "ContextInfo")
                {
                    if (node.Name == "UpdateCode")
                    {
                        _UpdateCodeLoadedEvent.WaitOne();
                        foreach (UpdateRecordType type in new UpdateRecordType[] { UpdateRecordType.新生異動, UpdateRecordType.轉入異動, UpdateRecordType.學籍異動, UpdateRecordType.畢業異動 })
                        {
                            if (_UpdateCodeSynopsis.ContainsKey(type.ToString()) && _UpdateCodeSynopsis[type.ToString()].ContainsKey(node.InnerText))
                            {
                                Style = type;
                                break;
                            }
                        }
                        NewData.ChangeNewDataText(node.InnerText);
                    }
                    this.SetValue(node.Name, node.InnerText);
                }
                else
                {
                    if (node.SelectSingleNode("ContextInfo") != null)
                    {
                        foreach (XmlNode contextInfo in node.SelectSingleNode("ContextInfo").ChildNodes)
                        {
                            this.SetValue(contextInfo.Name, contextInfo.InnerText);
                        }
                    }
                }
            }

            //Log,紀錄修改前的資料
            foreach (XmlNode node in GetElement().ChildNodes)
            {
                beforeData.Add(node.Name, node.InnerText);
            }
        }
        public void SetUpdateValue(string updateRecordId)
        {
            _Action = UpdateRecordAction.Update;
            _UpdateRecordID = updateRecordId;

            DSResponse dsrsp = SmartSchool.Feature.QueryStudent.GetUpdateRecord(updateRecordId);
            XmlElement element = dsrsp.GetContent().GetElement("UpdateRecord");

            foreach (XmlNode node in element.ChildNodes)
            {
                if (node.Name != "ContextInfo")
                {
                    if (node.Name == "UpdateCode")
                    {
                        _UpdateCodeLoadedEvent.WaitOne();
                        foreach (UpdateRecordType type in new UpdateRecordType[] { UpdateRecordType.新生異動, UpdateRecordType.轉入異動, UpdateRecordType.學籍異動, UpdateRecordType.畢業異動 })
                        {
                            if (_UpdateCodeSynopsis.ContainsKey(type.ToString()) && _UpdateCodeSynopsis[type.ToString()].ContainsKey(node.InnerText))
                            {
                                Style = type;
                                break;
                            }
                        }
                        _newDataField.ChangeNewDataText(node.InnerText);
                    }
                    this.SetValue(node.Name, node.InnerText);
                }
                else
                {
                    if (node.SelectSingleNode("ContextInfo") != null)
                    {
                        foreach (XmlNode contextInfo in node.SelectSingleNode("ContextInfo").ChildNodes)
                        {
                            this.SetValue(contextInfo.Name, contextInfo.InnerText);
                        }
                    }
                }
            }

            //Log,紀錄修改前的資料
            foreach (XmlNode node in GetElement().ChildNodes)
            {
                beforeData.Add(node.Name, node.InnerText);
            }
        }
        public void SetDefaultValue(string studentid)
        {
            _Action = UpdateRecordAction.Insert;
            _StudentID = studentid;

            SetValue("UpdateDate", DateTime.Now.ToShortDateString());
            SHStudentRecord studentRec = SHStudent.SelectByID(studentid);

            #region 查學籍身分

            List<SHPermrecStatusMappingInfo> MappingInfos = SHPermrecStatusMapping.SelectyByStudentID(studentid);

            if (MappingInfos.Count>0)
            {
                string comment = "";

                foreach (SHPermrecStatusMappingInfo MappingInfo in MappingInfos)
                {
                    if (!string.IsNullOrEmpty(comment)) comment += ",";
                    comment += MappingInfo.Code;
                }

                SetValue("SpecialStatus", comment);
                SetValue("Comment",comment);
            }

            #endregion

            SetValue("Name", studentRec.Name);
            SetValue("Birthdate", K12.Data.DateTimeHelper.ToDisplayString(studentRec.Birthday));
            SetValue("Gender", studentRec.Gender);
            SetValue("IDNumber", studentRec.IDNumber);
            SetValue("StudentNumber", studentRec.StudentNumber);
            SetValue("GradeYear", studentRec.Status.ToString() == "延修" ? "延修生" : string.IsNullOrEmpty(studentRec.RefClassID) ? "" : K12.Data.Int.GetString(studentRec.Class.GradeYear));
            if(studentRec.Department != null )
                SetValue("Department", studentRec.Department.FullName.Contains(":") ? studentRec.Department.FullName.Split(':')[0] : studentRec.Department.FullName);
            DateTime lastADDate = DateTime.MinValue;
            string lastADNumber = "";
            string lastUpdateCode = "";

            foreach (SHUpdateRecordRecord var in SHUpdateRecord.SelectByStudentID(studentRec.ID))
            {
                DateTime d1;
                if (DateTime.TryParse(var.ADDate, out d1) && d1 > lastADDate)
                {
                    lastADDate = d1;
                    lastADNumber = var.ADNumber;
                    lastUpdateCode = var.UpdateCode;
                }
            }
            SetValue("LastADDate", lastADNumber == "" ? "" : lastADDate.ToShortDateString());
            SetValue("LastADNumber", lastADNumber);
            SetValue("LastUpdateCode", lastUpdateCode);

            Style = UpdateRecordType.學籍異動;

            //Log,紀錄修改前的資料
            foreach (XmlNode node in GetElement().ChildNodes)
            {
                beforeData.Add(node.Name, node.InnerText);
            }
        }
Example #4
0
        public void SetDefaultValue(string id)
        {
            _Action    = UpdateRecordAction.Insert;
            _StudentID = id;

            SetValue("UpdateDate", DateTime.Now.ToShortDateString());

            // -- 這段因沒有 accessHelper 之後再寫,先註解
            //AccessHelper accessHelper = new AccessHelper();
            //StudentRecord studentRec = accessHelper.StudentHelper.GetStudents(id)[0];
            //accessHelper.StudentHelper.FillUpdateRecord(studentRec);

            //#region 查學籍身分

            //SmartSchool.Customization.Data.SystemInformation.getField("SchoolConfig");
            //XmlElement config = SmartSchool.Customization.Data.SystemInformation.Fields["SchoolConfig"] as XmlElement;
            //XmlElement identityMapping = (XmlElement)config.SelectSingleNode("學籍身分對照表");
            //if (identityMapping != null)
            //{
            //    string comment = "";

            //    List<string> code_list = new List<string>();
            //    foreach (CategoryInfo info in studentRec.StudentCategorys)
            //    {
            //        foreach (XmlElement each_identity in identityMapping.SelectNodes("Identity[Tag/@FullName='" + info.FullName + "']"))
            //        {
            //            string each_name = each_identity.GetAttribute("Code");
            //            if (!code_list.Contains(each_name))
            //                code_list.Add(each_name);
            //        }
            //    }

            //    foreach (string each_code in code_list)
            //    {
            //        if (!string.IsNullOrEmpty(comment)) comment += ",";
            //        comment += each_code;
            //    }

            //    SetValue("Comment", comment);
            //}

            ////test
            ////SetValue("Comment", "1");

            //#endregion

            //SetValue("Name", studentRec.StudentName);
            //SetValue("Birthdate", studentRec.Birthday);
            //SetValue("Gender", studentRec.Gender);
            //SetValue("IDNumber", studentRec.IDNumber);
            //SetValue("StudentNumber", studentRec.StudentNumber);
            //SetValue("GradeYear", studentRec.Status == "延修" ? "延修生" : studentRec.RefClass == null ? "" : studentRec.RefClass.GradeYear);
            //SetValue("Department", studentRec.Department.Contains(":") ? studentRec.Department.Split(':')[0] : studentRec.Department);
            //DateTime lastADDate = DateTime.MinValue;
            //string lastADNumber = "";
            //string lastUpdateCode = "";

            //foreach (SmartSchool.Customization.Data.StudentExtension.UpdateRecordInfo var in studentRec.UpdateRecordList)
            //{
            //    DateTime d1;
            //    if (DateTime.TryParse(var.ADDate, out d1) && d1 > lastADDate)
            //    {
            //        lastADDate = d1;
            //        lastADNumber = var.ADNumber;
            //        lastUpdateCode = var.UpdateCode;
            //    }
            //}
            //SetValue("LastADDate", lastADNumber == "" ? "" : lastADDate.ToShortDateString());
            //SetValue("LastADNumber", lastADNumber);
            //SetValue("LastUpdateCode", lastUpdateCode);

            // ----


            //DSResponse dsrsp = SmartSchool.Feature.QueryStudent.GetDefaultUpdateRecordInfo(id);
            //SetValue("Name", dsrsp.GetContent().GetText("Student[@ID='" + id + "']/Name"));
            //SetValue("Birthdate", dsrsp.GetContent().GetText("Student[@ID='" + id + "']/Birthdate"));
            //SetValue("Gender", dsrsp.GetContent().GetText("Student[@ID='" + id + "']/Gender"));
            //SetValue("IDNumber", dsrsp.GetContent().GetText("Student[@ID='" + id + "']/IDNumber"));
            //SetValue("StudentNumber", dsrsp.GetContent().GetText("Student[@ID='" + id + "']/StudentNumber"));
            //SetValue("GradeYear", dsrsp.GetContent().GetText("Student[@ID='" + id + "']/Status") == "延修" ? "延修生" : dsrsp.GetContent().GetText("Student[@ID='" + id + "']/GradeYear"));
            //SetValue("Department", dsrsp.GetContent().GetText("Student[@ID='" + id + "']/Department"));
            //SetValue("LastADDate", dsrsp.GetContent().GetText("Student[@ID='" + id + "']/LastADDate"));
            //SetValue("LastADNumber", dsrsp.GetContent().GetText("Student[@ID='" + id + "']/LastADNumber"));
            //SetValue("LastUpdateCode", dsrsp.GetContent().GetText("Student[@ID='" + id + "']/LastUpdateCode"));
            Style = UpdateRecordType.學籍異動;

            //Log,紀錄修改前的資料
            foreach (XmlNode node in GetElement().ChildNodes)
            {
                beforeData.Add(node.Name, node.InnerText);
            }
        }