当前位置: 首页>>代码示例>>C#>>正文


C# TriglavBL.SaveUser_Likes方法代码示例

本文整理汇总了C#中Data.EntityFramework.BLL.TriglavBL.SaveUser_Likes方法的典型用法代码示例。如果您正苦于以下问题:C# TriglavBL.SaveUser_Likes方法的具体用法?C# TriglavBL.SaveUser_Likes怎么用?C# TriglavBL.SaveUser_Likes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Data.EntityFramework.BLL.TriglavBL的用法示例。


在下文中一共展示了TriglavBL.SaveUser_Likes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btn_Like_Click

        protected void btn_Like_Click(object sender, ImageClickEventArgs e)
        {
            using (TriglavBL temp = new TriglavBL())
            {
                user_likes = temp.getUserLikes(korisnik.id, post.id);

                if (user_likes == null)
                {
                    user_likes = new Data.EntityFramework.DAL.User_Likes();
                    user_likes.PostId = post.id;
                    user_likes.UserId = korisnik.id;
                    user_likes.DaumRated = DateTime.Now;
                    user_likes.DatumLajkanja = DateTime.Now;
                    user_likes.isLiked = 1;
                    user_likes.Rate = 0;
                    temp.SaveUser_Likes(user_likes);
                }
                else
                {
                    Int32 LikesBefore = temp.getVoteUserLikes(user_likes.UserId.Value, user_likes.PostId.Value);
                    user_likes.DatumLajkanja = DateTime.Now;
                    user_likes.isLiked = 1;
                    temp.UpdateUser_Likes(user_likes, LikesBefore);
                }
            }
            LoadClanak(post.id);
        }
开发者ID:elvis-kadic,项目名称:FIT_KMS,代码行数:27,代码来源:QA_Pitanje.aspx.cs

示例2: btn_oLike_Click

        protected void btn_oLike_Click(object sender, ImageClickEventArgs e)
        {
            if (korisnik != null)
            {

                ImageButton _sender = (ImageButton)sender;
                HiddenField hid = (HiddenField)_sender.FindControl("hf");

                using (TriglavBL temp = new TriglavBL())
                {
                    Post odgovorNaLIsti = temp.getOdgovorByID(Convert.ToInt32(hid.Value));

                    if (odgovorNaLIsti != null)
                    {
                        user_likes = temp.getUserLikes(korisnik.id, odgovorNaLIsti.id);

                        if (user_likes == null)
                        {
                            user_likes = new Data.EntityFramework.DAL.User_Likes();
                            user_likes.PostId = odgovorNaLIsti.id;
                            user_likes.UserId = korisnik.id;
                            user_likes.DaumRated = DateTime.Now;
                            user_likes.DatumLajkanja = DateTime.Now;
                            user_likes.isLiked = 1;
                            user_likes.Rate = 0;
                            temp.SaveUser_Likes(user_likes);
                        }
                        else
                        {
                            Int32 LikesBefore = temp.getVoteUserLikes(user_likes.UserId.Value, user_likes.PostId.Value);
                            user_likes.DatumLajkanja = DateTime.Now;
                            user_likes.isLiked = 1;
                            temp.UpdateUser_Likes(user_likes, LikesBefore);
                        }
                    }
                }
                LoadClanak(post.id);
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "Login()", true);
            }
        }
开发者ID:elvis-kadic,项目名称:FIT_KMS,代码行数:43,代码来源:QA_Pitanje.aspx.cs

示例3: dl_odgovori_ItemDataBound

        protected void dl_odgovori_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            int id = (int)DataBinder.Eval(e.Item.DataItem, "id");

            using (TriglavBL temp = new TriglavBL())
            {
                Post p = temp.getPostByID(id);
                Data.EntityFramework.DAL.Korisnik k = temp.getKorisnikByID(p.VlasnikID.Value);
                System.Web.UI.WebControls.ImageButton img_User = (System.Web.UI.WebControls.ImageButton)e.Item.FindControl("img_User");
                img_User.ImageUrl = k.SlikaURL;
                img_User.PostBackUrl = "/Public/QA_Pitanja.aspx?KorisnikID=" + p.VlasnikID.Value;

                Label reputacija = (Label)e.Item.FindControl("lbl_Reputacija");
                reputacija.Text = "Reputacija: " + k.Reputacija;

                System.Web.UI.WebControls.ImageButton img_Bedz = (System.Web.UI.WebControls.ImageButton)e.Item.FindControl("img_Bedz");
                img_Bedz.ImageUrl = k.BedzSlika;
                img_Bedz.PostBackUrl = "/Public/QA_Bedz.aspx?BedzID=" + k.BedzID.Value;

                Label lbl_NazivBedza = (Label)e.Item.FindControl("lbl_NazivBedza");
                lbl_NazivBedza.Text = k.BedzNaziv;
                lbl_NazivBedza.ToolTip = k.BedzOpis;

                Label lbl_BrojPoena = (Label)e.Item.FindControl("lbl_BrojPoena");
                lbl_BrojPoena.Text = Convert.ToString(p.BrojPoena);

                if (p.BrojPoena >= 3)
                {
                    e.Item.BackColor = Color.LightGray;

                }
                if (p.BrojPoena >= 5)
                {

                    e.Item.BackColor = Color.LightYellow;

                }
                if (p.BrojPoena >= 10)
                {
                    e.Item.BackColor = Color.LightGreen;

                }
                if (p.BrojPoena < 3)
                {
                    e.Item.BackColor = Color.White;
                }

                ImageButton like = (ImageButton)e.Item.FindControl("btn_oLike");
                ImageButton unlike = (ImageButton)e.Item.FindControl("btn_oUnlike");
                if (korisnik != null)
                {
                    User_Likes ulo;
                    if (temp.getUserLikes(korisnik.id, p.id) == null)
                    {
                        ulo = new Data.EntityFramework.DAL.User_Likes();
                        ulo.PostId = p.id;
                        ulo.UserId = korisnik.id;
                        ulo.DatumLajkanja = DateTime.Now;
                        ulo.DaumRated = DateTime.Now;
                        ulo.isLiked = 0;
                        temp.SaveUser_Likes(ulo);
                    }
                    else
                    {
                        ulo = temp.getUserLikes(korisnik.id, p.id);
                    }
                    like.Enabled = false;
                    unlike.Enabled = false;

                    if (ulo.isLiked == 0)
                    {
                        like.Enabled = true;
                        unlike.Enabled = true;
                    }
                    if (ulo.isLiked == 1)
                    {
                        like.Enabled = false;
                        unlike.Enabled = true;
                    }
                    if (ulo.isLiked == 2)
                    {
                        like.Enabled = true;
                        unlike.Enabled = false;
                    }
                }
                else
                {
                    like.Enabled = false;
                    unlike.Enabled = false;
                }
            }
        }
开发者ID:elvis-kadic,项目名称:FIT_KMS,代码行数:92,代码来源:QA_Pitanje.aspx.cs


注:本文中的Data.EntityFramework.BLL.TriglavBL.SaveUser_Likes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。