/// <summary>增加接收者信息</summary> /// <param name="receiverId">接收者标识</param> /// <param name="isRead">是否已读</param> /// <param name="status">状态</param> /// <param name="finishTime">完成时间</param> public void AddReceiver(string receiverId, bool isRead, int status, DateTime finishTime) { TaskWorkReceiverInfo receiver = new TaskWorkReceiverInfo(); receiver.ReceiverId = receiverId; receiver.Status = status; receiver.IsRead = isRead; receiver.FinishTime = finishTime; this.ReceiverGroup.Add(receiver); }
// ------------------------------------------------------- // Xml 元素的导入和导出 // ------------------------------------------------------- #region 函数:Deserialize(XmlElement element) /// <summary>根据Xml元素加载对象</summary> /// <param name="element">Xml元素</param> public void Deserialize(XmlElement element) { StringBuilder outString = new StringBuilder(); this.ApplicationId = element.SelectSingleNode("applicationId").InnerText; this.TaskCode = element.SelectSingleNode("taskCode").InnerText; // 设置任务标识 this.Id = TasksContext.Instance.TaskWorkService.GetIdsByTaskCodes(this.ApplicationId, this.TaskCode); if (string.IsNullOrEmpty(this.Id)) { this.Id = StringHelper.ToGuid(); } this.Type = element.SelectSingleNode("type").InnerText; this.Title = element.SelectSingleNode("title").InnerText; this.Content = element.SelectSingleNode("content").InnerText; this.Tags = element.SelectSingleNode("tags").InnerText; // 设置发送人 IAccountInfo account = null; account = MembershipManagement.Instance.AccountService[element.SelectSingleNode("sender").InnerText]; this.SenderId = (account == null) ? element.SelectSingleNode("sender").InnerText + "(unkown)" : account.Id; // 设置接收人 outString.Append("<receiver>"); TaskWorkReceiverInfo item = null; string[] keys = element.SelectSingleNode("receiver").InnerText.Split(','); string[] temp; foreach (string key in keys) { if (!string.IsNullOrEmpty(key) && key.Contains("#")) { temp = key.Split('#'); item = new TaskWorkReceiverInfo(); item.TaskId = this.Id; item.Status = Convert.ToInt32(temp[0]); account = MembershipManagement.Instance.AccountService[temp[1]]; item.ReceiverId = (account == null) ? temp[1] : account.Id; // 1 代表任务完 , 插入任务完成时间. if (item.Status == 1) { item.FinishTime = Convert.ToDateTime(temp[2]); } this.ReceiverGroup.Add(item); } } this.CreateDate = Convert.ToDateTime(element.SelectSingleNode("createDate").InnerText); }