Пример #1
0
    protected void btnVerifyPhone_Click(object sender, EventArgs e)
    {
        pnlPhone.Visible       = true;
        btnVerifyPhone.Enabled = false;

        // Your Account SID from twilio.com/console
        var accountSid = "AC6df3f3bb4adeee93cdbc734e56757194";
        // Your Auth Token from twilio.com/console
        var authToken = "268d599703a742f5a70d22e28ad3e2ab";

        TwilioClient.Init(accountSid, authToken);

        if (tbxPhone.Value == "")
        {
            pnlMessageOutput.Visible = true;
            lblOutput.Text           = "Please insert phone number.";
        }
        else if (MemberDB.getMemberbyPhone(tbxPhone.Value).Email != null)
        {
            pnlMessageOutput.Visible = true;
            lblOutput.Text           = "Phone number exists.";
        }
        else
        {
            string otp = Utility.getRandomizedChar(5, 0);

            var message = MessageResource.Create(
                to: new PhoneNumber("+65" + tbxPhone.Value),
                from: new PhoneNumber("+12566678209"),
                body: otp + " is your RentHere OTP.");

            Session["OTP"] = otp;
        }
    }
Пример #2
0
 // method to read the column values in the database (through the referenced reader) and assign it to the correct properties of the referenced MemberMessage object
 // allows for easier editing of column names if needed, used only for methods with select statments regarding MemberMessage
 private static void readAMsg(ref MemberMessage msg, ref SqlDataReader reader)
 {
     msg.MemberInbox = MemberInboxDB.getMemberInboxID(reader["memberInboxID"].ToString());
     msg.Reply       = Convert.ToString(reader["reply"]);
     msg.Date        = Convert.ToDateTime(reader["date"]);
     msg.Sender      = MemberDB.getMemberbyID(reader["senderID"].ToString());
 }
Пример #3
0
        public ActionResult Register(RegisterViewModel mem)
        {
            // make sure model is valid
            if (ModelState.IsValid)
            {
                if (MemberDB.DoesUsernameExist(mem.Username))
                {
                    ModelState.AddModelError("DuplicateUsername", "Username is already taken");

                    return(View(mem));
                }

                // if valid add to DB
                Member m = new Member()
                {
                    Username = mem.Username,
                    Password = mem.Password,
                    Email    = mem.Email,
                };
                MemberDB.RegisterMember(m);
                SessionHelper.LogUserIn(m);
                return(RedirectToAction("Index", "Home"));
            }
            // if invalid, return view w/ errors
            return(View(mem));
        }
Пример #4
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Item newItem = new Item();

        newItem.CategoryName  = CategoryDB.getCategorybyName("Services");
        newItem.Deposit       = Convert.ToDecimal(tbxRefundableDeposit.Text);
        newItem.Location      = LocationDB.getLocationbyID(ddlMRTLocation.SelectedValue);
        newItem.PricePerDay   = Convert.ToDecimal(tbxPricePerDay);
        newItem.PricePerWeek  = Convert.ToDecimal(tbxPricePerWeek);
        newItem.PricePerMonth = Convert.ToDecimal(tbxPricePerMonth);
        newItem.Renter        = MemberDB.getMemberbyEmail(Session["user"].ToString());
        newItem.Description   = tbxDescription.InnerText;
        newItem.PostedDate    = DateTime.Now;
        newItem.ItemID        = Utility.convertIdentitytoPK("ITM", ItemDB.addItem(newItem));

        List <string> tags = Utility.findHashTags(tbxDescription.InnerText);

        if (tags.Count > 0)
        {
            foreach (string t in tags)
            {
                if (!TagDB.isTagPresent(t))
                {
                    TagDB.addTag(t);
                }

                ItemTagDB.addItemTag(newItem, t);
            }
        }
    }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //Validate the UI
            if (string.IsNullOrEmpty(txtJoinDate.Text.Trim()))
            {
                MessageBox.Show("Please enter a member name.");
                txtJoinDate.Focus();
                return;
            }

            Member objMember = MemberDB.GetMember(txtNumber.Text);

            try
            {
                bool status = MemberDB.DeleteMember(objMember);
                if (status) //You can use this syntax as well..if (status ==true)
                {
                    MessageBox.Show("Member was deleted from the database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Member was not deleted from the database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #6
0
 // gets messages regarding dispute selected
 protected string retrieveMessage(string memberID, string staffID, string reply, string datePosted)
 {
     if (memberID != "")
     {
         return(" <div class='item'> \n " +
                " <div class='text'> \n " +
                " <div class='heading'> \n " +
                " <a class='text-success' href='#'>" + MemberDB.getMemberbyID(memberID).Name + "</a> \n " +
                " <span class='date'>" + Convert.ToString(datePosted) + "</span> \n " +
                " </div> \n " +
                reply +
                " </div> \n " +
                " </div> \n ");
     }
     else
     {
         return(" <div class='item'> \n " +
                " <div class='text'> \n " +
                " <div class='heading'> \n " +
                " <a href='#'> <Strong> (Staff) " + StaffDB.getStaffbyID(staffID).Name + " </strong> </a> \n " +
                " <span class='date'>" + Convert.ToString(datePosted) + "</span> \n " +
                " </div> \n " +
                reply +
                " </div> \n " +
                " </div> \n ");
     }
 }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["user"] == null)
            {
                pnlBeforeLogin.Visible = true;
            }
            else
            {
                pnlAfterLogin.Visible = true;
                string[] fullName = MemberDB.getMemberbyEmail(Session["user"].ToString()).Name.Split(' ');

                lblUsername.Text = " " + fullName[0];
            }

            ddlCategory.DataSource = CategoryDB.getAllCategory();
            ddlCategory.DataBind();

            ddlLocation.DataSource = LocationDB.getAllLocation();
            ddlLocation.DataBind();

            ddlLocation.Items.Insert(0, new ListItem("Singapore", ""));
        }
    }
Пример #8
0
    protected void btnResolve_Click(object sender, EventArgs e)
    {
        Dispute dis = DisputeDB.getDisputeforRental(Request["rentid"].ToString());

        if (dis.Status == "Resolved")
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your page has expired since your disputer has closed the case')", true);
            rptMessages.DataBind();
            setChatControls(false);
            tbxMessage.Text = "";
            return;
        }

        //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "confirmMessage", "confirm('You are about to close the dispute case. As the action is irreversible, are you sure?')", true);
        DisputeDB.resolveDispute(dis.DisputeID);

        MessageDispute msgDis = new MessageDispute();

        msgDis.Date    = DateTime.Now;
        msgDis.Dispute = dis;
        msgDis.Member  = MemberDB.getMemberbyEmail(Session["user"].ToString());
        msgDis.Staff   = new Staff(null, null, null, null, 0, null, new DateTime());

        msgDis.Reply = "==============The Dispute has been closed================";

        MessageDisputeDB.addMsgDispute(msgDis);

        setChatControls(false);
    }
Пример #9
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (tbxMessage.Text.Length > 255)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your message cannot exceed 255 characters!')", true);
            return;
        }
        Dispute dis = DisputeDB.getDisputeforRental(Request["rentid"].ToString());



        if (dis.Status == "Resolved")
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your page has expired since your disputer has closed the case')", true);
            rptMessages.DataBind();
            setChatControls(false);
            tbxMessage.Text = "";
            return;
        }

        if (tbxMessage.Text != "")
        {
            if (dis.DisputeID == null)
            {
                if (ddlReason.SelectedValue != "")
                {
                    dis             = new Dispute();
                    dis.Reason      = ddlReason.SelectedItem.Value;
                    dis.Date        = DateTime.Now;
                    dis.Rental      = RentalDB.getRentalbyID(Request["rentid"].ToString());
                    dis.Status      = "Pending";
                    dis.SubmittedBy = MemberDB.getMemberbyEmail(Session["user"].ToString());
                    DisputeDB.addDispute(dis);

                    ddlReason.Enabled = false;
                }
                else
                {
                    return;
                }
            }

            dis = DisputeDB.getDisputeforRental(Request["rentid"].ToString());

            MessageDispute msgDis = new MessageDispute();

            msgDis.Date    = DateTime.Now;
            msgDis.Dispute = dis;
            msgDis.Member  = MemberDB.getMemberbyEmail(Session["user"].ToString());
            msgDis.Staff   = new Staff(null, null, null, null, 0, null, new DateTime());

            msgDis.Reply = tbxMessage.Text;
            MessageDisputeDB.addMsgDispute(msgDis);

            tbxMessage.Text = "";

            rptMessages.DataSource = MessageDisputeDB.getMsgforDispute(dis.DisputeID);
            rptMessages.DataBind();
        }
    }
Пример #10
0
    // method to get all support ticket from the database
    public static List <SupportTicket> getAllSupportTicket()
    {
        List <SupportTicket> ticketList = new List <SupportTicket>();

        try
        {
            SqlCommand command = new SqlCommand("Select * from SupportTicket");
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                SupportTicket t = new SupportTicket();
                t.TicketID    = reader["ticketID"].ToString();
                t.Title       = reader["title"].ToString();
                t.Description = reader["description"].ToString();
                t.Date        = Convert.ToDateTime(reader["Date"]);
                t.Status      = reader["status"].ToString();
                t.Urgency     = reader["urgency"].ToString();

                t.Member = MemberDB.getMemberbyID(reader["memberID"].ToString());

                ticketList.Add(t);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(ticketList);
    }
Пример #11
0
    // method to get all support tickets with answered status from the database
    public static List <SupportTicket> getAnsweredSupportTicket()
    {
        List <SupportTicket> ticketList = new List <SupportTicket>();

        try
        {
            SqlCommand command = new SqlCommand("Select ticketID, title, description, date, st.status, urgency, m.memberID, m.name, m.address, m.postalCode,m.password, m.email, m.phoneNumber, m.identificationNumber, m.identificationPicture, m.dateJoined , m.dateOfBirth, m.dateVerified, m.gender, m.status as MState, m.profilePic from SupportTicket st, Member m where st.status = 'Answered' and st.memberID = m.memberID");
            command.Connection = connection;
            connection.Open();
            SqlDataReader reader = command.ExecuteReader();
            while (reader.Read())
            {
                SupportTicket t = new SupportTicket();
                t.TicketID    = reader["ticketID"].ToString();
                t.Title       = reader["title"].ToString();
                t.Description = reader["description"].ToString();
                t.Date        = Convert.ToDateTime(reader["Date"]);
                t.Status      = reader["status"].ToString();
                t.Urgency     = reader["urgency"].ToString();

                t.Member = MemberDB.getMemberbyID(reader["memberID"].ToString());

                ticketList.Add(t);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(ticketList);
    }
Пример #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // user has selected a member to be viewed. this page displays information about the member selected

        // checks if user is logged in
        if (Session["admin"] == null) // if user is not logged in, redirect to login page
        {
            Response.Redirect("Login.aspx");
            return;
        }

        // check if member is selected
        if (Request.QueryString["memberID"] == null) // if nothing is selected, redirect to MemberList page
        {
            Server.Transfer("~/memberList.aspx");
        }
        else
        {
            // if member is selected, display the correct information for the item selected
            List <Member> memberList = new List <Member>();
            memberList.Add(MemberDB.getMemberbyID(Request.QueryString["memberID"].ToString()));
            rptMemberInfo.DataSource = memberList;
            rptMemberInfo.DataBind();
        }
        // allows user to see items listed by member
        List <Item> itemList = ItemDB.getAllItemofMember(MemberDB.getMemberbyID(Request.QueryString["memberID"].ToString()).MemberID);

        rptItemList.DataSource = itemList;
        rptItemList.DataBind();
    }
 // gets messages regarding supoprt ticket selected
 protected string retrieveMessage(string memberID, string staffID, string reply, string datePosted)
 {
     if (MemberDB.getMemberbyID(memberID).Email == SupportTicketDB.getSupportTicketbyID(Request.QueryString["ticketID"].ToString()).Member.Email)
     {
         return(" <div class='item'> \n " +
                " <div class='text'> \n " +
                " <div class='heading'> \n " +
                " <a class='text-success' href='#'>" + MemberDB.getMemberbyID(memberID).Name + "</a> \n " +
                " <span class='date'>" + Convert.ToString(datePosted) + "</span> \n " +
                " </div> \n " +
                reply +
                " </div> \n " +
                " </div> \n ");
     }
     else
     {
         return(" <div class='item'> \n " +
                " <div class='text'> \n " +
                " <div class='heading'> \n " +
                " <a href='#'> <Strong> (Staff) " + StaffDB.getStaffbyID(staffID).Name + " </strong> </a> \n " +
                " <span class='date'>" + Convert.ToString(datePosted) + "</span> \n " +
                " </div> \n " +
                reply +
                " </div> \n " +
                " </div> \n ");
     }
 }
Пример #14
0
    protected void lsvItemPostedList_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
    {
        DataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);

        lsvItemPostedList.DataSource = ItemDB.getAllItemofMember(MemberDB.getMemberbyEmail(Session["user"].ToString()).MemberID);
        lsvItemPostedList.DataBind();
    }
        public ActionResult Register(RegisterViewModel registerUser)
        {
            if (ModelState.IsValid)
            {
                if (MemberDB.IsUsernameTaked(registerUser))
                {
                    ModelState.AddModelError("UsernameTaken",
                                             "Username has been already taken!");
                    return(View(registerUser));
                }

                Member m = new Member()
                {
                    Username     = registerUser.Username,
                    EmailAddress = registerUser.Email
                };

                MemberDB.AddMember(m);
                SessionHelper.LogUserIn(m.Username);

                // redirect to home page
                return(RedirectToAction("Index", "Home"));
            }
            return(View(registerUser));
        }
Пример #16
0
    // gets sum of ratings by member from the database
    public static List <MemberAnalytic> getMemberFeedbackAnalytic()
    {
        List <MemberAnalytic> feedList = new List <MemberAnalytic>();

        try
        {
            SqlCommand command = new SqlCommand("SELECT feedbackTo, sum(case when rating='Positive' then 1 else 0 end) AS positiveCount, sum(case when rating = 'Neutral' then 1 else 0 end) AS neutralCount, sum(case when rating = 'Negative' then 1 else 0 end) AS negativeCount FROM Feedback F, Member M WHERE F.feedbackTo = M.memberID and M.status<>'Banned' GROUP BY feedbackTo");

            command.Connection = connection;
            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                MemberAnalytic ma = new MemberAnalytic();

                ma.Member = MemberDB.getMemberbyID(reader["feedbackTo"].ToString());
                ma.NoOfPositiveFeedback = Convert.ToInt32(reader["positiveCount"]);
                ma.NoOfNeutralFeedback  = Convert.ToInt32(reader["neutralCount"]);
                ma.NoOfNegativeFeedback = Convert.ToInt32(reader["negativeCount"]);
                ma.NoOfRentalAsRenter   = RentalDB.getNoofRentalAsRenter(ma.Member.MemberID);
                ma.NoOfRentalAsRentee   = RentalDB.getNoofRentalAsRentee(ma.Member.MemberID);

                feedList.Add(ma);
            }
            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(feedList);
    }
Пример #17
0
        private void btnSignUp_Click(object sender, EventArgs e)
        {
            try
            {
                Member member = new Member();
                member.joindate        = DateTime.Now.ToString();
                member.firstname       = txtFName.Text;
                member.lastname        = txtLName.Text;
                member.address         = txtAddress.Text;
                member.city            = txtCity.Text;
                member.state           = txtState.Text;
                member.zipcode         = txtZipcode.Text;
                member.phone           = maskedTextBox1.Text;
                member.member_status   = "A";
                member.login_name      = txtUsername.Text;
                member.password        = txtPass.Text;
                member.email           = txtEmail.Text;
                member.contact_method  = "1";
                member.subscription_id = "1";
                member.photo           = "";

                MemberDB.AddMember(member);

                MessageBox.Show("Welcome to Meramec OnLine Movie Kiosk " + member.login_name);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #18
0
        /// <summary>
        /// Clears form and loads list boxes with data.
        /// </summary>
        private void LoadBoxes()
        {
            Clear();

            List <Member> allMembers =
                MemberDB.GetAllMembers();

            if (allMembers != null)
            {
                foreach (Member m in allMembers)
                {
                    lstMembers.Items.Add($"{m.MemberID}, " +
                                         $"{m.Username},  " +
                                         $"{m.LastName},  " +
                                         $"{m.FirstName},  " +
                                         $"Admin: " +
                                         $"{m.IsAdmin}");
                }
            }

            List <Book> allBooks =
                LibraryDB.GetAllBooks();

            if (allBooks != null)
            {
                foreach (Book b in allBooks)
                {
                    lstBooks.Items.Add($"{b.ISBN}, " +
                                       $"{b.Title},  " +
                                       $"{b.Author},  " +
                                       $"{b.PubDate},  " +
                                       $"{b.Category}");
                }
            }
        }
Пример #19
0
        public RentalSearchForm(int memberID)
        {
            InitializeComponent();
            Global.memberID = memberID;
            Member currentMember = MemberDB.GetMember(memberID);

            lblName.Text = "Hello " + currentMember.firstname;
            List <Movie>      myMovieList = MovieDB.GetMovies();
            List <PictureBox> pixBoxes    = new List <PictureBox>();

            pixBoxes.Add(pictureBox7);
            pixBoxes.Add(pictureBox8);
            pixBoxes.Add(pictureBox9);
            pixBoxes.Add(pictureBox10);
            imageList1.ImageSize = new Size(32, 32);
            for (int i = 0; i < pixBoxes.Count; i++)
            {
                pixBoxes[i].Load(myMovieList[i].image);
            }
            //foreach (Movie movie in myMovieList)
            //{
            //    pictureBox1.Load(movie.image);
            //    var newImage = Image.FromFile(@"C:\Users\pezhe\OneDrive\Documents\College Classes\C# II\In-Class Demos\Week 10\Project2Template_v2Fall2016\Project2Template\MeramecNetFlixProject\Resources\stlcc-icon-dark-blue.png");
            //    pictureBox1.Image = newImage;
            //    imageList1.Images.Add(newImage);
            //}
        }
Пример #20
0
 // check if member logged in is giving or recieving feedback
 public string isGiveorReceiveFeedback(string rentalID, string renteeID, string rentStatus)
 {
     if (rentStatus != "On-going")
     {
         Feedback feed = FeedbackDB.getFeedbackforRental(rentalID);
         if (feed.FeedbackID != null)
         {
             if (renteeID == MemberDB.getMemberbyEmail(Session["user"].ToString()).MemberID)
             {
                 return("Review Feedback");
             }
             else
             {
                 return("Feedback Given");
             }
         }
         else
         {
             if (renteeID == MemberDB.getMemberbyEmail(Session["user"].ToString()).MemberID)
             {
                 return("Give Feedback");
             }
             else
             {
                 return("No Feedback Yet");
             }
         }
     }
     else
     {
         return("");
     }
 }
Пример #21
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            if (!(ValidateUI(BtnSubmit)))
            {
                return;
            }

            Member currentMember;

            try
            {
                currentMember = MemberDB.LoginMember(txtUsername.Text, txtPassword.Text);
                if (currentMember != null)
                {
                    new RentalSearchForm(currentMember.member_number).Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Login failed, username and/or password incorrect", "MeramecNetFlix", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "MeramecNetFlix", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw ex;
            }
        }
        private void btn_Browse_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            foreach (Member m in MemberDB.GetMembers())
            {
                //put each genre object into a datagridview row object
                DataGridViewRow newRow = new DataGridViewRow();

                //creates cells using dataGridView1 as a template
                newRow.CreateCells(dataGridView1);
                newRow.Cells[0].Value  = m.id;
                newRow.Cells[1].Value  = m.joindate;
                newRow.Cells[2].Value  = m.firstname;
                newRow.Cells[3].Value  = m.lastname;
                newRow.Cells[4].Value  = m.address;
                newRow.Cells[5].Value  = m.city;
                newRow.Cells[6].Value  = m.state;
                newRow.Cells[7].Value  = m.zipcode;
                newRow.Cells[8].Value  = m.phone;
                newRow.Cells[9].Value  = m.member_status;
                newRow.Cells[10].Value = m.login_name;
                newRow.Cells[11].Value = m.password;
                newRow.Cells[12].Value = m.email;
                newRow.Cells[13].Value = m.subscription_id;
                newRow.Cells[14].Value = m.admin;

                dataGridView1.Rows.Add(newRow);
            }
        }
Пример #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _memberid   = ConvertUtility.ToInt32(Request.QueryString["mi"]);
            _activeCode = ConvertUtility.ToString(Request.QueryString["code"]);
            string notApprove = "Mã kích hoạt không hợp lệ, vui lòng kiểm tra email đăng ký để có mã kích hoạt hợp lệ.";

            if (_activeCode.Length >= 150)
            {
                notice.InnerHtml = notApprove;
                return;
            }

            var memberInfo = MemberDB.GetInfo(_memberid);

            if (memberInfo != null)
            {
                if (_activeCode == memberInfo.Member_ActiveCode)
                {
                    memberInfo.Member_Active = true;

                    MemberDB.Update(memberInfo);
                    notice.InnerHtml = "Chúc mừng bạn đã kích hoạt tài khoản thành công. Từ bây giờ bạn có thể đăng nhập và mua sắm cùng My-Deal.vn";
                }
                else
                {
                    notice.InnerHtml = notApprove;
                }
            }
            else
            {
                notice.InnerHtml = notApprove;
            }
        }
    protected void btnRenterProfile_Click(object sender, EventArgs e)
    {
        // Redirect to renter's profile page
        Item itemInfo = ItemDB.getItembyID(Request.QueryString["itemID"].ToString());

        Response.Redirect("~/User.aspx?memberID=" + MemberDB.getMemberbyID(ItemDB.getItembyID(Request.QueryString["itemID"].ToString()).Renter.MemberID).MemberID);
    }
Пример #25
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        if (tbxMessage.Text.Length > 255)
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Your message cannot exceed 255 characters!')", true);
            return;
        }


        if (tbxMessage.Text != "")
        {
            MemberMessage msgDis = new MemberMessage();

            msgDis.Date        = DateTime.Now;
            msgDis.Reply       = tbxMessage.Text;
            msgDis.Sender      = MemberDB.getMemberbyEmail(Session["user"].ToString());
            msgDis.MemberInbox = MemberInboxDB.getMemberInboxID(Request.QueryString["memberInboxID"].ToString());
            //msgDis.Receiver = MemberDB.getMemberbyID(MemberDB.getMemberbyID("MEM000000001").MemberID);
            //msgDis.Item = ItemDB.getItembyID("ITM000000003");

            MemberMessageDB.AddMsgMember(msgDis);



            tbxMessage.Text = "";

            rptMessages.DataBind();
            Response.Redirect(Request.RawUrl);
        }
    }
    protected void btnContactRenter_Click(object sender, EventArgs e)
    {
        if (Session["user"].ToString() == null)
        {
            Response.Redirect("Login.aspx");
            return;
        }
        else
        {
            // If memberInbox doesnt exist
            if (MemberInboxDB.searchMemberInbox(MemberDB.getMemberbyEmail(Session["user"].ToString()).MemberID, ItemDB.getItembyID(Request.QueryString["itemID"].ToString()).ItemID) == null)
            {
                MemberInbox mem = new MemberInbox();
                mem.Date   = DateTime.Now;
                mem.Item   = ItemDB.getItembyID(Request.QueryString["itemID"]);
                mem.Sender = MemberDB.getMemberbyEmail(Session["user"].ToString());

                int memberInboxID = MemberInboxDB.AddMsgMember(mem);
                Response.Redirect("/inboxMessage.aspx?memberInboxID=" + memberInboxID);
            }

            else
            {
                Response.Redirect("/inboxMessage.aspx?memberInboxID=" + MemberInboxDB.searchMemberInbox(MemberDB.getMemberbyEmail(Session["user"].ToString()).MemberID, ItemDB.getItembyID(Request.QueryString["itemID"].ToString()).ItemID).MemberInboxID);
            }
        }
    }
Пример #27
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            foreach (Control control in groupBoxMemberData.Controls)
            {
                if (string.IsNullOrEmpty(control.Text.Trim()))
                {
                    MessageBox.Show("Please enter a value for " + control.Name.ToString());
                    control.Focus();
                    return;
                }
            }

            Member objMember = new Member();

            objMember.memberNumber = Convert.ToInt32(lblSelected.Text);

            try
            {
                bool status = MemberDB.DeleteMember(objMember);
                if (status) //You can use this syntax as well..if (status ==true)
                {
                    Reload_Data();
                    MessageBox.Show("Member was deleted from the database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Member was not deleted from the database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #28
0
 // method to read the column values in the database (through the referenced reader) and assign it to the correct properties of the referenced MemberInbox object
 // allows for easier editing of column names if needed, used only for methods with select statments regarding MemberInbox
 private static void readAMsg(ref MemberInbox msg, ref SqlDataReader reader)
 {
     msg.MemberInboxID = Convert.ToInt32(reader["memberInboxID"]);
     msg.Date          = Convert.ToDateTime(reader["date"]);
     msg.Sender        = MemberDB.getMemberbyID(reader["senderID"].ToString());
     msg.Item          = ItemDB.getItembyID(reader["itemID"].ToString());
 }
Пример #29
0
    // method to get rentee from rental record from the database
    public static Member getRenteeforRental(string rentalID)
    {
        Member m = new Member();

        try
        {
            SqlCommand command = new SqlCommand("SELECT * FROM Rental WHERE rentalID = @rentalID");
            command.Parameters.AddWithValue("@rentalID", rentalID);
            command.Connection = connection;
            connection.Open();

            SqlDataReader reader = command.ExecuteReader();

            if (reader.Read())
            {
                m = MemberDB.getMemberbyID(reader["renteeID"].ToString());
            }

            reader.Close();
        }
        finally
        {
            connection.Close();
        }
        return(m);
    }
Пример #30
0
 // gets message regarding inbox
 protected string retrieveMessage(string senderID, string reply, string datePosted)
 {
     if (MemberDB.getMemberbyID(senderID).Email == MemberInboxDB.getMemberInboxID(Request.QueryString["memberInboxID"].ToString()).Sender.Email)
     {
         return(" <div class='item '> \n" +
                " <div class='image'> \n" +
                " <img src='assets/images/users/user2.jpg' > \n" +
                " </div> \n" +
                " <div class='text' > \n" +
                " <div class='heading' > \n" +
                " <a href='#'>" + MemberDB.getMemberbyID(senderID).Name + "</a> \n" +
                " <span class='date' >" + datePosted + "</span> \n" +
                " </div> \n" +
                reply + " </div> \n" +
                " </div> \n");
     }
     else
     {
         return(" <div class='item in'> \n" +
                " <div class='image' > \n" +
                " <img src='assets/images/users/user.jpg'> \n" +
                " </div> \n" +
                " <div class='text'> \n" +
                " <div class='heading' > \n" +
                " <a href='#'>" + MemberDB.getMemberbyID(senderID).Name + "</a> \n" +
                " <span class='date' >" + datePosted + "</span> \n" +
                " </div> \n" +
                reply +
                " </div> \n" +
                " </div> \n");
     }
 }