Esempio n. 1
0
        public void ReassignTask(ReasignParameterObject param)
        {
            Session  session = this.Session;
            TaskNote tnote   = new TaskNote(session);

            tnote.CreateDate = DateTime.Now;
            tnote.Note       = string.Format("<strong>Task is reassigned to: {0}<br/><strong>Reason:</strong><br/>{1}", param.ReassignTo, param.ReassignReason);
            tnote.IsPrivate  = false;
            if (param.Attachment != null)
            {
                FileData     tData = new FileData(session);
                MemoryStream ms    = new MemoryStream();
                param.Attachment.SaveToStream(ms);
                ms.Position = 0;
                tData.LoadFromStream(param.Attachment.FileName, ms);
                tnote.Attachment = tData;
            }
            AssignedTo         = Session.GetObjectByKey <Employee>(param.ReassignTo.Oid);
            DueDate            = param.ChangeDueDate;
            tnote.IsSystemNote = true;
            TaskNotes.Add(tnote);
            tnote.Save();
            MailReassignNewTask();
            Session.CommitTransaction();
            Session.Save(this);
        }
Esempio n. 2
0
        public void SendReminder(SendReminderParameterObject param)
        {
            Employee     sender   = Session.GetObjectByKey <Employee>(SecuritySystem.CurrentUserId);
            ViewShortcut shortcut = new ViewShortcut("Task_DetailView", Oid.ToString());
            string       url      = "http://rnd.ntmarein.local/Default.aspx" + "?Shortcut" + shortcut.ToString();
            string       mSubject = string.Format("Reminder: {0}", this.Subject);
            string       mSendTo  = AssignedTo.CorporateEmail;
            string       mBody    = string.Format("Dear {0},<br/>", AssignedTo.FullName);

            mBody += string.Format("<p>This is a reminder from {0} for your task <strong><a href='{1}'>{2}</a></strong>.</p>", sender.FullName, url, Subject);
            mBody += string.Format("<p>The task will due on {0}. Please review detailed task information from Marbid system and complete the task immediately.</p>", DueDate);
            mBody += string.Format("<p>Bellow is an additional comment from {0}:</p>", sender.FullName);
            mBody += string.Format("<quote>{0}</quote>", param.AdditionalMessage);
            mBody += string.Format("<p>To review the task please click following URL:<br/><a href='{0}'>{0}</a>", url);
            Mailer sMailer = new Mailer("*****@*****.**", AssignedTo.CorporateEmail, mSubject, mBody);

            if (param.SendCopyToMySelf)
            {
                sMailer.CC = sender.CorporateEmail;
            }
            sMailer.SendMail();

            Session  session = this.Session;
            TaskNote tnote   = new TaskNote(session);

            tnote.CreateDate   = DateTime.Now;
            tnote.Note         = string.Format("<strong>Reminder is sent:</strong><br/>{0}", param.AdditionalMessage);
            tnote.IsSystemNote = true;
            TaskNotes.Add(tnote);
            tnote.Save();
            Session.CommitTransaction();
            Session.Save(this);
        }
Esempio n. 3
0
        public void AdvanceTask(AndvanceTaskParameterObject parameters)
        {
            Session  session = this.Session;
            TaskNote tnote   = new TaskNote(session);

            tnote.CreateDate   = DateTime.Now;
            tnote.Note         = string.Format("<strong>Task is advanced, current completion :{0}%</strong><br/>", parameters.PercentCompleted);
            tnote.Note        += parameters.Comment;
            tnote.IsSystemNote = true;
            tnote.IsPrivate    = false;
            if (parameters.Attachment != null)
            {
                FileData     tData = new FileData(session);
                MemoryStream ms    = new MemoryStream();
                parameters.Attachment.SaveToStream(ms);
                ms.Position = 0;
                tData.LoadFromStream(parameters.Attachment.FileName, ms);
                tnote.Attachment = tData;
            }
            PercentCompleted = (int)parameters.PercentCompleted;
            TaskNotes.Add(tnote);
            tnote.Save();
            Session.CommitTransaction();
            Session.Save(this);
        }
Esempio n. 4
0
        public void StartTask(StartTaskParameterObject parameters)
        {
            Session  session = this.Session;
            TaskNote tnote   = new TaskNote(session);

            tnote.CreateDate   = DateTime.Now;
            tnote.Owner        = Session.GetObjectByKey <Employee>(Session.GetKeyValue(SecuritySystem.CurrentUser));
            tnote.Note         = "<strong>Task is started.</strong><br/>";
            tnote.Note        += parameters.Comment;
            tnote.IsSystemNote = true;
            StartDate          = DateTime.Now;
            Status             = TaskStatus.InProgress;
            if (parameters.Attachment != null)
            {
                FileData     tData = new FileData(session);
                MemoryStream ms    = new MemoryStream();
                parameters.Attachment.SaveToStream(ms);
                ms.Position = 0;
                tData.LoadFromStream(parameters.Attachment.FileName, ms);
                tnote.Attachment = tData;
            }
            tnote.IsPrivate = false;
            TaskNotes.Add(tnote);
            tnote.Save();
            Session.CommitTransaction();
            Session.Save(this);
        }
Esempio n. 5
0
        public void Postpone(PostponeParametersObject parameters)
        {
            Session  session = this.Session;
            TaskNote tnote   = new TaskNote(session);

            tnote.CreateDate   = DateTime.Now;
            tnote.Owner        = Session.GetObjectByKey <Employee>(Session.GetKeyValue(SecuritySystem.CurrentUser));
            tnote.Note         = "<strong>Task is postponed.</strong><br />";
            tnote.Note        += parameters.Comment;
            tnote.IsPrivate    = false;
            tnote.IsSystemNote = true;
            if (parameters.Attachment != null)
            {
                FileData     tData = new FileData(session);
                MemoryStream ms    = new MemoryStream();
                parameters.Attachment.SaveToStream(ms);
                ms.Position = 0;
                tData.LoadFromStream(parameters.Attachment.FileName, ms);
                tnote.Attachment = tData;
            }
            TaskNotes.Add(tnote);
            DueDate += TimeSpan.FromDays(parameters.PostponeForDays);
            tnote.Save();
            Session.CommitTransaction();
        }
Esempio n. 6
0
        public void MarkComplete(CompleteParametersObject parameters)
        {
            Session  session = this.Session;
            TaskNote tnote   = new TaskNote(session);

            tnote.CreateDate   = DateTime.Now;
            tnote.Owner        = Session.GetObjectByKey <Employee>(SecuritySystem.CurrentUserId);
            tnote.Note         = "<strong>Task is completed</strong><br />";
            tnote.Note        += parameters.Comment;
            tnote.IsSystemNote = true;
            if (parameters.Attachment != null)
            {
                FileData     tData = new FileData(session);
                MemoryStream ms    = new MemoryStream();
                parameters.Attachment.SaveToStream(ms);
                ms.Position = 0;
                tData.LoadFromStream(parameters.Attachment.FileName, ms);
                tnote.Attachment = tData;
            }
            Status           = TaskStatus.Completed;
            PercentCompleted = 100;
            DateCompleted    = DateTime.Now;
            tnote.IsPrivate  = false;
            TaskNotes.Add(tnote);
            tnote.Save();
            Session.CommitTransaction();
            Session.Save(this);
        }
Esempio n. 7
0
        public void AddNewNote(AddNewNoteParameterObject parameters)
        {
            Session  session = this.Session;
            TaskNote tnote   = new TaskNote(session);

            tnote.Owner        = Session.GetObjectByKey <Employee>(Session.GetKeyValue(SecuritySystem.CurrentUser));
            tnote.CreateDate   = DateTime.Now;
            tnote.IsSystemNote = false;
            tnote.Note         = parameters.Content;
            tnote.IsPrivate    = parameters.IsPrivate;
            if (parameters.Attachment != null)
            {
                FileData     tData = new FileData(session);
                MemoryStream ms    = new MemoryStream();
                parameters.Attachment.SaveToStream(ms);
                ms.Position = 0;
                tData.LoadFromStream(parameters.Attachment.FileName, ms);
                tnote.Attachment = tData;
            }
            TaskNotes.Add(tnote);
            tnote.Save();
            Session.CommitTransaction();
        }