Beispiel #1
0
        public static System.Data.DataTable TransDTOToTable(Dictionary<string, Model.DTO.UKHandleQuanDetail> ukQuanList)
        {
            Model.DTO.UKHandleQuanDetail ukQuan = new Model.DTO.UKHandleQuanDetail();
            System.Data.DataTable dt = new System.Data.DataTable();
            //初始化列
            //ID
            System.Data.DataColumn col = new System.Data.DataColumn();
            col.Caption = "ID";
            col.ColumnName = "ID";
            dt.Columns.Add(col);
            //合同编号
            col = new System.Data.DataColumn();
            col.Caption = "合同编号";
            col.ColumnName = "ContractNum";
            dt.Columns.Add(col);
            //学生姓名
            col = new System.Data.DataColumn();
            col.Caption = "学生姓名";
            col.ColumnName = "StudentName";
            dt.Columns.Add(col);
            //院校名称
            col = new System.Data.DataColumn();
            col.Caption = "院校名称";
            col.ColumnName = "University";
            dt.Columns.Add(col);
            //申请类别
            col = new System.Data.DataColumn();
            col.Caption = "申请类别";
            col.ColumnName = "ApplicationType";
            dt.Columns.Add(col);
            //网申
            col = new System.Data.DataColumn();
            col.Caption = "网申";
            col.ColumnName = "Online";
            dt.Columns.Add(col);
            //套磁
            col = new System.Data.DataColumn();
            col.Caption = "套磁";
            col.ColumnName = "Megnetic";
            dt.Columns.Add(col);
            //文书
            col = new System.Data.DataColumn();
            col.Caption = "文书";
            col.ColumnName = "PS";
            dt.Columns.Add(col);
            //录取
            col = new System.Data.DataColumn();
            col.Caption = "录取";
            col.ColumnName = "Admission";
            dt.Columns.Add(col);
            //资深文案
            col = new System.Data.DataColumn();
            col.Caption = "资深文案";
            col.ColumnName = "Senior";
            dt.Columns.Add(col);
            //制作文案
            col = new System.Data.DataColumn();
            col.Caption = "制作文案";
            col.ColumnName = "Author";
            dt.Columns.Add(col);
            //文书文案
            col = new System.Data.DataColumn();
            col.Caption = "文书文案";
            col.ColumnName = "PSAuthor";
            dt.Columns.Add(col);
            //文书部门
            col = new System.Data.DataColumn();
            col.Caption = "文书部门";
            col.ColumnName = "PSDepartment";
            dt.Columns.Add(col);
            //转案区间
            col = new System.Data.DataColumn();
            col.Caption = "转案区间";
            col.ColumnName = "GetPeriod";
            dt.Columns.Add(col);
            //备注
            col = new System.Data.DataColumn();
            col.Caption = "备注";
            col.ColumnName = "Note";
            dt.Columns.Add(col);

            foreach (Model.DTO.UKHandleQuanDetail item in ukQuanList.Values)
            {
                System.Data.DataRow row = dt.NewRow();
                row["ID"] = item.ID;
                row["ContractNum"] = item.ContractNum;
                row["StudentName"] = item.StudentName;
                row["University"] = item.University;
                row["ApplicationType"] = item.ApplicationType;
                row["Online"] = item.SendQuan.Online;
                row["Megnetic"] = item.SendQuan.Magnetic;
                row["PS"] = item.SendQuan.PS;
                row["Admission"] = item.Admission;
                row["Author"] = item.CopyWriting.Author;
                row["Senior"] = item.CopyWriting.Senior;
                row["PSAuthor"] = item.PS.Author;
                row["PSDepartment"] = item.PS.Department;
                row["Note"] = item.Note;
                row["GetPeriod"] = item.GetPeriod;
                dt.Rows.Add(row);
            }
            return dt;
        }
        private bool collectData()
        {
            if (string.IsNullOrEmpty(this.mruContractNum.Text))
            {
                XtraMessageBox.Show("合同编号不能为空。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            if (string.IsNullOrEmpty(this.mruStudentName.Text))
            {
                XtraMessageBox.Show("学生姓名不能为空。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            if (string.IsNullOrEmpty(this.mruUniversity.Text))
            {
                XtraMessageBox.Show("院校缩写不能为空。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            if (this.dtSendDate.EditValue == null)
            {
                XtraMessageBox.Show("寄出日期不能为空。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            if (string.IsNullOrEmpty(this.cbSenior.Text))
            {
                XtraMessageBox.Show("资深文案不能为空。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            if (string.IsNullOrEmpty(this.tbAuthor.Text))
            {
                XtraMessageBox.Show("制作文案不能为空。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            if (!Controller.SQLiteController.BizContract.CheckQuanSendDate(this.mruContractNum.Text, this.mruStudentName.Text, this.cbUniversity.Text, this.cbCourse.Text))
            {
                if (XtraMessageBox.Show("当前合同信息还没有转交外联日期,\r\n是否仍要新增?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                {
                    return false;
                }
            }
            if (!Controller.SQLiteController.BizContract.CheckQuanSubmit(this.mruContractNum.Text, this.mruStudentName.Text, this.cbUniversity.Text, this.cbCourse.Text))
            {
                if (XtraMessageBox.Show("当前合同信息可能已报过量化,\r\n是否仍要新增?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                {
                    return false;
                }
            }
            if (this.country == Model.MotivationEnum.CountryEnum.UK)//英国
            {
                Model.DTO.UKHandleQuanDetail ukHandleQuanDetail;

                if (!string.IsNullOrEmpty(this.handleQuanDetailKey))//编辑时保证量化对象ID不变
                {
                    ukHandleQuanDetail = Controller.MainWin.MotivationData.Instanse.HandleQuan.UKDetails[this.handleQuanDetailKey];
                    ukHandleQuanDetail.ContractNum = this.mruContractNum.Text;
                }
                else
                {
                    ukHandleQuanDetail = new Model.DTO.UKHandleQuanDetail();
                }
                ukHandleQuanDetail.ContractNum = this.mruContractNum.Text;
                ukHandleQuanDetail.StudentName = this.mruStudentName.Text;
                ukHandleQuanDetail.University = this.mruUniversity.Text;
                ukHandleQuanDetail.UniversityFullName = this.cbUniversity.Text;
                ukHandleQuanDetail.Course = this.cbCourse.Text;
                ukHandleQuanDetail.ApplicationType = this.cbApplicationType.Text;
                ukHandleQuanDetail.SendQuan.Online = this.cbOnline.Text;
                ukHandleQuanDetail.SendQuan.SendDate = this.dtSendDate.DateTime;
                ukHandleQuanDetail.SendQuan.Magnetic = this.cbMagnetic.Text;
                ukHandleQuanDetail.SendQuan.PS = this.cbPS.Text;
                ukHandleQuanDetail.Admission = this.cbAdmission.Text;
                ukHandleQuanDetail.CopyWriting.Senior = this.cbSenior.Text;
                ukHandleQuanDetail.CopyWriting.Author = this.tbAuthor.Text;
                ukHandleQuanDetail.PS.Author = this.tbPSAuthor.Text;
                ukHandleQuanDetail.PS.Department = this.tbPSDepartment.Text;
                ukHandleQuanDetail.Note = this.tbNote.Text;
                ukHandleQuanDetail.GetPeriod = this.cbGetPeriod.Text;
                this.HandleQuanDetail = ukHandleQuanDetail;
                return true;
            }
            else
            {
                Model.DTO.HKHandleQuanDetail hkHandleQuanDetail;

                if (!string.IsNullOrEmpty(this.handleQuanDetailKey))//编辑时保证量化对象ID不变
                {
                    hkHandleQuanDetail = Controller.MainWin.MotivationData.Instanse.HandleQuan.HKDetails[this.handleQuanDetailKey];
                    hkHandleQuanDetail.ContractNum = this.mruContractNum.Text;
                }
                else
                {
                    hkHandleQuanDetail = new Model.DTO.HKHandleQuanDetail();
                }
                hkHandleQuanDetail.ContractNum = this.mruContractNum.Text;
                hkHandleQuanDetail.StudentName = this.mruStudentName.Text;
                hkHandleQuanDetail.University = this.mruUniversity.Text;
                hkHandleQuanDetail.UniversityFullName = this.cbUniversity.Text;
                hkHandleQuanDetail.Course = this.cbCourse.Text;
                hkHandleQuanDetail.ApplicationType = this.cbApplicationType.Text;
                hkHandleQuanDetail.SendQuan.Online = this.cbOnline.Text;
                hkHandleQuanDetail.SendQuan.Translation = this.cbTranslation.Text;
                hkHandleQuanDetail.SendQuan.Visa = this.cbVisa.Text;
                hkHandleQuanDetail.SendDate = this.dtSendDate.DateTime;
                hkHandleQuanDetail.Admission = this.cbAdmission.Text;
                hkHandleQuanDetail.Sign = this.cbSign.Text;
                hkHandleQuanDetail.CopyWriting.Senior = this.cbSenior.Text;
                hkHandleQuanDetail.CopyWriting.Author = this.tbAuthor.Text;
                hkHandleQuanDetail.PS.Author = this.tbPSAuthor.Text;
                hkHandleQuanDetail.PS.Department = this.tbPSDepartment.Text;
                hkHandleQuanDetail.Note = this.tbNote.Text;
                this.HandleQuanDetail = hkHandleQuanDetail;
                return true;
            }
        }
            public static Model.DTO.HandleQuantification LoadQuanXml(string filePath)
            {
                if (string.IsNullOrEmpty(filePath))
                {
                    throw new Exception("没有传入文件路径");
                }
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(filePath);
                if (xmlDoc == null)
                {
                    throw new Exception("缓存数据获取失败");
                }
                Model.DTO.HandleQuantification handleQuan = new Model.DTO.HandleQuantification();
                //首先获取UKDetails
                Dictionary<string, Model.DTO.UKHandleQuanDetail> ukDetails = new Dictionary<string, Model.DTO.UKHandleQuanDetail>();
                XmlNodeList nodelList = xmlDoc.SelectNodes("Performance/HandleQuantification/UKDetails/Detail");
                if (nodelList != null && nodelList.Count > 0)
                {
                    foreach (XmlNode node in nodelList)
                    {
                        Model.DTO.UKHandleQuanDetail detail = new Model.DTO.UKHandleQuanDetail();
                        detail.ID = node.Attributes["ID"].Value;
                        detail.ContractNum = node.Attributes["ContractNum"].Value;
                        detail.StudentName = node.Attributes["StudentName"].Value;
                        detail.University = node.Attributes["University"].Value;
                        detail.ApplicationType = node.Attributes["ApplicationType"].Value;
                        detail.SendQuan.Online = node.SelectSingleNode("SendQuan").Attributes["Online"].Value;
                        detail.SendQuan.SendDate = DateTime.Parse(node.SelectSingleNode("SendQuan").Attributes["SendDate"].Value);
                        detail.SendQuan.Magnetic = node.SelectSingleNode("SendQuan").Attributes["Magnetic"] == null ? "" : node.SelectSingleNode("SendQuan").Attributes["Magnetic"].Value;
                        detail.SendQuan.PS = node.SelectSingleNode("SendQuan").Attributes["PS"] == null ? "" : node.SelectSingleNode("SendQuan").Attributes["PS"].Value;
                        detail.Admission = node.Attributes["Admission"].Value;
                        detail.CopyWriting.Senior = node.SelectSingleNode("Copywriting").Attributes["Senior"].Value;
                        detail.CopyWriting.Author = node.SelectSingleNode("Copywriting").Attributes["Author"].Value;
                        detail.PS.Author = node.SelectSingleNode("PSInfo").Attributes["Author"].Value;
                        detail.PS.Department = node.SelectSingleNode("PSInfo").Attributes["Department"].Value;
                        detail.Note = node.Attributes["Note"].Value;
                        detail.GetPeriod = node.Attributes["GetPeriod"] == null ? "" : node.Attributes["GetPeriod"].Value;
                        ukDetails.Add(detail.ID, detail);
                    }
                }
                handleQuan.UKDetails = ukDetails;

                //然后加载HKDetails
                Dictionary<string, Model.DTO.HKHandleQuanDetail> hkDetails = new Dictionary<string, Model.DTO.HKHandleQuanDetail>();
                nodelList = xmlDoc.SelectNodes("Performance/HandleQuantification/HKDetails/Detail");
                if (nodelList != null && nodelList.Count > 0)
                {
                    foreach (XmlNode node in nodelList)
                    {
                        Model.DTO.HKHandleQuanDetail detail = new Model.DTO.HKHandleQuanDetail();
                        detail.ID = node.Attributes["ID"].Value;
                        detail.ContractNum = node.Attributes["ContractNum"].Value;
                        detail.StudentName = node.Attributes["StudentName"].Value;
                        detail.University = node.Attributes["University"].Value;
                        detail.ApplicationType = node.Attributes["ApplicationType"].Value;
                        detail.SendQuan.Online = node.SelectSingleNode("SendQuan").Attributes["Online"].Value;
                        detail.SendQuan.Translation = node.SelectSingleNode("SendQuan").Attributes["Translation"].Value;
                        detail.SendQuan.Visa = node.SelectSingleNode("SendQuan").Attributes["Visa"].Value;
                        detail.SendDate = DateTime.Parse(node.Attributes["SendDate"].Value);
                        detail.CopyWriting.Senior = node.SelectSingleNode("Copywriting").Attributes["Senior"].Value;
                        detail.CopyWriting.Author = node.SelectSingleNode("Copywriting").Attributes["Author"].Value;
                        detail.Admission = node.Attributes["Admission"].Value;
                        detail.Sign = node.Attributes["Sign"].Value;
                        detail.PS.Author = node.SelectSingleNode("PSInfo").Attributes["Author"].Value;
                        detail.PS.Department = node.SelectSingleNode("PSInfo").Attributes["Department"].Value;
                        detail.Note = node.Attributes["Note"].Value;
                        hkDetails.Add(detail.ID, detail);
                    }
                }
                handleQuan.HKDetails = hkDetails;
                handleQuan.HandleDate = DateTime.Now;
                return handleQuan;
            }