示例#1
0
        private string GetData()
        {
            context.Response.ContentType = "application/json";
            DataClassesDataContext dc = new DataClassesDataContext();
            String F_projectID = context.Session[SessionMgm.ProjectID].ToString();
            String guideID = null, result = "";

            if ("sci".Equals(paras["type"]))
            {
                ScienceProject sp = dc.ScienceProject.SingleOrDefault(_sp => _sp.F_ID.Equals(F_projectID));
                if (sp != null)
                {
                    guideID = sp.F_guideProjectID;
                }
            }
            else if ("social".Equals(paras["type"]))
            {
                EducationV2.SocialProject sp = dc.SocialProject.SingleOrDefault(_sp => _sp.F_ID.Equals(F_projectID));
                if (sp != null)
                {
                    guideID = sp.F_guideProjectID;
                }
            }
            if (String.IsNullOrEmpty(guideID) == false)
            {
                ProjectDetail pd = dc.ProjectDetail.SingleOrDefault(_pd => _pd.F_ID.Equals(guideID));
                result = UtilHelper.GetJSON(pd);
            }
            return(result);
        }
示例#2
0
        private void fillContent(WordHelper helper, ScienceProject project)
        {
            Type sciType = project.GetType();

            System.Reflection.PropertyInfo[] properties = sciType.GetProperties();
            foreach (System.Reflection.PropertyInfo property in properties)
            {
                if (property.GetValue(project, null) != null)
                {
                    String value = property.GetValue(project, null).ToString();
                    String name  = property.Name;
                    helper.Replace(name, value);
                }
            }
            String F_type = "重点(  )产学研(  )一般(  );B类(  )";

            switch (project.F_type)
            {
            case "重点": F_type = "重点( √ )产学研(  )一般(  );B类(  )"; break;

            case "产学研": F_type = "重点(  )产学研( √ )一般(  );B类(  )"; break;

            case "一般": F_type = "重点(  )产学研(  )一般( √ );B类(  )"; break;

            case "B类": F_type = "重点(  )产学研(  )一般(  );B类( √ )"; break;
            }

            helper.Replace("F_type1", F_type);
            helper.Replace("F_name1", project.F_name);
            helper.Replace("F_belongeddomain1", project.F_belongeddomain);
            helper.Replace("F_belongeddomain2", project.F_belongDomain2);
        }
示例#3
0
        private void ExportWord()
        {
            WordHelper helper = new WordHelper();
            String     file   = Server.MapPath("/resource/sciProject.dot");

            helper.CreateNewWordDocument(file);
            DataClassesDataContext dc = new DataClassesDataContext();
            String         F_ID       = Session[SessionMgm.SciProjectID].ToString();
            ScienceProject project    = dc.ScienceProject.SingleOrDefault(sp => sp.F_ID.Equals(F_ID));

            if (project != null)
            {
                fillContent(helper, project);
            }
            project.F_name = UtilHelper.getValidatePath(project.F_name);
            String fileName = Server.MapPath("/resource/" + project.F_name + ".doc");
            bool   result   = helper.SaveAs(fileName);

            helper.Close();
            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "Application/msword";
            Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(project.F_name) + ".doc");
            Response.TransmitFile(fileName);
            Response.Flush();
            Response.Close();
            Response.End();
        }
示例#4
0
        private void fillParticipants(WordHelper helper, ScienceProject project)
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            var participants          = dc.ApplicantMember.Where(am => am.F_applicantID.Equals(project.F_ID)).OrderBy(am => am.F_seq);

            if (helper.FindTable("F_participants"))
            {
                foreach (ApplicantMember member in participants)
                {
                    helper.MoveNextRow();
                    User user = dc.User.SingleOrDefault(us => us.F_ID.Equals(member.F_userID));
                    helper.SetCellValue(member.F_realName);
                    helper.MoveNextCell();
                    helper.SetCellValue(member.F_title);
                    helper.MoveNextCell();
                    helper.SetCellValue(member.F_expert);
                    helper.MoveNextCell();
                    helper.SetCellValue(member.F_duty);
                    helper.MoveNextCell();
                    helper.SetCellValue(member.F_workspace);
                    helper.MoveNextCell();
                    helper.SetCellValue("");
                }
            }
        }
示例#5
0
        protected void btnApproval_Click(object sender, EventArgs e)
        {
            DataClassesDataContext dc  = new DataClassesDataContext();
            List <String>          ids = GetSelectedIDs();

            foreach (String id in ids)
            {
                ScienceProject sciProject = dc.ScienceProject.SingleOrDefault(_sp => _sp.F_ID.Equals(id));
                if (sciProject != null)
                {
                    Services.SciProject.CreateAcceptProject(dc, sciProject);
                    sciProject.F_status = ProjectStatus.Approval;
                    dc.SubmitChanges();
                }
                else
                {
                    SocialProject socialProject = dc.SocialProject.SingleOrDefault(_sp => _sp.F_ID.Equals(id));
                    if (socialProject != null)
                    {
                        Services.SocialProject.CreateAcceptProject(dc, socialProject);
                        socialProject.F_status = ProjectStatus.Approval;
                        dc.SubmitChanges();
                    }
                }
            }
            GridView1.DataBind();
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bool isVisible = false;
                if (Session[SessionMgm.PageJumtType] == null)
                {
                    return;
                }

                String jumpType = Session[SessionMgm.PageJumtType].ToString();
                if (jumpType.Equals(PageJumpType.SCI))
                {
                    String F_ID = Session[SessionMgm.SciProjectID].ToString();
                    DataClassesDataContext dc  = new DataClassesDataContext();
                    ScienceProject         sci = dc.ScienceProject.SingleOrDefault(_sp => _sp.F_ID.Equals(F_ID));
                    if (sci != null)
                    {
                        if (sci.F_status.Equals(ProjectStatus.Deny) || sci.F_status.Equals(ProjectStatus.Draft))
                        {
                            if (sci.F_leaderID.Equals(Session[SessionMgm.UserID]))
                            {
                                isVisible = true;
                            }
                        }
                    }
                }
                else if (jumpType.Equals(PageJumpType.SOCIAL))
                {
                    String F_ID = Session[SessionMgm.SocialProjectID].ToString();
                    DataClassesDataContext dc  = new DataClassesDataContext();
                    SocialProject          sci = dc.SocialProject.SingleOrDefault(_sp => _sp.F_ID.Equals(F_ID));
                    if (sci != null)
                    {
                        if (sci.F_status.Equals(ProjectStatus.Deny) || sci.F_status.Equals(ProjectStatus.Draft))
                        {
                            if (sci.F_leaderID.Equals(Session[SessionMgm.UserID]))
                            {
                                isVisible = true;
                            }
                        }
                    }
                }
                else if (jumpType.Equals(PageJumpType.ASSIGN))
                {
                    if (Session[SessionMgm.Role].Equals(RoleType.EduAdmin))
                    {
                        isVisible = true;
                    }
                    else
                    {
                        isVisible = false;
                    }
                }
                btnDel.Visible    = isVisible;
                btnAdd.Visible    = isVisible;
                btnRename.Visible = isVisible;
            }
        }
示例#7
0
        private void fillContent(WordHelper helper, ScienceProject project)
        {
            Type sciType = project.GetType();

            System.Reflection.PropertyInfo[] properties = sciType.GetProperties();
            String[] manualTypes = new String[] { "F_beginDate", "F_finishDate", "F_applicantDate" };
            foreach (System.Reflection.PropertyInfo property in properties)
            {
                if (property.GetValue(project, null) != null)
                {
                    String value = property.GetValue(project, null).ToString();
                    String name  = property.Name;
                    if (!manualTypes.Contains(name))
                    {
                        helper.Replace(name, value);
                    }
                }
            }
            String F_type = "重点(  )产学研(  )一般(  );B类(  )";

            switch (project.F_type)
            {
            case "重点": F_type = "重点( √ )产学研(  )一般(  );B类(  )"; break;

            case "产学研": F_type = "重点(  )产学研( √ )一般(  );B类(  )"; break;

            case "一般": F_type = "重点(  )产学研(  )一般( √ );B类(  )"; break;

            case "B类": F_type = "重点(  )产学研(  )一般(  );B类( √ )"; break;
            }
            if (project.F_beginDate != null)
            {
                helper.Replace("F_beginDate", project.F_beginDate.Value.ToShortDateString());
            }
            if (project.F_finishDate != null)
            {
                helper.Replace("F_finishDate", project.F_finishDate.Value.ToShortDateString());
            }
            if (project.F_applicantDate != null)
            {
                helper.Replace("F_applicantDate", project.F_applicantDate.Value.ToShortDateString());
            }
            helper.Replace("F_type1", F_type);
            helper.Replace("F_name1", project.F_name);
            helper.Replace("F_belongeddomain1", project.F_belongeddomain);
            helper.Replace("F_belongeddomain2", project.F_belongDomain2);
            helper.Replace("F_belongedSubject1", project.F_belongedSubject);
            helper.Replace("F_belongedSubject2", project.F_belongSubject2);
            helper.Replace("F_leader1", project.F_leader);
            helper.Replace("F_totalFund2", project.F_totalFund.ToString());
            if (project.F_cooperator1Comment != null)
            {
                helper.Replace("F_cooperator1Comment", project.F_cooperator1Comment);
            }
            if (project.F_cooperator1Date != null)
            {
                helper.Replace("F_cooperator1Date", project.F_cooperator1Date.Value.ToShortDateString());
            }
        }
示例#8
0
        private void Commit()
        {
            DataClassesDataContext dc         = new DataClassesDataContext();
            ScienceProject         sciProject = dc.ScienceProject.Single(c => c.F_ID.Equals(F_ID));

            sciProject.F_status = ProjectStatus.UnderDeptAudit;
            dc.SubmitChanges();
        }
示例#9
0
        private void SavePage4()
        {
            DataClassesDataContext dc         = new DataClassesDataContext();
            ScienceProject         sciProject = dc.ScienceProject.Single(c => c.F_ID.Equals(F_ID));

            sciProject.F_scientificBasis = paras["F_scientificBasis"];
            dc.SubmitChanges();
        }
示例#10
0
        private void SavePage3()
        {
            DataClassesDataContext dc         = new DataClassesDataContext();
            ScienceProject         sciProject = dc.ScienceProject.Single(c => c.F_ID.Equals(F_ID));

            sciProject.F_belongDomain2   = paras["frm3_domain2"];
            sciProject.F_researchType    = paras["frm3_researchType"];
            sciProject.F_belongedSubject = paras["frm_subject1"];
            sciProject.F_belongSubject2  = paras["frm_subject2"];
            if (!String.IsNullOrWhiteSpace(paras["frm3_startTime"]))
            {
                sciProject.F_beginDate = DateTime.Parse(paras["frm3_startTime"]);
            }

            if (!String.IsNullOrWhiteSpace(paras["frm3_endTime"]))
            {
                sciProject.F_finishDate = DateTime.Parse(paras["frm3_endTime"]);
            }
            if (!String.IsNullOrWhiteSpace(paras["frm3_applyMoney"]))
            {
                sciProject.F_applicantMoney = UtilHelper.ParseDecimal(paras["frm3_applyMoney"]);
            }
            sciProject.F_address = paras["frm3_address"];

            sciProject.F_relyOnTeam = paras["frm3_team"];
            if (!String.IsNullOrWhiteSpace(paras["F_totalparticipant"]))
            {
                sciProject.F_totalparticipant = int.Parse(paras["F_totalparticipant"]);
            }
            if (!String.IsNullOrWhiteSpace(paras["F_senior"]))
            {
                sciProject.F_senior = int.Parse(paras["F_senior"]);
            }
            if (!String.IsNullOrWhiteSpace(paras["F_middle"]))
            {
                sciProject.F_middle = int.Parse(paras["F_middle"]);
            }
            if (!String.IsNullOrWhiteSpace(paras["F_junior"]))
            {
                sciProject.F_junior = int.Parse(paras["F_junior"]);
            }
            if (!String.IsNullOrWhiteSpace(paras["F_assist"]))
            {
                sciProject.F_assist = int.Parse(paras["F_assist"]);
            }
            sciProject.F_majorCooperator  = paras["F_majorCooperator"];
            sciProject.F_contentAndResult = paras["F_contentAndResult"];
            sciProject.F_country          = paras["frm3_leaderGrandCountry"];
            sciProject.F_keywords         = paras["F_keywords"];

            sciProject.F_sexual    = paras["F_sexual"];
            sciProject.F_idNumber  = paras["F_IDNumber"];
            sciProject.F_education = paras["F_education"];
            sciProject.F_degree    = paras["F_degree"];
            sciProject.F_title     = paras["F_title"];

            dc.SubmitChanges();
        }
示例#11
0
        private void SavePage7()
        {
            DataClassesDataContext dc         = new DataClassesDataContext();
            ScienceProject         sciProject = dc.ScienceProject.Single(c => c.F_ID.Equals(F_ID));

            sciProject.F_condition = paras["F_condition"];

            dc.SubmitChanges();
        }
示例#12
0
        private void SavePage5()
        {
            DataClassesDataContext dc         = new DataClassesDataContext();
            ScienceProject         sciProject = dc.ScienceProject.Single(c => c.F_ID.Equals(F_ID));

            sciProject.F_content     = paras["F_content"];
            sciProject.F_finalOutput = paras["F_finalOutput"];
            dc.SubmitChanges();
        }
示例#13
0
        private void SavePage6()
        {
            DataClassesDataContext dc         = new DataClassesDataContext();
            ScienceProject         sciProject = dc.ScienceProject.Single(c => c.F_ID.Equals(F_ID));

            sciProject.F_approach   = paras["F_approach"];
            sciProject.F_assignment = paras["F_assignment"];
            dc.SubmitChanges();
        }
示例#14
0
        private void SavePage9()
        {
            DataClassesDataContext dc         = new DataClassesDataContext();
            ScienceProject         sciProject = dc.ScienceProject.SingleOrDefault(c => c.F_ID.Equals(F_ID));

            sciProject.F_recommendContent   = paras["F_recommendContent"];
            sciProject.F_recommendName      = paras["F_recommendName"];
            sciProject.F_recommendTitle     = paras["F_recommendTitle"];
            sciProject.F_recommendExpert    = paras["F_recommendExpert"];
            sciProject.F_recommendWorkspace = paras["F_recommendWorkspace"];

            var existMembers = dc.ApplicantMember.Where(am => am.F_applicantID.Equals(F_ID));

            dc.ApplicantMember.DeleteAllOnSubmit(existMembers);
            foreach (ApplicantMember member in existMembers)
            {
                User user = dc.User.SingleOrDefault(_user => _user.F_ID.Equals(member.F_userID));
                if (user != null && user.F_Role.Equals(RoleType.ProjectMember))
                {
                    dc.User.DeleteOnSubmit(user);
                }
            }
            if (!String.IsNullOrWhiteSpace(paras["F_userID"]))
            {
                String[] F_userIDs          = paras["F_userID"].Split(new char[] { ',' });
                String[] F_memberDutys      = paras["F_memberDuty"].Split(new char[] { ',' });
                String[] F_memberExperts    = paras["F_memberExpert"].Split(new char[] { ',' });
                String[] F_memberNames      = paras["F_memberName"].Split(new char[] { ',' });
                String[] F_memberTitles     = paras["F_memberTitle"].Split(new char[] { ',' });
                String[] F_memberWorkspaces = paras["F_memberWorkspace"].Split(new char[] { ',' });
                String[] F_seqs             = paras["F_seq"].Split(new char[] { ',' });
                for (int i = 0; i < F_userIDs.Length; i++)
                {
                    if (F_userIDs[i].Trim().Length == 0)
                    {
                        continue;
                    }
                    ApplicantMember member = new ApplicantMember();
                    member.F_applicantID = F_ID;
                    member.F_ID          = Guid.NewGuid().ToString();
                    member.F_userID      = F_userIDs[i];
                    member.F_expert      = F_memberExperts[i];
                    member.F_duty        = F_memberDutys[i];
                    member.F_realName    = F_memberNames[i];
                    member.F_title       = F_memberTitles[i];
                    member.F_workspace   = F_memberWorkspaces[i];
                    member.F_seq         = UtilHelper.ParseInt(F_seqs[i]);
                    dc.ApplicantMember.InsertOnSubmit(member);
                }
            }
            dc.SubmitChanges();
        }
示例#15
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     if (!IsPostBack)
     {
         bool   showSave = false, showCommit = false;
         String fileName = Request.Path;
         fileName = fileName.Substring(fileName.IndexOf(Tag) + Tag.Length);
         String strPageIndex               = fileName.Substring(0, fileName.IndexOf('.'));
         int    pageIndex                  = int.Parse(strPageIndex);
         String F_ID                       = Session[SessionMgm.SciProjectID].ToString();
         DataClassesDataContext dc         = new DataClassesDataContext();
         ScienceProject         sciProject = dc.ScienceProject.SingleOrDefault(c => c.F_ID.Equals(F_ID));
         if (sciProject == null)
         {
             showSave = true;
         }
         else
         {
             if (Session[SessionMgm.UserID].Equals(sciProject.F_leaderID))
             {
                 showSave = true;
                 ProjectDetail guide = dc.ProjectDetail.SingleOrDefault(pd => pd.F_ID.Equals(sciProject.F_guideProjectID));
                 if (guide != null && guide.F_startDate.Value.Date <= DateTime.Now.Date && DateTime.Now.Date <= guide.F_endDate.Value.Date)
                 {
                     showCommit = true;
                 }
             }
             if (sciProject.F_status.Equals(ProjectStatus.Deny) == false && sciProject.F_status.Equals(ProjectStatus.Draft) == false)
             {
                 showCommit = false;
                 showSave   = false;
             }
         }
         if (showSave)
         {
             litContent = "<input id='btnSave' type='button' value='保 存' onclick='savePage(" + pageIndex + ")' class='btn' /> ";
         }
         if (showCommit)
         {
             litContent += "  <input id='btnSubmit' type='button' value='提 交' onclick='commit(" + pageIndex + ")' class='btn' />";
         }
         if (litContent.Length > 0)
         {
             litContent = " <div class='systitleline'>" + litContent + "</div>";
         }
     }
 }
示例#16
0
        private string InitialPage()
        {
            context.Response.ContentType = "application/json";
            String F_ID                       = context.Session[SessionMgm.SciProjectID].ToString();
            int    pageNum                    = int.Parse(paras["pageNum"]);
            DataClassesDataContext dc         = new DataClassesDataContext();
            ScienceProject         sciProject = dc.ScienceProject.SingleOrDefault(c => c.F_ID.Equals(F_ID));

            if (sciProject == null)
            {
                sciProject = new ScienceProject();
                User user = dc.User.SingleOrDefault(_user => _user.F_ID.Equals(context.Session[SessionMgm.UserID]));

                sciProject.F_leader        = context.Session[SessionMgm.RealName].ToString();
                sciProject.F_leaderID      = context.Session[SessionMgm.UserID].ToString();
                sciProject.F_dept          = user.F_workDept;
                sciProject.F_email         = user.F_email;
                sciProject.F_phone         = user.F_phone;
                sciProject.F_applicantDate = DateTime.Now;
            }

            if (pageNum != 4)
            {
                sciProject.F_scientificBasis = "";
            }

            if (pageNum != 5)
            {
                sciProject.F_content     = "";
                sciProject.F_finalOutput = "";
            }
            if (pageNum != 6)
            {
                sciProject.F_approach   = "";
                sciProject.F_assignment = "";
            }
            if (pageNum != 7)
            {
                sciProject.F_condition = "";
            }
            if (pageNum == 3)
            {
            }

            return(UtilHelper.GetJSON(sciProject));
        }
示例#17
0
        private void SavePage1()
        {
            bool create = false;
            DataClassesDataContext dc         = new DataClassesDataContext();
            ScienceProject         sciProject = dc.ScienceProject.SingleOrDefault(c => c.F_ID.Equals(F_ID));

            if (sciProject == null)
            {
                create              = true;
                sciProject          = new ScienceProject();
                sciProject.F_ID     = F_ID;
                sciProject.F_status = ProjectStatus.Draft;
            }
            sciProject.F_type            = paras["F_type"];
            sciProject.F_belongeddomain  = paras["F_belongeddomain"];
            sciProject.F_belongedSubject = paras["F_belongedSubject"];
            sciProject.F_name            = paras["F_name"];
            sciProject.F_leaderID        = paras["F_leaderID"];
            sciProject.F_leader          = paras["F_leader"];
            sciProject.F_dept            = paras["F_dept"];
            sciProject.F_phone           = paras["F_phone"];
            sciProject.F_email           = paras["F_email"];
            sciProject.F_unitID          = paras["F_unitID"];
            sciProject.F_guideProjectID  = paras["F_guideProjectID"];
            if (!String.IsNullOrWhiteSpace(paras["F_applicantDate"]))
            {
                sciProject.F_applicantDate = DateTime.Parse(paras["F_applicantDate"]);
            }

            if (!String.IsNullOrWhiteSpace(sciProject.F_leaderID))
            {
                User user = dc.User.Single(u => u.F_ID.Equals(sciProject.F_leaderID));
                sciProject.F_sexual    = user.F_sexual;
                sciProject.F_idNumber  = user.F_idNumber;
                sciProject.F_education = user.F_highestEducation;
                sciProject.F_degree    = user.F_highestDegree;
                sciProject.F_title     = user.F_title;
                sciProject.F_unitID    = user.F_belongUnitID;
                ExpertBll.SetPrincipal(F_ID, user);
            }
            if (create)
            {
                dc.ScienceProject.InsertOnSubmit(sciProject);
            }
            dc.SubmitChanges();
        }
示例#18
0
        private void fillAudit(WordHelper helper, ScienceProject project)
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            var deptAudit             = dc.AuditOpinion.SingleOrDefault(ao => ao.F_projectID.Equals(project.F_ID) && ao.F_type.Equals(RoleType.DeptAdmin));

            if (deptAudit != null)
            {
                helper.Replace("F_deptComment", deptAudit.F_content);
                if (deptAudit.F_date != null)
                {
                    helper.Replace("F_deptDate", deptAudit.F_date.Value.ToLongDateString());
                }
            }
            var teamAudit = dc.AuditOpinion.SingleOrDefault(ao => ao.F_projectID.Equals(project.F_ID) && ao.F_type.Equals(RoleType.TeamAdmin));

            if (teamAudit != null)
            {
                helper.Replace("F_teamComment", teamAudit.F_content);
                if (teamAudit.F_date != null)
                {
                    helper.Replace("F_teamDate", teamAudit.F_date.Value.ToLongDateString());
                }
            }

            var schoAudit = dc.AuditOpinion.SingleOrDefault(ao => ao.F_projectID.Equals(project.F_ID) && ao.F_type.Equals(RoleType.SchoolAdmin));

            if (schoAudit != null)
            {
                helper.Replace("F_scholComment", schoAudit.F_content);
                if (schoAudit.F_date != null)
                {
                    helper.Replace("F_scholDate", schoAudit.F_date.Value.ToLongDateString());
                }
            }

            var eduAudit = dc.AuditOpinion.SingleOrDefault(ao => ao.F_projectID.Equals(project.F_ID) && ao.F_type.Equals(RoleType.EduAdmin));

            if (eduAudit != null)
            {
                helper.Replace("F_eduComment", eduAudit.F_content);
                if (eduAudit.F_date != null)
                {
                    helper.Replace("F_eduDate", eduAudit.F_date.Value.ToLongDateString());
                }
            }
        }
示例#19
0
        public static bool AvailToApply(ScienceProject sp)
        {
            DataClassesDataContext dc            = new DataClassesDataContext();
            AssignProject          assignProject = dc.AssignProject.SingleOrDefault(_ap => _ap.F_projectID.Equals(sp.F_guideProjectID) &&
                                                                                    _ap.F_unitID.Equals(sp.F_unitID));
            int usedProjectCount = dc.ViewAuditedBySchool.Count(_vad => _vad.F_guideProjectID.Equals(sp.F_guideProjectID) &&
                                                                _vad.F_type.Equals(sp.F_type) && sp.F_unitID.Equals(_vad.F_unitID));
            int assignCount = 0;

            switch (sp.F_type)
            {
            case "重点": assignCount = assignProject.F_sciImp.Value; break;

            case "产学研": assignCount = assignProject.F_sciIndustry.Value; break;

            case "一般": assignCount = assignProject.F_sciNormal.Value; break;

            case "B类": assignCount = assignProject.F_sciB.Value; break;
            }
            if (assignCount == -1 || sp.F_type.Equals("B类"))  //-1或B类表示不限项,令可用项为最大值
            {
                assignCount = int.MaxValue;
            }
            if (assignCount <= usedProjectCount)
            {
                return(false);
            }

            if (assignProject.F_amount == -1)
            {
                return(true);
            }
            decimal?sumOfSci = (from m in dc.ViewAuditedBySchool
                                where m.F_projectType.Equals("科技项目") && m.F_type.Equals("B类") == false && m.F_guideProjectID.Equals(sp.F_guideProjectID) && sp.F_unitID.Equals(m.F_unitID)
                                select m.F_fund).Sum();
            decimal?sumOfSocial = (from m in dc.ViewAuditedBySchool
                                   where m.F_projectType.Equals("社科项目") && m.F_type.Equals("B类项目") == false && m.F_guideProjectID.Equals(sp.F_guideProjectID) && sp.F_unitID.Equals(m.F_unitID)
                                   select m.F_fund).Sum();

            if (sumOfSci + sumOfSocial + sp.F_totalFund <= assignProject.F_amount)
            {
                return(true);
            }
            return(false);
        }
示例#20
0
        private string GetStatus()
        {
            context.Response.ContentType = "text/plain";
            DataClassesDataContext dc = new DataClassesDataContext();

            ScienceProject sciProject = dc.ScienceProject.SingleOrDefault(c => c.F_ID.Equals(F_ID));

            if (sciProject == null)
            {
                return(ProjectStatus.Draft);
            }
            if (!context.Session[SessionMgm.UserID].Equals(sciProject.F_leaderID))
            {
                return(ProjectStatus.Commit);
            }

            return(sciProject.F_status);
        }
示例#21
0
        private void ExportWord()
        {
            HttpResponse Response = context.Response;
            WordHelper   helper   = new WordHelper();
            String       file     = context.Server.MapPath("/resource/sciProject.dot");

            helper.CreateNewWordDocument(file);
            DataClassesDataContext dc = new DataClassesDataContext();
            String         F_ID       = paras["id"].ToString();
            ScienceProject project    = dc.ScienceProject.SingleOrDefault(sp => sp.F_ID.Equals(F_ID));

            if (project != null)
            {
                fillContent(helper, project);
            }

            String fileName = context.Server.MapPath("/resource/projectName.doc");
            bool   result   = helper.SaveAs(fileName);

            helper.Close();
            Response.Clear();
        }
示例#22
0
        private void SavePage10()
        {
            DataClassesDataContext dc         = new DataClassesDataContext();
            ScienceProject         sciProject = dc.ScienceProject.Single(c => c.F_ID.Equals(F_ID));

            sciProject.F_cooperator1Comment = paras["F_cooperator1Comment"];
            if (String.IsNullOrEmpty(paras["F_cooperator1Date"].ToString()) == false)
            {
                sciProject.F_cooperator1Date = DateTime.Parse(paras["F_cooperator1Date"]);
            }
            sciProject.F_cooperator2Comment = paras["F_cooperator2Comment"];
            if (String.IsNullOrEmpty(paras["F_cooperator2Date"].ToString()) == false)
            {
                sciProject.F_cooperator2Date = DateTime.Parse(paras["F_cooperator2Date"]);
            }
            sciProject.F_cooperator3Comment = paras["F_cooperator3Comment"];
            if (String.IsNullOrEmpty(paras["F_cooperator3Date"].ToString()) == false)
            {
                sciProject.F_cooperator3Date = DateTime.Parse(paras["F_cooperator3Date"]);
            }

            dc.SubmitChanges();
        }
示例#23
0
        protected void btnDeny_Click(object sender, EventArgs e)
        {
            DataClassesDataContext dc  = new DataClassesDataContext();
            List <String>          ids = GetSelectedIDs();

            foreach (String id in ids)
            {
                ScienceProject sciProject = dc.ScienceProject.SingleOrDefault(_sp => _sp.F_ID.Equals(id));
                if (sciProject != null)
                {
                    sciProject.F_status = ProjectStatus.Deny;
                }
                else
                {
                    SocialProject socialProject = dc.SocialProject.SingleOrDefault(_sp => _sp.F_ID.Equals(id));
                    if (socialProject != null)
                    {
                        socialProject.F_status = ProjectStatus.Deny;
                    }
                }
                dc.SubmitChanges();
            }
            GridView1.DataBind();
        }
示例#24
0
        protected void Label1_Click(object sender, EventArgs e)
        {
            WordHelper helper = new WordHelper();
            String     file   = Server.MapPath("/resource/sciProject.dot");

            helper.CreateNewWordDocument(file);
            DataClassesDataContext dc = new DataClassesDataContext();
            String         F_ID       = (sender as LinkButton).CommandArgument;
            ScienceProject project    = dc.ScienceProject.SingleOrDefault(sp => sp.F_ID.Equals(F_ID));

            fillContent(helper, project);
            fillParticipants(helper, project);
            fillAudit(helper, project);
            project.F_name = UtilHelper.getValidatePath(project.F_name);
            String fileName = Server.MapPath("/resource/" + project.F_name + ".doc");
            bool   result   = helper.SaveAs(fileName);

            helper.Close();
            Response.Clear();
            Response.ContentType = "Application/msword";
            Response.AddHeader("content-disposition", "attachment;filename=" + HttpUtility.HtmlEncode(Path.GetFileName(fileName)));
            Response.TransmitFile(fileName);
            Response.End();
        }
示例#25
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "ret")
     {
         String role = Session[SessionMgm.Role].ToString();
         String id   = e.CommandArgument.ToString();
         DataClassesDataContext dc      = new DataClassesDataContext();
         ScienceProject         project = dc.ScienceProject.SingleOrDefault(_sp => _sp.F_ID.Equals(id));
         if (project.F_status.Equals(ProjectStatus.UnderEducationAudit) && role.Equals(RoleType.SchoolAdmin))
         {
             project.F_status = ProjectStatus.UnderSchoolAudit;
         }
         else if (project.F_status.Equals(ProjectStatus.UnderSchoolAudit) && role.Equals(RoleType.DeptAdmin))
         {
             project.F_status = ProjectStatus.UnderDeptAudit;
         }
         else if (project.F_status.Equals(ProjectStatus.UnderDeptAudit) && role.Equals(RoleType.Expert))
         {
             project.F_status = ProjectStatus.Draft;
         }
         dc.SubmitChanges();
         Response.Redirect("frmSciProjectList.aspx");
     }
 }
示例#26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         String projectID          = Session[SessionMgm.ProjectID].ToString();
         DataClassesDataContext dc = new DataClassesDataContext();
         String         guideID    = "";
         ScienceProject sp         = dc.ScienceProject.SingleOrDefault(_sp => _sp.F_ID.Equals(projectID));
         if (sp != null)
         {
             guideID = sp.F_guideProjectID;
         }
         else
         {
             SocialProject sop = dc.SocialProject.SingleOrDefault(_sp => _sp.F_ID.Equals(projectID));
             guideID = sop.F_guideProjectID;
         }
         IQueryable <AssignProject> assignProjects = dc.AssignProject.Where(_ap => _ap.F_authro.Value == true && _ap.F_projectID.Equals(guideID));
         ddlDelegate.DataSource     = assignProjects;
         ddlDelegate.DataValueField = "F_unitID";
         ddlDelegate.DataTextField  = "F_unitName";
         ddlDelegate.DataBind();
     }
 }
示例#27
0
        public static void CreateAcceptProject(DataClassesDataContext dc, ScienceProject project)
        {
            var aps = dc.AcceptProject.Where(apss => apss.F_projectID.Equals(project.F_ID));

            dc.AcceptProject.DeleteAllOnSubmit(aps);
            AcceptProject acceptProject = new AcceptProject();

            EducationV2.User user = dc.User.SingleOrDefault(us => us.F_ID.Equals(project.F_leaderID));
            int num = dc.AcceptProject.Count();

            acceptProject.F_ID = Guid.NewGuid().ToString();
            acceptProject.F_acceptApplicantState = ProjectStatus.Draft;
            acceptProject.F_acceptedCode         = "";
            acceptProject.F_acceptNo             = DateTime.Now.ToString("yyyyMMddhh") + num.ToString();
            acceptProject.F_applicantUnit        = user.F_adminUnit;
            acceptProject.F_appliedDate          = project.F_applicantDate;
            if (project.F_applicantDate != null)
            {
                acceptProject.F_appliedYear = project.F_applicantDate.Value.Year.ToString();
            }
            acceptProject.F_executeState = ProjectStatus.Draft;
            acceptProject.F_leaderName   = user.F_userName;
            acceptProject.F_leaderID     = project.F_leaderID;
            acceptProject.F_projectID    = project.F_ID;
            acceptProject.F_projectName  = project.F_name;
            if (project.F_finishDate != null)
            {
                acceptProject.F_finishDate = project.F_finishDate.Value;
                if (DateTime.Now < project.F_finishDate.Value)
                {
                    acceptProject.F_projectState = "在研";
                }
                else
                {
                    acceptProject.F_projectState = "到期未验收";
                }
            }
            acceptProject.F_projectType = project.F_type;
            dc.AcceptProject.InsertOnSubmit(acceptProject);

            var aas = dc.AcceptApplicant.Where(_aa => _aa.F_projectID.Equals(project.F_ID));

            dc.AcceptApplicant.DeleteAllOnSubmit(aas);
            AcceptApplicant aa = new AcceptApplicant();

            aa.F_ID          = Guid.NewGuid().ToString();
            aa.F_type        = project.F_type;
            aa.F_domain      = project.F_belongeddomain;
            aa.F_name        = project.F_name;
            aa.F_acceptNo    = acceptProject.F_acceptNo;
            aa.F_leaderName  = user.F_realName;
            aa.F_projectUnit = user.F_adminUnit;
            if (project.F_totalFund != null)
            {
                aa.F_totalFund = decimal.Parse(project.F_totalFund.Value.ToString());
            }
            aa.F_projectID     = project.F_ID;
            aa.F_projectObject = project.F_finalOutput;
            aa.F_cooperator    = project.F_majorCooperator;
            aa.F_status        = EducationV2.App_Code.ProjectStatus.Draft;
            if (project.F_applicantDate != null && project.F_finishDate != null)
            {
                aa.F_startStopDate = project.F_applicantDate.Value.ToShortDateString() + "-" + project.F_finishDate.Value.ToShortDateString();
            }
            aa.F_leaderID = user.F_ID;
            dc.AcceptApplicant.InsertOnSubmit(aa);
            dc.SubmitChanges();
        }
示例#28
0
    static void Main(string[] args)
    {
        string[] inputs;
        int      projectCount = int.Parse(Console.ReadLine());

        ScienceProject[] projects = new ScienceProject[projectCount];
        Console.Error.WriteLine("My Science Projects");
        for (int i = 0; i < projectCount; i++)
        {
            inputs = Console.ReadLine().Split(' ');
            int a = int.Parse(inputs[0]);
            int b = int.Parse(inputs[1]);
            int c = int.Parse(inputs[2]);
            int d = int.Parse(inputs[3]);
            int e = int.Parse(inputs[4]);
            Console.Error.WriteLine($"Project {i} : {a} {b} {c} {d} {e}");
            projects[i] = new ScienceProject(a, b, c, d, e);
        }

        Gundam gundam = new Gundam(projects);

        // game loop
        while (true)
        {
            Robot[] robots = new Robot[2];

            for (int i = 0; i < 2; i++)
            {
                inputs = Console.ReadLine().Split(' ');
                Robot robot = new Robot(inputs);
                robots[i] = robot;
            }

            inputs = Console.ReadLine().Split(' ');
            int availableA = int.Parse(inputs[0]);
            int availableB = int.Parse(inputs[1]);
            int availableC = int.Parse(inputs[2]);
            int availableD = int.Parse(inputs[3]);
            int availableE = int.Parse(inputs[4]);
            Dictionary <MoleculeType, int> availableMolecules = new Dictionary <MoleculeType, int>();
            availableMolecules[MoleculeType.A] = availableA;
            availableMolecules[MoleculeType.B] = availableB;
            availableMolecules[MoleculeType.C] = availableC;
            availableMolecules[MoleculeType.D] = availableD;
            availableMolecules[MoleculeType.E] = availableE;


            int sampleCount = int.Parse(Console.ReadLine());



            Sample[] samples = new Sample[sampleCount];

            for (int i = 0; i < sampleCount; i++)
            {
                inputs = Console.ReadLine().Split(' ');
//                int sampleId = int.Parse(inputs[0]);
//                int carriedBy = int.Parse(inputs[1]);
//                int rank = int.Parse(inputs[2]);
//                string expertiseGain = inputs[3];
//                int health = int.Parse(inputs[4]);
//                int costA = int.Parse(inputs[5]);
//                int costB = int.Parse(inputs[6]);
//                int costC = int.Parse(inputs[7]);
//                int costD = int.Parse(inputs[8]);
//                int costE = int.Parse(inputs[9]);
                Sample sample = new Sample(inputs);
                samples[i] = sample;
            }

            Game   game     = new Game(robots, samples, availableMolecules);
            string myAction = gundam.Think(game);
            Console.WriteLine(myAction);
        }
    }
示例#29
0
 partial void DeleteScienceProject(ScienceProject instance)
 {
     ExecuteDynamicDelete(instance);
     LoggerHelper.Log("项目删除", "项目名:" + instance.F_name + ",ID:" + instance.F_ID);
 }
示例#30
0
        private void SavePage8()
        {
            DataClassesDataContext dc         = new DataClassesDataContext();
            ScienceProject         sciProject = dc.ScienceProject.Single(c => c.F_ID.Equals(F_ID));

            sciProject.F_totalInvent = ParseString(paras["F_totalInvent"]);
            if (!String.IsNullOrWhiteSpace(paras["F_firstYear"]))
            {
                sciProject.F_firstYear = IntParse(paras["F_firstYear"]);
            }
            if (!String.IsNullOrWhiteSpace(paras["F_secondYear"]))
            {
                sciProject.F_secondYear = IntParse(paras["F_secondYear"]);
            }
            if (!String.IsNullOrWhiteSpace(paras["F_thirdYear"]))
            {
                sciProject.F_thirdYear = IntParse(paras["F_thirdYear"]);
            }
            if (!String.IsNullOrWhiteSpace(paras["F_fourthYear"]))
            {
                sciProject.F_fourthYear = IntParse(paras["F_fourthYear"]);
            }
            sciProject.F_totalFund      = ParseString(paras["F_totalFund"]);
            sciProject.F_firstYearFund  = ParseString(paras["F_firstYearFund"]);
            sciProject.F_secondYearFund = ParseString(paras["F_secondYearFund"]);
            sciProject.F_thirdYearFund  = ParseString(paras["F_thirdYearFund"]);
            sciProject.F_fouthYearFund  = ParseString(paras["F_fouthYearFund"]);

            sciProject.F_totalOtherFund  = ParseString(paras["F_totalOtherFund"]);
            sciProject.F_otherDepartment = ParseString(paras["F_otherDepartment"]);
            sciProject.F_schoolFund      = ParseString(paras["F_schoolFund"]);
            sciProject.F_load            = ParseString(paras["F_load"]);
            sciProject.F_otherFund       = ParseString(paras["F_otherFund"]);


            sciProject.F_directCost  = ParseString(paras["F_directCost"]);
            sciProject.F_directFund  = ParseString(paras["F_directFund"]);
            sciProject.F_directBasis = paras["F_directBasis"];

            sciProject.F_laborCost  = ParseString(paras["F_laborCost"]);
            sciProject.F_laborFund  = ParseString(paras["F_laborFund"]);
            sciProject.F_laborBasis = paras["F_laborBasis"];

            sciProject.F_facilityCost  = ParseString(paras["F_facilityCost"]);
            sciProject.F_facilityFund  = ParseString(paras["F_facilityFund"]);
            sciProject.F_facilityBasis = paras["F_facilityBasis"];

            sciProject.F_buyFacilityCost  = ParseString(paras["F_buyFacilityCost"]);
            sciProject.F_buyFacilityFund  = ParseString(paras["F_buyFacilityFund"]);
            sciProject.F_buyFacilityBasis = paras["F_buyFacilityBasis"];

            sciProject.F_trialFacilityCost  = ParseString(paras["F_trialFacilityCost"]);
            sciProject.F_trialFacilityFund  = ParseString(paras["F_trialFacilityFund"]);
            sciProject.F_trialFacilityBasis = paras["F_trialFacilityBasis"];

            sciProject.F_repairCost  = ParseString(paras["F_repairCost"]);
            sciProject.F_repairFund  = ParseString(paras["F_repairFund"]);
            sciProject.F_repairBasis = paras["F_repairBasis"];

            sciProject.F_materialCost  = ParseString(paras["F_materialCost"]);
            sciProject.F_materialFund  = ParseString(paras["F_materialFund"]);
            sciProject.F_materialBasis = paras["F_materialBasis"];

            sciProject.F_assistCost  = ParseString(paras["F_assistCost"]);
            sciProject.F_assistFund  = ParseString(paras["F_assistFund"]);
            sciProject.F_assistBasis = paras["F_assistBasis"];

            sciProject.F_conferenceCost  = ParseString(paras["F_conferenceCost"]);
            sciProject.F_conferenceFund  = ParseString(paras["F_conferenceFund"]);
            sciProject.F_conferenceBasis = paras["F_conferenceBasis"];

            sciProject.F_tripCost  = ParseString(paras["F_tripCost"]);
            sciProject.F_tripFund  = ParseString(paras["F_tripFund"]);
            sciProject.F_tripBasis = paras["F_tripBasis"];

            sciProject.F_intellectualCost  = ParseString(paras["F_intellectualCost"]);
            sciProject.F_intellectualFund  = ParseString(paras["F_intellectualFund"]);
            sciProject.F_intellectualBasis = paras["F_intellectualBasis"];

            sciProject.F_internationCost  = ParseString(paras["F_internationCost"]);
            sciProject.F_internationFund  = ParseString(paras["F_internationFund"]);
            sciProject.F_internationBasis = paras["F_internationBasis"];

            sciProject.F_otherDirectCost  = ParseString(paras["F_otherDirectCost"]);
            sciProject.F_otherDirectFund  = ParseString(paras["F_otherDirectFund"]);
            sciProject.F_otherDirectBasis = paras["F_otherDirectBasis"];

            sciProject.F_indirectCost  = ParseString(paras["F_indirectCost"]);
            sciProject.F_indirectFund  = ParseString(paras["F_indirectFund"]);
            sciProject.F_indirectBasis = paras["F_indirectBasis"];

            sciProject.F_managerCost  = ParseString(paras["F_managerCost"]);
            sciProject.F_managerFund  = ParseString(paras["F_managerFund"]);
            sciProject.F_managerBasis = paras["F_managerBasis"];

            sciProject.F_depreciationCost  = ParseString(paras["F_depreciationCost"]);
            sciProject.F_depreciationFund  = ParseString(paras["F_depreciationFund"]);
            sciProject.F_depreciationBasis = paras["F_depreciationBasis"];

            sciProject.F_developCost  = ParseString(paras["F_developCost"]);
            sciProject.F_developFund  = ParseString(paras["F_developFund"]);
            sciProject.F_developBasis = paras["F_developBasis"];

            sciProject.F_developDirectCost  = ParseString(paras["F_developDirectCost"]);
            sciProject.F_developDirectFund  = ParseString(paras["F_developDirectFund"]);
            sciProject.F_developDirectBasis = paras["F_developDirectBasis"];

            sciProject.F_developIndirectCost  = ParseString(paras["F_developIndirectCost"]);
            sciProject.F_developIndirectFund  = ParseString(paras["F_developIndirectFund"]);
            sciProject.F_developIndirectBasis = paras["F_developIndirectBasis"];

            sciProject.F_totalCost = ParseString(paras["F_totalCost"]);

            sciProject.F_totalFundBasis = paras["F_totalFundBasis"];



            dc.SubmitChanges();
        }