Ejemplo n.º 1
0
        public void deleteQuestion(int id)
        {
            Questioner Question = db.Questioners.Find(id);

            Question.IsActive = false;
            //db.Questioners.Remove(Question);
            db.SaveChanges();
        }
Ejemplo n.º 2
0
        public void updateQuestioner(QuestionerTO question)
        {
            Questioner dataToUpdate = db.Questioners.Where(x => x.Questioner_Id == question.Questioner_Id).FirstOrDefault();

            dataToUpdate.Questioner1 = question.Questioner1;
            dataToUpdate.Metadata_Id = question.Metadata_Id;
            dataToUpdate.IsActive    = question.IsActive;


            db.SaveChanges();
        }
Ejemplo n.º 3
0
 public HttpStatusCode Inbound([FromBody] InboundMessage message)
 {
     if (message.from.type == "messenger")
     {
         _ = Questioner.AskQuestion(message.from.id, message.to.id, message.from.type, message.message.content.text, _config);
     }
     else
     {
         _ = Questioner.AskQuestion(message.from.number, message.to.number, message.from.type, message.message.content.text, _config);
     }
     return(HttpStatusCode.NoContent);
 }
Ejemplo n.º 4
0
        public void saveQuestioners(QuestionerTO question)
        {
            Questioner dataToSave = new Questioner()
            {
                Questioner1 = question.Questioner1,
                Metadata_Id = question.Metadata_Id,
                IsActive    = true
            };

            db.Questioners.Add(dataToSave);
            db.SaveChanges();
        }
Ejemplo n.º 5
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Questioner questioner = await db.Questioners.FindAsync(id);

            db.Questioners.Remove(questioner);
            string     username = User.Identity.Name;
            Questioner qus      = new Questioner();
            await db.SaveChangesAsync();

            auditTransact.CreateAuditTrail("Delete", id, "Questioner", questioner, qus, username);
            TempData["message"] = "Questioner successfully deleted!";
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
        // GET: Questioners/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Questioner questioner = await db.Questioners.FindAsync(id);

            if (questioner == null)
            {
                return(HttpNotFound());
            }
            return(View(questioner));
        }
Ejemplo n.º 7
0
        public async Task <ActionResult> Update(string submit, string Textarea, string Textbox, string Rating, int QuestionerID)
        {
            var    questioner = db.Questioners.Find(QuestionerID);
            string user       = submit.Contains("By") ? submit.Split('y')[1] : String.Empty;

            if (submit == "Save" || submit == "Send Back")
            {
                questioner.Status = "Draft";
            }
            else if (submit == "Approve")
            {
                questioner.Status = "Approve";
            }
            else if (submit == "Submit For Review By" + user)
            {
                questioner.Status = "Pending for Review by" + user;
            }
            else if (submit == "Submit For Approve By" + user)
            {
                questioner.Status = "Pending for Approve by" + user;
                string          baseUrl    = Request.Url.GetLeftPart(UriPartial.Authority);
                List <string>   CIAUserIds = Request.GetOwinContext().GetUserManager <ApplicationRoleManager>().Roles.Where(p => p.Name.Equals(user.Trim())).FirstOrDefault().Users.Select(p => p.UserId).ToList();
                List <Employee> CIAEmpList = new List <Employee>();
                if (CIAUserIds.Count() > 0)
                {
                    var CIAUsers = Request.GetOwinContext().GetUserManager <ApplicationUserManager>().Users.Where(p => (CIAUserIds.Contains(p.Id))).ToList();
                    foreach (var CIAUser in CIAUsers)
                    {
                        Employee emp = db.Employees.Where(p => p.Email.Equals(CIAUser.Email)).FirstOrDefault();

                        string emailContent = "Dear {0}, <BR/><BR/>Questioner : {1} need your approval. Please click on this <a href=\"{2}\" title=\"Questioner\">link</a> to show the Questioner.<BR/><BR/><BR/> Regards,<BR/><BR/> ePatria Team";
                        string url          = baseUrl + "/Questioners/Details/" + questioner.QuestionerID;
                        //emailTransact.SentEmailApproval(emp.Email, emp.Name, questioner.Name, emailContent, url);
                    }
                }
            }
            string username = User.Identity.Name;

            db.Configuration.ProxyCreationEnabled = false;
            Questioner oldData = db.Questioners.AsNoTracking().Where(p => p.QuestionerID.Equals(questioner.QuestionerID)).FirstOrDefault();

            auditTransact.CreateAuditTrail("Update", questioner.QuestionerID, "Questioner", oldData, questioner, username);
            db.Entry(questioner).State = EntityState.Modified;
            await db.SaveChangesAsync();

            TempData["message"] = "Questioner successfully updated!";
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 8
0
        public ViewResult FeedBackURL(int id, int empId)
        {
            FeedbackQuestionDetail     fdq       = db.FeedbackQuestionDetails.Find(id);
            List <Questioner>          questList = new List <Questioner>();
            QuestionerAnswersViewModel q         = new QuestionerAnswersViewModel();
            Questioner quest = new Questioner();

            foreach (var question in fdq.QuestionerID.Split(';'))
            {
                if (!String.IsNullOrEmpty(question))
                {
                    quest = db.Questioners.Find(Convert.ToInt32(question));
                    questList.Add(quest);
                }
            }
            ViewBag.EmpName = db.Employees.Find(fdq.PICID).Name;
            q.Questioners   = questList;
            return(View(q));
        }
Ejemplo n.º 9
0
        // GET: Questioners/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Questioner questioner = await db.Questioners.FindAsync(id);

            ViewBag.Textbox  = questioner.Value;
            ViewBag.Textarea = questioner.Value;
            if (questioner.Value != null && questioner.Value.Contains(";"))
            {
                ViewBag.Rating1 = questioner.Value.Split(';')[0];
                ViewBag.Rating2 = questioner.Value.Split(';')[1];
            }
            ViewBag.Rating = questioner.Value;
            if (questioner == null)
            {
                return(HttpNotFound());
            }
            return(View(questioner));
        }
Ejemplo n.º 10
0
        public Form1(string argument)
        {
            InitializeComponent();

            fileReader    = new FileReader();
            textFormatter = new StringToList();
            questioner    = new Questioner(lbWordsCount, tbEnglishWord);

            wordsFromDatabase = new Database().initializeInMemoryList();

            #region Drag and drop a file?
            if (File.Exists(argument))
            {
                fileReader.setPath(argument);
                QuestionerButton();
            }

            #endregion

            #region Sandbox

            #endregion
        }
Ejemplo n.º 11
0
 public HttpStatusCode InboundSms([FromQuery] SMS.SMSInbound inboundMessage)
 {
     _ = Questioner.AskQuestion(inboundMessage.msisdn, inboundMessage.to, "sms", inboundMessage.text, _config);
     return(HttpStatusCode.NoContent);
 }
Ejemplo n.º 12
0
        public async Task <ActionResult> Create(string submit, [Bind(Include = "QuestionerID,Name,Type,Value,Status")] Questioner questioner, string Textarea, string Textbox, string Rating, string from, string to)
        {
            if (ModelState.IsValid)
            {
                if (questioner.Type == "TextBox")
                {
                    questioner.Value = Textbox;
                }
                else if (questioner.Type == "TextArea")
                {
                    questioner.Value = Textarea;
                }
                else
                {
                    questioner.Value = from + ";" + to;
                }
                string user = submit.Contains("By") ? submit.Split('y')[1] : String.Empty;
                if (submit == "Save" || submit == "Send Back")
                {
                    questioner.Status = "Draft";
                }
                else if (submit == "Approve")
                {
                    questioner.Status = "Approve";
                }
                else if (submit == "Submit For Review By" + user)
                {
                    questioner.Status = "Pending for Review by" + user;
                }
                else if (submit == "Submit For Approve By" + user)
                {
                    questioner.Status = "Pending for Approve by" + user;
                    string          baseUrl    = Request.Url.GetLeftPart(UriPartial.Authority);
                    List <string>   CIAUserIds = Request.GetOwinContext().GetUserManager <ApplicationRoleManager>().Roles.Where(p => p.Name.Equals(user.Trim())).FirstOrDefault().Users.Select(p => p.UserId).ToList();
                    List <Employee> CIAEmpList = new List <Employee>();
                    if (CIAUserIds.Count() > 0)
                    {
                        var CIAUsers = Request.GetOwinContext().GetUserManager <ApplicationUserManager>().Users.Where(p => (CIAUserIds.Contains(p.Id))).ToList();
                        foreach (var CIAUser in CIAUsers)
                        {
                            Employee emp = db.Employees.Where(p => p.Email.Equals(CIAUser.Email)).FirstOrDefault();

                            string emailContent = "Dear {0}, <BR/><BR/>Questioner : {1} need your approval. Please click on this <a href=\"{2}\" title=\"Questioner\">link</a> to show the Questioner.<BR/><BR/><BR/> Regards,<BR/><BR/> ePatria Team";
                            string url          = baseUrl + "/Questioners/Details/" + questioner.QuestionerID;
                            //emailTransact.SentEmailApproval(emp.Email, emp.Name, questioner.Name, emailContent, url);
                        }
                    }
                }
                db.Questioners.Add(questioner);
                await db.SaveChangesAsync();

                string     username = User.Identity.Name;
                Questioner qus      = new Questioner();
                auditTransact.CreateAuditTrail("Create", questioner.QuestionerID, "Questioner", qus, questioner, username);

                ReviewRelationMaster rrm = new ReviewRelationMaster();
                string page = "questioner";
                rrm.Description = page + questioner.QuestionerID;
                db.ReviewRelationMasters.Add(rrm);
                db.SaveChanges();

                TempData["message"] = "Questioner successfully created!";
                return(RedirectToAction("Index"));
            }

            return(View(questioner));
        }