Exemplo n.º 1
0
        public void loadDiskusi(int id)
        {
            H_DiskusiModel model = new H_DiskusiModel();

            model.addWhere("ID_ITEM", id.ToString());
            if (model.get().Length <= 0)
            {
                ViewComponent.textblockDiskusiProduk.Text = "BELUM ADA DISKUSI";
                Color color = (Color)ColorConverter.ConvertFromString("#E23434");
                ViewComponent.textblockDiskusiProduk.Foreground = new SolidColorBrush(color);
                return;
            }
            else
            {
                ViewComponent.textblockDiskusiProduk.Text = "DISKUSI";
                Color color = (Color)ColorConverter.ConvertFromString("#FFFFFF");
                ViewComponent.textblockDiskusiProduk.Foreground = new SolidColorBrush(color);
            }
            model.addOrderBy("CREATED_AT ASC");
            foreach (DataRow row in model.get())
            {
                DiscussionCard dc       = new DiscussionCard(ViewComponent.spanelDiscussion.ActualWidth);
                DataRow        customer = new DB("CUSTOMER").select().@where("ID", row["ID_CUSTOMER"].ToString()).getFirst();
                dc.initMainComment(
                    message: row["MESSAGE"].ToString(),
                    commenterName: customer["NAMA"].ToString(),
                    date: Utility.formatDate(row["CREATED_AT"].ToString()),
                    url: customer["IMAGE"].ToString()
                    );
                dc.initComments(Convert.ToInt32(row["ID"]));
                ViewComponent.spanelDiscussion.Children.Add(dc);
            }
        }
Exemplo n.º 2
0
        public static void kirimDiskusi(string message, int id_item)
        {
            H_DiskusiModel hd = new H_DiskusiModel();

            hd.insert(
                "ID", 0,
                "ID_CUSTOMER", Session.User["ID"].ToString(),
                "MESSAGE", message,
                "ID_ITEM", id_item,
                "STATUS", 1,
                "CREATED_AT", DateTime.Now.ToString()
                );
        }
Exemplo n.º 3
0
        public static void loadDiscussions(StackPanel elem, int ItemID)
        {
            spDiscussion = elem;
            ItemId       = ItemID;
            H_DiskusiModel hdm = new H_DiskusiModel();

            hdm.addWhere("ID_ITEM", ItemID.ToString());
            hdm.addOrderBy("CREATED_AT ASC");
            foreach (DataRow row in hdm.get())
            {
                DiscussionCard dc       = new DiscussionCard(elem.ActualWidth);
                DataRow        customer = new DB("CUSTOMER").select().@where("ID", row["ID_CUSTOMER"].ToString()).getFirst();
                dc.initMainComment(
                    message: row["MESSAGE"].ToString(),
                    commenterName: customer["NAMA"].ToString(),
                    date: Utility.formatDate(row["CREATED_AT"].ToString()),
                    url: customer["IMAGE"].ToString()
                    );
                dc.initComments(Convert.ToInt32(row["ID"]));
                elem.Children.Add(dc);
            }
        }