Esempio n. 1
0
        public static NotificationModel UpdateNotiRead(int id, out string error)
        {
            error = "";
            LUSSISEntities    entities = new LUSSISEntities();
            notification      n        = new notification();
            NotificationModel nm       = new NotificationModel();

            try
            {
                n        = entities.notifications.Where(x => x.notiid == id).FirstOrDefault();
                n.isread = true;
                entities.SaveChanges();

                nm = GetNotiBynotiid(n.notiid, out error);
            }
            catch (NullReferenceException)
            {
                error = ConError.Status.NOTFOUND;
            }
            catch (Exception e)
            {
                error = e.Message;
            }
            return(nm);
        }
 protected void btnsend_Click(object sender, EventArgs e)
 {
     if (txtsem.Text == string.Empty || txtmessage.Text == string.Empty)
     {
         lblsenderror.Text = "All details are mandatory.";
         return;
     }
     else
     {
         using (DepartmentPortalDataContext db = new DepartmentPortalDataContext())
         {
             try
             {
                 notification n = new notification()
                 {
                     sem       = Convert.ToInt32(txtsem.Text),
                     notifdate = DateTime.Now,
                     notif     = txtmessage.Text
                 };
                 db.notifications.InsertOnSubmit(n);
                 db.SubmitChanges();
                 lblsenderror.Text = "Notification has been sent";
             }
             catch (Exception ex) { }
         }
     }
 }
Esempio n. 3
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            //try
            //{
            notification n = new notification();

            n.id                   = textBox1.Text;
            n.idCause              = (string)comboBox2.SelectedValue;
            n.date                 = dateTimePicker1.Value;
            n.numdecision          = textBox2.Text;
            n.decisionFinal        = textBox3.Text;
            n.dateDecision         = dateTimePicker2.Value;
            n.idClient             = textBox4.Text;
            n.idAdv                = "";
            n.tribunal             = comboBox3.SelectedValue.ToString();
            n.typeCause            = textBox9.Text;
            n.ville                = comboBox5.SelectedValue.ToString();
            n.commisaireJudiciaire = textBox6.Text;
            n.note                 = textBox7.Text;
            n.typeFile             = comboBox1.SelectedItem.ToString();
            string t = n.save();

            if (t != "")
            {
                MessageBox.Show("تمت الإضافة بنجاح");
                history.AddHistory("تبليغ", "إضافة", t);
            }
            refresh();
            //}
            //catch (Exception nn)
            //{
            //    MessageBox.Show("المرجو إعادة ملئ البيانات" + nn.Message);
            //}
        }
Esempio n. 4
0
        public static List <NotificationModel> GetNotiByisread(bool isread, int deptid, int role, out string error)
        {
            LUSSISEntities entities = new LUSSISEntities();

            error = "";
            List <notification>      no   = new List <notification>();
            notification             noti = new notification();
            List <NotificationModel> nm   = new List <NotificationModel>();

            try
            {
                no = entities.notifications.Where(p => p.isread == isread && p.deptid == deptid && p.role == role).ToList <notification>();
                no = no.OrderByDescending(x => x.datetime).ToList();
                foreach (notification notii in no)
                {
                    nm.Add(CovertDBNotitoAPINoti(notii));
                }
            }
            catch (NullReferenceException)
            {
                error = ConError.Status.NOTFOUND;
            }
            catch (Exception e)
            {
                error = e.Message;
            }
            return(nm);
        }
Esempio n. 5
0
        public void AddComment(int id)
        {
            string   currid = Request.Params["id"].ToString();
            user     us     = Session["User" + currid] as user;
            NewsFeed feed   = db.NewsFeeds.Find(id);
            comment  com    = new comment();

            com.newsfeed_id    = id;
            com.datetime       = DateTime.Now;
            com.comment1       = Request.Params["content"];
            com.commentator_id = us.id;
            db.comments.Add(com);

            if (feed.user_id != us.id)
            {
                notification notif = new notification();
                notif.datetime   = DateTime.Now;
                notif.sender_id  = us.id;
                notif.user_id    = feed.user_id;
                notif.on_feed_id = id;
                notif.state      = 1;
                notif.text_id    = 5;
                db.notifications.Add(notif);
            }
            db.SaveChanges();
        }
        public async Task <IHttpActionResult> Postnotification(notification notification)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.notifications.Add(notification);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (notificationExists(notification.description))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = notification.description }, notification));
        }
Esempio n. 7
0
 public void addListener(string s, notification noti)
 {
     if (!listeners.ContainsKey(s))
     {
         listeners.Add(s, noti);
     }
 }
Esempio n. 8
0
        public void del(notification N)
        {
            notification n = (from x in db.notifications where x.Id == N.Id select x).First();

            db.notifications.Remove(n);
            db.SaveChanges();
        }
Esempio n. 9
0
        public async void ShareViedo(int id)
        {
            string   currid = Request.Params["id"].ToString();
            user     us     = Session["User" + currid] as user;
            NewsFeed feed   = await db.NewsFeeds.FindAsync(id);

            NewsFeed myfeed = new NewsFeed();

            myfeed.dateTime     = DateTime.Now;
            myfeed.user_id      = us.id;
            myfeed.feedState_id = 4;
            if (feed.on_feed_id == null)
            {
                myfeed.on_feed_id = feed.id;
            }
            else
            {
                myfeed.on_feed_id = feed.on_feed_id;
            }
            myfeed.videos      = feed.videos;
            myfeed.contetnfeed = feed.contetnfeed;
            db.NewsFeeds.Add(myfeed);
            if (feed.user_id != us.id)
            {
                notification not = new notification();
                not.sender_id  = us.id;
                not.datetime   = DateTime.Now;
                not.user_id    = feed.user_id;
                not.text_id    = 7;
                not.state      = 1;
                not.on_feed_id = feed.id;
                db.notifications.Add(not);
            }
            db.SaveChanges();
        }
        public IActionResult Post([FromBody] notification n)
        {
            db.Notifications.Add(n);

            db.SaveChanges();
            return(StatusCode(StatusCodes.Status201Created));
        }
Esempio n. 11
0
        public static async Task <List <notification> > readNotifications(int userId, bool seen = false)
        {
            List <notification> notifications = new List <notification>();
            await databaseManager.selectQuery($"SELECT * FROM notifications WHERE userId = @userId", delegate(DbDataReader reader)
            {
                if (reader.HasRows)
                {
                    notification notification = new notification();
                    notification.date         = (DateTime)reader["date"];
                    notification.userId       = (int)reader["userId"];
                    notification.username     = (string)reader["username"];
                    notification.message      = (string)reader["message"];
                    notification.seen         = (bool)reader["seen"];
                    notification.id           = (int)reader["id"];
                    notifications.Add(notification);
                }
            }).addValue("@userId", userId).Execute();

            if (seen)
            {
                await databaseManager.updateQuery($"UPDATE notifications SET seen = True WHERE userId = @userId AND seen = False").addValue("@userId", userId).Execute();
            }

            return(notifications.OrderByDescending(a => a.date).ToList());
        }
Esempio n. 12
0
    public static void newIkemenGet(Sprite sp1)
    {
        Debug.Log("newIkemenGet");
        Debug.Log(sp1);

        maskObj.SetActive(true);
        notificationObj.SetActive(true);
        notificationObj.transform.localScale = Vector3.zero;
        notificationImageObj.GetComponent <Image>().overrideSprite = sp1;

        notification nscript = notificationObj.GetComponent <notification>();

        nscript.setStar(Random.Range(1, 4));

        Sequence seq = DOTween.Sequence();

        seq.Append(notificationObj.transform.DOScale(Vector3.one, 0.5f).SetEase(Ease.OutExpo))
        .Append(notificationObj.transform.DOScale(Vector3.one, 0.5f))
        .AppendCallback(() => {
            Debug.Log(" notification comp");
            notificationObj.SetActive(false);
            maskObj.SetActive(false);
        }
                        ).Play();
    }
Esempio n. 13
0
        public static void NotificationAdd(int id)
        {
            FYPEntities db        = new FYPEntities();
            var         grouplist = db.Student_Group.Where(p => p.Group_Id == id).FirstOrDefault();

            for (int i = 0; i < 2; i++)
            {
                notification notif = new notification();
                if (i == 0)
                {
                    notif.N_To = grouplist.Student_1_ID;
                }
                if (i == 1)
                {
                    notif.N_To = grouplist.Student_2_ID;
                }
                notif.Notification_Msg = "Your Request is Accepted By Advisor";
                notif.Isread           = false;

                notif.DateCreated = DateTime.Now;
                notif.is_active   = true;
                FYPEntities dbs = new FYPEntities();
                dbs.notifications.Add(notif);
                dbs.SaveChanges();
            }
        }
Esempio n. 14
0
        public static NotificationModel CreatNotification(NotificationModel nm, out string error)
        {
            error = "";
            LUSSISEntities entities = new LUSSISEntities();
            notification   n        = new notification();

            try
            {
                n.datetime = DateTime.Now;
                n.deptid   = nm.Deptid;
                n.role     = nm.Role;
                n.title    = nm.Title;
                n.remark   = nm.Remark;
                n.isread   = false;
                n.resid    = nm.ResID;
                n.notitype = nm.NotiType;
                n          = entities.notifications.Add(n);
                entities.SaveChanges();

                nm = GetNotiBynotiid(n.notiid, out error);
            }
            catch (NullReferenceException)
            {
                error = ConError.Status.NOTFOUND;
            }
            catch (Exception e)
            {
                error = e.Message;
            }
            return(nm);
        }
        /// <summary>
        /// Converts this instance of <see cref="notification"/> to an instance of <see cref="notificationDto"/>.
        /// </summary>
        /// <param name="entity"><see cref="notification"/> to convert.</param>
        public static notificationDto ToDTO(this notification entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new notificationDto();

            dto.v_NotificationId      = entity.v_NotificationId;
            dto.v_OrganizationId      = entity.v_OrganizationId;
            dto.d_NotificationDate    = entity.d_NotificationDate;
            dto.v_PersonId            = entity.v_PersonId;
            dto.v_Title               = entity.v_Title;
            dto.v_Body                = entity.v_Body;
            dto.i_TypeNotificationId  = entity.i_TypeNotificationId;
            dto.d_ScheduleDate        = entity.d_ScheduleDate;
            dto.i_IsRead              = entity.i_IsRead;
            dto.i_StateNotificationId = entity.i_StateNotificationId;
            dto.v_Path                = entity.v_Path;
            dto.i_IsDeleted           = entity.i_IsDeleted;
            dto.i_InsertUserId        = entity.i_InsertUserId;
            dto.d_InsertDate          = entity.d_InsertDate;
            dto.i_UpdateUserId        = entity.i_UpdateUserId;
            dto.d_UpdateDate          = entity.d_UpdateDate;

            entity.OnDTO(dto);

            return(dto);
        }
        /// <summary>
        /// Converts this instance of <see cref="notificationDto"/> to an instance of <see cref="notification"/>.
        /// </summary>
        /// <param name="dto"><see cref="notificationDto"/> to convert.</param>
        public static notification ToEntity(this notificationDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new notification();

            entity.v_NotificationId      = dto.v_NotificationId;
            entity.v_OrganizationId      = dto.v_OrganizationId;
            entity.d_NotificationDate    = dto.d_NotificationDate;
            entity.v_PersonId            = dto.v_PersonId;
            entity.v_Title               = dto.v_Title;
            entity.v_Body                = dto.v_Body;
            entity.i_TypeNotificationId  = dto.i_TypeNotificationId;
            entity.d_ScheduleDate        = dto.d_ScheduleDate;
            entity.i_IsRead              = dto.i_IsRead;
            entity.i_StateNotificationId = dto.i_StateNotificationId;
            entity.v_Path                = dto.v_Path;
            entity.i_IsDeleted           = dto.i_IsDeleted;
            entity.i_InsertUserId        = dto.i_InsertUserId;
            entity.d_InsertDate          = dto.d_InsertDate;
            entity.i_UpdateUserId        = dto.i_UpdateUserId;
            entity.d_UpdateDate          = dto.d_UpdateDate;

            dto.OnEntity(entity);

            return(entity);
        }
        public IHttpActionResult Putnotification(int id, notification notification)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != notification.id)
            {
                return(BadRequest());
            }

            db.Entry(notification).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!notificationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 18
0
        public override void SAVEbtn_Click(object sender, EventArgs e)
        {
            if (SelectTypeTxt.Text == "")
            {
                SelectTypeErrorLabel.Visible = true;
            }
            else
            {
                SelectTypeErrorLabel.Visible = false;
            }
            if (SelectRecipientDD.SelectedIndex == -1)
            {
                SelectRecipientErrorlabel.Visible = true;
            }
            else
            {
                SelectRecipientErrorlabel.Visible = false;
            }
            if (MsgTxt.Text == "")
            {
                MessageErrorLabel.Visible = true;
            }
            else
            {
                MessageErrorLabel.Visible = false;
            }
            if (SelectTypeErrorLabel.Visible || /*SelectStudentErrorlabel.Visible ||*/ SelectRecipientErrorlabel.Visible || MessageErrorLabel.Visible)
            {
                MainClass.ShowMSG("Fields with * are required ", "Required", "Error");
            }
            else
            {
                if (edit == 0)// for save data entered by user
                {
                    try
                    {
                        notification notifi = new notification();
                        obj.nt_insertnotifications(SelectTypeTxt.Text, Convert.ToInt32(SelectRecipientDD.SelectedValue.ToString()), MsgTxt.Text);
                        MainClass.ShowMSG(SelectTypeTxt.Text + " added successfully", "Success....", "Success");
                        MainClass.disable_reset(panel6);
                        loadData();
                    }
                    catch (Exception ex) { MainClass.ShowMSG(ex.Message, "Dulpicate", "Error"); }
                }
                else if (edit == 1)// for Update perious data entered by user
                {
                    try
                    {
                        obj.nt_updatenotifications(SelectTypeTxt.Text, Convert.ToInt32(SelectRecipientDD.SelectedValue.ToString()), MsgTxt.Text, notificationID);
                        MainClass.ShowMSG(SelectTypeTxt.Text + " added successfully", "Success....", "Success");
                        MainClass.disable_reset(panel6);
                        loadData();
                    }
                    catch (Exception ex) { MainClass.ShowMSG(ex.Message, "Dulpicate", "Error"); }
                }
            }

            SAVEbtn.Text = "SAVE";
        }
Esempio n. 19
0
        public void DenyRequest()
        {
            int          notifID = int.Parse(Request.Params["notifID"]);
            notification not     = db.notifications.Where(n => n.id == notifID).ToList().First();

            db.notifications.Remove(not);
            db.SaveChanges();
        }
Esempio n. 20
0
 /// <summary>
 /// Update notification info
 /// </summary>
 /// <returns></returns>
 public void UpdateNotificationInfo(notification obj)
 {
     using (var db = new TittleEntities())
     {
         db.notifications.Add(obj);
         db.SaveChanges();
     }
 }
Esempio n. 21
0
        public ActionResult DeleteConfirmed(int id)
        {
            notification notification = db.notifications.Find(id);

            db.notifications.Remove(notification);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 22
0
        public void notification_createNewNotification(String pMensaje, int pHora)
        {
            notification noti = new notification(pMensaje, pHora);

            Assert.That(noti.mensaje, Is.Not.EqualTo(null));
            Assert.Less(noti.hora, 24);
            Assert.GreaterOrEqual(noti.hora, 0);
            Assert.IsNotNull(noti);
        }
Esempio n. 23
0
        public IHttpActionResult post([FromBody] notification adata)
        {
            notification p = adata;

            context.notifications.Add(p);
            context.SaveChanges();

            return(Ok(new { results = adata }));
        }
Esempio n. 24
0
        private void showNotification(notification notification)
        {
            notifyIcon1.Visible        = true;
            notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;

            //notifyIcon1.ShowBalloonTip();

            notifyIcon1.ShowBalloonTip(10000, notification.subject, notification.message, ToolTipIcon.Info);
        }
Esempio n. 25
0
 // DELETE Notification by id
 public string DELETE(int id)
 {
     using (ThyroidDataEntities entities = new ThyroidDataEntities())
     {
         notification notifications = entities.notification.Find(id);
         entities.notification.Remove(notifications);
         entities.SaveChanges();
         return("Deleted Successfully");
     }
 }
Esempio n. 26
0
 public ActionResult Edit([Bind(Include = "ID,loginuser,friendemail,description,amount")] notification notification)
 {
     if (ModelState.IsValid)
     {
         db.Entry(notification).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(notification));
 }
Esempio n. 27
0
        // POST Notification
        public void POST(notification notifications)
        {
            using (ThyroidDataEntities entities = new ThyroidDataEntities())
            {
                entities.notification.Add(notifications);


                entities.SaveChanges();
            }
        }
Esempio n. 28
0
 public ActionResult Edit([Bind(Include = "Id,author,title,description")] notification notification)
 {
     if (ModelState.IsValid)
     {
         db.Entry(notification).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.author = new SelectList(db.teachers, "Id", "name", notification.author);
     return(View(notification));
 }
        public IHttpActionResult Getnotification(int id)
        {
            notification notification = db.notifications.Find(id);

            if (notification == null)
            {
                return(NotFound());
            }

            return(Ok(notification));
        }
        public async Task <IHttpActionResult> Getnotification(string id)
        {
            notification notification = await db.notifications.FindAsync(id);

            if (notification == null)
            {
                return(NotFound());
            }

            return(Ok(notification));
        }
        //creates a new notification when mechanic is added to job
        public HttpStatusCodeResult newNotification(job j)
        {
            notification newNotification = new notification();
            newNotification.MechanicID = (int)j.MechanicID;
            newNotification.Read = false;

            newNotification.Message = "'" + UppercaseFirst(j.jobslist.Name) + "' on Car: "
                + UppercaseFirst(j.booking.car.model.make.MakeName) + " "
                + UppercaseFirst(j.booking.car.model.ModelName) + " with Reg "
                + j.booking.car.Registration;
            newNotification.Date = DateTime.Now;
            newNotification.MechanicID = (int)j.MechanicID;
            newNotification.JobID = j.JobID;
            db.notifications.Add(newNotification);
            db.SaveChanges();
            return new HttpStatusCodeResult(200);
        }