コード例 #1
0
        protected void btnFilter_Click(object sender, EventArgs e)
        {
            DataClassesDataContext dc = new DataClassesDataContext();

            switch (Session[SessionMgm.Role].ToString())
            {
            case "申报人员(专家)": break;

            case "部门主管": condition = ProjectStatus.UnderDeptAudit; break;

            case "单位主管": condition = ProjectStatus.UnderSchoolAudit; break;

            case "教育厅管理人员": condition = ProjectStatus.UnderEducationAudit; break;
            }
            if (!String.IsNullOrWhiteSpace(condition))
            {
                List <String> userIDs = Global.GetSuitUsers(Session);
                //    GridView1.DataSource = dc.SocialProject.Where(sp => sp.F_status.Equals(condition) && userIDs.Contains(sp.F_leaderID));
                var datasource = from x in dc.SocialProject.AsEnumerable() where userIDs.Contains(x.F_leaderID) && x.F_status.Equals(condition) select x;
                GridView1.DataSource = UtilHelper.ToDataTable(datasource);
                Session.Add(SessionMgm.DataSource, GridView1.DataSource);
                GridView1.DataBind();
            }
        }
コード例 #2
0
        private String savePage3()
        {
            context.Response.ContentType = "text/plain";
            DataClassesDataContext dc = new DataClassesDataContext();

            string id;
            Staff  newStaff = null;

            if (getStaffID(out id))
            {
                newStaff = dc.Staff.SingleOrDefault(staff => staff.F_StaffID.Equals(id /*paras["F_ID"]*/));
            }

            if (newStaff == null)
            {
                return("系统中不存在该职工信息,请先保存职工基本资料!");
            }

            newStaff.F_resume         = paras["F_resume"];
            newStaff.F_rwdandpunishmt = paras["F_rwdandpunishmt"];
            newStaff.F_lastModifyTime = DateTime.Now;
            dc.SubmitChanges();
            return(UtilHelper.GetJSON(newStaff));
        }
コード例 #3
0
        protected void Unnamed_Click(object sender, EventArgs e)
        {
            WordHelper helper = new WordHelper();
            String     file   = Server.MapPath("/resource/socialProject.dot");

            helper.CreateNewWordDocument(file);
            DataClassesDataContext dc = new DataClassesDataContext();
            String        F_ID        = (sender as LinkButton).CommandArgument;
            SocialProject project     = dc.SocialProject.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();
        }
コード例 #4
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            User user = dc.User.SingleOrDefault(_user => _user.F_idType.Equals(ddlType.SelectedValue) && _user.F_idNumber.Equals(txtNo.Text));

            if (user != null)
            {
                ApplicantMember member = new ApplicantMember();
                member.F_userID    = user.F_ID;
                member.F_realName  = user.F_realName;
                member.F_title     = user.F_title;
                member.F_workspace = user.F_workspace;
                member.F_birthday  = user.F_birthday;
                member.F_sexual    = user.F_sexual;
                member.F_education = user.F_highestEducation;
                member.F_degree    = user.F_highestDegree;
                String result = UtilHelper.GetJSON(member);
                Response.Write("<script> window.opener.addUser('" + result + "'); window.close();</script>");
            }
            else
            {
                UtilHelper.AlertMsg("找不到指定用户");
            }
        }
コード例 #5
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            User user = dc.User.SingleOrDefault(_user => _user.F_userName.Equals(txtName.Text));

            if (user != null)
            {
                Response.Write("<script>alert('该用户名已被使用');</script>");
                return;
            }
            user          = new EducationV2.User();
            user.F_ID     = Guid.NewGuid().ToString();
            user.F_status = ddlType.SelectedValue;

            user.F_belongDeptID = ddlBelongDept.SelectedValue;

            user.F_Role         = ddlRole.SelectedValue;
            user.F_realName     = txtRealName.Text;
            user.F_pwd          = UtilHelper.MD5Encrypt(txtPwd.Text);
            user.F_userName     = txtName.Text;
            user.F_belongUnitID = Session[SessionMgm.UnitID].ToString();
            dc.User.InsertOnSubmit(user);
            dc.SubmitChanges();
        }
コード例 #6
0
ファイル: Default.aspx.cs プロジェクト: masach/EduProject
        protected void btnCommit_Click(object sender, ImageClickEventArgs e)
        {
            DataClassesDataContext dc = new DataClassesDataContext();
            User user = dc.User.SingleOrDefault(u => u.F_userName.Equals(txtUserName.Text) &&
                                                u.F_pwd.Equals(UtilHelper.MD5Encrypt(txtPwd.Text)) && u.F_Role.Equals(ddlType.SelectedValue));

            if (user == null)
            {
                Response.Write("<script>alert('密码错误或用户不存在');</script>");
            }
            else
            {
                Session.Add(SessionMgm.UserID, user.F_ID);
                Session.Add(SessionMgm.Role, user.F_Role);
                Session.Add(SessionMgm.RealName, user.F_realName);
                Session.Add(SessionMgm.UnitID, user.F_belongUnitID);
                if (user.F_Role.Equals(RoleType.DeptAdmin) && user.F_belongDeptID != null)
                {
                    Session.Add(SessionMgm.BelongDept, user.F_belongDeptID);
                }

                Response.Redirect("main.aspx");
            }
        }
コード例 #7
0
        protected void EduBtn_Click(object sender, EventArgs e)
        {
            if (Session[SessionMgm.Role].Equals(RoleType.EduAdmin) == false)
            {
                UtilHelper.AlertInUpdatePanel(UpdatePanel1, this.GetType(), "没有权限");
                return;
            }
            DataClassesDataContext dc = new DataClassesDataContext();
            DateTime dt = DateTime.Now;

            RemoveHistoricalOpinion(F_ID, RoleType.EduAdmin);
            EducationV2.SocialProject socialProject = dc.SocialProject.Single(c => c.F_ID.Equals(F_ID));
            socialProject.F_status = ProjectStatus.Approval;
            AuditOpinion opinion = new AuditOpinion();

            opinion.F_projectID = F_ID;
            opinion.F_ID        = Guid.NewGuid().ToString();
            opinion.F_content   = EduContent.Text;
            DateTime.TryParse(EduDate.Text, out dt);
            opinion.F_date   = dt;
            opinion.F_type   = RoleType.EduAdmin;
            opinion.F_result = EduResult.SelectedValue;
            dc.AuditOpinion.InsertOnSubmit(opinion);
            if (opinion.F_result.Equals("审核不通过"))
            {
                socialProject.F_status = ProjectStatus.Deny;
            }
            else
            {
                socialProject.F_status = ProjectStatus.Pass;
            }
            //if(socialProject.F_applicantDate != null )
            //    socialProject.F_code = Services.SocialProject.GetCode(socialProject.F_type, socialProject.F_applicantDate.Value.Year.ToString());
            dc.SubmitChanges();
            Response.Redirect("frmSocialProject.aspx?tabNum=6&id=" + F_ID);
        }
コード例 #8
0
        public DataTable GetAdvanceSearchTable()
        {
            NameValueCollection          paras      = System.Web.HttpContext.Current.Request.Params;
            DataClassesDataContext       dc         = new DataClassesDataContext();
            IQueryable <AcceptApplicant> datasource = dc.AcceptApplicant.Where(_sp => _sp.F_status.Equals(ProjectStatus.Draft) == false);
            DataTable dt = UtilHelper.ToDataTableWithStrCol(datasource);

            if (paras["F_scope"] == null)
            {
                Session.Add(SessionMgm.DataSource, dt);
                return(dt);
            }
            String[] F_scopes             = paras["F_scope"].Split(new char[] { ',' });
            String[] F_matchTypes         = paras["F_matchType"].Split(new char[] { ',' });
            String[] F_keywords           = paras["F_keyword"].Split(new char[] { ',' });
            String[] F_contactTypes       = paras["F_contactType"].Split(new char[] { ',' });
            IEnumerable <DataRow> results = null;
            String combineType            = "and";

            for (int index = 0; index < F_scopes.Length; index++)
            {
                int indexOfMatch = index;
                IEnumerable <DataRow> matchResult = null;
                if (F_matchTypes[indexOfMatch].Equals(SearchType.ExactMatch))
                {
                    matchResult = from m in dt.AsEnumerable()
                                  where m.Field <String>(F_scopes[indexOfMatch]).Equals(F_keywords[indexOfMatch])
                                  select m;
                }
                else if (F_matchTypes[indexOfMatch].Equals(SearchType.FuzzMatch))
                {
                    matchResult = from m in dt.AsEnumerable()
                                  where m.Field <String>(F_scopes[indexOfMatch]).Contains(F_keywords[indexOfMatch])
                                  select m;
                }

                if (indexOfMatch == 0)
                {
                    results = matchResult;
                }
                else
                {
                    if (combineType.Trim().Equals("and"))
                    {
                        results = results.Intersect(matchResult);
                    }
                    else if (combineType.Trim().Equals("or"))
                    {
                        results = results.Union(matchResult);
                    }
                    else if (combineType.Trim().Equals("not"))
                    {
                        results = results.Except(matchResult);
                    }
                }
                combineType = F_contactTypes[indexOfMatch];
            }
            DataTable newTable = dt.Clone();


            foreach (DataRow dr in results)
            {
                newTable.Rows.Add(dr.ItemArray);
            }
            Session.Add(SessionMgm.DataSource, newTable);
            return(newTable);
        }
コード例 #9
0
ファイル: Expert.ashx.cs プロジェクト: masach/FjutOrgProject
        private string LoadMenu()
        {
            String role   = context.Session[SessionMgm.Role].ToString();
            String status = GetStatus();
            List <ExtjsComponent> components = new List <ExtjsComponent>();

            //单位管理,非专家都是管理员
            if (!role.Equals(RoleType.Applicant))
            {
                ExtjsComponent component = new ExtjsComponent();
                component.xtype  = "panel";
                component.height = 200;
                component.width  = 200;
                component.title  = "单位管理";
                StringBuilder sb = new StringBuilder();

                if (role.Equals(RoleType.OrgDeptAdmin)) //单位管理员可以管部门,修改单位信息
                {
                    sb.Append("<a target='rightFrame'  href='frmModifyScho.aspx'>单位信息管理</a> <p />");
                    sb.Append("<a target='rightFrame'  href='frmDeptManage.aspx'>部门管理</a> <p />");
                }
                if (role.Equals(RoleType.EduAdmin)) //教育厅管理人员可以审核
                {
                    sb.Append("<a target='rightFrame'  href='frmSchoMgm.aspx'>单位管理</a> <p />");
                    sb.Append("<a target='rightFrame'  href='frmAdminManag.aspx'>人员管理</a> <p />");
                }
                else
                {
                    sb.Append("<a target='rightFrame'  href='frmUserManage.aspx'>人员管理</a> <p />");
                }
                component.html = sb.ToString();
                components.Add(component);
            }
            //申报管理,只要经过审核就可以申报
            if (status.Equals(InfoStatus.Authoried))
            {
                ExtjsComponent component = new ExtjsComponent();
                component.xtype  = "panel";
                component.height = 200;
                component.width  = 200;
                component.title  = "申报管理";
                StringBuilder sb = new StringBuilder();
                if (role.Equals(RoleType.EduAdmin) || role.Equals(RoleType.OrgDeptAdmin))
                {
                    sb.Append("<a target='rightFrame'  href='frmProjectManage.aspx'>计划管理</a> <p />");
                }

                sb.Append("<a target='rightFrame'  href='frmSciProjectList.aspx'>科技项目申报管理</a> <p />");
                sb.Append("<a target='rightFrame'  href='frmSocialProjectList.aspx'>社科项目申报管理</a> <p />");
                component.html = sb.ToString();
                components.Add(component);
            }
            ExtjsComponent comp = new ExtjsComponent();

            comp.xtype  = "panel";
            comp.height = 200;
            comp.width  = 200;
            comp.title  = "立项管理";
            comp.html   = " <a target='rightFrame' href='frmApprovalList.aspx'>立项项目管理</a>";
            components.Add(comp);


            comp        = new ExtjsComponent();
            comp.xtype  = "panel";
            comp.height = 200;
            comp.width  = 200;
            comp.title  = "综合查询";
            comp.html   = " <a target='rightFrame' href='frmAdvanceSearch.aspx'>项目查询</a>";
            components.Add(comp);


            comp        = new ExtjsComponent();
            comp.xtype  = "panel";
            comp.height = 200;
            comp.width  = 200;
            comp.title  = "执行和验收";
            comp.html   = "<a target='rightFrame' href='frmExecuteList.aspx'> 项目执行情况表</a> <p />" +
                          " <a target='rightFrame'    href='frmAcceptApplicantList.aspx'>  验收申请书 </a>";
            components.Add(comp);

            comp        = new ExtjsComponent();
            comp.xtype  = "panel";
            comp.height = 200;
            comp.width  = 200;
            comp.title  = "个人信息维护";
            comp.html   = " <a target='rightFrame' href='frmUserDetail.aspx?type=self'>  个人信息 </a> <p />" +
                          " <a target='rightFrame'    href='frmModifyPWD.aspx'>  密码修改 </a>";
            components.Add(comp);

            return(UtilHelper.GetJSON(components));
        }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="dc"></param>
        /// <returns>新用户的id</returns>
        private string createNewUser(DataClassesDataContext dc)
        {
            // 创建新用户
            User newUser = new User();

            newUser.F_Role = RoleType.Applicant;
            newUser.F_ID   = Guid.NewGuid().ToString();

            newUser.F_userName = paras["F_empno"];// 教工号即username,密码同教工号
            newUser.F_pwd      = UtilHelper.MD5Encrypt(newUser.F_userName);

            newUser.F_realName = paras["F_realName"];
            newUser.F_sexual   = paras["F_sexual"];
            if (String.IsNullOrEmpty(paras["F_birthday"]) == false)
            {
                newUser.F_birthday = DateTime.Parse(paras["F_birthday"]);
            }
            newUser.F_bornplace = paras["F_bornplace"];

            newUser.F_nativeplace = paras["F_nativeplace"];
            newUser.F_nationality = paras["F_nationality"];
            newUser.F_party       = paras["F_party"];
            if (String.IsNullOrEmpty(paras["F_partyEntryDate"]) == false)
            {
                newUser.F_partyEntryDate = DateTime.Parse(paras["F_partyEntryDate"]);
            }

            newUser.F_highestDegree     = paras["F_highestDegree"];
            newUser.F_highestEducation  = paras["F_highestEducation"];
            newUser.F_highestGrduateSch = paras["F_highestGrduateSch"];
            if (String.IsNullOrEmpty(paras["F_workBeginDate"]) == false)
            {
                newUser.F_workBeginDate = DateTime.Parse(paras["F_workBeginDate"]);
            }

            newUser.F_workDept     = paras["F_workDeptText"];
            newUser.F_belongDeptID = paras["F_workDept"];

            newUser.F_position = paras["F_position"];
            newUser.F_title    = paras["F_title"];

            if (String.IsNullOrEmpty(paras["F_posBeginDate"]) == false)
            {
                newUser.F_posBeginDate = DateTime.Parse(paras["F_posBeginDate"]);
            }
            newUser.F_adminRanking = paras["F_adminRanking"];
            if (String.IsNullOrEmpty(paras["F_adminRkBeginDate"]) == false)
            {
                newUser.F_adminRkBeginDate = DateTime.Parse(paras["F_adminRkBeginDate"]);
            }

            newUser.F_idType   = paras["F_idType"];
            newUser.F_idNumber = paras["F_idNumber"];
            if (String.IsNullOrWhiteSpace(newUser.F_idNumber) == false)
            {
                User t = dc.User.SingleOrDefault(_staff => _staff.F_idType.Equals(newUser.F_idType) && _staff.F_idNumber.Equals(newUser.F_idNumber));
                if (t != null && t.F_ID.Equals(newUser.F_ID) == false)
                {
                    return("该证件号和证件名已被其他用户使用");
                }
            }
            newUser.F_mobile = paras["F_mobile"];
            newUser.F_phone  = paras["F_phone"];

            newUser.F_phone2      = paras["F_phone2"];
            newUser.F_email       = paras["F_email"];
            newUser.F_freeAddress = paras["F_freeAddress"];
            newUser.F_fax         = paras["F_fax"];

            // 在此处自动创建的用户默认为“审核通过”
            newUser.F_status         = InfoStatus.Authoried;
            newUser.F_lastModifyTime = DateTime.Now;

            dc.User.InsertOnSubmit(newUser);
            return(newUser.F_ID);
        }
コード例 #11
0
        private String saveBaseInfo()
        {
            context.Response.ContentType = "text/plain";
            DataClassesDataContext dc = new DataClassesDataContext();

            bool   insert = false;
            string id;
            Staff  newStaff;

            if (getStaffID(out id))
            {
                newStaff = dc.Staff.SingleOrDefault(staff => staff.F_StaffID.Equals(id /*paras["F_ID"]*/));
            }
            else
            {
                newStaff           = new Staff();
                newStaff.F_StaffID = Guid.NewGuid().ToString();
                insert             = true;
            }

            newStaff.F_empno = paras["F_empno"];
            if (String.IsNullOrWhiteSpace(newStaff.F_empno) == false)
            {
                Staff t = dc.Staff.SingleOrDefault(_staff => _staff.F_empno.Equals(newStaff.F_empno));
                if (t != null && t.F_StaffID.Equals(newStaff.F_StaffID) == false)
                {
                    return("档案库中已存在相同的教工号");
                }
            }

            if (String.IsNullOrEmpty(paras["F_UserID"]) == false)
            {
                newStaff.F_UserID   = paras["F_UserID"].ToString().Trim();
                newStaff.F_userName = paras["F_userName"];
            }
            else
            {
                newStaff.F_UserID   = createNewUser(dc);
                newStaff.F_userName = paras["F_empno"];
            }

            newStaff.F_realName = paras["F_realName"];
            newStaff.F_sexual   = paras["F_sexual"];
            if (String.IsNullOrEmpty(paras["F_birthday"]) == false)
            {
                newStaff.F_birthday = DateTime.Parse(paras["F_birthday"]);
            }
            newStaff.F_bornplace = paras["F_bornplace"];

            newStaff.F_nativeplace = paras["F_nativeplace"];
            newStaff.F_nationality = paras["F_nationality"];
            newStaff.F_party       = paras["F_party"];
            if (String.IsNullOrEmpty(paras["F_partyEntryDate"]) == false)
            {
                newStaff.F_partyEntryDate = DateTime.Parse(paras["F_partyEntryDate"]);
            }

            newStaff.F_highestDegree     = paras["F_highestDegree"];
            newStaff.F_highestEducation  = paras["F_highestEducation"];
            newStaff.F_highestGrduateSch = paras["F_highestGrduateSch"];
            if (String.IsNullOrEmpty(paras["F_workBeginDate"]) == false)
            {
                newStaff.F_workBeginDate = DateTime.Parse(paras["F_workBeginDate"]);
            }

            newStaff.F_workDept     = paras["F_workDeptText"];
            newStaff.F_belongDeptID = paras["F_workDept"];

            newStaff.F_position = paras["F_position"];
            newStaff.F_title    = paras["F_title"];

            if (String.IsNullOrEmpty(paras["F_posBeginDate"]) == false)
            {
                newStaff.F_posBeginDate = DateTime.Parse(paras["F_posBeginDate"]);
            }
            newStaff.F_adminRanking = paras["F_adminRanking"];
            if (String.IsNullOrEmpty(paras["F_adminRkBeginDate"]) == false)
            {
                newStaff.F_adminRkBeginDate = DateTime.Parse(paras["F_adminRkBeginDate"]);
            }

            newStaff.F_idType   = paras["F_idType"];
            newStaff.F_idNumber = paras["F_idNumber"];
            if (String.IsNullOrWhiteSpace(newStaff.F_idNumber) == false)
            {
                Staff t = dc.Staff.SingleOrDefault(_staff => _staff.F_idType.Equals(newStaff.F_idType) && _staff.F_idNumber.Equals(newStaff.F_idNumber));
                if (t != null && t.F_StaffID.Equals(newStaff.F_StaffID) == false)
                {
                    return("档案库中已存在相同的证件号和证件名");
                }
            }
            newStaff.F_mobile = paras["F_mobile"];
            newStaff.F_phone  = paras["F_phone"];

            newStaff.F_phone2      = paras["F_phone2"];
            newStaff.F_email       = paras["F_email"];
            newStaff.F_freeAddress = paras["F_freeAddress"];
            newStaff.F_fax         = paras["F_fax"];

            newStaff.F_status         = paras["F_status"];
            newStaff.F_lastModifyTime = DateTime.Now;

            if (insert)
            {
                dc.Staff.InsertOnSubmit(newStaff);
            }

            dc.SubmitChanges();
            return(UtilHelper.GetJSON(newStaff));
        }
コード例 #12
0
        protected void btnCommit_Click(object sender, EventArgs e)
        {
            String[] projects  = txtName.Text.Trim().Split(new char[] { '\n' });
            String[] units     = txtUnit.Text.Trim().Split(new char[] { '\n' });
            String[] leaders   = this.txtLeader.Text.Trim().Split(new char[] { '\n' });
            String[] funds     = this.txtFund.Text.Trim().Split(new char[] { '\n' });
            DateTime startDate = DateTime.Parse(txtStart.Text);
            DateTime endDate   = DateTime.Parse(txtEnd.Text);

            if (projects.Length == units.Length && units.Length == leaders.Length)
            {
                DataClassesDataContext dc = new DataClassesDataContext();
                for (int i = 0; i < projects.Length; i++)
                {
                    try
                    {
                        units[i] = units[i].Trim().Replace("\"", "");
                        units[i] = units[i].Replace("\r", "").Trim();
                        units[i] = units[i].Replace(" ", "").Trim();
                        ApplicantUnit unit = dc.ApplicantUnit.SingleOrDefault(_au => _au.F_name.Equals(units[i]));
                        if (unit == null)
                        {
                            unit          = new ApplicantUnit();
                            unit.F_ID     = Guid.NewGuid().ToString();
                            unit.F_name   = units[i];
                            unit.F_status = RoleType.Authoried;
                            dc.ApplicantUnit.InsertOnSubmit(unit);
                        }
                        leaders[i] = leaders[i].Trim().Replace("\"", "");
                        leaders[i] = leaders[i].Replace(" ", "");
                        leaders[i] = leaders[i].Replace("\r", "").Trim();
                        EducationV2.User user = dc.User.SingleOrDefault(_user => _user.F_realName.Equals(leaders[i]) && _user.F_belongUnitID.Equals(unit.F_ID));
                        if (user == null)
                        {
                            user                = new EducationV2.User();
                            user.F_ID           = Guid.NewGuid().ToString();
                            user.F_userName     = leaders[i];
                            user.F_realName     = leaders[i];
                            user.F_Role         = RoleType.Expert;
                            user.F_belongUnitID = unit.F_ID;
                            dc.User.InsertOnSubmit(user);
                            dc.SubmitChanges();
                        }
                        if (ddlType.SelectedIndex < 4)
                        {
                            projects[i] = projects[i].Trim().Replace("\"", "");
                            projects[i] = projects[i].Replace("\r", "").Trim();
                            SocialProject project = dc.SocialProject.SingleOrDefault(_sp => _sp.F_name.Equals(projects[i]));
                            if (project != null)
                            {
                                continue;
                            }
                            project                  = new SocialProject();
                            project.F_unitID         = unit.F_ID;
                            project.F_leader         = user.F_realName;
                            project.F_leaderID       = user.F_ID;
                            project.F_status         = ProjectStatus.Approval;
                            project.F_guideProjectID = ddlGuide.SelectedValue;
                            project.F_code           = EducationV2.Services.SocialProject.GetCode(ddlType.SelectedValue, txtYear.Text);
                            project.F_status         = ProjectStatus.Approval;
                            if (txtSameFund.Text.Trim().Length > 0)
                            {
                                project.F_Fund = decimal.Parse(txtSameFund.Text);
                            }
                            else
                            {
                                project.F_Fund = decimal.Parse(funds[i]);
                            }
                            project.F_applicantDate = startDate;
                            project.F_completeDate  = endDate;
                            project.F_type          = ddlType.SelectedValue;
                            project.F_name          = projects[i];
                            project.F_ID            = Guid.NewGuid().ToString();
                            CreateAcceptProject(dc, project);
                            dc.SocialProject.InsertOnSubmit(project);
                        }
                        else
                        {
                            ScienceProject project = dc.ScienceProject.SingleOrDefault(_sp => _sp.F_name.Equals(projects[i]));
                            if (project != null)
                            {
                                continue;
                            }
                            project                  = new ScienceProject();
                            project.F_unitID         = unit.F_ID;
                            project.F_leader         = user.F_realName;
                            project.F_leaderID       = user.F_ID;
                            project.F_status         = ProjectStatus.Approval;
                            project.F_guideProjectID = ddlGuide.SelectedValue;
                            project.F_code           = EducationV2.Services.SciProject.GetCode(ddlType.SelectedValue, txtYear.Text);
                            project.F_status         = ProjectStatus.Approval;
                            if (txtSameFund.Text.Trim().Length > 0)
                            {
                                project.F_totalFund = decimal.Parse(txtSameFund.Text);
                            }
                            else
                            {
                                project.F_totalFund = decimal.Parse(funds[i]);
                            }
                            project.F_beginDate     = startDate;
                            project.F_applicantDate = startDate;
                            project.F_finishDate    = endDate;
                            project.F_type          = ddlType.SelectedValue;
                            project.F_name          = projects[i];
                            project.F_ID            = Guid.NewGuid().ToString();
                            dc.ScienceProject.InsertOnSubmit(project);
                            CreateAcceptProject(dc, project);
                        }
                        dc.SubmitChanges();
                    }
                    catch (Exception exp) {
                        Console.Write(exp.ToString());
                    }
                }
            }
            else
            {
                UtilHelper.AlertMsg(Response, "name: " + projects.Length + " unit: " + units.Length + " leader: " + leaders.Length +
                                    " fund: " + funds.Length);
                UtilHelper.AlertMsg(Response, "inequal");
            }
        }
コード例 #13
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            DataClassesDataContext   dc         = new DataClassesDataContext();
            List <String>            userIDs    = Global.GetSuitUsers(Session);
            IEnumerable <ViewPosApl> datasource = getDatasource(false);

            if (txtKeyword.Text.Trim().Length > 0)
            {
                DataTable dt = UtilHelper.ToDataTable(datasource);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (ddlType.SelectedValue.Equals(SearchType.ExactMatch))
                    {
                        if (dt.Rows[i][ddlField.SelectedValue].ToString().Equals(txtKeyword.Text) == false)
                        {
                            dt.Rows.RemoveAt(i);
                            i--;
                        }
                    }
                    else if (ddlType.SelectedValue.Equals(SearchType.FuzzMatch))
                    {
                        if (dt.Rows[i][ddlField.SelectedValue].ToString().Contains(txtKeyword.Text) == false)
                        {
                            dt.Rows.RemoveAt(i);
                            i--;
                        }
                    }
                    else
                    {
                        DateTime selectedDate, inputDate;
                        if (DateTime.TryParse(dt.Rows[i][ddlField.SelectedValue].ToString(), out selectedDate))
                        {
                            if (DateTime.TryParse(txtKeyword.Text, out inputDate) == false)
                            {
                                UtilHelper.AlertMsg("请输入合法的日期");
                            }
                            else
                            {
                                if (ddlType.SelectedValue.Equals(SearchType.Bigger))
                                {
                                    if (DateTime.Compare(selectedDate, inputDate) < 0)
                                    {
                                        dt.Rows.RemoveAt(i--);
                                    }
                                }
                                else if (ddlType.SelectedValue.Equals(SearchType.Smaller))
                                {
                                    if (DateTime.Compare(selectedDate, inputDate) > 0)
                                    {
                                        dt.Rows.RemoveAt(i--);
                                    }
                                }
                            }
                        }
                        else
                        {
                            UtilHelper.AlertMsg("大小只能用于比较日期");
                        }
                    }
                }
                GridView1.DataSource = dt;
            }
            else
            {
                GridView1.DataSource = UtilHelper.ToDataTable(datasource);
            }
            Session.Add(SessionMgm.DataSource, GridView1.DataSource);
            GridView1.PageIndex = 0;
            GridView1.DataBind();
        }
コード例 #14
0
ファイル: Default.aspx.cs プロジェクト: masach/EduProject
 protected void Page_Load(object sender, EventArgs e)
 {
     Session.Add(SessionMgm.IPAddr, UtilHelper.GetClientIPv4Address());
 }