public void DocEdit(int? id) { if (id != null) { DocEditViewData viewData = new DocEditViewData() { lsWordNo = new List<string>(), ClassType = new Dictionary<string, string>(), Secret = new Dictionary<string, string>(), Emergercy = new Dictionary<string, string>(), DocClass = new Dictionary<string, string>(), DocType = new Dictionary<string, string>() }; //取得所有的公文字号 int orgID = GetOrgID(); viewData.lsWordNo = (from c in CQGJ.DocWord where c.Org.OrgID == orgID select c.WordName).ToList(); string[] secret = (ConfigurationManager.AppSettings.Get("Secret")).Split(','); string[] secretdetail = ConfigurationManager.AppSettings.Get("SecretDetail").Split(','); for (int i = 0; i < secret.Count(); i++) { viewData.Secret.Add(secret[i], secretdetail[i]); } string[] Emergercy = ConfigurationManager.AppSettings.Get("Emergercy").Split(','); string[] EmergercyDetail = ConfigurationManager.AppSettings.Get("EmergercyDetail").Split(','); for (int i = 0; i < Emergercy.Count(); i++) { viewData.Emergercy.Add(Emergercy[i], EmergercyDetail[i]); } string[] DocClass = ConfigurationManager.AppSettings.Get("DocClass").Split(','); string[] DocClassDetail = ConfigurationManager.AppSettings.Get("DocClassDetail").Split(','); for (int i = 0; i < DocClass.Count(); i++) { viewData.DocClass.Add(DocClass[i], DocClassDetail[i]); } string[] ClassType = ConfigurationManager.AppSettings.Get("ClassType").Split(','); string[] ClassTypeDetail = ConfigurationManager.AppSettings.Get("ClassTypeDetail").Split(','); for (int i = 0; i < ClassType.Count(); i++) { viewData.ClassType.Add(ClassType[i], ClassTypeDetail[i]); } string[] DocType = ConfigurationManager.AppSettings.Get("DocType").Split(','); string[] DocTypeDetail = ConfigurationManager.AppSettings.Get("DocTypeDetail").Split(','); for (int i = 0; i < DocType.Count(); i++) { viewData.DocType.Add(DocType[i], DocTypeDetail[i]); } viewData.sigDoc=(from c in CQGJ.Doc where c.DocID==id.Value select c).First(); int attachmentID=Convert.ToInt32( viewData.sigDoc.AttachmentReference.EntityKey.EntityKeyValues[0].Value); viewData.lsAttachmentItem = (from a in CQGJ.Attachment from at in a.AttachmentItem where a.AttachmentID==attachmentID select at); RenderView("DocEditView", viewData); } }
public ActionResult DocEdit(int? id) { if (id != null) { DocEditViewData viewData = new DocEditViewData() { lsWordNo = new List<string>() }; //取得所有的公文字号 int orgID = GetOrg().OrgID; viewData.lsWordNo = (from c in CQGJ.DocWord where c.Org.OrgID == orgID select c.WordName).ToList(); Doc doc = (from c in CQGJ.Doc where c.DocID == id.Value select c).First(); viewData.SecretLevel = SecretLevelList((int)doc.SecretLevel); viewData.UrgentLevel = UrgentLevelList((int)doc.UrgentLevel); viewData.DocClass = DocClassList((int)doc.DocClass); viewData.TrainType = TrainTypeList((int)doc.TrainType); viewData.DocType = DocTypeList((int)doc.DocType); viewData.sigDoc = doc; int attachmentID = Convert.ToInt32(viewData.sigDoc.AttachmentReference.EntityKey.EntityKeyValues[0].Value); viewData.lsAttachmentItem = (from a in CQGJ.Attachment from at in a.AttachmentItem where a.AttachmentID == attachmentID select at); return View("DocEditView", viewData); } return View(); }