예제 #1
0
        public static int GetNewsRecordCountByTypeIDAndDateTime(int typeid, DateTime begindate, DateTime enddate)
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            string sqlstr = "";

            //-1则返回所有文章数量
            if (typeid == -1)
            {
                sqlstr = "SELECT Count(*) from View_ALL where convert(varchar(10),[NewsTime],120) between @begindate and @enddate";
            }
            else
            {
                sqlstr = "SELECT Count(*) from View_ALL where TypeID=@TypeID and convert(varchar(10),[NewsTime],120) between @begindate and @enddate";
            }

            SqlCommand cmd = new SqlCommand(sqlstr, conn);

            cmd.Parameters.Add(new SqlParameter("@TypeID", typeid));
            cmd.Parameters.Add(new SqlParameter("@begindate", begindate));
            cmd.Parameters.Add(new SqlParameter("@enddate", enddate));
            int totalpagecount = Convert.ToInt32(cmd.ExecuteScalar());

            cmd.Dispose();
            conn.Close();
            return(totalpagecount);
        }
예제 #2
0
        public static int GetNewsRecordCountByType(int typeid)
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            string sqlstr = "";

            //-1则返回所有文章数量
            if (typeid == -1)
            {
                sqlstr = "SELECT Count(*) from View_ALL";
            }
            else
            {
                sqlstr = "SELECT Count(*) from View_ALL where TypeID=@TypeID";
            }

            SqlCommand cmd = new SqlCommand(sqlstr, conn);

            cmd.Parameters.Add(new SqlParameter("@TypeID", typeid));

            int totalpagecount = Convert.ToInt32(cmd.ExecuteScalar());

            cmd.Dispose();
            conn.Close();
            return(totalpagecount);
        }
예제 #3
0
        public static int GetNewsRecordCountByKey(string key, string adminType = "0")
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            string sqlstr = "";

            if (adminType == "1")
            {
                //1为湘雅
                sqlstr = "SELECT Count(*) from View_ALL where Title like '%" + key + "%' and TypeID=2";
            }
            else if (adminType == "2")
            {
                //2为铁道
                sqlstr = "SELECT Count(*) from View_ALL where Title like '%" + key + "%' and TypeID=3";
            }
            else
            {
                //0为本部管理员,默认为0用来显示所有
                sqlstr = "SELECT Count(*) from View_ALL where Title like '%" + key + "%'";
            }
            SqlCommand cmd            = new SqlCommand(sqlstr, conn);
            int        totalpagecount = Convert.ToInt32(cmd.ExecuteScalar());

            cmd.Dispose();
            conn.Close();
            return(totalpagecount);
        }
예제 #4
0
        public static DataRow Authenciation(string ID, string pwd)
        {
            SqlConnection conn = DBLink.GetConnection();
            SqlCommand    cmd  = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "StudentDetails";
            cmd.Parameters.Add(new SqlParameter("@StudentID", ID));
            cmd.Parameters.Add(new SqlParameter("@StudentPwd", pwd));
            try
            {
                conn.Open();
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataTable      dt  = new DataTable();
                sda.Fill(dt);
                DataRow dr = null;
                if (dt != null)
                {
                    dr = dt.Rows[0];
                }
                return(dr);
            }
            catch (Exception)
            {
                return(null);
            }
            finally {
                cmd.Dispose();
                conn.Close();
            }
        }
예제 #5
0
        public static bool PictureNewsUpdate(int NewsID, string ImgAddr, int Rank)
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand("update PictureNews set ImgAddr=@ImgAddr, Rank=@Rank where NewsID=@NewsID", conn);

            cmd.Parameters.Add(new SqlParameter("@NewsID", NewsID));
            cmd.Parameters.Add(new SqlParameter("@ImgAddr", ImgAddr));
            cmd.Parameters.Add(new SqlParameter("@Rank", Rank));
            try
            {
                cmd.ExecuteNonQuery();
            }
            catch
            {
                return(false); //如果出错,返回false
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
            return(true);//如果没有出错,返回true
        }
예제 #6
0
        public static bool Insert(TempDemandInfo tempDemandInfo)
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "TempDemandInfoInsert";
            cmd.Parameters.Add(new SqlParameter("@TempArticleID", tempDemandInfo.TempArticleID));
            cmd.Parameters.Add(new SqlParameter("@PositionName", tempDemandInfo.PositionName));
            cmd.Parameters.Add(new SqlParameter("@EducationalLevel", tempDemandInfo.EducationalLevel));
            cmd.Parameters.Add(new SqlParameter("@Major", tempDemandInfo.Major));
            cmd.Parameters.Add(new SqlParameter("@DemandNum", tempDemandInfo.DemandNum));
            cmd.Parameters.Add(new SqlParameter("@PositionDec", tempDemandInfo.PositionDec));
            //int ID = 0;
            try { cmd.ExecuteNonQuery(); }
            catch
            {
                return(false); //如果出错,返回false
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
            return(true);//如果没有出错,返回true
        }
예제 #7
0
        public static bool PlaceListSecondUpdate(int PlaceSecondID, int PlaceFirstID, string PlaceName, DateTime PlaceTime)
        {
            //安全性检查
            SqlConnection conn = DBLink.GetConnection();//拿到新数据库的链接

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            try
            {
                cmd.Connection  = conn;
                cmd.CommandText = "update PlaceListSecond set PlaceFirstID = @PlaceFirstID, PlaceName = @PlaceName, PlaceTime = @PlaceTime where PlaceSecondID = @PlaceSecondID";
                cmd.Parameters.Add(new SqlParameter("@PlaceSecondID", PlaceSecondID));
                cmd.Parameters.Add(new SqlParameter("@PlaceFirstID", PlaceFirstID));
                cmd.Parameters.Add(new SqlParameter("@PlaceName", PlaceName));
                cmd.Parameters.Add(new SqlParameter("@PlaceTime", PlaceTime));
                cmd.ExecuteNonQuery();
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
            return(true);//如果没有出错,返回true
        }
예제 #8
0
        public static int ArticleInsert(Article article)
        {
            SqlConnection conn = DBLink.GetConnection();//拿到新数据库的链接

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "ArticleInsert";
            cmd.Parameters.Add(new SqlParameter("@TypeID", article.TypeID));
            cmd.Parameters.Add(new SqlParameter("@Title", article.Title));
            cmd.Parameters.Add(new SqlParameter("@Introduction", article.Introduction));
            if (article.PlaceSecondID != -1)                                                   //-1表示不是专场招聘,没有添加招聘场地
            {
                cmd.Parameters.Add(new SqlParameter("@PlaceSecondID", article.PlaceSecondID)); //这个字段默认为null
            }
            cmd.Parameters.Add(new SqlParameter("@EditTime", article.EditTime));
            cmd.Parameters.Add(new SqlParameter("@EditorAccount", article.EditorAccount));
            cmd.Parameters.Add(new SqlParameter("@ContactInfo", article.ContactInfo));
            cmd.Parameters.Add(new SqlParameter("@ClickTimes", article.ClickTimes));
            cmd.Parameters.Add(new SqlParameter("@FileAddr", article.FileAddr));
            int ArticleID = Convert.ToInt32(cmd.ExecuteScalar().ToString());

            cmd.Dispose();
            conn.Close();
            return(ArticleID);//如果没有出错,返回刚插入的ArticleID
        }
예제 #9
0
        public static int Insert(News news)
        {
            int ID = 0;//存储执行insert存储过程返回的ID

            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "NewsInsert";
            cmd.Parameters.Add(new SqlParameter("@TypeID", news.TypeID));
            cmd.Parameters.Add(new SqlParameter("@Title", news.Title));
            cmd.Parameters.Add(new SqlParameter("@Content", news.Content));
            cmd.Parameters.Add(new SqlParameter("@NewsTime", news.NewsTime));
            cmd.Parameters.Add(new SqlParameter("@Editor", news.Editor));
            cmd.Parameters.Add(new SqlParameter("@ClickTimes", 0));
            cmd.Parameters.Add(new SqlParameter("@FileAddr", news.FileAddr));
            try { ID = Convert.ToInt32(cmd.ExecuteScalar()); }
            catch
            {
                return(-1); //如果出错,返回-1
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
            return(ID);//如果没有出错,返回ID
        }
예제 #10
0
        public static bool Update(News news)
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "NewsUpdate";
            cmd.Parameters.Add(new SqlParameter("@NewsID", news.NewsID));
            cmd.Parameters.Add(new SqlParameter("@TypeID", news.TypeID));
            cmd.Parameters.Add(new SqlParameter("@Title", news.Title));
            cmd.Parameters.Add(new SqlParameter("@Content", news.Content));
            cmd.Parameters.Add(new SqlParameter("@NewsTime", news.NewsTime));
            cmd.Parameters.Add(new SqlParameter("@Editor", news.Editor));
            cmd.Parameters.Add(new SqlParameter("@FileAddr", news.FileAddr));
            try
            {
                cmd.ExecuteNonQuery();
            }
            catch
            {
                return(false); //如果出错,返回false
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
            return(true);//如果没有出错,返回true
        }
예제 #11
0
        public static bool EmployerInsert(Employer employer)
        {
            SqlConnection conn = DBLink.GetConnection();
            SqlCommand    cmd  = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "EmployerInsert";
            //共25个字段
            //账号信息部分
            cmd.Parameters.Add(new SqlParameter("@EmployerAccount", employer.EmployerAccount));
            cmd.Parameters.Add(new SqlParameter("@EmployerPwd", employer.EmployerPwd));
            //联系人信息
            cmd.Parameters.Add(new SqlParameter("@ContactPersonName", employer.ContactPersonName));
            cmd.Parameters.Add(new SqlParameter("@ContactPersonSex", employer.ContactPersonSex));
            cmd.Parameters.Add(new SqlParameter("@FixedTelephone", employer.FixedTelephone));
            cmd.Parameters.Add(new SqlParameter("@MobilePhone", employer.MobilePhone));
            cmd.Parameters.Add(new SqlParameter("@Email", employer.Email));
            //单位基本信息
            cmd.Parameters.Add(new SqlParameter("@CompanyName", employer.CompanyName));
            cmd.Parameters.Add(new SqlParameter("@ParentCompanyName", employer.ParentCompanyName));
            cmd.Parameters.Add(new SqlParameter("@CompanyIntroduction", employer.CompanyIntroduction));
            cmd.Parameters.Add(new SqlParameter("@CompanyPhone", employer.CompanyPhone));
            cmd.Parameters.Add(new SqlParameter("@OrganizationCode", employer.OrganizationCode));

            cmd.Parameters.Add(new SqlParameter("@ValidPeriod", employer.ValidPeriod));
            cmd.Parameters.Add(new SqlParameter("@CompanyNature", employer.CompanyNature));
            cmd.Parameters.Add(new SqlParameter("@CompanyBusiness", employer.CompanyBusiness));
            cmd.Parameters.Add(new SqlParameter("@CompanySize", employer.CompanySize));
            cmd.Parameters.Add(new SqlParameter("@RegisteredCapital", employer.RegisteredCapital));

            cmd.Parameters.Add(new SqlParameter("@IsTop500", employer.IsTop500));
            cmd.Parameters.Add(new SqlParameter("@CompanyAreaProvince", employer.CompanyAreaProvince));
            cmd.Parameters.Add(new SqlParameter("@CompanyAreaCity", employer.CompanyAreaCity));
            cmd.Parameters.Add(new SqlParameter("@CompanyAddress", employer.CompanyAddress));
            cmd.Parameters.Add(new SqlParameter("@CityClass", employer.CityClass));

            cmd.Parameters.Add(new SqlParameter("@Remark", employer.Remark));
            //证件照片
            cmd.Parameters.Add(new SqlParameter("@CredentialsDir", employer.CredentialsDir));
            //其他字段
            cmd.Parameters.Add(new SqlParameter("@RegisterTime", employer.RegisterTime));
            cmd.Parameters.Add(new SqlParameter("@IsDelete", employer.IsDelete));

            try
            {
                conn.Open();
                cmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
        }
예제 #12
0
        public static bool DeleteEmployerArticle(int id, int isAudit)
        {
            SqlConnection cn        = DBLink.GetConnection();
            string        sqlstr1   = "";
            string        sqlstr2   = "";
            string        sqlstr3   = "";   //用于处理类型为专场招聘并且已经安排了场地的PlaceListSecond表记录
            string        sqlstr4   = "";   //用于删除大型招聘会的BigArticle表里,某一公司的记录
            DataTable     dtArticle = null; //根据ArticleID得到Article文章信息

            if (isAudit == 2)
            {
                dtArticle = Article.GetArticleByIDForUpdate(id);    //根据ArticleID得到Article文章信息
                //如果是已经审核的
                sqlstr1 = "delete from DemandInfo where ArticleID=" + id;
                sqlstr2 = "delete from Article where ArticleID=" + id;
                sqlstr3 = "delete from PlaceListSecond where PlaceSecondID=" + dtArticle.Rows[0]["PlaceSecondID"].ToString();
                sqlstr4 = "delete from BigArticle where EmployerBigArticleID = " + dtArticle.Rows[0]["ArticleID"].ToString();
            }
            else
            {
                //待审核或者已经拒绝的
                sqlstr1 = "delete from TempDemandInfo where TempArticleID=" + id;
                sqlstr2 = "delete from TempArticle where TempArticleID=" + id;
            }
            SqlCommand cmm1 = new SqlCommand(sqlstr1, cn);
            SqlCommand cmm2 = new SqlCommand(sqlstr2, cn);
            SqlCommand cmm3 = new SqlCommand(sqlstr3, cn);  //删除已通过审核专场招聘的场地信息
            SqlCommand cmm4 = new SqlCommand(sqlstr4, cn);  //删除已通过审核大型招聘会的BigArticle表里,某一公司的记录

            try
            {
                cn.Open();
                cmm1.ExecuteNonQuery();
                cmm2.ExecuteNonQuery();
                if (isAudit == 2)                                                  //已经审核的
                {
                    if (dtArticle.Rows[0]["TypeName"].ToString().Trim() == "专场招聘") //专场招聘
                    {
                        cmm3.ExecuteNonQuery();                                    //删除地点信息
                    }
                    //2-双选会,3-组团招聘
                    if (Int32.Parse(dtArticle.Rows[0]["TypeID"].ToString()) == 2 || Int32.Parse(dtArticle.Rows[0]["TypeID"].ToString()) == 3)
                    {
                        cmm4.ExecuteNonQuery();//删除大型招聘会记录
                    }
                }
                return(true);
            }
            catch (Exception)
            {
            }
            finally
            {
                cmm1.Dispose();
                cmm2.Dispose();
                cmm3.Dispose();
                cn.Close();
            }
            return(false);
        }
예제 #13
0
        public static DataRow Authentication(string account, string password)
        {
            SqlConnection conn = DBLink.GetConnection();
            SqlCommand    cmd  = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AdminAuthentication";
            cmd.Parameters.Add(new SqlParameter("@AdminAccount", account));
            cmd.Parameters.Add(new SqlParameter("@AdminPwd", password));
            try
            {
                conn.Open();
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataTable      dt  = new DataTable();
                sda.Fill(dt);
                DataRow dr = null;
                if (dt != null)
                {
                    dr = dt.Rows[0];
                }
                cmd.Dispose();
                conn.Close();
                return(dr);
            }
            catch (Exception)
            {
                return(null);
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
        }
예제 #14
0
        public static int Insert(Admin admin)
        {
            //安全性检查,如果time格式不对,函数返回false
            //try {  }
            //catch () { return false; }

            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AdminInsert";
            cmd.Parameters.Add(new SqlParameter("@AdminAccount", admin.AdminAccount));
            cmd.Parameters.Add(new SqlParameter("@AdminName", admin.AdminName));
            cmd.Parameters.Add(new SqlParameter("@AdminPwd", admin.AdminPwd));
            cmd.Parameters.Add(new SqlParameter("@AdminType", admin.AdminType));
            try { cmd.ExecuteNonQuery(); }
            catch
            {
                return(-1); //如果出错,返回-1
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
            return(1);//如果没有出错,返回1
        }
예제 #15
0
        public static DataTable GetEmployerListByType(int pageindex, int pagesize, int type)
        {
            //安全性检查,如果time格式不对,函数返回false
            //try {  }
            //catch () { return false; }
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetEmployerPagedRecordByType";
            cmd.Parameters.Add(new SqlParameter("@pagesize", pagesize));
            cmd.Parameters.Add(new SqlParameter("@pageindex", pageindex));
            cmd.Parameters.Add(new SqlParameter("@type", type));

            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            cmd.Dispose();
            conn.Close();
            return(dt);
        }
예제 #16
0
        public static bool Update(Admin admin)
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AdminUpdate";
            cmd.Parameters.Add(new SqlParameter("@AdminID", admin.AdminID));
            cmd.Parameters.Add(new SqlParameter("@AdminName", admin.AdminName));
            cmd.Parameters.Add(new SqlParameter("@AdminPwd", admin.AdminPwd));
            cmd.Parameters.Add(new SqlParameter("@AdminType", admin.AdminType));
            try
            {
                cmd.ExecuteNonQuery();
            }
            catch
            {
                return(false); //如果出错,返回false
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
            return(true);//如果没有出错,返回true
        }
예제 #17
0
        public static List <ArticleType> Select()
        {
            //安全性检查,如果time格式不对,函数返回false
            //try {  }
            //catch () { return false; }
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand     cmd = new SqlCommand("select * from [ArticleType]", conn);
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            cmd.Dispose();
            conn.Close();
            List <ArticleType> list = new List <ArticleType>();

            //for(int i=0;i<dt.Rows.Count;++i){
            //    list.Add(new ArticleType(Convert.ToInt32( dt.Rows[i][0]), dt.Rows[i][1].ToString()));
            //}
            foreach (DataRow item in dt.Rows)
            {
                list.Add(new ArticleType(Convert.ToInt32(item["TypeID"]), item["TypeName"].ToString()));
            }
            return(list);
        }
예제 #18
0
        public static DataTable GetEmployerListByTypeByKey(int pageindex, int pagesize, int type, string key)
        {
            //安全性检查,如果time格式不对,函数返回false
            //try {  }
            //catch () { return false; }
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            //SqlCommand cmd = new SqlCommand();
            //cmd.Connection = conn;
            //cmd.CommandType = CommandType.StoredProcedure;
            //cmd.CommandText = "GetEmployerPagedRecordByTypeByKey";

            string     str = "select EmployerID,CompanyName,CompanyNature,CompanyBusiness into #tb1 from Employer where IsDelete=@type and CompanyName like '%'+@key+'%' and CompanyNature like '%'+@nature+'%' and CompanyBusiness like '%'+@business+'%';select EmployerID,CompanyName,CompanyNature,CompanyBusiness from (select ROW_NUMBER() over (order by EmployerID desc) as RowId,* from #tb1) as temptable where RowId>=(@pageindex-1)*@pagesize+1 and RowId<=@pageindex*@pagesize";
            SqlCommand cmd = new SqlCommand(str, conn);

            cmd.Parameters.Add(new SqlParameter("@pagesize", pagesize));
            cmd.Parameters.Add(new SqlParameter("@pageindex", pageindex));
            cmd.Parameters.Add(new SqlParameter("@type", type));
            cmd.Parameters.Add(new SqlParameter("@key", key));
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            cmd.Dispose();
            conn.Close();
            return(dt);
        }
예제 #19
0
        public static DataTable GetEmployerListByTypeBykeyByCNatureByCBusiness(int pageindex, int pagesize, int type, string key, string CompanyNature, string CompanyBusiness)
        {
            //数据查询
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            string str = "select EmployerID,CompanyName,CompanyNature,CompanyBusiness into #tb1 from Employer where IsDelete=@type and CompanyName like '%'+@key+'%' and CompanyNature like '%'+@nature+'%' and CompanyBusiness like '%'+@business+'%';select EmployerID,CompanyName,CompanyNature,CompanyBusiness from (select ROW_NUMBER() over (order by EmployerID desc) as RowId,* from #tb1) as temptable where RowId>=(@pageindex-1)*@pagesize+1 and RowId<=@pageindex*@pagesize";

            SqlCommand cmd = new SqlCommand(str, conn);

            cmd.Parameters.Add(new SqlParameter("@pagesize", pagesize));
            cmd.Parameters.Add(new SqlParameter("@pageindex", pageindex));
            cmd.Parameters.Add(new SqlParameter("@type", type));
            cmd.Parameters.Add(new SqlParameter("@key", key));
            cmd.Parameters.Add(new SqlParameter("@nature", CompanyNature));
            cmd.Parameters.Add(new SqlParameter("@business", CompanyBusiness));

            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            cmd.Dispose();
            conn.Close();
            return(dt);
        }
예제 #20
0
        public static DataTable GetArticleByAuditByDttypeByPage(int PageSize, int CurrentPageIndex, int isAudit, DateTime dtbegin, DateTime dtend, int dttype)
        {
            SqlConnection cn  = DBLink.GetConnection();
            SqlCommand    cmm = new SqlCommand();

            cmm.Connection = cn;
            //调用存储过程
            cmm.CommandType = CommandType.StoredProcedure;
            cmm.CommandText = "GetArticleByAuditByPage";
            //存储过程参数
            cmm.Parameters.Add(new SqlParameter("@pagesize", PageSize));
            cmm.Parameters.Add(new SqlParameter("@pageindex", CurrentPageIndex));
            cmm.Parameters.Add(new SqlParameter("@isAudit", isAudit));
            cmm.Parameters.Add(new SqlParameter("@dtBegin", dtbegin));
            cmm.Parameters.Add(new SqlParameter("@dtEnd", dtend));
            cmm.Parameters.Add(new SqlParameter("@dtType", dttype));
            SqlDataAdapter da = new SqlDataAdapter(cmm);
            DataTable      dt = new DataTable();

            try
            {
                cn.Open();
                da.Fill(dt);
                cn.Close();
            }
            catch (Exception ex)
            {
                HttpContext.Current.Response.Write(ex.Message);
            }
            return(dt);
        }
예제 #21
0
        public static int GetTempArticleRecordCount(string editoraccount, int typeid)
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            string sqlstr = "";

            if (typeid == 0)
            {
                sqlstr = "SELECT Count(*) from TempArticle where EditorAccount=@EditorAccount";
            }
            else
            {
                sqlstr = "SELECT Count(*) from TempArticle where EditorAccount=@EditorAccount and TypeID=@TypeID";
            }
            SqlCommand cmd = new SqlCommand(sqlstr, conn);

            cmd.Parameters.Add(new SqlParameter("@EditorAccount", editoraccount));
            cmd.Parameters.Add(new SqlParameter("@TypeID", typeid));

            int totalpagecount = Convert.ToInt32(cmd.ExecuteScalar());

            cmd.Dispose();
            conn.Close();
            return(totalpagecount);
        }
예제 #22
0
        public static DataTable GetArticleListFromTempArticle(string editoraccount, int pageindex, int pagesize, int typeid)
        {
            //安全性检查,如果time格式不对,函数返回false
            //try {  }
            //catch () { return false; }
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetTempArticlePagedRecord";

            cmd.Parameters.Add(new SqlParameter("@EditorAccount", editoraccount));
            cmd.Parameters.Add(new SqlParameter("@TypeID", typeid));
            cmd.Parameters.Add(new SqlParameter("@pagesize", pagesize));
            cmd.Parameters.Add(new SqlParameter("@pageindex", pageindex));

            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            cmd.Dispose();
            conn.Close();
            return(dt);
        }
예제 #23
0
        public static bool Authentication(string account, string password)
        {
            int           count = 0;
            SqlConnection conn  = DBLink.GetConnection();
            SqlCommand    cmd   = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "EmployerAuthentication";
            cmd.Parameters.Add(new SqlParameter("@EmployerAccount", account));
            cmd.Parameters.Add(new SqlParameter("@EmployerPwd", password));
            try
            {
                conn.Open();
                count = int.Parse(cmd.ExecuteScalar().ToString());
                if (count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
        }
예제 #24
0
        /// <summary>
        /// 供给创建文章使用
        /// </summary>
        /// <param name="article"></param>
        /// <returns></returns>
        public static int InsertTempArticle(TempArticle article)
        {
            int ID = 0;//存储执行insert存储过程返回的ID

            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "TempArticleInsert";
            //cmd.Parameters.Add(new SqlParameter("@ArticleID", article.ArticleID));  //注释的部分都是存储过程中默认值是null的
            cmd.Parameters.Add(new SqlParameter("@TypeID", article.TypeID));
            cmd.Parameters.Add(new SqlParameter("@Title", article.Title));
            cmd.Parameters.Add(new SqlParameter("@Introduction", article.Introduction));
            //cmd.Parameters.Add(new SqlParameter("@PlaceSecondID", article.PlaceSecondID));
            cmd.Parameters.Add(new SqlParameter("@EditTime", article.EditTime));
            cmd.Parameters.Add(new SqlParameter("@EditorAccount", article.EditorAccount));
            cmd.Parameters.Add(new SqlParameter("@ContactInfo", article.ContactInfo));
            if (article.TypeID == 1)  //专场招聘
            {
                cmd.Parameters.Add(new SqlParameter("@PlaceFirstID", article.PlaceFirstID));
                cmd.Parameters.Add(new SqlParameter("@RecruitTime", article.RecruitTime));
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@PlaceFirstID", DBNull.Value));
                cmd.Parameters.Add(new SqlParameter("@RecruitTime", DBNull.Value));
            }

            if (article.FileAddr == null || article.FileAddr == "")
            {
                cmd.Parameters.Add(new SqlParameter("@FileAddr", DBNull.Value));
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@FileAddr", article.FileAddr));
            }
            cmd.Parameters.Add(new SqlParameter("@ArticleDescription", article.ArticleDescription));
            cmd.Parameters.Add(new SqlParameter("@BigArticleID", article.BigArticleID));
            cmd.Parameters.Add(new SqlParameter("@IsAudit", article.IsAudit));

            try { ID = Convert.ToInt32(cmd.ExecuteScalar()); }
            catch
            {
                return(-1); //如果出错,返回-1
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
            return(ID);//如果没有出错,返回ID
        }
예제 #25
0
        public static void NewsClickTimesPlus(int NewsID)
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand("update [News] set [ClickTimes]=([ClickTimes]+1) where [NewsID]=@NewsID", conn);

            cmd.Parameters.Add(new SqlParameter("@NewsID", NewsID));
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            conn.Close();
        }
예제 #26
0
        public static int GetEmployerAuditResult(int id)
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            string sqlstr = "";

            sqlstr = "update Employer set IsDelete=0 where EmployerID=" + id;
            SqlCommand cmd = new SqlCommand(sqlstr, conn);

            cmd.ExecuteNonQuery();
            return(1);
        }
예제 #27
0
        public static bool Update(TempArticle article)
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "TempArticleUpdate";
            cmd.Parameters.Add(new SqlParameter("@TempArticleID", article.TempArticleID));
            cmd.Parameters.Add(new SqlParameter("@Title", article.Title));
            cmd.Parameters.Add(new SqlParameter("@Introduction", article.Introduction));
            cmd.Parameters.Add(new SqlParameter("@ContactInfo", article.ContactInfo));
            if (article.TypeID == 1)
            {//专场招聘
                cmd.Parameters.Add(new SqlParameter("@PlaceFirstID", article.PlaceFirstID));
                cmd.Parameters.Add(new SqlParameter("@RecruitTime", article.RecruitTime));
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@PlaceFirstID", DBNull.Value));
                cmd.Parameters.Add(new SqlParameter("@RecruitTime", DBNull.Value));
            }

            if (article.FileAddr == null || article.FileAddr == "")
            {
                cmd.Parameters.Add(new SqlParameter("@FileAddr", DBNull.Value));
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@FileAddr", article.FileAddr));
            }
            cmd.Parameters.Add(new SqlParameter("@BigArticleID", article.BigArticleID));
            cmd.Parameters.Add(new SqlParameter("@ArticleDescription", article.ArticleDescription));
            cmd.Parameters.Add(new SqlParameter("@IsAudit", article.IsAudit));
            try
            {
                cmd.ExecuteNonQuery();
            }
            catch
            {
                return(false); //如果出错,返回false
            }
            finally
            {
                cmd.Dispose();
                conn.Close();
            }
            return(true);//如果没有出错,返回true
        }
예제 #28
0
        public static int GetTypeIDByTempArticleID(int TempArticleID)
        {
            SqlConnection conn = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand("select TypeID from [TempArticle] where TempArticleID = @TempArticleID", conn);

            cmd.Parameters.Add(new SqlParameter("@TempArticleID", TempArticleID));
            int typeid = Convert.ToInt32(cmd.ExecuteScalar());

            cmd.Dispose();
            conn.Close();
            return(typeid);
        }
예제 #29
0
        public static string GetTypeNameByTypeID(int typeid)
        {
            string        typename = "";
            SqlConnection conn     = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand("select TypeName from [ArticleType] where TypeID = @typeid", conn);

            cmd.Parameters.Add(new SqlParameter("@typeid", typeid));
            typename = cmd.ExecuteScalar().ToString();
            cmd.Dispose();
            conn.Close();
            return(typename);
        }
예제 #30
0
        public static string GetTypeIDFromView_ArticleTypeToNewsType(int ArticleID)
        {
            string        typename = "";
            SqlConnection conn     = DBLink.GetConnection();

            conn.Open();
            SqlCommand cmd = new SqlCommand("SELECT [TypeID] FROM [View_ArticleTypeToNewsType] WHERE ArticleID = @ArticleID", conn);

            cmd.Parameters.Add(new SqlParameter("@ArticleID", ArticleID));
            typename = cmd.ExecuteScalar().ToString();
            cmd.Dispose();
            conn.Close();
            return(typename);
        }