Beispiel #1
0
        public void initComments(int id_h_diskusi)
        {
            D_DiskusiModel ddm = new D_DiskusiModel();

            ddm.addWhere("ID_H_DISKUSI", id_h_diskusi.ToString());
            // Dapatkan semua comment dengan id header diskusi yang diminta
            bool isPenjual;

            foreach (DataRow row in ddm.get())
            {
                exist = true;

                isPenjual = row["SENDER"].ToString() == "C" ? false : true;
                Comment com = new Comment(isPenjual);
                DataRow user;
                if (isPenjual)
                {
                    user = new DB("SELLER").select().@where("ID", row["ID_SELLER"].ToString()).getFirst();
                    com.init(
                        message: row["MESSAGE"].ToString(),
                        commenterName: user["NAMA_SELLER"].ToString(),
                        date: Utility.formatDate(row["CREATED_AT"].ToString()),
                        url: user["IMAGE"].ToString()
                        );
                }
                else
                {
                    user = new DB("CUSTOMER").select().@where("ID", row["ID_CUSTOMER"].ToString()).getFirst();
                    com.init(
                        message: row["MESSAGE"].ToString(),
                        commenterName: user["NAMA"].ToString(),
                        date: Utility.formatDate(row["CREATED_AT"].ToString()),
                        url: user["IMAGE"].ToString()
                        );
                }
                spComments.Children.Add(com);
            }

            if (exist)
            {
                ReplyCard rc = new ReplyCard();
                rc.initCard(id_h_diskusi);
                spComments.Children.Add(rc);
            }
        }
Beispiel #2
0
        private void BtnKirimOnClick(object sender, RoutedEventArgs e)
        {
            // Kirim Diskusi
            D_DiskusiModel dti = new D_DiskusiModel();
            string         col, id, Sender;

            if (Session.role.ToUpper() == "SELLER")
            {
                col    = "ID_SELLER";
                Sender = "S";
            }
            else
            {
                col    = "ID_CUSTOMER";
                Sender = "C";
            }
            id = Session.User["ID"].ToString();
            string message = Utility.StringFromRichTextBox(richTextBox);

            dti.insert(
                "ID", 0,
                col, id,
                "MESSAGE", message,
                "SENDER", Sender,
                "ID_H_DISKUSI", id_h_diskusi,
                "CREATED_AT", DateTime.Now.ToString()
                );
            Utility.setRichTextBoxString(richTextBox, "");
            if (Session.role.ToUpper() == "SELLER")
            {
                SellerViewModel.pageProduk.resetDiskusi();
            }
            else
            {
                ItemDetailViewModel.resetDiscussion();
            }
        }