Exemple #1
0
        private bool saveApplicantPartInfo(out PosApplicant apl, DataClassesDataContext dc)
        {
            bool   insert = false;
            string id;

            if (context.Request.Params["aplID"] != null)
            {
                id  = context.Request.Params["aplID"];
                apl = dc.PosApplicant.SingleOrDefault(_apl => _apl.F_ID.Equals(id));
            }
            else
            {
                apl          = new PosApplicant();
                apl.F_ID     = Guid.NewGuid().ToString();
                apl.F_UserID = context.Session[SessionMgm.UserID].ToString();
                insert       = true;
            }

            //apl.F_appliedDate = DateTime.Now;
            apl.F_status     = ProjectStatus.ApplicantDraft;
            apl.F_statusEnum = (short)ProjectStatus.EStatus.ApplicantDraft;

            if (insert)
            {
                dc.PosApplicant.InsertOnSubmit(apl);
            }

            return(true);
        }
Exemple #2
0
        //这里是指定时间执行的代码,必须是静态的。
        private static void Task_ChangeApplicantState(object state)
        {
            LoggerHelper.Log("定时处理", "定时修改申请状态");
            // 计算哪些岗位申请业务关闭
            DataClassesDataContext dc = new DataClassesDataContext();
            // 用于跟踪LINQ 冲突错误
            //dc.Log = new System.IO.StringWriter();
            IEnumerable <ViewPosApl> datasource = from x in dc.ViewPosApl.AsEnumerable()
                                                  where x.F_statusEnum.Equals((short)ProjectStatus.EStatus.ApplicantCommit) &&
                                                  (
                (x.F_endDate1 == null ? false : (x.F_endDate1.Value.Date > DateTime.Now.Date)) ||
                (x.F_endDate2 == null ? false : (x.F_endDate2.Value.Date > DateTime.Now.Date)) ||
                (x.F_endDate3 == null ? false : (x.F_endDate3.Value.Date > DateTime.Now.Date))
                                                  )
                                                  select x;

            //string temp = dc.Log.ToString();
            foreach (ViewPosApl vapl in datasource)
            {
                PosApplicant apl = dc.PosApplicant.SingleOrDefault(_apl => _apl.F_ID.Equals(vapl.F_ID));
                apl.F_status     = ProjectStatus.ApplicantComplete;
                apl.F_statusEnum = (short)ProjectStatus.EStatus.ApplicantComplete;
            }
            dc.SubmitChanges();
        }
        String Tag = "PosApplicantP"; // mod by cy [20140926]
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (HttpContext.Current == null)
            {
                return;
            }
            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    = 0;
                int.TryParse(strPageIndex, out pageIndex);

                PosApplicant projappl = null;
                string       id;
                //if (Request.QueryString["aplID"] != null)// 子页面后台是无法获得get参数的
                string url = Request.UrlReferrer.ToString();
                if (!string.IsNullOrEmpty(getParam(url, "aplID")))
                {
                    id = getParam(url, "aplID");
                    DataClassesDataContext dc = new DataClassesDataContext();
                    projappl = dc.PosApplicant.SingleOrDefault(_apl => _apl.F_ID.Equals(id));
                }

                if (projappl == null)
                {
                    showSave   = true;
                    showCommit = true;
                }
                else
                {
                    if (Session[SessionMgm.UserID].Equals(projappl.F_UserID) && projappl.F_statusEnum.Equals((short)ProjectStatus.EStatus.ApplicantDraft))
                    {
                        showSave   = true;
                        showCommit = true;
                    }
                    else if (Session[SessionMgm.UserID].Equals(projappl.F_UserID) && projappl.F_statusEnum.Equals((short)ProjectStatus.EStatus.ApplicantCommit))
                    {
                        showCommit = true;
                    }
                }
                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>";
                }
            }
        }
Exemple #4
0
        private string GetStatus()
        {
            context.Response.ContentType = "text/plain";
            DataClassesDataContext dc = new DataClassesDataContext();
            string id;

            if (context.Request.Params["aplID"] != null)
            {
                id = context.Request.Params["aplID"];
            }
            else
            {
                return(string.Empty);
            }
            PosApplicant exs = dc.PosApplicant.SingleOrDefault(es => es.F_ID.Equals(id));

            return(exs.F_status);
        }
Exemple #5
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}");
        }
Exemple #6
0
        private String savePage1()
        {
            String F_ID = context.Session[SessionMgm.UserID].ToString();

            context.Response.ContentType = "text/plain";
            DataClassesDataContext dc  = new DataClassesDataContext();
            PosApplicant           apl = null;

            if (saveBaseInfo(F_ID, dc) &&
                saveFamilyInfo(F_ID, dc) &&
                saveApplicantPartInfo(out apl, dc))
            {
                dc.SubmitChanges();
                return("{\"success\":true}");
            }
            else
            {
                return("保存失败");
            }
        }
Exemple #7
0
        private String savePage2()
        {
            context.Response.ContentType = "text/plain";
            DataClassesDataContext dc  = new DataClassesDataContext();
            PosApplicant           apl = null;

            if (saveApplicantPartInfo(out apl, dc))
            {
                apl.F_pos1   = paras["F_pos1"];
                apl.F_pos2   = paras["F_pos2"];
                apl.F_pos3   = paras["F_pos3"];
                apl.F_posID1 = paras["F_posID1"];
                apl.F_posID2 = paras["F_posID2"];
                apl.F_posID3 = paras["F_posID3"];
                apl.F_reason = paras["F_reason"];
            }

            dc.SubmitChanges();

            // return "保存成功";
            return(UtilHelper.GetJSON(apl));// 为了把业务id返回给页面已支持用户切换tab页面的刷新
        }
 partial void DeletePosApplicant(PosApplicant instance)
 {
     ExecuteDynamicDelete(instance);
     LoggerHelper.Log("岗位申请删除", "用户ID:" + instance.F_UserID + ",ID:" + instance.F_ID);
 }