//结课资料 protected void btnUpload_Click(object sender, EventArgs e) { List<int> listArchiveItemIds = new List<int>(); List<string> listArchivesAttachmentIds = new List<string>(); DalOperationAboutArchives doaa = new DalOperationAboutArchives(); foreach (Control ctlTable in phUpload.Controls) { foreach (Control ctlTableRow in ctlTable.Controls) { foreach (Control ctlTableCell in ctlTableRow.Controls) { foreach (Control ctl in ctlTableCell.Controls) { string _type = ctl.GetType().ToString(); if (_type == "System.Web.UI.WebControls.HiddenField") { if (ctl.ID.StartsWith("hid_")) { listArchiveItemIds.Add(int.Parse(ctl.ID.Split("_".ToCharArray())[1])); } else if (ctl.ID.StartsWith("hidAttachmentId")) { listArchivesAttachmentIds.Add(((HiddenField)ctl).Value); } } } } } } Archives archives = new Archives { courseNo = Request["courseNo"], classID = Server.UrlDecode(Request["classID"]), termTag = Request["termTag"].Trim(), teacherType = Master.teacherType }; for (int i = 0; i < listArchiveItemIds.Count; i++) { archives.archiveItemId = listArchiveItemIds[i]; archives.attachmentIds = listArchivesAttachmentIds[i]; //判断是否存在课程结课资料记录,并返回archiveId int archiveId = doaa.IsExistArchivesBycourseNo(Master.courseNo, Master.classID, Master.termtag, Master.teacherType, archives.archiveItemId); if (archiveId != 0) { archives.archiveId = archiveId; doaa.UpdateArchives(archives); Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page); Javascript.AlertAndRedirect("上传成功!", "CInfoAttachment.aspx?courseNo=" + archives.courseNo + "&classID=" + Master.classID + "&termtag=" + Master.termtag + "&teacherType=" + Master.teacherType, Page); } else { doaa.AddArchives(archives); Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page); Javascript.AlertAndRedirect("上传成功!", "CInfoAttachment.aspx?courseNo=" + archives.courseNo + "&classID=" + Master.classID + "&termtag=" + Master.termtag + "&teacherType=" + Master.teacherType, Page); } } }
//结课资料 protected void btnUpload_Click(object sender, EventArgs e) { List<int> listArchiveItemIds = new List<int>(); List<string> listArchivesAttachmentIds = new List<string>(); DalOperationAboutArchives doaa = new DalOperationAboutArchives(); foreach (Control ctlTable in phUpload.Controls) { foreach (Control ctlTableRow in ctlTable.Controls) { foreach (Control ctlTableCell in ctlTableRow.Controls) { foreach (Control ctl in ctlTableCell.Controls) { string _type = ctl.GetType().ToString(); if (_type == "System.Web.UI.WebControls.HiddenField") { if (ctl.ID.StartsWith("hid_")) { listArchiveItemIds.Add(int.Parse(ctl.ID.Split("_".ToCharArray())[1])); } else if (ctl.ID.StartsWith("hidAttachmentId")) { listArchivesAttachmentIds.Add(((HiddenField)ctl).Value); } } } } } } Archives archives = new Archives { courseNo = Request["courseNo"], classID = Server.UrlDecode(Request["classID"]), termTag = Request["termTag"].Trim(), teacherType = teacherType }; for (int i = 0; i < listArchiveItemIds.Count; i++) { archives.archiveItemId = listArchiveItemIds[i]; archives.attachmentIds = listArchivesAttachmentIds[i]; //判断是否存在课程结课资料记录,并返回archiveId int archiveId = doaa.IsExistArchivesBycourseNo(courseNo, classID, termtag, teacherType, archives.archiveItemId); if (archiveId != 0) { archives.archiveId = archiveId; doaa.UpdateArchives(archives); Javascript.RefreshParentWindow("上传成功!", "/Administrator/ArchivesManage.aspx?fragment=1&termTag=" + termtag + "&locale=" + Server.UrlEncode(locale) + "&keyword=" + Server.UrlEncode(keyword) + "#archive_" + anchor, Page); } else { doaa.AddArchives(archives); Javascript.RefreshParentWindow("上传成功!", "/Administrator/ArchivesManage.aspx?fragment=1&termTag=" + termtag + "&locale=" + Server.UrlEncode(locale) + "&keyword=" + Server.UrlEncode(keyword) + "#archive_" + anchor, Page); } } }