Example #1
0
        public void editNotification(DOneTable dOneTable)
        {
            // delete notification
            deleteNotification(dOneTable);

            // tekrar notification ekle
            setNotificaitonAndMail(dOneTable);
        }
        // GET: DOneTables/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DOneTable dOneTable = db.DOneTable.Find(id);

            if (dOneTable == null)
            {
                return(HttpNotFound());
            }
            return(View(dOneTable));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            DOneTable dOneTable = db.DOneTable.Find(id);

            // tablodan veriler silinice notification refresh edilir
            sqlHelper.deleteNotification(dOneTable);


            db.DOneTable.Remove(dOneTable);
            db.SaveChanges();



            return(RedirectToAction("Index"));
        }
Example #4
0
 public void deleteNotification(DOneTable dOneTable)
 {
     // ilk başta notificationları silelim daha sonra tekrar ekleyelim
     try
     {
         var notifList = db.NotificationTable.Where(x => x.ErrorNo == dOneTable.ErrorNo).ToList();
         foreach (var notif in notifList)
         {
             db.NotificationTable.Remove(notif);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
     }
 }
Example #5
0
        public ActionResult DeleteConfirmed(string id)
        {
            ErrorListTable errorListTable = db.ErrorListTable.Find(id);

            // tablodan veriler silinice notification refresh edilir
            DOneTable dOneTable = db.DOneTable.Where(x => x.ErrorNo == errorListTable.ErrorNo).FirstOrDefault();

            sqlHelper.deleteNotification(dOneTable);
            // delete image from project folder and db cascade delete already delete on db
            sqlHelper.deleteImageOnFolder(errorListTable.ErrorNo);

            // delete document from project folder and db cascade delete already delete on db
            sqlHelper.deleteDocumentOnFolder(errorListTable.ErrorNo);

            db.ErrorListTable.Remove(errorListTable);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #6
0
        public void sendCompleteErrorMail(DOneTable dOneTable, string subject, string message)
        {
            inanSoftDBEntities1 db = new inanSoftDBEntities1();
            List <MailAddress>  teamMemberMailList = new List <MailAddress>();
            var builder = new StringBuilder();

            foreach (var member in dOneTable.TeamMembers.Split(','))
            {
                teamMemberMailList.Add(new MailAddress(db.UserTable.Where(x => x.Name == member).FirstOrDefault().Email, member));
                builder.AppendLine("Takım Üyesi: " + member + ",");
            }
            // sendMail For TeamLeader and TeamMembers
            sendMail(
                db.UserTable.Where(x => x.Name == dOneTable.TeamLeader).FirstOrDefault().Email,
                dOneTable.TeamLeader,
                teamMemberMailList,
                "'" + dOneTable.ErrorNo + "' " + subject,
                message + " (Takım Lideri : " + dOneTable.TeamLeader + "," + builder.ToString() + ")"
                );
        }
        public ActionResult Edit([Bind(Include = "ID,TeamLeader,TeamMembers,ErrorNo")] DOneTable dOneTable)
        {
            var userModel = common.getCurrentUserModel();

            dOneTable.Company = userModel.Company;

            if (ModelState.IsValid)
            {
                db.Entry(dOneTable).State = EntityState.Modified;
                db.SaveChanges();

                // tablodan veriler silinice notification refresh edilir
                // ekip düzenlenince bildirimler de güncellenicek
                mailHelper.sendMailToUserEditTeam(dOneTable); // mail gönderme işlemi yapılır
                sqlHelper.editNotification(dOneTable);
                return(RedirectToAction("DSteps", "EightStep", new { errorNo = dOneTable.ErrorNo }));
            }

            ViewBag.TeamLeader = new SelectList(db.UserTable.Where(x => x.Company == userModel.Company), "Name", "Name", dOneTable.TeamLeader);

            return(View(dOneTable));
        }
        // GET: DOneTables/Edit/5
        public ActionResult Edit(int?id)
        {
            var userModel = common.getCurrentUserModel();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DOneTable dOneTable = db.DOneTable.Find(id);

            if (dOneTable == null)
            {
                return(HttpNotFound());
            }

            ViewBag.TeamLeader = new SelectList(db.UserTable.Where(x => x.Company == userModel.Company), "Name", "Name", dOneTable.TeamLeader);
            ViewBag.Team       = sqlHelper.getUserList();



            return(View(dOneTable));
        }
Example #9
0
        public void setNotificaitonAndMail(DOneTable dOneTable)
        {
            // yeni oluturulan ekip üyelerine mail ve bildirim gidecek
            // bildirim gitmesi:

            // ekip liderine gidecek mail
            var userTable = db.UserTable.Where(x => x.Name == dOneTable.TeamLeader).FirstOrDefault();
            NotificationTable notification = new NotificationTable();

            notification.Date         = DateTime.Now;
            notification.MailAddress  = userTable.Email;
            notification.Notification = dOneTable.ErrorNo + " nol'lu hatanın çözüm ekibi Liderisiniz";
            notification.IsRead       = null;
            notification.ErrorNo      = dOneTable.ErrorNo;

            db.NotificationTable.Add(notification);
            db.SaveChanges();

            // ekip üyelerine gidecek mail
            var teamMembers = dOneTable.TeamMembers.Split(',').ToList();

            foreach (var member in teamMembers)
            {
                if (member != null)
                {
                    userTable                 = db.UserTable.Where(x => x.Name == member).FirstOrDefault();
                    notification              = new NotificationTable();
                    notification.Date         = DateTime.Now;
                    notification.MailAddress  = userTable.Email;
                    notification.Notification = dOneTable.ErrorNo + " nol'lu hatanın çözüm ekibine atandınız";
                    notification.IsRead       = null;
                    notification.ErrorNo      = dOneTable.ErrorNo;

                    db.NotificationTable.Add(notification);
                    db.SaveChanges();
                }
            }
        }
Example #10
0
        public void sendMailToUserEditTeam(DOneTable dOneTable)
        {
            inanSoftDBEntities1 db = new inanSoftDBEntities1();
            List <MailAddress>  teamMemberMailList = new List <MailAddress>();

            var builder = new StringBuilder();

            foreach (var member in dOneTable.TeamMembers.Split(','))
            {
                teamMemberMailList.Add(new MailAddress(db.UserTable.Where(x => x.Name == member).FirstOrDefault().Email, member));
                builder.AppendLine("Takım Üyesi: " + member + ",");
            }

            // sendMail For TeamLeader and TeamMembers
            sendMail(
                db.UserTable.Where(x => x.Name == dOneTable.TeamLeader).FirstOrDefault().Email,
                dOneTable.TeamLeader,
                teamMemberMailList,
                "'" + dOneTable.ErrorNo + "'" + " Çözüm Ekibi Yeniden oluşturuldu",

                "Takım Lideri : " + dOneTable.TeamLeader + "," + builder.ToString()
                );
        }
        public ActionResult Create([Bind(Include = "ID,TeamLeader,TeamMembers")] DOneTable dOneTable, string errorNo)
        {
            var userModel   = common.getCurrentUserModel();
            var tempErrorNo = common.getCurrentErrorNo();

            if (tempErrorNo != errorNo)
            {
                dOneTable.ErrorNo = tempErrorNo;
            }
            else
            {
                dOneTable.ErrorNo = errorNo;
            }


            // save model to see another view

            if (ModelState.IsValid)
            {
                mailHelper.sendMailToUser(dOneTable); // mail gönderme işlemi yapılır

                dOneTable.Company = userModel.Company;
                // takım lideri ve takım üyelerine mail ve bildirim gidecek, takım üyeleri virgül ile ayrılmı gönderilecek
                sqlHelper.setNotificaitonAndMail(dOneTable);
                db.DOneTable.Add(dOneTable);
                db.SaveChanges();


                return(RedirectToAction("DSteps", "EightStep", new { errorNo = errorNo })); // hata çözüm adımları sayfasına yönlendirme yapar
            }


            ViewBag.TeamLeader = new SelectList(db.UserTable.Where(x => x.Company == userModel.Company), "Name", "Name", dOneTable.TeamLeader);
            ViewBag.Team       = sqlHelper.getUserList();

            return(View(dOneTable));
        }