[ValidateAntiForgeryToken] //传入

        public ActionResult AddArchive(int?securityName, string hezai, string totallong, string zaojia, string Fee, int?retentionPeriodName, string structureTypeID, long paperProjectSeqNo, string action, string RegistrationNo, string archivesNo, string shizhengNo, string licenseNo, string mapsheetNo, string microNo, string buildingArea, string archivesTitle, string firstResponsible, string responsibleOther, string developmentOrganization, string transferUnit, string disignOrganization, string PaiJiaNo, string constructionOrganization, string TextMaterial, string drawing, string PhotoCount, string ArchiveThickness, string bianzhiTime, string jgDate, string Material, string location, string remarks, string newLocation, string overground, string underground, int?changeLog, string fazhaoTime, string jungongTime, string kaigongTime, string indexer, string indexeDate, string checker, string checkDate, string Typist, string TyperDate)
        {
            if (action == "返回")
            {
                return(RedirectToAction("ArchiveMaga"));
            }
            var papaerarchive = from a in cb.gxPaperArchives
                                where a.paperProjectSeqNo == paperProjectSeqNo
                                select a;
            gxPaperArchives paperArchives = papaerarchive.First();
            long            ID            = Convert.ToInt32(paperArchives.projectID);
            var             projectInfo   = from b in cb.gxProjectInfo
                                            where b.projectID == ID
                                            select b;
            gxProjectInfo    projects = projectInfo.First();
            gxArchivesDetail archive  = new gxArchivesDetail();
            //var SEQNO = cb.vw_gxpassList.Where(a => a.paperProjectSeqNo == paperProjectSeqNo).Where(a=>a.classifyID.Trim()=="1").First().paperProjectSeqNo;
            gxArchivesDetail archive1 = cb.gxArchivesDetail.Where(a => a.paperProjectSeqNo == paperProjectSeqNo).OrderByDescending(a => a.volNo).First();

            archive.registrationNo    = RegistrationNo;
            archive.archivesNo        = archivesNo;
            archive.paperProjectSeqNo = paperProjectSeqNo;

            archive.volNo            = archive1.volNo;
            archive1.volNo           = archive1.volNo + 1;
            archive.paijiaNo         = PaiJiaNo.Trim();
            archive.archiveThickness = Convert.ToInt32(ArchiveThickness);

            if (TextMaterial.Trim() != "")
            {
                archive.textMaterial = Int32.Parse(TextMaterial.Trim()); //文字材料
            }
            archive.archivesTitle    = archivesTitle;                    //案卷提名
            archive.firstResponsible = firstResponsible;                 //第一负责人

            if (drawing.Trim() != "")
            {
                archive.drawing = Int32.Parse(drawing.Trim()); //图纸
            }
            if (PhotoCount.Trim() != "")                       //照片
            {
                archive.photoCount = Int32.Parse(PhotoCount.Trim());
            }
            archive.responsibleOther = responsibleOther;//其他责任者


            archive.developmentUnit  = developmentOrganization;
            archive.constructionUnit = constructionOrganization;
            archive.designUnit       = disignOrganization;

            archive.bianzhiTime = bianzhiTime.Trim(); //编制日期
            //archive.bianzhiTime = DateTime.ParseExact(strbianzhiTime, "yyyy-MM-dd", null).Date;
            archive.transferUnit = transferUnit;      //移交单位
            archive.notearea     = location;          //附注改为工程地址
            archive.licenseNo    = licenseNo;         //执照号
            archive.shizhengNo   = shizhengNo;        //市政档案号

            archive.remarks = remarks;                //备注
            string strbiaoyinriqi = indexeDate;       //标引日期

            archive.indexDate = DateTime.Parse(strbiaoyinriqi);
            archive.indexer   = indexer;//标引员


            string strshenheriqi = checkDate;//审核日期

            archive.checkDate = DateTime.Parse(strshenheriqi);
            archive.checker   = checker;              //审核员

            archive.kaigongTime = kaigongTime.Trim(); //开工日期
            archive.jungongTime = jungongTime.Trim(); //竣工日期
            archive.fazhaoTime  = fazhaoTime.Trim();  //发照日期
            if (jgDate != null)
            {
                archive.jgDate = DateTime.Parse(jgDate.Trim());
            }
            string strlururiqi = TyperDate;//录入日期

            if (strlururiqi != null)
            {
                archive.typerDate = DateTime.Parse(strlururiqi);
            }
            archive.typist = Typist;//录入员

            archive.isImageExist = "无";
            if (mapsheetNo == "")
            {
                archive.mapsheetNo = "0";
            }
            else
            {
                archive.mapsheetNo = mapsheetNo;//图幅号
            }
            if (microNo == "")
            {
                archive.microNo = "0";
            }
            else
            {
                archive.microNo = microNo;//微缩号
            }

            if (ModelState.IsValid)
            {
                cb.Entry(archive1).State = EntityState.Modified;
                cb.gxArchivesDetail.Add(archive);
                cb.SaveChanges();
            }

            //if (projects != null)
            //{
            //    if (projects.developmentOrganization.Trim() != developmentOrganization.Trim() || projects.constructionOrganization.Trim() != constructionOrganization.Trim() || projects.disignOrganization.Trim() != disignOrganization.Trim())
            //    {
            //        if (developmentOrganization.Trim() != "")
            //            projects.developmentOrganization = developmentOrganization.Trim();
            //        if (constructionOrganization.Trim() != "")
            //            projects.constructionOrganization = constructionOrganization.Trim();
            //        if (disignOrganization.Trim() != "")
            //            projects.disignOrganization = disignOrganization.Trim();

            //    }
            //    projects.securityID = securityName.ToString().Trim();
            //    projects.retentionPeriodNo = retentionPeriodName.ToString().Trim();
            //    projects.structureTypeID = structureTypeID.ToString().Trim();
            //    projects.newLocation = newLocation.Trim();
            //    if (ModelState.IsValid)
            //    {
            //        cb.Entry(projects).State = EntityState.Modified;
            //        cb.SaveChanges();
            //    }
            //}
            if (paperArchives != null)
            {
                string jinguandata = Convert.ToDateTime(paperArchives.jgDate).ToString("yyyy-MM-dd");
                if (jinguandata != jgDate.Trim())
                {
                    paperArchives.jgDate = DateTime.Parse(jgDate.Trim());
                }
                paperArchives.structureTypeID = structureTypeID.ToString().Trim();
                paperArchives.buildingArea    = Convert.ToDouble((buildingArea.Trim()));
                paperArchives.underground     = underground.Trim();
                paperArchives.overground      = overground.Trim();
                paperArchives.Fee             = Fee;
                paperArchives.zaojia          = zaojia;
                paperArchives.Material        = Material;
                paperArchives.totallong       = totallong;
                paperArchives.hezai           = hezai;
                if (Material == null)
                {
                    Material = "";
                }
                if (Material.Trim() != "")
                {
                    paperArchives.Material = Material.Trim();
                }

                paperArchives.luruTime          = TyperDate.Trim();
                paperArchives.projectStartDate  = kaigongTime.Trim();
                paperArchives.projectFinishDate = jungongTime.Trim();
                paperArchives.licenseNo         = licenseNo.Trim();
                paperArchives.licenseDate       = fazhaoTime.Trim();
                if (changeLog == 0)
                {
                    paperArchives.changeLog = "没有";
                }
                if (changeLog == 1)
                {
                    paperArchives.changeLog = "有";
                }


                paperArchives.transferUnit = transferUnit;
                if (TextMaterial.Trim() != "")
                {
                    if (paperArchives.textMaterial != 0)
                    {
                        paperArchives.textMaterial = paperArchives.textMaterial + Int32.Parse(TextMaterial.Trim());
                    }
                    else
                    {
                        paperArchives.textMaterial = Int32.Parse(TextMaterial.Trim());
                    }
                }
                if (TextMaterial.Trim() != "")
                {
                    if (paperArchives.drawing != 0)
                    {
                        paperArchives.drawing = paperArchives.drawing + Int32.Parse(TextMaterial.Trim());
                    }
                    else
                    {
                        paperArchives.drawing = Int32.Parse(TextMaterial.Trim());
                    }
                }
                if (PhotoCount.Trim() != "")
                {
                    if (paperArchives.PhotoCount != 0)
                    {
                        paperArchives.PhotoCount = paperArchives.PhotoCount + Int32.Parse(PhotoCount.Trim());
                    }
                    else
                    {
                        paperArchives.PhotoCount = Int32.Parse(PhotoCount.Trim());
                    }
                }
                paperArchives.firstResponsible = firstResponsible.Trim();
                paperArchives.responsibleOther = responsibleOther.Trim();


                string shizhengno = shizhengNo.Trim();
                paperArchives.archivesCount = (int.Parse(paperArchives.archivesCount) + 1).ToString();
                //int volCount = 0;
                //int.TryParse(paperArchives.archivesCount, out volCount);
                int vol = Convert.ToInt32(archive.volNo);

                if (vol == 1)
                {
                    paperArchives.shizhengNoStart = shizhengno;
                }
                if (vol == int.Parse(paperArchives.archivesCount))
                {
                    paperArchives.shizhengNoEnd = shizhengno;
                }

                if (ModelState.IsValid)
                {
                    cb.Entry(paperArchives).State = EntityState.Modified;
                    cb.SaveChanges();
                    return(Content("<script >alert('保存成功!');window.location.href='/gxArchiveManagement/AddArchive';</script >"));
                }
            }
            return(View());
        }
Exemple #2
0
        public ActionResult Index(int id, string uuid)
        {
            //string uuid = "297d413364dc4e7d81e5858c1bfcfbb5";
            var test = from ad in db.ArchivesDetail
                       where (ad.UUID == uuid)
                       select ad;

            if (test.Count() == 0)
            {
                var test1 = from ad in bb.gxArchivesDetail
                            where (ad.UUID == uuid)
                            select ad;

                if (test1.Count() == 0)
                {
                    return(HttpNotFound());;
                }
                //管线数据
                gxArchivesDetail gxArchivesDetail  = test1.First();
                long             paperProjectSeqNo = gxArchivesDetail.paperProjectSeqNo;
                var n = from a in bb.gxPaperArchives
                        where a.paperProjectSeqNo == paperProjectSeqNo
                        select a;
                gxPaperArchives gxPaperArchives = n.First();

                var n1 = from a in bb.gxProjectInfo
                         where a.projectID == gxPaperArchives.projectID
                         where a.isNB == "外部"
                         select a;
                gxProjectInfo gxProjectInfo = n1.First();

                ViewBag.projectName              = gxProjectInfo.projectName;              //工程名称
                ViewBag.location                 = gxProjectInfo.location;                 //工程地点
                ViewBag.developmentOrganization  = gxProjectInfo.developmentOrganization;  //建设单位
                ViewBag.devolonpentOrgContacter  = gxProjectInfo.devolonpentOrgContacter;  //建设单位联系人
                ViewBag.mobilephoneNoDevelopment = gxProjectInfo.mobilephoneNoDevelopment; //建设单位联系人电话

                ViewBag.constructionOrganization = gxProjectInfo.constructionOrganization; //施工单位
                ViewBag.constructionOrgContacter = gxProjectInfo.constructionOrgContacter; //施工单位法人
                ViewBag.telphoneNoDevelopment    = gxProjectInfo.telphoneNoDevelopment;    //施工单位电话

                ViewBag.disignOrganization   = gxProjectInfo.disignOrganization;           //设计单位
                ViewBag.designOrgaContacter  = gxProjectInfo.designOrgaContacter;          //设计单位联系人
                ViewBag.telphoneNoDesignOrga = gxProjectInfo.telphoneNoDesignOrga;         //设计者

                ViewBag.jianliUnit           = gxProjectInfo.jianliUnit;                   //监理单位
                ViewBag.jianliUnitContacter  = gxProjectInfo.jianliUnitContacter;          //监理单位负责人
                ViewBag.telphoneNoJianliUnit = gxProjectInfo.telphoneNoJianliUnit;         //监理者

                ViewBag.Kcdw     = gxProjectInfo.Kcdw;                                     //勘察单位
                ViewBag.Kcdwlxr  = gxProjectInfo.Kcdwlxr;                                  //勘察单位负责人
                ViewBag.Kcdwlxdh = gxProjectInfo.Kcdwlxdh;                                 //勘察单位电话


                //ViewBag.jgdate = Convert.ToDateTime(gxArchivesDetail.jgDate).ToString("yyyy-MM-dd");//进馆时间
                ViewBag.kaigongTime      = Convert.ToDateTime(gxArchivesDetail.kaigongTime).ToString("yyyy-MM-dd"); //开工时间
                ViewBag.jungongTime      = Convert.ToDateTime(gxArchivesDetail.jungongTime).ToString("yyyy-MM-dd"); //竣工时间
                ViewBag.archivesTitle    = gxArchivesDetail.archivesTitle;                                          //案卷题名
                ViewBag.firstResponsible = gxArchivesDetail.firstResponsible;                                       //责任者
                ViewBag.bianzhiTime      = gxArchivesDetail.bianzhiTime;                                            //编制时间
                ViewBag.indexer          = gxArchivesDetail.indexer;                                                //立卷人
                ViewBag.indexDate        = Convert.ToDateTime(gxArchivesDetail.indexDate).ToString("yyyy-MM-dd");;  //立卷时间
                ViewBag.key1             = gxArchivesDetail.key1;                                                   //主题词
                ViewBag.remarks          = gxArchivesDetail.remarks;                                                //备注

                var gxfileInfo = from ad in bb.gxFileInfo
                                 select ad;
                gxfileInfo     = gxfileInfo.Where(ad => ad.archivesNo.ToString().Equals(gxArchivesDetail.archivesNo));//根据档号搜索
                gxfileInfo     = gxfileInfo.OrderBy(s => s.ID).Take(1000);
                ViewBag.result = JsonConvert.SerializeObject(gxfileInfo);
                return(View());
            }
            else
            {
                //竣工数据
                ArchivesDetail ArchivesDetail    = test.First();
                long           paperProjectSeqNo = ArchivesDetail.paperProjectSeqNo;
                var            n = from a in db.PaperArchives
                                   where a.paperProjectSeqNo == paperProjectSeqNo
                                   select a;
                if (n.Count() == 0)
                {
                    return(Content("<script >alert('找不到工程文件!');</script >"));
                }
                PaperArchives PaperArchives = n.First();

                var n1 = from a in db.ProjectInfo
                         where a.projectID == PaperArchives.projectID
                         select a;
                ProjectInfo ProjectInfo = n1.First();

                ViewBag.projectName              = ProjectInfo.projectName;              //工程名称
                ViewBag.location                 = ProjectInfo.location;                 //工程地点
                ViewBag.developmentOrganization  = ProjectInfo.developmentOrganization;  //建设单位
                ViewBag.devolonpentOrgContacter  = ProjectInfo.devolonpentOrgContacter;  //建设单位联系人
                ViewBag.mobilephoneNoDevelopment = ProjectInfo.mobilephoneNoDevelopment; //建设单位联系人电话

                ViewBag.constructionOrganization = ProjectInfo.constructionOrganization; //施工单位
                ViewBag.constructionOrgContacter = ProjectInfo.constructionOrgContacter; //施工单位法人
                ViewBag.telphoneNoDevelopment    = ProjectInfo.telphoneNoDevelopment;    //施工单位电话

                ViewBag.disignOrganization   = ProjectInfo.disignOrganization;           //设计单位
                ViewBag.designOrgaContacter  = ProjectInfo.designOrgaContacter;          //设计单位联系人
                ViewBag.telphoneNoDesignOrga = ProjectInfo.telphoneNoDesignOrga;         //设计者

                ViewBag.jianliUnit           = ProjectInfo.jianliUnit;                   //监理单位
                ViewBag.jianliUnitContacter  = ProjectInfo.jianliUnitContacter;          //监理单位负责人
                ViewBag.telphoneNoJianliUnit = ProjectInfo.telphoneNoJianliUnit;         //监理者

                ViewBag.Kcdw     = ProjectInfo.Kcdw;                                     //勘察单位
                ViewBag.Kcdwlxr  = ProjectInfo.Kcdwlxr;                                  //勘察单位负责人
                ViewBag.Kcdwlxdh = ProjectInfo.Kcdwlxdh;                                 //勘察单位电话


                //ViewBag.jgdate = Convert.ToDateTime(ArchivesDetail.jgDate).ToString("yyyy-MM-dd");//进馆时间
                ViewBag.kaigongTime      = Convert.ToDateTime(ArchivesDetail.kaigongTime).ToString("yyyy-MM-dd"); //开工时间
                ViewBag.jungongTime      = Convert.ToDateTime(ArchivesDetail.jungongTime).ToString("yyyy-MM-dd"); //竣工时间
                ViewBag.archivesTitle    = ArchivesDetail.archivesTitle;                                          //案卷题名
                ViewBag.firstResponsible = ArchivesDetail.firstResponsible;                                       //责任者
                ViewBag.bianzhiTime      = ArchivesDetail.bianzhiTime;                                            //编制时间
                ViewBag.indexer          = ArchivesDetail.indexer;                                                //立卷人
                ViewBag.indexDate        = Convert.ToDateTime(ArchivesDetail.indexDate).ToString("yyyy-MM-dd");;  //立卷时间
                ViewBag.key1             = ArchivesDetail.key1;                                                   //主题词
                ViewBag.remarks          = ArchivesDetail.remarks;                                                //备注

                var fileInfo = from ad in db.FileInfo
                               select ad;
                fileInfo       = fileInfo.Where(ad => ad.archivesNo.ToString().Equals(ArchivesDetail.archivesNo));//根据档号搜索
                fileInfo       = fileInfo.OrderBy(s => s.id).Take(1000);
                ViewBag.result = JsonConvert.SerializeObject(fileInfo);

                if (ArchivesDetail == null)
                {
                    return(HttpNotFound());
                }
                return(View());
            }
        }