예제 #1
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();
        }
예제 #2
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);
        }