Пример #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public tabPositionOutlineModel GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * ");
            strSql.Append("  from tabPositionOutline ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;


            tabPositionOutlineModel model = new tabPositionOutlineModel();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(ModelHandler <tabPositionOutlineModel> .FillModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        void funPositionOutLine(int PositionID)
        {
            try
            {
                #region


                WinFormControlHelper.AddLog(rtbLog, "开始操作" + PositionID, "");
                int    count  = 0;
                string _where = "";
                string _order = " id desc";
                //获取详情
                tabPositionModel modelPos = tabPositionBLL.GetInstance().GetModel(PositionID);
                _where = string.Format(" id={0} ", modelPos.ParentID);
                tabOrgModel modelOrg = tabOrgBLL.GetInstance().GetModel(_where, 0);
                if (modelOrg.IsNull())
                {
                    modelOrg = new tabOrgModel();
                }

                //组合成新的模型
                bool IsExist = false;
                _where = string.Format(" PositionID={0} ", modelPos.id);
                tabPositionOutlineModel modelPosOtln = tabPositionOutlineBLL.GetInstance().GetModel(_where, 0);
                IsExist = modelPosOtln.IsNotNull();
                if (!IsExist)
                {
                    modelPosOtln = new tabPositionOutlineModel();
                }
                #region
                modelPosOtln.PositionID      = modelPos.id;
                modelPosOtln.PositionName    = modelPos.PositionName;
                modelPosOtln.RequireWorkYear = modelPos.RequireYear;
                modelPosOtln.RequireXueLi    = modelPos.RequireEdu;
                modelPosOtln.SalaryBein      = modelPos.SalaryBein;
                modelPosOtln.SalaryEnd       = modelPos.SalaryEnd;
                modelPosOtln.WordAddress     = modelPos.WordAddress;

                modelPosOtln.OrgName  = modelOrg.OrgName;
                modelPosOtln.OrgPro   = modelOrg.OrgPro;
                modelPosOtln.OrgScale = modelOrg.Scale;

                string strSkill = " ";
                strSkill += modelPos.PositionDesc + " ";
                strSkill += modelPos.RequireContent + " ";
                strSkill += modelPos.RequireAbility + " ";
                strSkill += modelPos.RequireExperience + " ";
                strSkill += modelPos.AdditionInfo + " ";
                #region  Skill
                //
                List <string> lsSkill = PanGuSegmentHelper.SegmentToStringList(strSkill); //分词
                hsJDSkill = new HashSet <string>();
                foreach (string key in lsSkill)                                           //加入集合
                {
                    hsJDSkill.Add(key);
                    hsCVJDSkillFull.Add(key);
                }
                //获得交集
                hsJDSkill.IntersectWith(hsCVJDKeyWord);
                //转化成字符串
                strSkill = "";
                foreach (string str in hsJDSkill)
                {
                    strSkill += str + " ";
                }
                modelPosOtln.RequireSkill = strSkill;
                WinFormControlHelper.AddLog(rtbLog, modelPosOtln.PositionName, modelPosOtln.RequireSkill);
                #endregion
                #endregion
                //插入或更新
                if (IsExist)
                {
                    tabPositionOutlineBLL.GetInstance().Update(modelPosOtln);
                }
                else
                {
                    tabPositionOutlineBLL.GetInstance().Add(modelPosOtln);
                }

                #endregion
            }
            catch (Exception ex)
            {
                WinFormControlHelper.AddLog(rtbLog, "funPositionOutLine", ex.Message);
            }
        }
Пример #3
0
        void MatchForJD(int PositionID)
        {
            try
            {
                #region
                //
                List <tabCVJDMatchModel> slsCVJDMatch = new List <tabCVJDMatchModel>();//用于存放匹配结果,最大数量为100
                slsCVJDMatch.Capacity = 100;
                //
                #region 获取JD简要模型
                tabPositionOutlineModel modelPosOtln = tabPositionOutlineBLL.GetInstance().GetModel(" PositionID=" + PositionID + " ", 0);
                if (modelPosOtln.IsNull())
                {
                    WinFormControlHelper.AddLog(rtbLog, "MatchForJD", "需要先进行要提取");
                }
                //Skill
                string[]         aryJDSkill = modelPosOtln.RequireSkill.Split(new char[] { ' ', ',' });
                HashSet <string> hsJDSkill  = new HashSet <string>();
                foreach (string str in aryJDSkill)
                {
                    hsJDSkill.Add(str);
                }
                hsJDSkill.Remove("");
                WinFormControlHelper.AddLog(rtbLog, "职位 " + modelPosOtln.PositionName + " 技能关键字", modelPosOtln.RequireSkill);;

                #endregion

                //粗选适合的简历
                string _where = "";
                if (modelPosOtln.RequireSchool.IsNotNull())
                {
                    _where += " ";
                }
                if (modelPosOtln.RequireXueLi.IsNotNull())
                {
                    _where += " ";
                }
                if (modelPosOtln.RequireMajor.IsNotNull())
                {
                    _where += " ";
                }
                string.Format(" id in ( select [KEY] form containstable(tabCVJDMatch,' or  or  or  ',1000) )");
                string _orderby = "";
                int    count    = 0;
                int    pageSize = 100;
                int    pageNo   = 1;
                do
                {
                    #region
                    List <int> lsResumeID = tabCVJDMatchBLL.GetInstance().GetResumeIDListForJD(pageSize, pageNo, _where.ToString(), _orderby, out count);

                    //逐个计算
                    foreach (int ResumeID in lsResumeID)
                    {
                        #region 获取CV简要模型
                        tabResumeOutlineModel modelRmOtln = tabResumeOutlineBLL.GetInstance().GetModel(" ResumeID=" + ResumeID + " ", 0);
                        //Skill
                        string[]         aryCVSkill = modelRmOtln.Skill.Split(new char[] { ' ', ',' });
                        HashSet <string> hsCVSkill  = new HashSet <string>();
                        foreach (string str in aryCVSkill)
                        {
                            hsCVSkill.Add(str);
                        }
                        hsJDSkill.Remove("");
                        WinFormControlHelper.AddLog(rtbLog, "简历" + modelRmOtln.ResumeNo + "技能关键字", modelRmOtln.Skill);;
                        #endregion

                        #region  计算匹配度
                        tabCVJDMatchModel modelMch = new tabCVJDMatchModel();
                        modelMch.PositionID = modelPosOtln.PositionID;
                        modelMch.ResumeID   = modelRmOtln.ResumeID;
                        modelMch.ResumeNo   = modelRmOtln.ResumeNo;
                        modelMch.BaseOn     = "Position";

                        hsCVSkill.IntersectWith(hsJDSkill);
                        modelMch.Skill       = (hsCVSkill.Count * 100) / hsJDSkill.Count;
                        modelMch.MatchDegree = modelMch.Skill;
                        WinFormControlHelper.AddLog(rtbLog, "简历" + modelRmOtln.ResumeNo + "综合评价", modelMch.MatchDegree.ToString());
                        #endregion

                        #region 保存到内存列表中(只保存前100条记录)
                        //是否要删除
                        if (slsCVJDMatch.Count == slsCVJDMatch.Capacity)
                        {
                            tabCVJDMatchModel modelMin = slsCVJDMatch[0];
                            foreach (tabCVJDMatchModel model in slsCVJDMatch)
                            {
                                if (model.MatchDegree < modelMin.MatchDegree)
                                {
                                    modelMin = model;
                                }
                            }
                            slsCVJDMatch.Remove(modelMin);
                        }
                        //是否添加
                        if (slsCVJDMatch.Count < slsCVJDMatch.Capacity)
                        {
                            slsCVJDMatch.Add(modelMch);
                        }


                        #endregion
                    }
                    #endregion
                    pageNo++;//
                }while (pageNo * pageSize < count);
                #region  保存至数据库
                //删除原来的
                tabCVJDMatchBLL.GetInstance().Delete(" PositionID=" + PositionID + " and BaseOn='Position' ");
                //添加新的
                string strLsResumeID = "";
                foreach (tabCVJDMatchModel model in slsCVJDMatch)
                {
                    tabCVJDMatchBLL.GetInstance().Add(model);
                    strLsResumeID += model.ResumeID.ToString() + ",";
                }
                WinFormControlHelper.AddLog(rtbLog, "职位 " + PositionID.ToString() + " 匹配结果", strLsResumeID);

                #endregion

                #endregion
            }
            catch (Exception ex)
            {
                WinFormControlHelper.AddLog(rtbLog, "MatchForJD", ex.Message);
            }
        }
Пример #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(tabPositionOutlineModel model)
 {
     return(dal.Update(model));
 }
Пример #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(tabPositionOutlineModel model)
 {
     return(dal.Add(model));
 }
Пример #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(tabPositionOutlineModel model, List <string> ChangedFields)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tabPositionOutline set ");

            strSql.Append(" PositionID = @PositionID , ");
            strSql.Append(" PositionName = @PositionName , ");
            strSql.Append(" CreateUser = @CreateUser , ");
            strSql.Append(" CreateDate = @CreateDate , ");
            strSql.Append(" ParentID = @ParentID , ");
            strSql.Append(" OrgName = @OrgName , ");
            strSql.Append(" OrgPro = @OrgPro , ");
            strSql.Append(" OrgScale = @OrgScale , ");
            strSql.Append(" WordAddress = @WordAddress , ");
            strSql.Append(" SalaryBein = @SalaryBein , ");
            strSql.Append(" SalaryEnd = @SalaryEnd , ");
            strSql.Append(" AgeBein = @AgeBein , ");
            strSql.Append(" AgeEnd = @AgeEnd , ");
            strSql.Append(" RequireWorkYear = @RequireWorkYear , ");
            strSql.Append(" RequireSchool = @RequireSchool , ");
            strSql.Append(" RequireMajor = @RequireMajor , ");
            strSql.Append(" RequireXueLi = @RequireXueLi , ");
            strSql.Append(" RequireSkill = @RequireSkill , ");
            strSql.Append(" RequireCoreSkill = @RequireCoreSkill , ");
            strSql.Append(" AppID = @AppID , ");
            strSql.Append(" Version = @Version , ");
            strSql.Append(" RandomNo = @RandomNo , ");
            strSql.Append(" Remark = @Remark , ");
            strSql.Append(" LableText = @LableText , ");
            strSql.Append(" ExJson = @ExJson , ");
            strSql.Append(" Status = @Status , ");
            strSql.Append(" OrderNo = @OrderNo , ");
            strSql.Append(" ModifyDate = @ModifyDate , ");
            strSql.Append(" ModifyUser = @ModifyUser  ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",               SqlDbType.Int,        4),
                new SqlParameter("@PositionID",       SqlDbType.Int,        4),
                new SqlParameter("@PositionName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@CreateUser",       SqlDbType.Int,        4),
                new SqlParameter("@CreateDate",       SqlDbType.NVarChar, 200),
                new SqlParameter("@ParentID",         SqlDbType.Int,        4),
                new SqlParameter("@OrgName",          SqlDbType.NVarChar,  50),
                new SqlParameter("@OrgPro",           SqlDbType.NVarChar,  50),
                new SqlParameter("@OrgScale",         SqlDbType.NVarChar,  50),
                new SqlParameter("@WordAddress",      SqlDbType.NVarChar,  -1),
                new SqlParameter("@SalaryBein",       SqlDbType.Int,        4),
                new SqlParameter("@SalaryEnd",        SqlDbType.Int,        4),
                new SqlParameter("@AgeBein",          SqlDbType.NChar,     10),
                new SqlParameter("@AgeEnd",           SqlDbType.NVarChar,  50),
                new SqlParameter("@RequireWorkYear",  SqlDbType.NVarChar,  50),
                new SqlParameter("@RequireSchool",    SqlDbType.NVarChar, 500),
                new SqlParameter("@RequireMajor",     SqlDbType.NVarChar, 500),
                new SqlParameter("@RequireXueLi",     SqlDbType.NVarChar, 500),
                new SqlParameter("@RequireSkill",     SqlDbType.NText),
                new SqlParameter("@RequireCoreSkill", SqlDbType.NVarChar, 500),
                new SqlParameter("@AppID",            SqlDbType.NVarChar, 100),
                new SqlParameter("@Version",          SqlDbType.NVarChar, 100),
                new SqlParameter("@RandomNo",         SqlDbType.NVarChar, 200),
                new SqlParameter("@Remark",           SqlDbType.NVarChar,  -1),
                new SqlParameter("@LableText",        SqlDbType.NVarChar,  -1),
                new SqlParameter("@ExJson",           SqlDbType.NVarChar,  -1),
                new SqlParameter("@Status",           SqlDbType.NVarChar,  -1),
                new SqlParameter("@OrderNo",          SqlDbType.Int,        4),
                new SqlParameter("@ModifyDate",       SqlDbType.NVarChar, 200),
                new SqlParameter("@ModifyUser",       SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.id;
            parameters[1].Value  = model.PositionID;
            parameters[2].Value  = model.PositionName;
            parameters[3].Value  = model.CreateUser;
            parameters[4].Value  = model.CreateDate;
            parameters[5].Value  = model.ParentID;
            parameters[6].Value  = model.OrgName;
            parameters[7].Value  = model.OrgPro;
            parameters[8].Value  = model.OrgScale;
            parameters[9].Value  = model.WordAddress;
            parameters[10].Value = model.SalaryBein;
            parameters[11].Value = model.SalaryEnd;
            parameters[12].Value = model.AgeBein;
            parameters[13].Value = model.AgeEnd;
            parameters[14].Value = model.RequireWorkYear;
            parameters[15].Value = model.RequireSchool;
            parameters[16].Value = model.RequireMajor;
            parameters[17].Value = model.RequireXueLi;
            parameters[18].Value = model.RequireSkill;
            parameters[19].Value = model.RequireCoreSkill;
            parameters[20].Value = model.AppID;
            parameters[21].Value = model.Version;
            parameters[22].Value = model.RandomNo;
            parameters[23].Value = model.Remark;
            parameters[24].Value = model.LableText;
            parameters[25].Value = model.ExJson;
            parameters[26].Value = model.Status;
            parameters[27].Value = model.OrderNo;
            parameters[28].Value = model.ModifyDate;
            parameters[29].Value = model.ModifyUser;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #7
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(tabPositionOutlineModel model)
        {
            model.Version    = model.Version.IsNotNullOrEmpty()? model.Version: "1";
            model.RandomNo   = model.RandomNo.IsNotNullOrEmpty()? model.RandomNo: Guid.NewGuid().ToString("N");
            model.Status     = model.Status.IsNotNullOrEmpty()? model.Status: "1";
            model.OrderNo    = model.OrderNo > 0? model.OrderNo: 1;
            model.CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            model.ModifyDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tabPositionOutline(");
            strSql.Append("PositionID,PositionName,CreateUser,CreateDate,ParentID,OrgName,OrgPro,OrgScale,WordAddress,SalaryBein,SalaryEnd,AgeBein,AgeEnd,RequireWorkYear,RequireSchool,RequireMajor,RequireXueLi,RequireSkill,RequireCoreSkill,AppID,Version,RandomNo,Remark,LableText,ExJson,Status,OrderNo,ModifyDate,ModifyUser");
            strSql.Append(") values (");
            strSql.Append("@PositionID,@PositionName,@CreateUser,@CreateDate,@ParentID,@OrgName,@OrgPro,@OrgScale,@WordAddress,@SalaryBein,@SalaryEnd,@AgeBein,@AgeEnd,@RequireWorkYear,@RequireSchool,@RequireMajor,@RequireXueLi,@RequireSkill,@RequireCoreSkill,@AppID,@Version,@RandomNo,@Remark,@LableText,@ExJson,@Status,@OrderNo,@ModifyDate,@ModifyUser");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PositionID",       SqlDbType.Int,        4),
                new SqlParameter("@PositionName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@CreateUser",       SqlDbType.Int,        4),
                new SqlParameter("@CreateDate",       SqlDbType.NVarChar, 200),
                new SqlParameter("@ParentID",         SqlDbType.Int,        4),
                new SqlParameter("@OrgName",          SqlDbType.NVarChar,  50),
                new SqlParameter("@OrgPro",           SqlDbType.NVarChar,  50),
                new SqlParameter("@OrgScale",         SqlDbType.NVarChar,  50),
                new SqlParameter("@WordAddress",      SqlDbType.NVarChar,  -1),
                new SqlParameter("@SalaryBein",       SqlDbType.Int,        4),
                new SqlParameter("@SalaryEnd",        SqlDbType.Int,        4),
                new SqlParameter("@AgeBein",          SqlDbType.NChar,     10),
                new SqlParameter("@AgeEnd",           SqlDbType.NVarChar,  50),
                new SqlParameter("@RequireWorkYear",  SqlDbType.NVarChar,  50),
                new SqlParameter("@RequireSchool",    SqlDbType.NVarChar, 500),
                new SqlParameter("@RequireMajor",     SqlDbType.NVarChar, 500),
                new SqlParameter("@RequireXueLi",     SqlDbType.NVarChar, 500),
                new SqlParameter("@RequireSkill",     SqlDbType.NText),
                new SqlParameter("@RequireCoreSkill", SqlDbType.NVarChar, 500),
                new SqlParameter("@AppID",            SqlDbType.NVarChar, 100),
                new SqlParameter("@Version",          SqlDbType.NVarChar, 100),
                new SqlParameter("@RandomNo",         SqlDbType.NVarChar, 200),
                new SqlParameter("@Remark",           SqlDbType.NVarChar,  -1),
                new SqlParameter("@LableText",        SqlDbType.NVarChar,  -1),
                new SqlParameter("@ExJson",           SqlDbType.NVarChar,  -1),
                new SqlParameter("@Status",           SqlDbType.NVarChar,  -1),
                new SqlParameter("@OrderNo",          SqlDbType.Int,        4),
                new SqlParameter("@ModifyDate",       SqlDbType.NVarChar, 200),
                new SqlParameter("@ModifyUser",       SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.PositionID;
            parameters[1].Value  = model.PositionName;
            parameters[2].Value  = model.CreateUser;
            parameters[3].Value  = model.CreateDate;
            parameters[4].Value  = model.ParentID;
            parameters[5].Value  = model.OrgName;
            parameters[6].Value  = model.OrgPro;
            parameters[7].Value  = model.OrgScale;
            parameters[8].Value  = model.WordAddress;
            parameters[9].Value  = model.SalaryBein;
            parameters[10].Value = model.SalaryEnd;
            parameters[11].Value = model.AgeBein;
            parameters[12].Value = model.AgeEnd;
            parameters[13].Value = model.RequireWorkYear;
            parameters[14].Value = model.RequireSchool;
            parameters[15].Value = model.RequireMajor;
            parameters[16].Value = model.RequireXueLi;
            parameters[17].Value = model.RequireSkill;
            parameters[18].Value = model.RequireCoreSkill;
            parameters[19].Value = model.AppID;
            parameters[20].Value = model.Version;
            parameters[21].Value = model.RandomNo;
            parameters[22].Value = model.Remark;
            parameters[23].Value = model.LableText;
            parameters[24].Value = model.ExJson;
            parameters[25].Value = model.Status;
            parameters[26].Value = model.OrderNo;
            parameters[27].Value = model.ModifyDate;
            parameters[28].Value = model.ModifyUser;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }