| | |
| | | using CY.Infrastructure.DESEncrypt; |
| | | using CY.Infrastructure.Query; |
| | | using CY.BLL.OA; |
| | | using System.Transactions; |
| | | |
| | | namespace CY.WebForm.Pages.work |
| | | { |
| | |
| | | OA_WorkPlanBll oA_WorkReminderBll = null; |
| | | OA_CarDictionaryBLL bll_OA_CarDictionaryBLL = null; |
| | | OA_SuppliersBLL _OA_SuppliersBLL = null; |
| | | OA_WorkPlan_attachmentBLL oA_WorkPlan_AttachmentBLL = null; |
| | | public MyRequestAdd() |
| | | { |
| | | departmentBll = new OA_DepartmentBll(); |
| | |
| | | oA_StaffBLL = new OA_StaffBLL(); |
| | | bll_OA_CarDictionaryBLL = new OA_CarDictionaryBLL(); |
| | | _OA_SuppliersBLL = new OA_SuppliersBLL(); |
| | | oA_WorkPlan_AttachmentBLL = new OA_WorkPlan_attachmentBLL(); |
| | | } |
| | | |
| | | //页面加载 |
| | |
| | | this.txtShoukuandanwei.Value = ""; |
| | | } |
| | | this.txtPlanContent.Value = m_OA_WorkPlan.PlanContent.ToString(); |
| | | |
| | | if(m_OA_WorkPlan.PlanDataType == 15) |
| | | { |
| | | this.RepClientList.DataSource = oA_WorkPlan_AttachmentBLL.GetModelByKaipiaoIdandType(Request["keyid"].ToInt32().Value,15); |
| | | this.RepClientList.DataBind(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | //表单提交 |
| | | protected void btn_submit_form(object sender, EventArgs e) |
| | | { |
| | | using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, |
| | | new TransactionOptions |
| | | { |
| | | IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted, |
| | | Timeout = TransactionManager.MaximumTimeout |
| | | } |
| | | ) |
| | | ) |
| | | { |
| | | |
| | | try |
| | | { |
| | | bool res = true; |
| | | DateTime nowTime = DateTime.Now; |
| | | OA_WorkPlan m_OA_WorkPlan = oA_WorkReminderBll.GetModelByKeyid(Request["keyid"].ToInt32()); |
| | | if (m_OA_WorkPlan == null) |
| | |
| | | |
| | | if (Request["keyid"].ToInt32() > 0) |
| | | { |
| | | if (oA_WorkReminderBll.UpdateModel(m_OA_WorkPlan)) |
| | | JavaScript.MessageBox("更新成功", this, true, true); |
| | | else |
| | | JavaScript.MessageBox("操作失败", this); |
| | | res = oA_WorkReminderBll.UpdateModel(m_OA_WorkPlan); |
| | | |
| | | if (res && m_OA_WorkPlan.PlanDataType == 15) |
| | | { |
| | | var HideKeyidFapiao = Request["HideKeyidFapiao"].Split(','); |
| | | var HideAttachmentFapiao = Request["HideAttachmentFapiao"].Split(','); |
| | | |
| | | |
| | | //需要删除的附件 |
| | | var oA_WorkPlan_Attachments = oA_WorkPlan_AttachmentBLL.GetModelByKaipiaoIdandType(m_OA_WorkPlan.Keyid.Value, 15); |
| | | List<int> HideKeyidFujianid = new List<int>(); |
| | | for (int i = 0; i < HideKeyidFapiao.Length; i++) |
| | | { |
| | | if (!string.IsNullOrEmpty(HideKeyidFapiao[i]) && HideKeyidFapiao[i].ToInt32() != 0) |
| | | { |
| | | HideKeyidFujianid.Add(HideKeyidFapiao[i].ToInt32().Value); |
| | | } |
| | | } |
| | | |
| | | var oA_WorkPlan_Attachments1 = oA_WorkPlan_Attachments.Where(x => !HideKeyidFujianid.Contains(x.Keyid)).ToList(); |
| | | |
| | | foreach (var oa_WorkPlan_Attachment in oA_WorkPlan_Attachments1) |
| | | { |
| | | res = oA_WorkPlan_AttachmentBLL.DeleteModel(oa_WorkPlan_Attachment); |
| | | } |
| | | |
| | | for (int i = 0; i < HideKeyidFapiao.Length; i++) |
| | | { |
| | | if (string.IsNullOrEmpty(HideKeyidFapiao[i])) |
| | | { |
| | | var a_WorkPlan_Attachment = new OA_WorkPlan_attachment(); |
| | | a_WorkPlan_Attachment.OA_WorkPlanId = m_OA_WorkPlan.Keyid; |
| | | a_WorkPlan_Attachment.AttachmentType = 15; |
| | | a_WorkPlan_Attachment.PlanAttachment = HideAttachmentFapiao[i]; |
| | | a_WorkPlan_Attachment.CreateTime = DateTime.Now; |
| | | a_WorkPlan_Attachment.Operator = CurrentUser.TrueName; |
| | | var sss = oA_WorkPlan_AttachmentBLL.InsertModel(a_WorkPlan_Attachment); |
| | | } |
| | | else |
| | | { |
| | | if (oA_WorkReminderBll.InsertModel(m_OA_WorkPlan)) |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | scope.Complete(); |
| | | |
| | | |
| | | JavaScript.MessageBox("更新成功", this, true, true); |
| | | } |
| | | else |
| | | JavaScript.MessageBox("操作失败", this); |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | var aaaa = oA_WorkReminderBll.InserModelAndGetId(m_OA_WorkPlan); |
| | | m_OA_WorkPlan.Keyid = aaaa; |
| | | if (aaaa > 0 && m_OA_WorkPlan.PlanDataType == 15) |
| | | { |
| | | var HideKeyidFapiao = Request["HideKeyidFapiao"].Split(','); |
| | | var HideAttachmentFapiao = Request["HideAttachmentFapiao"].Split(','); |
| | | |
| | | |
| | | |
| | | |
| | | for (int i = 0; i < HideKeyidFapiao.Length; i++) |
| | | { |
| | | if (string.IsNullOrEmpty(HideKeyidFapiao[i])) |
| | | { |
| | | var a_WorkPlan_Attachment = new OA_WorkPlan_attachment(); |
| | | a_WorkPlan_Attachment.OA_WorkPlanId = m_OA_WorkPlan.Keyid; |
| | | a_WorkPlan_Attachment.AttachmentType = 15; |
| | | a_WorkPlan_Attachment.PlanAttachment = HideAttachmentFapiao[i]; |
| | | a_WorkPlan_Attachment.CreateTime = DateTime.Now; |
| | | a_WorkPlan_Attachment.Operator = CurrentUser.TrueName; |
| | | var sss = oA_WorkPlan_AttachmentBLL.InsertModel(a_WorkPlan_Attachment); |
| | | } |
| | | else |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | scope.Complete(); |
| | | |
| | | |
| | | |
| | | JavaScript.MessageBox("新增成功", this, true, true); |
| | | } |
| | | else |
| | | JavaScript.MessageBox("操作失败", this); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | PAGEHandleException(ex); |
| | | JavaScript.MessageBox("操作失败", this); |
| | | } |
| | | finally |
| | | { |
| | | // 释放资源 |
| | | scope.Dispose(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |