Пример #1
0
 public ActionResult Feedback(FeedbackClass fc)
 {
     _context.Feedbacks.Add(fc);
     _context.SaveChanges();
     //var user = _context.Bookings.Include(u => u.UserClass).SingleOrDefault(v => v.Id == id);
     return(RedirectToAction("VendorDetail", "Vendor"));
 }
Пример #2
0
 private void LoadFeedback()
 {
     try
     {
         FeedbackClass feedbackObj = new FeedbackClass();
         dgv_feedback.DataSource = feedbackObj.GetFeedbackInfo(connString);
         dgv_feedback.DataBind();
     }
     catch (Exception ex)
     {
         lbl_error_message.Text = ex.Message;
     }
 }
Пример #3
0
        public ActionResult Details(int?id, string f_class = "F0001")
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ViewBag.f_class = db.feedback_class.Where(m => m.f_class == f_class).FirstOrDefault().f_class;
            FeedbackClass fb = new FeedbackClass()
            {
                Feedbacks        = db.feedback.Where(m => m.f_sn == id).ToList(),
                Feedback_Classes = db.feedback_class.Where(m => m.f_class == f_class).ToList()
            };

            return(View(fb));
        }
Пример #4
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Validator v = new Validator();

            if (!v.isPresent(txtContent))
            {
                lbl_error_message.Text = "Fill Content Field!";
            }
            else if (!v.isPresent(txtClientName))
            {
                lbl_error_message.Text = "Fill Name Field!";
            }
            else if (!v.isPresent(txtEmail))
            {
                lbl_error_message.Text = "Fill Email Address!";
            }
            else
            {
                if (!v.isValidEmail(txtEmail.Text))
                {
                    lbl_error_message.Text = "Enter Valid Email!";
                }
                else
                {
                    try
                    {
                        DateTime      localDate = DateTime.Now;
                        FeedbackClass feed      = new FeedbackClass(txtContent.Text, localDate, txtClientName.Text, txtEmail.Text);
                        if (feed.AddFeedback(connString))
                        {
                            lbl_error_message.Text = "Inserted Successfully";
                            txtClientName.Text     = "";
                            txtEmail.Text          = "";
                            txtContent.Text        = "";
                        }
                        else
                        {
                            lbl_error_message.Text = "Sorry,Error Occurred";
                        }
                    }
                    catch (Exception ex)
                    {
                        lbl_error_message.Text = ex.Message;
                    }
                }
            }
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string        clientName = txtClientName.Text;
            string        email      = txtEmail.Text;
            string        feedback   = txtFeed.Text;
            DateTime      now        = DateTime.Now;
            FeedbackClass f          = new FeedbackClass();

            f.client_name   = clientName;
            f.email         = email;
            f.content       = feedback;
            f.date_and_time = now;
            f.AddFeedback(connString);
            txtClientName.Text = "";
            txtEmail.Text      = "";
            txtFeed.Text       = "";
        }
Пример #6
0
        protected void dgv_feedback_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int         rIndex = Convert.ToInt32(e.CommandArgument);
            GridViewRow row    = dgv_feedback.Rows[rIndex];

            if (e.CommandName == "cmdDelete")
            {
                FeedbackClass f = new FeedbackClass();
                f.feedback_id = Convert.ToInt32(((Label)row.Cells[0].Controls[1]).Text);
                if (f.RemoveFeedback(connString))
                {
                    LoadFeedback();
                }
                else
                {
                    lbl_error_message.Text = "Sorry,Error Occurred!";
                }
            }
        }
Пример #7
0
    /*Insert on Log_FeedbackWholeField table with the insert Operation */
    public void insertOn_Log_FeedbackWholeField_WithInsertOperation(String feedbackDate)
    {
        SqlCommand cmd = new SqlCommand();

        cmd.Connection = gc.cn;

        String feedbackWholeFieldLog_Date;
        String feedbackWholeFieldLog_Operation = "Insert";

        /*Current date and time calculated*/
        DateTime currentDateNTime = DateTime.Now;

        feedbackWholeFieldLog_Date = currentDateNTime.ToString("dd/MM/yyyy hh:mm:ss tt");

        cmd.CommandText = "sp_Log_feedbackWholeField";
        cmd.CommandType = CommandType.StoredProcedure;

        /*Getting Feedback Id from Feedback's username and putting that userId value*/
        try
        {
            FeedbackClass fc = new FeedbackClass();

            /*Getting Feedback Id from Feedback's userId*/
            DataTable dtFeedback = fc.SelectAllFeedbackFromFeedbackDate(feedbackDate);
            if (dtFeedback.Rows.Count > 0)
            {
                String feedbackIdString = dtFeedback.Rows[0]["feedbackId"].ToString();
                int    feedbackId       = Convert.ToInt32(feedbackIdString);
                cmd.Parameters.Add("@feedbackId", feedbackId);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        cmd.Parameters.Add("@feedbackWholeFieldLog_Date", feedbackWholeFieldLog_Date);
        cmd.Parameters.Add("@feedbackWholeFieldLog_Operation", feedbackWholeFieldLog_Operation);
        cmd.ExecuteNonQuery();
    }
Пример #8
0
        public ActionResult Index(string f_class = "F0001")
        {
            string[] f_c = { "F0001", "F0002", "F0003", "F0004" };

            ViewBag.f_c01 = fb_count(f_c[0]);
            ViewBag.f_c02 = fb_count(f_c[1]);
            ViewBag.f_c03 = fb_count(f_c[2]);
            ViewBag.f_c04 = fb_count(f_c[3]);

            var a = db.feedback_class.Where(m => m.f_class == f_class);

            ViewBag.f_class       = a.FirstOrDefault().f_class;
            ViewBag.class_content = a.FirstOrDefault().class_content;

            FeedbackClass fb = new FeedbackClass()
            {
                Feedbacks        = db.feedback.Where(m => m.f_class == f_class).ToList(),
                Feedback_Classes = db.feedback_class.ToList()
            };

            return(View(fb));
        }
Пример #9
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        ltrMessage.Text      = "";
        ltrMessageGreen.Text = "";

        FeedbackClass    fc  = new FeedbackClass();
        LogFeedbackClass lfc = new LogFeedbackClass();
        UserClass        uc  = new UserClass();

        int    feedbackByUserId, feedbackToUserId;
        String feedbackSubject, feedbackDescription;
        String feedbackCheckUserType = "";
        String feedbackToUsername;

        String feedbackDate;

        /*Current date and time calculated*/
        DateTime currentDateNTime = DateTime.Now;

        feedbackDate = currentDateNTime.ToString("dd/MM/yyyy hh:mm:ss tt");

        feedbackSubject     = txtboxSubject.Text;
        feedbackDescription = txtboxMessage.Text;
        feedbackToUsername  = dropdownlistUsername.SelectedValue;
        dropdownlistUsername.Items.Insert(0, feedbackToUsername);

        /*Getting feedbackBy userId from Session*/
        String userIdString = Session["userId"].ToString();
        int    userId       = Convert.ToInt32(userIdString);

        feedbackByUserId = userId;

        try
        {
            /*Getting feedbackToUserId from feedbackToUsername*/
            DataTable dt = uc.SelectAllUsersFromUsername(feedbackToUsername);
            if (dt.Rows.Count > 0)
            {
                feedbackCheckUserType = dt.Rows[0]["userType"].ToString();

                if (feedbackCheckUserType == "Patient")
                {
                    Session["feedbackToUserId"] = dt.Rows[0]["userId"].ToString();
                    String feedbackToUserIdString = dt.Rows[0]["userId"].ToString();
                    feedbackToUserId = Convert.ToInt32(feedbackToUserIdString);

                    /*Inserting and putting the values in Log*/
                    fc.InsertFeedback(feedbackByUserId, feedbackToUserId, feedbackSubject, feedbackDescription);
                    lfc.insertOn_Log_FeedbackWholeField_WithInsertOperation(feedbackDate);

                    /*Refreshing*/
                    Response.Redirect("Inform_EntryUserMaster.aspx");
                    dropdownlistUsername.Focus();
                }
                else
                {
                    ltrMessage.Text = "Invalid Username!";
                }
            }
        }
        catch (Exception ex)
        {
            ltrMessage.Text = ex.Message;
        }
    }