Example #1
0
        private string GetFamilyMember()
        {
            context.Response.ContentType = "application/json";
            DataClassesDataContext    dc      = new DataClassesDataContext();
            IQueryable <FamilyMember> members = null;

            string id;

            if (context.Request.Params["aplID"] != null)
            {
                id = context.Request.Params["aplID"];
                ViewPosApl exs = dc.ViewPosApl.SingleOrDefault(es => es.F_ID.Equals(id));
                if (null != exs)
                {
                    members = dc.FamilyMember.Where(pp => pp.F_userID.Equals(exs.F_UserID));
                }
            }
            else
            {
                id      = context.Session[SessionMgm.UserID].ToString();
                members = dc.FamilyMember.Where(pp => pp.F_userID.Equals(id));
            }

            List <FamilyMember> pps = new List <FamilyMember>();

            foreach (var member in members)
            {
                pps.Add(member);
            }
            return(UtilHelper.GetJSON(pps));
        }
        private void FillExcel(String fileName, ViewPosApl userInfo)
        {
            String      templeteFile = Server.MapPath("/resource/applicationForm.xls");
            ExcelHelper helper       = new ExcelHelper(templeteFile, fileName);

            helper.SetCells(2, 2, userInfo.F_realName);
            helper.SetCells(2, 7, userInfo.F_workDept + " " + userInfo.F_position);
            helper.SetCells(3, 2, userInfo.F_party);

            helper.SetCells(3, 6, userInfo.F_title);
            helper.SetCells(3, 10, userInfo.F_highestEducation);

            helper.SetCells(4, 2, userInfo.F_highestDegree);
            helper.SetCells(4, 6, userInfo.F_adminRkBeginDate.Value.ToShortDateString());
            helper.SetCells(5, 2, "岗位1:" + userInfo.F_pos1);
            helper.SetCells(6, 2, "岗位2:" + userInfo.F_pos2);
            helper.SetCells(7, 2, "岗位3:" + userInfo.F_pos3);
            helper.SetCells(8, 2, userInfo.F_resume);
            helper.SetCells(9, 2, userInfo.F_rwdandpunishmt);
            helper.SetCells(10, 2, userInfo.F_reason);

            helper.SaveAsFile(fileName);

            /*
             * 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();
             */
        }
Example #3
0
        /// <summary>
        /// 申请提交
        /// </summary>
        private string Commit()
        {
            context.Response.ContentType = "text/plain";
            DataClassesDataContext dc = new DataClassesDataContext();
            string id;

            if (context.Request.Params["aplID"] != null)
            {
                id = context.Request.Params["aplID"];
            }
            else
            {
                return("提交失败,可能新业务没保存成功!");
            }

            ViewPosApl vapl = dc.ViewPosApl.SingleOrDefault(x => x.F_ID.Equals(id) &&
                                                            ((x.F_endDate1 == null ? true : (x.F_endDate1.Value.Date >= DateTime.Now.Date)) &&
                                                             (x.F_endDate2 == null ? true : (x.F_endDate2.Value.Date >= DateTime.Now.Date)) &&
                                                             (x.F_endDate3 == null ? true : (x.F_endDate3.Value.Date >= DateTime.Now.Date))
                                                            )
                                                            );

            if (null == vapl)
            {
                // 说明本次提交某岗位已经过期了(可能是先前只保存未提交的业务)
                return("提交失败,可能岗位已过期!");
            }

            PosApplicant exs = dc.PosApplicant.SingleOrDefault(es => es.F_ID.Equals(id));


            if (exs.F_appliedDate == null)
            {
                exs.F_appliedDate = DateTime.Now; // 如果用户未提交过则设置时间
            }

            // 状态赋值代码需要成对出现
            exs.F_status     = ProjectStatus.ApplicantCommit;
            exs.F_statusEnum = (short)ProjectStatus.EStatus.ApplicantCommit;

            dc.SubmitChanges();
            return("{\"success\":true}");
        }
        /// <summary>
        /// 需要根据模板修改
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Label1_Click(object sender, EventArgs e)
        {
            String F_ID                     = (sender as LinkButton).CommandArgument;
            String fileName                 = Server.MapPath("/resource/" + F_ID + ".xls");
            DataClassesDataContext dc       = new DataClassesDataContext();
            ViewPosApl             userInfo = dc.ViewPosApl.SingleOrDefault(_uid => _uid.F_ID.Equals(F_ID));

            FillExcel(fileName, userInfo);
            FileInfo fileInfo = new FileInfo(fileName);

            Response.Clear();
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
            Response.AddHeader("Content-Length", fileInfo.Length.ToString());
            Response.ContentType     = "application/ms-excel";
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
            Response.WriteFile(fileInfo.FullName);
            Response.Flush();
            File.Delete(fileName);//删除已下载文件
            Response.End();
        }
Example #5
0
        private string GetBaseInfo()
        {
            String result = "";

            context.Response.ContentType = "application/json";
            DataClassesDataContext dc = new DataClassesDataContext();

            string id;

            if (context.Request.Params["aplID"] != null)
            {
                id = context.Request.Params["aplID"];
                ViewPosApl exs = dc.ViewPosApl.SingleOrDefault(es => es.F_ID.Equals(id));
                result = UtilHelper.GetJSON(exs);
            }
            else
            {
                id = context.Session[SessionMgm.UserID].ToString(); // 当前登录用户即该业务的申请者
                User usr = dc.User.SingleOrDefault(es => es.F_ID.Equals(id));
                result = UtilHelper.GetJSON(usr);
                result = result.Replace("F_ID", "F_UserID");
            }
            return(result);
        }