示例#1
0
        protected override void PageLoad()
        {
            base.PageLoad();
            base.Title = "¹«Ë¾±à¼­";
            base.CheckUserPower("ReadCompany,UpdateCompany,UpdateSubCompany", PowerCheckType.OR);

            string sonCompanyID = CookiesHelper.ReadCookieValue("UserCompanySonCompanyID");

            if (companyID > 0)
            {
                if (!StringHelper.CompareSingleString(sonCompanyID, companyID.ToString()))
                {
                    ScriptHelper.Alert("Òì³£");
                }
            }
            else
            {
                companyID = base.UserCompanyID;
            }
            company = CompanyBLL.ReadCompany(companyID);
            if (StringHelper.CompareSingleString(company.BrandId, "0"))
            {
                productBrandList = ProductBrandBLL.ReadProductBrandCacheList();
            }
            else
            {
                productBrandList = ProductBrandBLL.ReadProductBrandCacheList(company.BrandId);
            }
            departmentList = PostBLL.ReadParentPostListByPostId(company.Post);
            postList       = PostBLL.ReadPostListByPostId(company.Post);
            if (company.GroupId == (int)CompanyType.SubCompany || company.GroupId == (int)CompanyType.SubGroup)
            {
                parentCompanyPath = CompanyBLL.ReadParentCompanyName(company.ParentId);
            }
        }
示例#2
0
        public List <Post> GetPostList()
        {
            _postBLL = new PostBLL();
            List <Post> userPosts = _postBLL.GetPostList();

            return(userPosts);
        }
示例#3
0
        private string CreatePostHtml(string companyPost, int parentPostID)
        {
            StringBuilder postHtml = new StringBuilder();

            //岗位设置
            postHtml.Append("<div>");
            List <PostInfo> postList = PostBLL.FilterPostListByCompanyID(PostBLL.ReadPostList(parentPostID), companyID);

            foreach (PostInfo info in postList)
            {
                //if (info.CompanyID != CompanyBLL.SystemCompanyId && parentPostID==0 && info.IsPost==0)
                //{
                //    postHtml.Append(CreatePostHtml(companyPost, info.PostId));
                //    continue;
                //}
                postHtml.AppendLine("<dl>");
                postHtml.AppendLine("<dt><input name=\"Department\" type=\"checkbox\" value=\"" + info.PostId + "\">" + info.PostName + "</dt>");
                postHtml.AppendLine("<div class=\"post\">");
                foreach (PostInfo info2 in PostBLL.FilterPostListByCompanyID(PostBLL.ReadPostList(info.PostId), companyID))
                {
                    postHtml.AppendLine("<dd><input name=\"Post\" data-type=\"" + info.PostId + "\" type=\"checkbox\" value=\"" + info2.PostId + "\"");
                    if (StringHelper.CompareString(companyPost, info2.PostId.ToString()))
                    {
                        postHtml.Append(" checked");
                    }
                    postHtml.Append(">" + info2.PostName + "</dd>");
                }
                postHtml.AppendLine("</div>");
                postHtml.AppendLine("</dl>");
            }
            postHtml.Append("</div>");
            return(postHtml.ToString());
        }
示例#4
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int postid = 0;

        postid = int.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString());


        try
        {
            PostBLL pb = new PostBLL();
            int     i  = pb.DeletePost(postid);
            if (i == 1)
            {
                Response.Write("<script language='javascript'>alert('Post has been deleted !');</script>");
                GridView1.DataBind();
            }

            else
            {
                Response.Write("<script language='javascript'>alert('Post is failed to be deleted !');</script>");
            }
        }
        catch (SqlException ex)
        {
            Response.Write(ex.ToString());
        }
    }
示例#5
0
    private void LoadPostInfo()
    {
        try
        {
            posts = new PostBLL();
            Post post = posts.ListPostWithPostCode(Request.QueryString["PostCode"]).FirstOrDefault();
            txtPostTitleVN.Value     = post.TitleVN;
            txtPostTitleEN.Value     = post.TitleEN;
            EditorPostContentVN.Text = post.PostContentVN;
            EditorPostContentEN.Text = post.PostContentEN;
            txtMetaTitle.Text        = post.MetaTitle;
            txtMetaKeywords.Text     = post.MetaKeywords;
            txtMetaDescription.Text  = post.MetaDescriptions;
            chkTopHot.Checked        = post.TopHot;
            lblpost_status.Text      = (post.PostStatus) ? " -- Đăng bài --" : " -- Chờ xét duyệt  --";
            dlpost_status.Items.FindByValue((post.PostStatus) ? "1" : "0").Selected = true;

            lblTimePost.Text = post.PostTime.ToString();
            this.load_Checkcbltag(post.ID);

            images              = new ImagesBLL();
            imgpost.Src         = (images.ListWithID(post.PostImages).FirstOrDefault() == null) ? "../../images/noimage.jpg.jpg" : "../../" + images.ListWithID(post.PostImages).FirstOrDefault().ImagesUrl;
            txtPostImgTemp.Text = (images.ListWithID(post.PostImages).FirstOrDefault() == null) ? "" : images.ListWithID(post.PostImages).FirstOrDefault().ImagesName;
            posts = new PostBLL();
            this.checkedTreeBoxCategory(posts.ListPostWithPostCode(Request.QueryString["PostCode"]).FirstOrDefault().ID.ToString());
        }
        catch (Exception ex)
        {
            this.AlertPageValid(true, ex.ToString(), alertPageValid, lblPageValid);
        }
    }
示例#6
0
        public async Task Create(PostBLL post)         //post
        {
            if (post == null)
            {
                throw new Exception("Post is null");
            }
            string path;
            var    rand = new Random();

            do
            {
                path = @"C:\data\Projects\Finalv2\photo_archive\WebAPI\App_Data\" + rand.Next(1000).ToString() + ".jpg";
            }while (File.Exists(path));
            string base64 = post.Content.Substring(post.Content.LastIndexOf(',') + 1);

            File.WriteAllBytes(path, Convert.FromBase64String(base64));

            var    client   = new ImgurClient("", "");
            var    endpoint = new ImageEndpoint(client);
            IImage image;

            using (var fs = new FileStream(path, FileMode.Open))
            {
                image = await endpoint.UploadImageStreamAsync(fs);
            }

            post.Url = image.Link;
            //File.Delete(path);
            var  mapper  = new Mapper(BLLtoDAL);
            Post postDAL = mapper.Map <PostBLL, Post>(post);

            db.Post.Create(postDAL);
            db.Save();
        }
示例#7
0
        /// <summary>
        /// 取得岗位课程ID
        /// </summary>
        /// <param name="PostId"></param>
        /// <returns></returns>
        public static string GetPostCourseId(int PostId)
        {
            string   CourseId = string.Empty;
            PostInfo Info     = PostBLL.ReadPost(PostId);

            if (Info != null)
            {
                List <PostInfo> PostList = PostBLL.ReadPostList(Info.PostId);
                if (PostList != null && PostList.Count > 0)
                {
                    foreach (PostInfo Item in PostList)
                    {
                        if (!string.IsNullOrEmpty(Item.PostPlan))
                        {
                            CourseId += "," + Item.PostPlan;
                        }
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(Info.PostPlan))
                    {
                        CourseId = Info.PostPlan;
                    }
                }

                if (CourseId.StartsWith(","))
                {
                    CourseId = CourseId.Substring(1);
                }
            }
            return(CourseId);
        }
示例#8
0
 public List <T_HR_POST> GetAllPostByDepartId(string DepartmentID, bool IsAll)
 {
     using (PostBLL bll = new PostBLL())
     {
         return(bll.GetAllPostByDepartId(DepartmentID, IsAll));
     }
 }
示例#9
0
 public void PostCancel(T_HR_POST postID, ref string strMsg)
 {
     using (PostBLL bll = new PostBLL())
     {
         bll.PostCancel(postID, ref strMsg);
     }
 }
示例#10
0
 public int GetPostNumber(string postID)
 {
     using (PostBLL bll = new PostBLL())
     {
         return(bll.GetPostNumber(postID));
     }
 }
示例#11
0
 public void PostUpdate(T_HR_POST entity, ref string strMsg)
 {
     using (PostBLL bll = new PostBLL())
     {
         bll.PostUpdate(entity, ref strMsg);
     }
 }
示例#12
0
        protected override void PageLoad()
        {
            base.PageLoad();
            base.Title = "岗位学习进度分析";
            base.CheckUserPower("ReadEMSReport", PowerCheckType.Single);

            if (CompanyID < 0)
            {
                CompanyID = base.UserCompanyID;
            }
            CompanyInfo company = CompanyBLL.ReadCompany(CompanyID);

            PostList = PostBLL.ReadPostListByPostId(company.Post);
            if (base.ExistsSonCompany)
            {
                userGroupList = AdminGroupBLL.ReadAdminGroupList(CompanyID, UserBLL.ReadUserGroupIDByCompanyID(base.SonCompanyID));
            }
            else
            {
                userGroupList = AdminGroupBLL.ReadAdminGroupList(CompanyID, UserBLL.ReadUserGroupIDByCompanyID(CompanyID.ToString()));
            }

            //用户权限组默认给考试人员
            if (string.IsNullOrEmpty(groupID))
            {
                groupID = "36";
            }

            if (Action == "Search")
            {
                ReportContentHtml = HtmlOut1(company);
            }
        }
示例#13
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int postid = 0;
        string postcontent = "";
        DateTime modified = DateTime.Now;
        string poststatus = "";
        int rating = 0;

        postid = Convert.ToInt16(((Label)GridView1.Rows[e.RowIndex].FindControl("lblpostid")).Text);
        postcontent = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtPostContent")).Text;
        poststatus = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtstatus")).Text;
        rating = Convert.ToInt16(((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtrating")).Text);

        PostBLL pb = new PostBLL();
           int i= pb.UpdatePost(postid,postcontent,modified,poststatus,rating);
           if (i == 1)
           {
           Response.Write("<script language='javascript'>alert('Post has been updated !');</script>");
           GridView1.DataBind();
           }
           else
           {
           Response.Write("<script language='javascript'>alert('Post is failed to be updated !');</script>");
           GridView1.DataBind();
           }
    }
示例#14
0
 public T_HR_POST GetPostById(string postID)
 {
     using (PostBLL bll = new PostBLL())
     {
         return(bll.GetPostById(postID));
     }
 }
示例#15
0
        public ActionResult Category(int id)
        {
            PostBLL post = new PostBLL(new DAL.UnitOfWork.UnitOfWork(new BlogDBContext()));

            ViewBag.lstCategory = post.getPostByCategoryId(id);
            return(View());
        }
示例#16
0
        private TopCagadasView RetornaViewTopCagadas(int pagina, string sessao)
        {
            string nomeSessao = "", nomeAction = "", idDiv = "";

            PostBLL    bll = new PostBLL(); List <Post> itens = new List <Post>();
            PagingInfo paging = new PagingInfo(pagina, bll.RetornaTotalRegistros(), tamanhoPagina);

            switch (sessao.ToLower())
            {
            case "maiscomentadas":
                nomeSessao = "Veja aqui as cagadas mais comentadas!";
                itens      = bll.RetornaMaisComentadas(tamanhoPagina, pagina);
                idDiv      = "maisComentados";
                nomeAction = "MaisComentadas";
                break;

            case "maiscurtidas":
            default:
                nomeSessao = "Acompanhe aqui as cagadas mais curtidas!";
                itens      = bll.RetornaMaisCurtidas(tamanhoPagina, pagina);
                idDiv      = "maisCurtidos";
                nomeAction = "MaisCurtidos";
                break;
            }

            var sessaoTopCagadaView = new SessaoTopCagadasView(itens, idDiv, nomeAction, paging);

            return(new TopCagadasView(sessaoTopCagadaView, nomeSessao));
        }
示例#17
0
    protected void New_Tags_relationships(string postcode)
    {
        posts = new PostBLL();
        tags_relationships = new Tags_relationshipsBLL();
        List <Post>     lstP   = posts.ListPostWithPostCode(postcode);
        Post            pp     = lstP.FirstOrDefault();
        int             postid = pp.ID;
        List <TagsPost> lstp   = new List <TagsPost>();

        foreach (ListItem itm in cbltags.Items)
        {
            if (itm.Selected)
            {
                lstp.Add(new TagsPost()
                {
                    id = int.Parse(itm.Value), name = itm.Text
                });
            }
        }
        List <TagsPost> newlt = lstp.OrderBy(r => r.id).ToList();

        foreach (TagsPost tp in newlt)
        {
            this.tags_relationships.NewTags_relationships(postid, tp.id);
        }
    }
示例#18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            base.CheckAdminPower("ReadPost", PowerCheckType.Single);
            string action = RequestHelper.GetQueryString <string>("Action");
            int    id     = RequestHelper.GetQueryString <int>("ID");

            if ((!string.IsNullOrEmpty(action)) && (id != -2147483648))
            {
                if (!string.IsNullOrEmpty(action))
                {
                    if (action == "Up")
                    {
                        base.CheckAdminPower("UpdatePostOrder", PowerCheckType.Single);
                        PostBLL.MoveUp(id);
                        AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("MoveRecord"), ShopLanguage.ReadLanguage("Post"), id);
                    }
                    else if (action == "Down")
                    {
                        base.CheckAdminPower("UpdatePostOrder", PowerCheckType.Single);
                        PostBLL.MoveDown(id);
                        AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("MoveRecord"), ShopLanguage.ReadLanguage("Post"), id);
                    }
                    else if (action == "Delete")
                    {
                        base.CheckAdminPower("DeletePost", PowerCheckType.Single);
                        PostBLL.DeletePost(id);
                        AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("Post"), id);
                    }
                }
            }
            PostInfo Model = new PostInfo();

            Model.ParentId = 0;
            base.BindControl(PostBLL.ReadPostCateNamedList(), this.RecordList);
        }
示例#19
0
 private void load_btnAddPost()
 {
     posts = new PostBLL();
     this.load_DropdownList(dlPosts, posts.ListAllPostinACtive(), "TitleVN", "ID");
     dlPosts.DataBind();
     dlPosts.Items.Insert(0, new ListItem(" -- Select a Post -- ", "0"));
 }
示例#20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(action))
            {
                groupID = "36";
                state   = ((int)UserState.Normal).ToString();
                rzDate  = 0;
            }

            if (!IsPostBack)
            {
                List <PostInfo> PostList    = PostBLL.ReadPostCateNamedList(2);
                List <PostInfo> NewPostList = new List <PostInfo>();
                foreach (PostInfo Info in PostList)
                {
                    List <PostInfo> TempPostList = PostBLL.ReadPostList(Info.PostId);
                    if (TempPostList == null || TempPostList.Count <= 0 || Info.ParentId > 0)
                    {
                        Info.PostName = Info.PostName.Trim().Replace("├", "").Trim();
                        NewPostList.Add(Info);
                    }
                }
                //base.BindControl(NewPostList, PostNameList);
                //base.BindControl(NewPostList, StudyPostNameList);
                if (!string.IsNullOrEmpty(action) && companyID > 0)
                {
                    ShowArea.Style.Add("display", "");
                    HtmlOut();
                }
            }
        }
示例#21
0
        protected override void PageLoad()
        {
            base.PageLoad();

            if (id > 0)
            {
                post       = PostBLL.ReadPost(id);
                base.Title = pageTitle = post.IsPost == 1 ? "修改培训信息" : "修改培训分类";
                action     = post.IsPost == 1 ? "Training" : "TrainingClass";
            }

            switch (action)
            {
            case "TrainingClass":
                base.Title = pageTitle = "添加培训分类";
                break;

            case "Training":
                base.Title = pageTitle = "添加培训项目";
                //添加或修改培训信息时,需调取上级培训分类信息
                List <PostInfo> postCateRoot = PostBLL.ReadPostCateRootList(base.UserCompanyID.ToString());
                if (postCateRoot.Count > 0)
                {
                    PostInfo firstPost = PostBLL.ReadPostCateRootList(base.UserCompanyID.ToString())[0];
                    parentPostList = PostBLL.FilterPostListByCompanyID(PostBLL.ReadPostListByParentID(firstPost.PostId), base.UserCompanyID.ToString());
                }
                break;
            }
        }
示例#22
0
 public int GetOnPostEmployeeCount(string PostID)
 {
     using (PostBLL bll = new PostBLL())
     {
         return(bll.GetOnPostNumber(PostID));
     }
 }
示例#23
0
 public void PostDelete(string postID, ref string strMsg)
 {
     using (PostBLL bll = new PostBLL())
     {
         bll.PostDelete(postID, ref strMsg);
     }
 }
示例#24
0
        public FriendsPage(string friendLogin)
        {
            InitializeComponent();

            _friendLogin = friendLogin;
            _userBLL     = new UserBLL();
            _personBLL   = new PersonBLL();
            _postBLL     = new PostBLL();

            _user        = _userBLL.GetUser(_friendLogin);
            info.Content = _user.FirstName + "  " + _user.LastName + "\nLogin:   "******"\nActive:\n      " + _user.LastLogin;
            if (_personBLL.IsUserFollowing(_userBLL.LoginRead(), _friendLogin))
            {
                btnFollow.BorderBrush = Brushes.MediumPurple;
            }
            else
            {
                btnFollow.BorderBrush = Brushes.Transparent;
            }

            _current_post     = new Post();
            btnPrev.IsEnabled = false;
            btnNext.IsEnabled = false;

            Refresh();
        }
示例#25
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int postid = 0;
        postid = int.Parse(GridView1.DataKeys[e.RowIndex].Values[0].ToString());

        try
        {

            PostBLL pb = new PostBLL();
            int i = pb.DeletePost(postid);
            if (i == 1)
            {
                Response.Write("<script language='javascript'>alert('Post has been deleted !');</script>");
                GridView1.DataBind();
            }

            else
                Response.Write("<script language='javascript'>alert('Post is failed to be deleted !');</script>");
        }
        catch (SqlException ex)
        {

            Response.Write(ex.ToString());
        }
    }
        public ActionResult MostView()
        {
            List <StructurePostToRender> lst = new List <StructurePostToRender>();

            lst = PostBLL.Post_GetTopViewPost();
            return(View(lst));
        }
 public EditPost(ObjectId postId)
 {
     InitializeComponent();
     _postId   = postId;
     _postBLL  = new PostBLL();
     Text.Text = _postBLL.GetPost(_postId).Text;
 }
        public ActionResult Create(StructurePost data, ObjFile doc)
        {
            var filePath = "";

            if (Session["uid"] != null)
            {
                data.userid = Session["uid"].ToString();
            }
            foreach (var file in doc.files)
            {
                if (file != null)
                {
                    var fileName = Path.GetFileName(file.FileName);
                    filePath = Path.Combine(Server.MapPath("~/Files"), fileName);
                    file.SaveAs(filePath);
                }
                else
                {
                    filePath = "";
                }
            }

            PostBLL.Post_CreateNewPost(data, filePath);
            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult Popular()
        {
            List <StructurePostToRender> lst = new List <StructurePostToRender>();

            lst = PostBLL.Post_GetTopPopularPost();
            return(View(lst));
        }
示例#30
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        int      postid      = 0;
        string   postcontent = "";
        DateTime modified    = DateTime.Now;
        string   poststatus  = "";
        int      rating      = 0;

        postid      = Convert.ToInt16(((Label)GridView1.Rows[e.RowIndex].FindControl("lblpostid")).Text);
        postcontent = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtPostContent")).Text;
        poststatus  = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtstatus")).Text;
        rating      = Convert.ToInt16(((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtrating")).Text);

        PostBLL pb = new PostBLL();
        int     i  = pb.UpdatePost(postid, postcontent, modified, poststatus, rating);

        if (i == 1)
        {
            Response.Write("<script language='javascript'>alert('Post has been updated !');</script>");
            GridView1.DataBind();
        }
        else
        {
            Response.Write("<script language='javascript'>alert('Post is failed to be updated !');</script>");
            GridView1.DataBind();
        }
    }
        private void BindBookTree()
        {
            string        strId  = Request.QueryString.Get("id");
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(strId));


            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> bookList = null;

            string strPostID = objRandomExam.PostID;

            string[] str    = strPostID.Split(',');
            int      orgID  = PrjPub.CurrentLoginUser.OrgID;
            int      leader = objRandomExam.IsGroupLeader;
            int      techID = objRandomExam.TechnicianTypeID;

            PostBLL   objPostBll = new PostBLL();
            Hashtable htBook     = new Hashtable();

            for (int i = 0; i < str.Length; i++)
            {
                int          postID      = Convert.ToInt32(str[i]);
                IList <Post> objPostList = objPostBll.GetPostsByParentID(postID);
                if (objPostList.Count > 0)
                {
                    continue;
                }

                bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(-1, orgID, postID, leader, techID, 0);

                if (bookList.Count > 0)
                {
                    TreeViewNode tvn = null;

                    foreach (RailExam.Model.Book book in bookList)
                    {
                        if (!htBook.ContainsKey(book.bookId))
                        {
                            tvn       = new TreeViewNode();
                            tvn.ID    = book.bookId.ToString();
                            tvn.Value = book.bookId.ToString();
                            //int n = objItemBll.GetItemsByBookID(book.bookId, Convert.ToInt32(strItemTypeID));
                            tvn.Text    = book.bookName;
                            tvn.ToolTip = book.bookName;
                            tvn.Attributes.Add("isBook", "true");
                            tvn.ImageUrl           = "/RailExamBao/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Book.gif";
                            tvn.ContentCallbackUrl = "/RailExamBao/Common/GetBookChapter.aspx?itemTypeID=1&item=no&id=" +
                                                     book.bookId;

                            tvBookChapter.Nodes.Add(tvn);

                            htBook.Add(book.bookId, book.bookName);
                        }
                    }
                }
            }
        }
        public ActionResult Detail(int postId)
        {
            Post postData = new Post();

            postData         = PostBLL.Post_GetDetailsPost(postId);
            ViewBag.ListComt = PostBLL.Post_GetListCommentOfPost(postId);
            return(View(postData));
        }
示例#33
0
        public void ShouldReturnAllPostsWhenNoDateRangeIsEntered()
        {
            _postDataAccess = new Mock<IPostDataAccess>();
            _postDataAccess.Setup(x => x.GetPostsByDateRange(It.IsAny<DateTime>(), It.IsAny<DateTime>()))
                .Returns(Mother.PostsWithoutTagsOrComments);

            var sut = new PostBLL(_postDataAccess.Object);

            var posts = sut.GetPostsByDateRange(null, null);

            Assert.Equal(Mother.PostsWithoutTagsOrComments.Count(), posts.Count());
        }
示例#34
0
    protected void btnAddPost_Click(object sender, EventArgs e)
    {
        int userid = Convert.ToInt16(lblShowID.Text);
        int categoryid = Convert.ToInt16(ddlCategory.SelectedValue);
        string postcontent = txtPostContent.Text;
        DateTime published = DateTime.Now;
        string status = "posted";
        string image;

           if (FileUpload1.PostedFile.ContentLength < 800000)
           {
           string fileFullname = this.FileUpload1.FileName;
           string dataName = DateTime.Now.ToString("yyyyMMddhhmmss");
           string fileName = fileFullname.Substring(fileFullname.LastIndexOf("\\") + 1);
           //   string type = fileFullname.Substring(fileFullname.LastIndexOf(".") , 3);
           string type = fileFullname;
           //string strFileName = DateTime.Now.ToString("MM-dd-yyyy_HHmmss");
           //string strFileType = System.IO.Path.GetExtension(FileUpload1.FileName).ToString().ToLower();

           //  string type = strFileName.Substring(strFileName.LastIndexOf(".") + 1);
           type = type.Substring(type.Length - 3);
           if (type == "bmp" || type == "jpg" || type == "gif" || type == "JPG" || type == "BMP" || type == "GIF")
           {
               this.FileUpload1.PostedFile.SaveAs(Server.MapPath("~/images/blog") + "\\" + dataName + "." + type);
               //    FileUpload1.PostedFile.SaveAs(Server.MapPath("~/images/" + fileName + type));
               image = "~/images/blog/" + dataName + "." + type;
               PostBLL pb = new PostBLL();
              int i= pb.NewPost(categoryid, userid,postcontent,published,status,image);
              if (i > 0)
              {
                  Response.Write("<script language='javascript'>alert('Your post has been added !');</script>");
                  Response.Redirect("ViewMyPost.aspx");
              }
              else
              {
                  Response.Write("<script language='javascript'>alert('Your post is failed to be added  !');</script>");
              }

           }
           else
           {
               Response.Write("<script language='javascript'>alert('Support format:|jpg|gif|bmp| !');</script>");
           }
           }
           else
           {
           Response.Write("<script language='javascript'>alert('Your image exceeds 800K!');</script>");
           }
    }
示例#35
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     string postcontent = txtpostcontent.Text;
     DateTime modified = DateTime.Now;
     postid =Convert.ToInt16( GridView1.SelectedValue);
     PostBLL pb = new PostBLL();
     int i = pb.UpdatePost(postid, postcontent, modified);
     if(i==1)
     {
         Response.Write("<script language='javascript'>alert('Post has been updated !');</script>");
         GridView1.DataBind();
     }
     else
     {
         Response.Write("<script language='javascript'>alert('Post is failed to be updated !');</script>");
         GridView1.DataBind();
     }
 }
示例#36
0
        public List<T_HR_POST> GetPostWithSpecifiedTime(string startDate)
        {
            using (PostBLL bll = new PostBLL())
            {
                var ents = bll.GetPostWithSpecifiedTime(startDate);
                if (ents != null)
                {
                    return ents.Count() > 0 ? ents.ToList() : null;
                }
                else
                {
                    return null;
                }

            }
        }
示例#37
0
 public void PostDelete(string postID, ref string strMsg)
 {
     using (PostBLL bll = new PostBLL())
     {
         bll.PostDelete(postID, ref strMsg);
     }
 }
示例#38
0
 public int GetPostNumber(string postID)
 {
     using (PostBLL bll = new PostBLL())
     {
         return bll.GetPostNumber(postID);
     }
 }
示例#39
0
 public void PostCancel(T_HR_POST postID, ref string strMsg)
 {
     using (PostBLL bll = new PostBLL())
     {
         bll.PostCancel(postID, ref strMsg);
     }
 }
示例#40
0
 public List<SMT.HRM.CustomModel.V_POST> GetPostViewByDateAndUser(string startDate, string userID)
 {
     using (PostBLL bll = new PostBLL())
     {
         var ents = bll.GetPostViewByDateAndUser(startDate, userID);
         if (ents != null)
         {
             return ents.Count() > 0 ? ents.ToList() : null;
         }
         else
         {
             return null;
         }
     }
 }
示例#41
0
        public List<T_HR_POST> GetPostByEntityPerm(string userID, string perm, string entity)
        {
            using (PostBLL bll = new PostBLL())
            {

                IQueryable<T_HR_POST> ents = null;

                if (string.IsNullOrEmpty(perm) || string.IsNullOrEmpty(entity))
                    ents = bll.GetPostActived(userID);
                else
                    ents = bll.GetPostActived(userID, perm, entity);


                return ents.Count() > 0 ? ents.ToList() : null;
            }
        }
示例#42
0
 public List<SMT.HRM.CustomModel.V_POST> GetPostView(string userID, string perm, string entity)
 {
     using (PostBLL bll = new PostBLL())
     {
         var ents = bll.GetPostView(userID, perm, entity);
         return ents.Count() > 0 ? ents.ToList() : null;
     }
 }
示例#43
0
 public List<T_HR_POST> GetPostActived(string userID)
 {
     using (PostBLL bll = new PostBLL())
     {
         var ents = bll.GetPostActived(userID);
         return ents.Count() > 0 ? ents.ToList() : null;
     }
 }
示例#44
0
 public int GetOnPostEmployeeCount(string PostID)
 {
     using (PostBLL bll = new PostBLL())
     {
         return bll.GetOnPostNumber(PostID);
     }
 }
示例#45
0
 public List<T_HR_POST> GetAllPostByDepartId(string DepartmentID,bool IsAll)
 {
     using (PostBLL bll = new PostBLL())
     {
         return bll.GetAllPostByDepartId(DepartmentID,IsAll);
     }
 }
示例#46
0
 public bool IsFatherPost(string postID)
 {
     PostBLL bll = new PostBLL();
     return bll.IsFatherPost(postID);
 }
示例#47
0
        public T_HR_POST GetPostById(string postID)
        {
            using (PostBLL bll = new PostBLL())
            {
                return bll.GetPostById(postID);
            }

        }
示例#48
0
 public void PostUpdate(T_HR_POST entity, ref string strMsg)
 {
     using (PostBLL bll = new PostBLL())
     {
         bll.PostUpdate(entity, ref strMsg);
     }
 }
示例#49
0
 public List<T_HR_POST> PostPaging(int pageIndex, int pageSize, string sort, string filterString, IList<object> paras, ref int pageCount, string userID, string checkState)
 {
     using (PostBLL bll = new PostBLL())
     {
         var ents = bll.PostPaging(pageIndex, pageSize, sort, filterString, paras, ref pageCount, userID, checkState);
         if (ents != null)
         {
             return ents.Count() > 0 ? ents.ToList() : null;
         }
         else
         {
             return null;
         }
     }
     //  return ents.Count() > 0 ? ents.ToList() : null;
 }
示例#50
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Email_ID"] == null || Session["Email_ID"] == " ")
        {

            lblgiverating.Visible = false;
            ddlrating.Visible = false;
            lblopinion.Visible = false;
            rbtndislike.Visible = false;
            rbtnlike.Visible = false;
            btnSubmit.Visible = false;

            string id = Request.QueryString["id"].ToString();
            int postid = Convert.ToInt16(id);

            PostBLL pb = new PostBLL();
            Post p = pb.ShowPost(postid);
            img01.ImageUrl = p.ImagePath;
            lblShowPostID.Text = postid.ToString();
            lblShowRating.Text = p.Post_Rating.ToString();
            txtPostContent.Text = p.Post_Content;

        }

        else
        {

            string emailid = Session["Email_ID"].ToString();

            string id = Request.QueryString["id"].ToString();
            int postid = Convert.ToInt16(id);

            PostBLL pb = new PostBLL();
            Post p = pb.ShowPost(postid);
            img01.ImageUrl = p.ImagePath;
            lblShowPostID.Text = postid.ToString();
            lblShowRating.Text = p.Post_Rating.ToString();
            txtPostContent.Text = p.Post_Content;
        }
    }