예제 #1
0
 public object CreateFbk(Feedback feedbk)
 {
     try
     {
         tblFeedback fb = new tblFeedback();
         fb.Question1 = feedbk.Question1;
         fb.Question2 = feedbk.Question2;
         fb.Question3 = feedbk.Question3;
         fb.Question4 = feedbk.Question4;
         fb.Question5 = feedbk.Question5;
         db.tblFeedbacks.Add(fb);
         db.SaveChanges();
         return(new Response
         {
             Status = "Success",
             Message = "SuccessFully Saved."
         });
     }
     catch (Exception)
     {
         throw;
     }
     return(new Response
     {
         Status = "Error",
         Message = "Invalid Data."
     });
 }
예제 #2
0
        //Enter Feedback
        public bool createFeedbackAnswer(FeedbackAnswer feedModel)
        {
            bool  result = false;
            float fValue = 0;

            using (myProjectEntities context = new myProjectEntities())
            {
                Mapper.CreateMap <FeedbackAnswer, tblFeedbackResult>();

                tblFeedbackResult newFeed = Mapper.Map <FeedbackAnswer, tblFeedbackResult>(feedModel);

                context.tblFeedbackResults.Add(newFeed);

                context.SaveChanges();

                var   valueFeed = context.tblFeedbackResults.Where(q => q.FK_Feedback_id == feedModel.FK_Feedback_id).Select(q => q.feedback_answer).AsEnumerable();
                float d         = float.Parse(valueFeed.Aggregate((a, b) => a + b).ToString());
                int   count     = valueFeed.Count();
                fValue = d / count;

                tblFeedback f = context.tblFeedbacks.Where(q => q.PK_Feedback_id == feedModel.FK_Feedback_id).FirstOrDefault();
                f.feedback_value       = fValue;
                context.Entry(f).State = EntityState.Modified;
                context.SaveChanges();
            }


            return(result);
        }
예제 #3
0
        //Get all feedback lectures of by moduleid
        public IEnumerable <lectureModel> GetAllFeedbackByModule(int moduleId, int studentId)
        {
            using (myProjectEntities context = new myProjectEntities())
            {
                List <tblLecture>  allLectures = context.tblLectures.Where(q => q.FK_Module_id == moduleId && q.lecture_status == 1 && q.lecture_date <= System.DateTime.Now).ToList();
                List <tblFeedback> feedModel   = new List <tblFeedback>();
                List <tblLecture>  lectModel   = new List <tblLecture>();

                foreach (tblLecture item in allLectures)
                {
                    tblFeedback d = context.tblFeedbacks.Where(w => w.FK_Lecture_id == item.PK_Lecture_id && System.DateTime.Now <= w.end_date).FirstOrDefault();
                    ////////Look here
                    if (d != null)
                    {
                        var checkStudent = context.tblFeedbackResults.Where(r => r.FK_Student_id == studentId && r.FK_Feedback_id == d.PK_Feedback_id).FirstOrDefault();
                        if (checkStudent == null)
                        {
                            //feedModel.Add(d);
                            lectModel.Add(item);
                        }
                    }
                }

                Mapper.CreateMap <tblLecture, lectureModel>();
                IEnumerable <lectureModel> result = Mapper.Map <IEnumerable <tblLecture>, IEnumerable <lectureModel> >(lectModel);
                return(result);
            }
        }
예제 #4
0
        protected void btnDetails_Click(object sender, EventArgs e)
        {
            mvFeedback.ActiveViewIndex = 1;

            int hash = sender.GetHashCode();

            foreach (RepeaterItem item in rFeedback.Items)
            {
                LinkButton button = item.FindControl("btnDetails") as LinkButton;

                if (button.GetHashCode() == hash)
                {
                    TableCell tc         = item.FindControl("tcFeedbackID") as TableCell;
                    int       feedbackID = Convert.ToInt32(tc.Text);

                    using (DatabaseDataContext db = new DatabaseDataContext()) {
                        tblFeedback feedback = db.tblFeedbacks.Where(x => x.FeedbackID == feedbackID).FirstOrDefault();
                        tblUser     user     = db.tblUsers.Where(x => x.UserID == feedback.UserID).FirstOrDefault();

                        lblFeedbackID.Text          = feedback.FeedbackID.ToString();
                        lblUserID.Text              = user.UserID.ToString();
                        lblFeedbackDate.Text        = feedback.FeedbackDate.ToString();
                        txtFeedbackDescription.Text = feedback.FeedbackDescription.ToString();

                        feedback.IsSeen = true;
                        db.SubmitChanges();
                    }
                }
            }
        }
 protected void rptFeedBack_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Read")
         {
             var         DC     = new DataClassesDataContext();
             tblFeedback result = (from u in DC.tblFeedbacks
                                   where u.FeedbackID == Convert.ToInt32(e.CommandArgument)
                                   select u).Single();
             if (result.IsRead == true)
             {
                 result.IsRead = false;
             }
             else
             {
                 result.IsRead = true;
             }
             DC.SubmitChanges();
         }
         BindFeedBack();
     }
     catch (Exception ex)
     {
         int    session    = Convert.ToInt32(Session["AdminID"].ToString());
         string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
         string MACAddress = GetMacAddress();
         AddErrorLog(ref ex, PageName, "Admin", 0, session, MACAddress);
         ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
     }
 }
예제 #6
0
    protected void rptfb_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try {
            var DC = new DataClassesDataContext();

            int ID = Convert.ToInt32(e.CommandArgument);


            if (e.CommandName == "Notify")
            {
                tblFeedback result = (from u in DC.tblFeedbacks
                                      where u.FeedBackID == ID
                                      select u).Single();

                if (result.IsNotify == true)
                {
                    result.IsNotify = false;
                }
                else
                {
                    result.IsNotify = true;
                }
                DC.SubmitChanges();
            }
            else if (e.CommandName == "View")
            {
                var str = from obj in DC.tblFeedbacks
                          join obj1 in DC.tblClients
                          on obj.ClientID equals obj1.ClientID
                          where obj.ClientID == obj1.ClientID && obj.Email == obj1.Email && obj.FeedBackID == Convert.ToInt32(e.CommandArgument)
                          select new
                {
                    Data = obj1.FirstName + " " + obj1.LastName,
                    obj1.ContactNo,
                    obj1.ClientID,
                    obj.FeedBackID,
                    obj.Email,
                    obj.Description,
                    obj.CreatedOn,
                    obj.IsNotify
                };


                rptViewDetail.DataSource = str;
                rptViewDetail.DataBind();
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal({backdrop:'static', keyboard: false});", true);
                //    upModal.Update();
            }
            binddata();
        }
        catch (Exception ex)
        {
            int    session    = Convert.ToInt32(Session["AdminID"].ToString());
            string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
            string MACAddress = GetMacAddress();
            AddErrorLog(ref ex, PageName, "Admin", 0, session, MACAddress);
            ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
        }
    }
 public feedbackModel GetFeedbackByLectureId(int lectureId)
 {
     using (myProjectEntities context = new myProjectEntities())
     {
         tblFeedback feed = context.tblFeedbacks.Where(q => q.FK_Lecture_id == lectureId).FirstOrDefault();
         Mapper.CreateMap <tblFeedback, feedbackModel>();
         feedbackModel result = Mapper.Map <tblFeedback, feedbackModel>(feed);
         return(result);
     }
 }
        public ActionResult Detail(int id)
        {
            tblFeedback feedback = dc.tblFeedbacks.SingleOrDefault(ob => ob.FeedbackId == id);

            //ViewBag.Company = (from ob in dc.tblTransportCompanies where ob.CompanyId == feedback.CompanyId select ob).Take(1).SingleOrDefault().CompanyName;
            //ViewBag.User = (from ob in dc.tblUsers where ob.UserId == feedback.UserId select ob).Take(1).SingleOrDefault().FirstName;
            //string Name = ViewBag.Company;
            //string Uname = ViewBag.User;
            return(View(feedback));
        }
예제 #9
0
        public ActionResult Feedback(FormCollection form)
        {
            tblFeedback feedback = new tblFeedback();

            feedback.Subject   = form["txtSubject"];
            feedback.Desc      = form["txtDesc"];
            feedback.CreatedOn = DateTime.Now;
            feedback.IsActive  = false;
            dc.tblFeedbacks.Add(feedback);
            dc.SaveChanges();
            return(RedirectToAction("Blank", "Home"));
        }
        public JsonResult Active(int id)
        {
            tblFeedback feedback = dc.tblFeedbacks.SingleOrDefault(ob => ob.FeedbackId == id);

            if (feedback.IsActive == true)
            {
                feedback.IsActive = false;
            }
            else
            {
                feedback.IsActive = true;
            }
            dc.SaveChanges();
            return(Json(feedback.IsActive, JsonRequestBehavior.AllowGet));
        }
예제 #11
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            using (DatabaseDataContext con = new DatabaseDataContext()) {
                #region checks
                hideAllPlaceholders();

                if (SessionManager.UserID == 0)
                {
                    showError("You must be logged in to use this feature!");
                    return;
                }

                string EncodedResponse = Request.Form["g-Recaptcha-Response"];
                bool   IsCaptchaValid  = (ReCaptcha.Validate(EncodedResponse) == "true" ? true : false);

                if (!IsCaptchaValid)
                {
                    showError("Prove that you are not a robot!");
                    return;
                }

                if (string.IsNullOrEmpty(txtFeeddescription.Text))
                {
                    showError("Description is empty!");
                    return;
                }

                #endregion
                try {
                    tblFeedback feedback = new tblFeedback {
                        FeedbackDescription = txtFeeddescription.Text,
                        FeedbackDate        = DateTime.Now,
                        IsSeen = false,
                        UserID = SessionManager.UserID
                    };

                    con.tblFeedbacks.InsertOnSubmit(feedback);
                    con.SubmitChanges();

                    showSuccess("Feeback submitted!");
                    Utilities.clearAllTextBoxes(viewMain);

                    NotificationManager.feedbackSent();
                } catch (Exception ex) {
                    showError("Error: " + ex);
                }
            }
        }
예제 #12
0
        public int SaveFeedBack(FeedBackModel model)
        {
            tblFeedback feedBackObj = new tblFeedback();

            if (model != null)
            {
                feedBackObj.Headline = model.FeedBackHeadline;
                feedBackObj.Feedback = model.FeedBack;
                feedBackObj.ConsumerProfilePicture = ConvertBase64StringToByteArray(model.ProfilePicture);
                feedBackObj.Consumer_ID            = db.tblConsumers.Where(x => x.Login_ID == Session.Login_ID).FirstOrDefault().ID;
                feedBackObj.ConsumerName           = model.UserName;

                db.tblFeedbacks.Add(feedBackObj);
                db.SaveChanges();
            }
            return(feedBackObj.ID > 0 ? feedBackObj.ID : 0);
        }
예제 #13
0
        public bool createFeedAnswer(int studentId, int lectureId, float answer)
        {
            bool  result = false;
            float fValue = 0;

            using (myProjectEntities context = new myProjectEntities())
            {
                int            q3        = 0;
                var            feedId    = context.tblFeedbacks.Where(q => q.FK_Lecture_id == lectureId).FirstOrDefault();
                FeedbackAnswer feedModel = new FeedbackAnswer();
                feedModel.feedback_answer = answer;
                feedModel.feedback_date   = System.DateTime.Now;
                feedModel.FK_Feedback_id  = Convert.ToInt32(feedId.PK_Feedback_id);
                feedModel.FK_Student_id   = studentId;


                Mapper.CreateMap <FeedbackAnswer, tblFeedbackResult>();

                tblFeedbackResult newFeed = Mapper.Map <FeedbackAnswer, tblFeedbackResult>(feedModel);

                context.tblFeedbackResults.Add(newFeed);

                q3 = context.SaveChanges();
                //Now update feedback value in tblFeedback
                //This is because after every submission there is change in the overall feedback value
                if (q3 != 0)
                {
                    var   valueFeed = context.tblFeedbackResults.Where(q => q.FK_Feedback_id == feedModel.FK_Feedback_id).Select(q => q.feedback_answer).AsEnumerable();
                    float d         = float.Parse(valueFeed.Aggregate((a, b) => a + b).ToString());
                    int   count     = valueFeed.Count();
                    fValue = d / count;

                    tblFeedback f = context.tblFeedbacks.Where(q => q.PK_Feedback_id == feedModel.FK_Feedback_id).FirstOrDefault();
                    f.feedback_value       = fValue;
                    context.Entry(f).State = EntityState.Modified;
                    q3 = context.SaveChanges();
                    if (q3 != 0)
                    {
                        result = true;
                    }
                }
            }
            return(result);
        }
예제 #14
0
        //Create new Feedback
        public int createFeedback(feedbackModel feedData)
        {
            int result = 0;

            using (myProjectEntities context = new myProjectEntities())
            {
                Mapper.CreateMap <feedbackModel, tblFeedback>();

                tblFeedback newFeed = Mapper.Map <feedbackModel, tblFeedback>(feedData);

                context.tblFeedbacks.Add(newFeed);
                int q = context.SaveChanges();
                if (q > 0)
                {
                    result = newFeed.PK_Feedback_id;
                }
                return(result);
            }
        }
예제 #15
0
        //Get Lecture Data
        public IEnumerable <lectureModel> GetLecturesByProfessor(int ProfId, int isFeed)
        {
            using (myProjectEntities context = new myProjectEntities())
            {
                List <tblLecture>        lectures = new List <tblLecture>();
                IEnumerable <tblLecture> pro      = context.tblLectures.Where(q => q.FK_Professor_id == ProfId && q.lecture_status == 1).AsEnumerable();

                if (isFeed == 1)  // If feedback want
                {
                    foreach (tblLecture item in pro)
                    {
                        int         lectureId = item.PK_Lecture_id;
                        tblFeedback feed      = context.tblFeedbacks.Where(q => q.FK_Lecture_id == lectureId).FirstOrDefault(); // If there is feedback of the lecture
                        if (feed != null)
                        {
                            lectures.Add(item);
                        }
                    }
                }
                else if (isFeed == 0)// if not
                {
                    foreach (tblLecture item in pro)
                    {
                        int         lectureId = item.PK_Lecture_id;
                        tblFeedback feed      = context.tblFeedbacks.Where(q => q.FK_Lecture_id == lectureId).FirstOrDefault();
                        if (feed == null)
                        {
                            lectures.Add(item);
                        }
                    }
                }
                else if (isFeed == 2) //All lectures
                {
                    lectures = pro.ToList();
                }

                //IEnumerable<tblLecture> pro = context.tblLectures.Where(q => q.FK_Professor_id == ProfId && q.lecture_status == 1).AsEnumerable();
                Mapper.CreateMap <tblLecture, lectureModel>();
                IEnumerable <lectureModel> result = Mapper.Map <IEnumerable <tblLecture>, IEnumerable <lectureModel> >(lectures);
                return(result);
            }
        }
예제 #16
0
        //Get FeedBackList by Professor Id
        public IEnumerable <feedbackModel> GetFeedbackByProfessor(int ProfId)
        {
            using (myProjectEntities context = new myProjectEntities())
            {
                List <tblFeedback>       pro      = new List <tblFeedback>();
                IEnumerable <tblLecture> lectures = context.tblLectures.Where(qq => qq.FK_Professor_id == ProfId).AsEnumerable();
                foreach (tblLecture item in lectures)
                {
                    int         lectureId = item.PK_Lecture_id;
                    tblFeedback feed      = context.tblFeedbacks.Where(q => q.FK_Lecture_id == lectureId).FirstOrDefault();
                    if (feed != null)
                    {
                        pro.Add(feed);
                    }
                }

                Mapper.CreateMap <tblFeedback, feedbackModel>();
                IEnumerable <feedbackModel> result = Mapper.Map <IEnumerable <tblFeedback>, IEnumerable <feedbackModel> >(pro);
                return(result);
            }
        }
예제 #17
0
        public IHttpActionResult PosttblFeedback(int orderID, FeedbackDTO dto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            tblFeedback feedback = new tblFeedback
            {
                toyID   = dto.toyID,
                content = dto.content,
                cusID   = dto.cusID,
                status  = 0
            };

            db.tblFeedbacks.Add(feedback);
            tblOrderDetail ordDetail = db.tblOrderDetails.FirstOrDefault(detail => detail.id == orderID && detail.toyID == dto.toyID);

            ordDetail.isFeedback = true;
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = dto.id }, dto));
        }
예제 #18
0
        public IHttpActionResult PuttblFeedback(int id, FeedbackDTO dto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != dto.id)
            {
                return(BadRequest());
            }
            tblFeedback feedback = db.tblFeedbacks.Find(dto.id);

            if (feedback != null)
            {
                feedback.status          = dto.status;
                db.Entry(feedback).State = EntityState.Modified;
            }
            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tblFeedbackExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #19
0
 protected void btnfeedback_Click(object sender, EventArgs e)
 {
     try {
         var dc   = new DataClassesDataContext();
         var data = (from obj in dc.tblClients
                     where obj.Email == txtemail.Text
                     select obj).SingleOrDefault();
         var data1 = (from obj in dc.tblClients
                      where obj.Email == txtemail.Text
                      select obj).Count();
         if (data1 > 0)
         {
             tblFeedback ob = new tblFeedback();
             ob.Email       = txtemail.Text;
             ob.ClientID    = Convert.ToInt32(data.ClientID);
             ob.Description = txtdis.Text;
             ob.IsNotify    = true;
             ob.CreatedOn   = DateTime.Now;
             dc.tblFeedbacks.InsertOnSubmit(ob);
             dc.SubmitChanges();
         }
         else
         {
             errorCode.Visible = true;
         }
         clear();
     }
     catch (Exception ex)
     {
         int    session    = Convert.ToInt32(Session["ClientID"].ToString());
         string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
         string MACAddress = GetMacAddress();
         AddErrorLog(ref ex, PageName, "User", session, 0, MACAddress);
         ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
     }
 }
예제 #20
0
    private void BindData()
    {
        try
        {
            rptProRunning.DataSource = ViewProjectObject.ViewProject();
            rptProRunning.DataBind();
            foreach (RepeaterItem Item in rptProRunning.Items)
            {
                //---------for Category show-------------

                string      CategoryName = "---";
                HiddenField Category     = (HiddenField)Item.FindControl("hidCategory");
                if (Category.Value != "")
                {
                    CategoryName = ViewProjectObject.ViewCategory(Convert.ToInt32(Category.Value));
                }
                Literal ltrCategory = (Literal)Item.FindControl("ltrCategory");
                ltrCategory.Text = CategoryName;

                //--------for Category show----------------

                //---------for Language show---------------

                string      LanguageName = "---";
                HiddenField Language     = (HiddenField)Item.FindControl("hidLanguage");
                if (Language.Value != "")
                {
                    LanguageName = ViewProjectObject.ViewLanguage(Convert.ToInt32(Language.Value));
                }
                Literal ltrLanguage = (Literal)Item.FindControl("ltrLanguage");
                ltrLanguage.Text = LanguageName;

                //---------for Language show----------------

                //---------for Client show------------------

                string      ClientName = "---";
                HiddenField Client     = (HiddenField)Item.FindControl("hidClient");
                if (Client.Value != "")
                {
                    ClientName = ViewProjectObject.ViewClient(Convert.ToInt32(Client.Value));
                }
                Literal ltrClient = (Literal)Item.FindControl("ltrClient");
                ltrClient.Text = ClientName;

                //---------for Client show------------------

                //---------for Maneger show------------------

                string      ManagerName = "---";
                HiddenField Manager     = (HiddenField)Item.FindControl("hidManager");
                if (Manager.Value != "")
                {
                    ManagerName = ViewProjectObject.ViewManager(Convert.ToInt32(Manager.Value));
                }
                Literal ltrManager = (Literal)Item.FindControl("ltrManager");
                ltrManager.Text = ManagerName;

                //---------for Manger show------------------

                //---------for Duration show------------------

                string      Duration     = "---";
                string      PanddingDays = "---";
                HiddenField hdnCreatedOn = (HiddenField)Item.FindControl("hdnCreatedOn");
                HiddenField hdnAssignDay = (HiddenField)Item.FindControl("hdnAssignDay");
                HiddenField hdnDeadLine  = (HiddenField)Item.FindControl("hdnDeadLine");
                if (hdnAssignDay.Value != "")
                {
                    TimeSpan Days = Convert.ToDateTime(hdnDeadLine.Value) - Convert.ToDateTime(hdnAssignDay.Value);
                    Duration = Convert.ToInt32(Days.TotalDays).ToString();
                    TimeSpan PanddingDay = Convert.ToDateTime(hdnDeadLine.Value) - DateTime.Now;
                    PanddingDays = Convert.ToInt32(PanddingDay.TotalDays).ToString();
                }
                else if (hdnAssignDay.Value == "")
                {
                    TimeSpan Days = Convert.ToDateTime(hdnDeadLine.Value) - Convert.ToDateTime(hdnCreatedOn.Value);
                    Duration = Convert.ToInt32(Days.TotalDays).ToString();
                }
                Literal ltrDuration     = (Literal)Item.FindControl("ltrDuration");
                Literal ltrPanddingDays = (Literal)Item.FindControl("lblPanddingDays");
                ltrDuration.Text     = Duration + " Days";
                ltrPanddingDays.Text = PanddingDays + " Days";

                //---------for Duration show------------------
            }


            reptprgpanding.DataSource = ViewProjectObject.ViewProjectPandding();
            reptprgpanding.DataBind();
            foreach (RepeaterItem Item in reptprgpanding.Items)
            {
                string      CategoryName = "---";
                HiddenField Category     = (HiddenField)Item.FindControl("hidCategory");
                if (Category.Value != "")
                {
                    CategoryName = ViewProjectObject.ViewCategory(Convert.ToInt32(Category.Value));
                }
                Literal ltrCategory = (Literal)Item.FindControl("ltrCategory");
                ltrCategory.Text = CategoryName;
                string      ClientName = "---";
                HiddenField Client     = (HiddenField)Item.FindControl("hidClient");
                if (Client.Value != "")
                {
                    ClientName = ViewProjectObject.ViewClient(Convert.ToInt32(Client.Value));
                }
                Literal ltrClient = (Literal)Item.FindControl("ltrClient");
                ltrClient.Text = ClientName;
                string      Duration     = "---";
                string      PanddingDays = "---";
                HiddenField hdnCreatedOn = (HiddenField)Item.FindControl("hdnCreatedOn");
                HiddenField hdnAssignDay = (HiddenField)Item.FindControl("hdnAssignDay");
                HiddenField hdnDeadLine  = (HiddenField)Item.FindControl("hdnDeadLine");
                if (hdnAssignDay.Value != "")
                {
                    TimeSpan Days = Convert.ToDateTime(hdnDeadLine.Value) - Convert.ToDateTime(hdnAssignDay.Value);
                    Duration = Convert.ToInt32(Days.TotalDays).ToString();
                    TimeSpan PanddingDay = Convert.ToDateTime(hdnDeadLine.Value) - DateTime.Now;
                    PanddingDays = Convert.ToInt32(PanddingDay.TotalDays).ToString();
                }
                else if (hdnAssignDay.Value == "")
                {
                    TimeSpan Days = Convert.ToDateTime(hdnDeadLine.Value) - Convert.ToDateTime(hdnCreatedOn.Value);
                    Duration = Convert.ToInt32(Days.TotalDays).ToString();
                }
                Literal ltrDuration     = (Literal)Item.FindControl("ltrDuration");
                Literal ltrPanddingDays = (Literal)Item.FindControl("lblPanddingDays");
                ltrDuration.Text     = Duration + " Days";
                ltrPanddingDays.Text = PanddingDays + " Days";
            }

            reptprjcomplete.DataSource = ViewProjectObject.ViewProjectComplete();
            reptprjcomplete.DataBind();
            foreach (RepeaterItem Item in reptprjcomplete.Items)
            {
                var         DC           = new DataClassesDataContext();
                string      ManagerName  = "---";
                HiddenField Manager      = (HiddenField)Item.FindControl("hidManager");
                Literal     ltrPoint     = (Literal)Item.FindControl("ltrPoint");
                HiddenField hdnProjectID = (HiddenField)Item.FindControl("hdnProjectID");
                int         cnt          = DC.tblFeedbacks.Count(ob => ob.ProjectID == Convert.ToInt32(hdnProjectID.Value));
                if (cnt > 0)
                {
                    tblFeedback Point = DC.tblFeedbacks.Single(ob => ob.ProjectID == Convert.ToInt32(hdnProjectID.Value));
                    ltrPoint.Text = Convert.ToString(Point.FeedBackPoint);
                }
                else
                {
                    ltrPoint.Text = "---";
                }

                if (Manager.Value != "")
                {
                    ManagerName = ViewProjectObject.ViewManager(Convert.ToInt32(Manager.Value));
                }
                Literal ltrManager = (Literal)Item.FindControl("ltrManager");
                ltrManager.Text = ManagerName;

                string      CategoryName = "---";
                HiddenField Category     = (HiddenField)Item.FindControl("hidCategory");
                if (Category.Value != "")
                {
                    CategoryName = ViewProjectObject.ViewCategory(Convert.ToInt32(Category.Value));
                }
                Literal ltrCategory = (Literal)Item.FindControl("ltrCategory");
                ltrCategory.Text = CategoryName;
                string      ClientName = "---";
                HiddenField Client     = (HiddenField)Item.FindControl("hidClient");
                if (Client.Value != "")
                {
                    ClientName = ViewProjectObject.ViewClient(Convert.ToInt32(Client.Value));
                }
                Literal ltrClient = (Literal)Item.FindControl("ltrClient");
                ltrClient.Text = ClientName;
                string      Duration     = "---";
                string      PanddingDays = "---";
                HiddenField hdnCreatedOn = (HiddenField)Item.FindControl("hdnCreatedOn");
                HiddenField hdnAssignDay = (HiddenField)Item.FindControl("hdnAssignDay");
                HiddenField hdnDeadLine  = (HiddenField)Item.FindControl("hdnDeadLine");
                if (hdnAssignDay.Value != "")
                {
                    TimeSpan Days = Convert.ToDateTime(hdnDeadLine.Value) - Convert.ToDateTime(hdnAssignDay.Value);
                    Duration = Convert.ToInt32(Days.TotalDays).ToString();
                    TimeSpan PanddingDay = Convert.ToDateTime(hdnDeadLine.Value) - DateTime.Now;
                    PanddingDays = Convert.ToInt32(PanddingDay.TotalDays).ToString();
                }
                else if (hdnAssignDay.Value == "")
                {
                    TimeSpan Days = Convert.ToDateTime(hdnDeadLine.Value) - Convert.ToDateTime(hdnCreatedOn.Value);
                    Duration = Days.TotalDays.ToString();
                }
                Literal ltrDuration     = (Literal)Item.FindControl("ltrDuration");
                Literal ltrPanddingDays = (Literal)Item.FindControl("lblPanddingDays");
                ltrDuration.Text = Convert.ToInt32(Duration) + " Days";
            }
        }
        catch (Exception ex)
        {
            int    session    = Convert.ToInt32(Session["AdminID"].ToString());
            string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
            string MACAddress = GetMacAddress();
            AddErrorLog(ref ex, PageName, "Admin", 0, session, MACAddress);
            ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
        }
    }
예제 #21
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (CheckForInternetConnection() == true)
        {
            try
            {
                var DC = new DataClassesDataContext();
                int ProjectID;
                if (ddProduct.SelectedValue != null)
                {
                    ProjectID = Convert.ToInt32(ddProduct.SelectedValue);
                }
                else
                {
                    ProjectID = 0;
                }

                //if (txtRate.Value == "5")
                //{
                //    Point = 5;
                //}
                //else if (txtRate.Value == "4")
                //{
                //    Point = 4;
                //}
                //else if (txtRate.Value == "3")
                //{
                //    Point = 3;
                //}
                //else if (txtRate.Value == "2")
                //{
                //    Point = 2;
                //}
                //else if (txtRate.Value == "1")
                //{
                //    Point = 1;
                //}
                //else
                //{
                //    Point = 5;
                //}

                int Point = Convert.ToInt32(txtRate.Value);

                int count = DC.tblFeedbacks.Count(ob => ob.ClientID == Convert.ToInt32(Session["ClientID"]) && ob.ProjectID == Convert.ToInt32(ddProduct.SelectedValue));
                if (count > 0)
                {
                    tblFeedback FeedbackPoint = (from ob in DC.tblFeedbacks
                                                 where ob.ClientID == Convert.ToInt32(Session["ClientID"]) && ob.ProjectID == Convert.ToInt32(ddProduct.SelectedValue)
                                                 select ob).Single();
                    FeedbackPoint.FeedBackPoint = Point;
                    DC.SubmitChanges();
                    ClientScript.RegisterClientScriptBlock(GetType(), "Javascript", "<script>alert('FeedBack Successfully Submitted');window.location ='Default.aspx'</script>");
                }
                else
                {
                    bool obj = objFeedBack.GiveFeedback(txtEmail.Text, ProjectID, Point, txtEnquiry.Text);
                    if (obj == true)
                    {
                        //IList<string> vc;
                        tblFeedback FeedbackID = (from ob in DC.tblFeedbacks
                                                  orderby ob.FeedbackID descending
                                                  select ob).First();
                        tblFeedback Client = (from ob in DC.tblFeedbacks
                                              where ob.EmailID == FeedbackID.EmailID
                                              select ob).Single();
                        DateTime    now = DateTime.Now;
                        MailMessage Msg = new MailMessage("*****@*****.**", FeedbackID.EmailID);
                        Msg.Subject = "feedback";
                        //Msg.Body = "<html><head></head><body><table><tr><td>Your E-Mail :</td><td>" + InquiryID.EmailID + "</td><br></tr><tr><p><td>" + "Your inquiry Successfull recieved and inquiry under process" + "</td></p></tr></table></body></html>";
                        Msg.Body       = "<!DOCTYPE html><html><head><title>Track My Work</title> <meta charset=\"utf - 8\"><meta name=\"viewport\" content=\"width = device - width, initial - scale = 1\"><meta http-equiv=\"X - UA - Compatible\" content=\"IE = edge\" /><style type=\"text / css\"> /* CLIENT-SPECIFIC STYLES */ body, table, td, a{-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%;} /* Prevent WebKit and Windows mobile changing default text sizes */ table, td{mso-table-lspace: 0pt; mso-table-rspace: 0pt;} /* Remove spacing between tables in Outlook 2007 and up */ img{-ms-interpolation-mode: bicubic;} /* Allow smoother rendering of resized image in Internet Explorer */ /* RESET STYLES */ img{border: 0; height: auto; line-height: 100%; outline: none; text-decoration: none;} table{border-collapse: collapse !important;} body{height: 100% !important; margin: 0 !important; padding: 0 !important; width: 100% !important;} /* iOS BLUE LINKS */ a[x-apple-data-detectors] { color: inherit !important; text-decoration: none !important; font-size: inherit !important; font-family: inherit !important; font-weight: inherit !important; line-height: inherit !important; } /* MOBILE STYLES */ @media screen and (max-width: 525px) { /* ALLOWS FOR FLUID TABLES */ .wrapper { width: 100% !important; max-width: 100% !important; } /* ADJUSTS LAYOUT OF LOGO IMAGE */ .logo img { margin: 0 auto !important; } /* USE THESE CLASSES TO HIDE CONTENT ON MOBILE */ .mobile-hide { display: none !important; } .img-max { max-width: 100% !important; width: 100% !important; height: auto !important; } /* FULL-WIDTH TABLES */ .responsive-table { width: 100% !important; } /* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */ .padding { padding: 10px 5% 15px 5% !important; } .padding-meta { padding: 30px 5% 0px 5% !important; text-align: center; } .no-padding { padding: 0 !important; } .section-padding { padding: 50px 15px 50px 15px !important; } /* ADJUST BUTTONS ON MOBILE */ .mobile-button-container { margin: 0 auto; width: 100% !important; } .mobile-button { padding: 15px !important; border: 0 !important; font-size: 16px !important; display: block !important; } } /* ANDROID CENTER FIX */ div[style*=\"margin: 16px 0; \"] { margin: 0 !important; }</style></head><body style=\"margin: 0 !important; padding: 0 !important; \"><!-- HIDDEN PREHEADER TEXT --><div style=\"display: none; font - size: 1px; color: #fefefe; line-height: 1px; font-family: Helvetica, Arial, sans-serif; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden;\"> Entice the open with some amazing preheader text. Use a little mystery and get those subscribers to read through...</div><!-- HEADER --><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"> <tr> <td align=\"center\" style=\" background:#008bff;\"> <!--[if (gte mso 9)|(IE)]> <table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\"> <tr> <td align=\"center\" valign=\"top\" width=\"500\"> <![endif]--> <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"max-width: 500px;\" class=\"wrapper\"> <tr style=\" background:#008bff;\"> <td align=\"center\" valign=\"top\" style=\"padding: 15px 0;\" class=\"logo\"> <h1 style=\"color:white; background:#008bff; font-family:calibri; font-size:40px;\">Track My Work</h1> </td> </tr> </table> <!--[if (gte mso 9)|(IE)]> </td> </tr> </table> <![endif]--> </td> </tr> <tr> <td bgcolor=\"#ffffff\" align=\"center\" style=\"padding: 70px 15px 70px 15px;\" class=\"section-padding\"> <!--[if (gte mso 9)|(IE)]> <table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\"> <tr> <td align=\"center\" valign=\"top\" width=\"500\"> <![endif]--> <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"max-width: 500px;\" class=\"responsive-table\"> <tr> <td> <!-- HERO IMAGE --> <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td> <!-- COPY --> <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td align=\"center\" style=\"font-size: 25px; font-family: Helvetica, Arial, sans-serif; color: #333333; padding-top: 30px;\" class=\"padding\">Your Email id is</td> </tr> <tr> <td align=\"center\" style=\"padding: 20px 0 0 0; font-size: 16px; line-height: 25px; font-family: Helvetica, Arial, sans-serif; color: #666666;\" class=\"padding\">" + FeedbackID.EmailID + "</td> </tr> <tr> <td align=\"center\" style=\"font-size: 25px; font-family: Helvetica, Arial, sans-serif; color: #333333; padding-top: 30px;\" class=\"padding\">Your Feedback Successfully Submitted.. Thank You For Your Valuable Feedback..</td> </tr> <tr> <td align=\"center\" style=\"padding: 20px 0 0 0; font-size: 16px; line-height: 25px; font-family: Helvetica, Arial, sans-serif; color: #666666;\" class=\"padding\"></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> <!--[if (gte mso 9)|(IE)]> </td> </tr> </table> <![endif]--> </td> </tr> <tr> <td align=\"center\" style=\"padding: 20px 0px; background:#424242; color:white;\"> <!--[if (gte mso 9)|(IE)]> <table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\"> <tr> <td align=\"center\" valign=\"top\" width=\"500\"> <![endif]--> <!-- UNSUBSCRIBE COPY --> <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" style=\"max-width: 500px;\" class=\"responsive-table\"> <tr> <td align=\"center\" style=\"font-size: 12px; line-height: 18px; font-family: Helvetica, Arial, sans-serif; color:white;\"> <b>Track My Work</b> by:- Renown Infosys <span style=\"font-family: Arial, sans-serif; font-size: 12px; color:white;\">&nbsp;&nbsp;</span> </td> </tr> </table> <!--[if (gte mso 9)|(IE)]> </td> </tr> </table> <![endif]--> </td> </tr></table></body></html>";
                        Msg.IsBodyHtml = true;

                        SmtpClient smtp = new SmtpClient();
                        smtp.Host = "smtp.gmail.com";
                        smtp.Port = 587;
                        smtp.UseDefaultCredentials = false;
                        smtp.EnableSsl             = true;
                        smtp.DeliveryMethod        = SmtpDeliveryMethod.Network;

                        NetworkCredential MyCredentials = new NetworkCredential("*****@*****.**", "TMW2016open");
                        smtp.Credentials = MyCredentials;
                        smtp.Send(Msg);
                        ClientScript.RegisterClientScriptBlock(GetType(), "Javascript", "<script>alert('FeedBack Successfully Submitted');window.location ='Default.aspx'</script>");
                    }
                    else
                    {
                        ClientScript.RegisterClientScriptBlock(GetType(), "Javascript", "<script>alert('Oops! Something goes wrong...');window.location ='FeedBack.aspx'</script>");
                    }
                }

                //ManagerAppraisal
                tblEmployee Manager = (from ob in DC.tblEmployees
                                       join ob2 in DC.tblProjects
                                       on ob.EmpID equals ob2.ManagerID
                                       where ob2.ProjectID == Convert.ToInt32(ddProduct.SelectedValue)
                                       select ob).Single();
                int cnt = (from ob in DC.tblEmpAppraisals
                           where ob.EmpID == Manager.EmpID
                           select ob).Count();
                if (cnt > 0)
                {
                    tblEmpAppraisal Appraisal = (from ob in DC.tblEmpAppraisals
                                                 where ob.EmpID == Manager.EmpID
                                                 select ob).Single();
                    Appraisal.ClientFeedback += Convert.ToInt32(Point);
                }
                else
                {
                    tblEmpAppraisal Appraisal = new tblEmpAppraisal();
                    Appraisal.EmpID          = Manager.EmpID;
                    Appraisal.Skills         = Convert.ToDecimal(0.0);
                    Appraisal.Quality        = Convert.ToDecimal(0.0);
                    Appraisal.Avialibility   = Convert.ToDecimal(0.0);
                    Appraisal.Deadlines      = Convert.ToDecimal(0.0);
                    Appraisal.Communication  = Convert.ToDecimal(0.0);
                    Appraisal.Cooperation    = Convert.ToDecimal(0.0);
                    Appraisal.ClientFeedback = Convert.ToDecimal(Point);
                    Appraisal.CreatedOn      = DateTime.Now;
                    DC.tblEmpAppraisals.InsertOnSubmit(Appraisal);
                    DC.SubmitChanges();
                }

                //TeamLeader
                IQueryable <tblEmployee> TeamMember = (from ob in DC.tblEmployees
                                                       join ob2 in DC.tblTeamModules
                                                       on ob.EmpID equals ob2.EmpID
                                                       join ob3 in DC.tblModules
                                                       on ob2.ModuleID equals ob3.ModuleID
                                                       where ob3.ProjectID == Convert.ToInt32(ddProduct.SelectedValue)
                                                       select ob);

                foreach (tblEmployee data in TeamMember)
                {
                    int cntEmp = (from ob in DC.tblEmpAppraisals
                                  where ob.EmpID == data.EmpID
                                  select ob).Count();
                    if (cntEmp > 0)
                    {
                        tblEmpAppraisal Appraisal = (from ob in DC.tblEmpAppraisals
                                                     where ob.EmpID == data.EmpID
                                                     select ob).Single();
                        Appraisal.ClientFeedback += Convert.ToInt32(Point);
                    }
                    else
                    {
                        tblEmpAppraisal Appraisal = new tblEmpAppraisal();
                        Appraisal.EmpID          = data.EmpID;
                        Appraisal.Skills         = Convert.ToDecimal(0.0);
                        Appraisal.Quality        = Convert.ToDecimal(0.0);
                        Appraisal.Avialibility   = Convert.ToDecimal(0.0);
                        Appraisal.Deadlines      = Convert.ToDecimal(0.0);
                        Appraisal.Communication  = Convert.ToDecimal(0.0);
                        Appraisal.Cooperation    = Convert.ToDecimal(0.0);
                        Appraisal.ClientFeedback = Convert.ToDecimal(Point);
                        Appraisal.CreatedOn      = DateTime.Now;
                        DC.tblEmpAppraisals.InsertOnSubmit(Appraisal);
                        DC.SubmitChanges();
                    }
                }

                //Employee
                IQueryable <tblEmployee> Employee = (from ob in DC.tblEmployees
                                                     join ob2 in DC.tblTeamMembers
                                                     on ob.EmpID equals ob2.EmpID
                                                     join ob3 in DC.tblTasks
                                                     on ob2.TaskID equals ob3.TaskID
                                                     join ob4 in DC.tblModules
                                                     on ob3.ModuleID equals ob4.ModuleID
                                                     where ob4.ProjectID == Convert.ToInt32(ddProduct.SelectedValue)
                                                     select ob);

                foreach (tblEmployee data in Employee)
                {
                    int cntEmp = (from ob in DC.tblEmpAppraisals
                                  where ob.EmpID == data.EmpID
                                  select ob).Count();
                    if (cntEmp > 0)
                    {
                        tblEmpAppraisal Appraisal = (from ob in DC.tblEmpAppraisals
                                                     where ob.EmpID == data.EmpID
                                                     select ob).Single();
                        Appraisal.ClientFeedback += Convert.ToInt32(Point);
                    }
                    else
                    {
                        tblEmpAppraisal Appraisal = new tblEmpAppraisal();
                        Appraisal.EmpID          = data.EmpID;
                        Appraisal.Skills         = Convert.ToDecimal(0.0);
                        Appraisal.Quality        = Convert.ToDecimal(0.0);
                        Appraisal.Avialibility   = Convert.ToDecimal(0.0);
                        Appraisal.Deadlines      = Convert.ToDecimal(0.0);
                        Appraisal.Communication  = Convert.ToDecimal(0.0);
                        Appraisal.Cooperation    = Convert.ToDecimal(0.0);
                        Appraisal.ClientFeedback = Convert.ToDecimal(Point);
                        Appraisal.CreatedOn      = DateTime.Now;
                        DC.tblEmpAppraisals.InsertOnSubmit(Appraisal);
                        DC.SubmitChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                int    session    = Convert.ToInt32(Session["ClientID"].ToString());
                string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
                string MACAddress = GetMacAddress();
                AddErrorLog(ref ex, PageName, "Client", session, 0, MACAddress);
                ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
            }
        }
        else
        {
            ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Please Check your Internet Connection');", true);
        }
    }
예제 #22
0
        public string SaveFeedback()
        {
            var Name        = Convert.ToString(Request.Form["avia_1_1"]);
            var ToEmail     = Convert.ToString(Request.Form["avia_2_1"]);
            var Message     = Convert.ToString(Request.Form["avia_6_1"]);
            var txtmobileno = Convert.ToString(Request.Form["txtmobileno"]);

            var    rating = Convert.ToString(Request.Form["rating"]);
            string msg    = string.Empty;

            if (string.IsNullOrEmpty(rating))
            {
                msg = "Please select Rating.";
                return(msg);
            }

            if (string.IsNullOrEmpty(Name))
            {
                msg = "Please provide name.";
                return(msg);
            }

            if (string.IsNullOrEmpty(ToEmail))
            {
                msg = "Please porvide email.";
                return(msg);
            }

            if (string.IsNullOrEmpty(txtmobileno))
            {
                msg = "Please provide mobile no.";
                return(msg);
            }


            //Message = string.Format("<b>Name:</b> {0}<br /><br />", Name);
            //Message += string.Format("<b>Email:</b> {0}<br /><br />", ToEmail);
            //Message += string.Format("<b>Mobile:</b> {0}<br /><br />",  txtmobileno);
            //Message += string.Format("<b>Message:</b> {0}<br /><br />", Message);
            //Message += string.Format("<b>Rating:</b> {0}<br /><br />", rating);


            //MailMessage message = new MailMessage();
            //SmtpClient smtpClient = new SmtpClient();

            //try
            //{
            //    MailAddress fromAddress = new MailAddress("*****@*****.**");
            //    message.From = fromAddress;
            //    message.To.Add("*****@*****.**");
            //    message.Subject = "Flex Fixes Feedback from Website";
            //    message.IsBodyHtml = true;
            //    message.Body = Message;
            //    smtpClient.Host = "relay-hosting.secureserver.net";   //-- Donot change.
            //    smtpClient.Port = 25; //--- Donot change
            //    smtpClient.EnableSsl = false;//--- Donot change
            //    smtpClient.UseDefaultCredentials = true;
            //    smtpClient.Credentials = new System.Net.NetworkCredential("*****@*****.**", "usman83213");

            //    smtpClient.Send(message);
            //    msg = "1";
            //    //lblConfirmationMessage.Text = "Your email successfully sent.";
            //}
            //catch (Exception ex)
            //{
            //    msg = ex.Message;
            //}


            try
            {
                using (EFDbContext context = new EFDbContext())
                {
                    tblFeedback f = new tblFeedback();
                    f.Message      = Message;
                    f.Name         = Name;
                    f.Email        = ToEmail;
                    f.MobileNo     = txtmobileno;
                    f.Rating       = rating;
                    f.CreationDate = DateTime.Now;
                    //context.Entry(f).State = System.Data.EntityState.Added;
                    context.Feedbacks.Add(f);
                    context.SaveChanges();

                    msg = "1";
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }



            return(msg);
        }
예제 #23
0
        public ActionResult Details(int id)
        {
            tblFeedback ad = dc.tblFeedbacks.SingleOrDefault(ob => ob.FeedbackId == id);

            return(View(ad));
        }