Exemplo n.º 1
0
        public async Task <IActionResult> acceptApplicant(AcceptApplicant applicant)
        {
            var alreadyMember = _context.ProfileEnsembles.Where(p => p.EnsembleId == int.Parse(applicant.EnsembleId) && p.ProfileId == int.Parse(applicant.ProfileId)).ToList();

            if (alreadyMember.Count() >= 1)
            {
                return(NoContent());
            }

            var profile = _context.Profiles.Where(p => p.ProfileId == int.Parse(applicant.ProfileId)).ToList()[0];

            ProfileEnsemble profens = new ProfileEnsemble();

            profens.Start_Date = System.DateTime.Now;
            profens.End_Date   = System.DateTime.MaxValue;
            profens.ProfileId  = profile.ProfileId;
            profens.Profile    = profile;
            profens.Ensemble   = _context.Ensembles.Find(int.Parse(applicant.EnsembleId));
            profens.EnsembleId = int.Parse(applicant.EnsembleId);

            if (ModelState.IsValid)
            {
                _context.Add(profens);
                await _context.SaveChangesAsync();
            }

            return(NoContent());
        }
        private void Commit()
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            String          projectID = context.Session[SessionMgm.AcceptProjectID].ToString();
            AcceptApplicant exs       = dc.AcceptApplicant.SingleOrDefault(es => es.F_projectID.Equals(projectID));

            exs.F_status = ProjectStatus.UnderEducationAudit;
            dc.SubmitChanges();
        }
        private string GetStatus()
        {
            context.Response.ContentType = "text/plain";
            DataClassesDataContext dc = new DataClassesDataContext();
            String          projectID = context.Session[SessionMgm.AcceptProjectID].ToString();
            AcceptApplicant exs       = dc.AcceptApplicant.SingleOrDefault(es => es.F_projectID.Equals(projectID));

            return(exs.F_status);
        }
Exemplo n.º 4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            AcceptApplicant        es = dc.AcceptApplicant.SingleOrDefault(ess => ess.F_projectID.Equals(projectID));

            es.F_status = ProjectStatus.UnderEducationAudit;
            dc.SubmitChanges();
            Response.Redirect("frmAcceptApplicant.aspx");
        }
        private void SavePage3()
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            String          projectID = context.Session[SessionMgm.AcceptProjectID].ToString();
            AcceptApplicant exs       = dc.AcceptApplicant.SingleOrDefault(es => es.F_projectID.Equals(projectID));

            exs.F_actualAchieve  = paras["F_actualAchieve"].ToString();
            exs.F_achieveBenefit = paras["F_achieveBenefit"].ToString();

            dc.SubmitChanges();
        }
        private string GetBaseInfo()
        {
            String result;

            context.Response.ContentType = "application/json";
            DataClassesDataContext dc = new DataClassesDataContext();
            String          projectID = context.Session[SessionMgm.AcceptProjectID].ToString();
            AcceptApplicant exs       = dc.AcceptApplicant.SingleOrDefault(es => es.F_projectID.Equals(projectID));

            result = UtilHelper.GetJSON(exs);
            return(result);
        }
Exemplo n.º 7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            AcceptApplicant        es = dc.AcceptApplicant.SingleOrDefault(ess => ess.F_projectID.Equals(projectID));

            if (String.IsNullOrEmpty(txtAppliedDate.Text) == false)
            {
                es.F_appliedDate = DateTime.Parse(txtAppliedDate.Text);
            }
            dc.SubmitChanges();
            Response.Redirect("frmAcceptApplicant.aspx");
        }
Exemplo n.º 8
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.ProjectID].ToString();
         DataClassesDataContext dc  = new DataClassesDataContext();
         AcceptApplicant        aap = dc.AcceptApplicant.SingleOrDefault(_ap => _ap.F_ID.Equals(F_ID));
         if (aap == null)
         {
             showSave = true;
         }
         else
         {
             if (Session[SessionMgm.UserID].Equals(aap.F_leaderID))
             {
                 showSave   = true;
                 showCommit = true;
             }
             if (aap.F_status.Equals(ProjectStatus.Deny) == false && aap.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>";
         }
     }
 }
        private void SavePage2()
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            String          projectID = context.Session[SessionMgm.AcceptProjectID].ToString();
            AcceptApplicant exs       = dc.AcceptApplicant.SingleOrDefault(es => es.F_projectID.Equals(projectID));

            if (String.IsNullOrEmpty(paras["F_acceptDate"].ToString()) == false)
            {
                exs.F_acceptDate = DateTime.Parse(paras["F_acceptDate"].ToString());
            }
            exs.F_acceptType    = paras["F_acceptType"].ToString();
            exs.F_acceptPlace   = paras["F_acceptPlace"].ToString();
            exs.F_acceptContact = paras["F_acceptContact"].ToString();
            exs.F_acceptPhone   = paras["F_acceptPhone"].ToString();
            exs.F_acceptEmail   = paras["F_acceptEmail"].ToString();
            exs.F_acceptAddress = paras["F_acceptAddress"].ToString();
            exs.F_acceptZipcode = paras["F_acceptZipcode"].ToString();
            dc.SubmitChanges();
        }
        private void SavePage5()
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            String          projectID = context.Session[SessionMgm.AcceptProjectID].ToString();
            AcceptApplicant exs       = dc.AcceptApplicant.SingleOrDefault(es => es.F_projectID.Equals(projectID));

            exs.F_acceptOpinion = paras["F_acceptOpinion"].ToString();
            exs.F_acceptLeader  = paras["F_acceptLeader"].ToString();
            if (String.IsNullOrEmpty(paras["F_acceptLeaderDate"].ToString()) == false)
            {
                exs.F_acceptLeaderDate = DateTime.Parse(paras["F_acceptLeaderDate"].ToString());
            }
            if (paras["F_acceptPass"].ToString() == "1")
            {
                exs.F_status = ProjectStatus.PassEduCheck;
            }
            else
            {
                exs.F_status = ProjectStatus.Deny;
            }
            dc.SubmitChanges();
        }
Exemplo n.º 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     projectID = Session[SessionMgm.AcceptProjectID].ToString();
     if (!IsPostBack)
     {
         DataClassesDataContext dc = new DataClassesDataContext();
         AcceptApplicant        es = dc.AcceptApplicant.SingleOrDefault(ess => ess.F_projectID.Equals(projectID));
         labAcceptNo.Text    = es.F_acceptNo;
         labDomain.Text      = es.F_domain;
         labProjectName.Text = es.F_name;
         labType.Text        = es.F_type;
         labUnit.Text        = es.F_projectUnit;
         labLeader.Text      = es.F_leaderName;
         if (es.F_appliedDate != null)
         {
             txtAppliedDate.Text = es.F_appliedDate.Value.ToShortDateString();
         }
         if (es.F_status.Equals(ProjectStatus.UnderEducationAudit))
         {
             btnSave.Visible   = false;
             btnSubmit.Visible = false;
         }
     }
 }
Exemplo n.º 12
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();
        }
Exemplo n.º 13
0
        private 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));
            EducationV2.ApplicantUnit unit = dc.ApplicantUnit.SingleOrDefault(_au => _au.F_ID.Equals(user.F_belongUnitID));
            int num = dc.AcceptProject.Count();

            acceptProject.F_ID = Guid.NewGuid().ToString();
            acceptProject.F_acceptApplicantState = ProjectStatus.Complete;
            acceptProject.F_acceptedCode         = "";
            acceptProject.F_applicantUnit        = unit.F_name;
            acceptProject.F_acceptNo             = DateTime.Now.ToString("yyyyMMddhh") + num.ToString();
            acceptProject.F_applicantUnit        = user.F_adminUnit;
            acceptProject.F_appliedDate          = project.F_applicantDate;
            acceptProject.F_appliedYear          = project.F_applicantDate.Value.Year.ToString();
            acceptProject.F_executeState         = ProjectStatus.Complete;
            acceptProject.F_leaderName           = user.F_userName;
            acceptProject.F_leaderID             = project.F_leaderID;
            acceptProject.F_projectID            = project.F_ID;
            acceptProject.F_projectName          = project.F_name;
            acceptProject.F_finishDate           = project.F_finishDate.Value;
            acceptProject.F_projectState         = ProjectStatus.Complete;
            acceptProject.F_projectType          = project.F_type;
            dc.AcceptProject.InsertOnSubmit(acceptProject);

            var ess = dc.ExecuteStatus.Where(_es => _es.F_projectID.Equals(project.F_ID));

            dc.ExecuteStatus.DeleteAllOnSubmit(ess);
            ExecuteStatus es = new ExecuteStatus();

            es.F_acceptNo         = acceptProject.F_acceptNo;
            es.F_planMoney        = Decimal.ToInt32(project.F_totalFund.Value);
            es.F_applicantName    = project.F_name;
            es.F_applicantType    = project.F_type;
            es.F_applicantUnit    = user.F_adminUnit;
            es.F_ContactPhone     = user.F_phone;
            es.F_domain           = project.F_belongeddomain;
            es.F_ID               = Guid.NewGuid().ToString();
            es.F_leaderID         = project.F_leaderID;
            es.F_leaderName       = project.F_leader;
            es.F_leaderNo         = user.F_idNumber;
            es.F_mobile           = user.F_mobile;
            es.F_projectID        = project.F_ID;
            es.F_status           = ProjectStatus.Complete;
            es.F_startAndStopDate = project.F_beginDate.Value.ToShortDateString() + "-" + project.F_finishDate.Value.ToShortDateString();
            dc.ExecuteStatus.InsertOnSubmit(es);


            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;
            if (String.IsNullOrEmpty(project.F_belongeddomain))
            {
                aa.F_domain = "未定义";
            }
            else
            {
                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;
            aa.F_projectUnit   = unit.F_name;
            aa.F_startStopDate = es.F_startAndStopDate;
            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.Complete;
            aa.F_leaderID      = user.F_ID;
            aa.F_appliedDate   = project.F_applicantDate;
            dc.AcceptApplicant.InsertOnSubmit(aa);
        }