コード例 #1
0
ファイル: CQGJ.Designer.cs プロジェクト: dalinhuang/cqgj
 /// <summary>
 /// There are no comments for DocTreat in the schema.
 /// </summary>
 public void AddToDocTreat(DocTreat docTreat)
 {
     base.AddObject("DocTreat", docTreat);
 }
コード例 #2
0
ファイル: DocController.cs プロジェクト: dalinhuang/cqgj
        public void DocSave()
        {
            int ot = Convert.ToInt32(HttpContext.Session["OrgType"]);
            Doc doc = new Doc();
            if (GetString("DocTitle") != "" )
            {
                doc.DocTitle = GetString("DocTitle");
                doc.DocType = GetInt("DocType");
                doc.TrainType = GetInt("TrainType");
                doc.WordNo = GetString("WordNo");
                doc.YearNo = GetString("YearNo");
                doc.TeamNo = GetString("TeamNo");
                //采用select
                doc.UserID =(int?) GetUserID();
                doc.KeyWord = GetString("KeyWord");
                doc.DocClass = GetInt("DocClass");
                doc.UrgentLevel = GetInt("UrgentLevel");
                doc.SecretLevel = GetInt("SecretLevel");
                //来文单位
                string su = ((b01)HttpContext.Session["Org"]).b0101.ToString();
                doc.SourceUnit = su;
                //GetString("SourceUnit")
                //doc.SignMan = GetString("SignMan");
                doc.SignMan = GetOrgID().ToString();
                doc.ComeCause = GetString("ComeCause");
                doc.Summary = GetString("Summary");
                //不需那个控件了
                doc.DocCaption = GetString("DocCaption");
                doc.DocSource = GetString("DocSource");
                doc.PubDate = DateTime.Now;
                //发布状态
                //为1为草稿
                if (GetInt("token") == 1)
                {
                    doc.Status = (int?)DocStatus.Draft;
                }
                else
                {
                    doc.Status = (int?)DocStatus.Normal;
                }

                doc.ViewCount = 0;
                //取出发送的公文对象
                //b01 currentOrg = (b01)(HttpContext.Session["Org"]);
                //保存附件用代码
                if (HttpContext.Request.Files != null)
                {
                    HttpFileCollection uploadFiles = this.HttpContext.Request.Files;
                    // 设置上传目标文件夹
                    string savaPath = this.HttpContext.Request.MapPath(@"../Content/uploadfiles/");
                    // 上传文件,并返回上传的文件名(由于附件表需要文件名称,所以SaveFiles函数返回了文件名
                    List<string> fileNames = FileUpload.SaveFiles(uploadFiles, savaPath);
                    Attachment attachment = new Attachment();
                    //暂时将Type设置为0
                    attachment.TypeID = 0;
                    CQGJ.AddToAttachment(attachment);
                    doc.Attachment = attachment;
                    foreach (var f in fileNames)
                    {
                        AttachmentItem item = new AttachmentItem();
                        item.AddTime = DateTime.Now;
                        item.Attachment = attachment;
                        item.FileName = f.Split(',').First();
                        //表示激活
                        item.Status = 1;
                        CQGJ.AddToAttachmentItem(item);
                    }
                }

                //如果单位类型为重庆市委组织部
                if (ot == 1)
                {
                    //存储发送对象
                    string ddd = GetString("DocDownUser");
                    string[] strList = GetString("DocDownUser").Split(',');
                    foreach (var c in strList)
                    {
                        int iOrgID = ToOrgID(c);
                        DocTreat doctreat = new DocTreat();
                        doctreat.Doc = doc;
                        doctreat.Org = (from o in CQGJ.Org
                                        where o.OrgID == iOrgID
                                        select o).First();
                        if (GetInt("token") == 1)
                        {
                            doctreat.TreatType = (int?)DocProcessStatus.Draft;
                        }
                        else
                        {
                            doctreat.TreatType = (int?)DocProcessStatus.Published;
                        }

                        doctreat.DownCount = 0;
                        doctreat.LastDownTime = DateTime.Now;
                        doctreat.TreatContent = "暂时没有反馈";
                        CQGJ.AddToDocTreat(doctreat);
                    }
                }
                else if (ot == 2 || ot == 3 || ot == 4)
                {
                    b01[] orgList = cqgjPassport.GetOrglistByType(1);
                    foreach (var c in orgList)
                    {
                        int iOrgID = ToOrgID(c.b0111);
                        DocTreat docTreat = new DocTreat();
                        docTreat.Doc = doc;
                        docTreat.Org = (from o in CQGJ.Org
                                        where o.OrgID == iOrgID
                                        select o).First();
                        if (GetInt("token") == 1)
                        {
                            docTreat.TreatType = (int?)DocProcessStatus.Draft;
                        }
                        else
                        {
                            docTreat.TreatType = (int?)DocProcessStatus.Published;
                        }
                        docTreat.DownCount = 0;
                        docTreat.LastDownTime = DateTime.Now;
                        docTreat.TreatContent = "暂时没有反馈";
                        CQGJ.AddToDocTreat(docTreat);
                    }
                }
                CQGJ.AddToDoc(doc);
                CQGJ.SaveChanges();

                //在跳转时提供viewData
                DocActionResultViewData viewData = new DocActionResultViewData();
                viewData.ActionSuccess = true;
                viewData.Message = "提交公文成功";

                viewData.javascriptMessage = "/doc/docadd/1";
                RenderView("MessagePage", viewData);
            }
            //注意:组织部和下级单位跳转的页面不一样
            if (ot == 1)
            {
                RedirectToAction("DocSendedIndex");
            }
            else
            {
                RedirectToAction("DocSendedSubList/1/1/1");
            }
        }
コード例 #3
0
ファイル: CQGJ.Designer.cs プロジェクト: dalinhuang/cqgj
 /// <summary>
 /// Create a new DocTreat object.
 /// </summary>
 /// <param name="treatID">Initial value of TreatID.</param>
 public static DocTreat CreateDocTreat(int treatID)
 {
     DocTreat docTreat = new DocTreat();
     docTreat.TreatID = treatID;
     return docTreat;
 }