Exemplo n.º 1
0
    public void LoadData()
    {
        TaskInfoBll BLL = new TaskInfoBll();

        //role = BLL.GetById(1);
        task = BLL.GetById(Convert.ToInt32(Request["id"]));
    }
Exemplo n.º 2
0
        public bool ModifyTaskState(int taskID, int teamID, int state, string currentUserMail)
        {
            var currentUserRepoModel = this._userRepository.GetUser(currentUserMail);

            if (currentUserRepoModel == null)
            {
                Enforce.Throw(new LogicErrorException("当前用户已被删除"));
            }

            T_TASK task = _taskBll.GetEntity(new DapperExQuery <T_TASK>()
                                             .AndWhere(s => s.ID, OperationMethod.Equal, taskID));

            if (task == null)
            {
                Enforce.Throw(new LogicErrorException("当前任务不存在"));
            }
            //TeamRepoModel teamRepoModel = _teamRepository.GetTeamDetail(teamID);
            //if (!teamRepoModel.members.Any(A => A.memberMail == currentUserMail))
            //{
            //    Enforce.Throw(new LogicErrorException("该用户不属于当前团队"));
            //}
            TaskInfoModel taskInfoModel = Mapper.Map <T_TASK, TaskInfoModel>(task);

            taskInfoModel.state = state;
            return(_taskBll.ModifyTask(AutoMapper.Mapper.Map <TaskInfoModel, T_TASK>(taskInfoModel), currentUserRepoModel.info.userName, currentUserMail, DateTime.Now));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加
        /// </summary>
        /// <param name="fun"></param>
        /// <returns></returns>
        public int Add(TaskInfoModel fun)
        {
            //string sql = "insert into CMT_Command values (@commandLevelID,@userID,@themeID,@commandSerialNumber,@commandNumber,@serverName,@commandContent,@valiDate,@disableDate,@urgent,@commandState,@isReview,@sendState,@organID,@commandEventID,@possyURL,@isMessage,@feedbackCount,@createTime,@updateTime,@isDel)";
            //用户ID,指令编号,指令内容,逻辑删除
            //string sql = "insert into CMT_Command(UserID,CommandNumber,CommandContent,IsDel) values(@userID,@commandNumber,@commandContent,@isDel)";
            string sql = "insert into CMT_Command(CommandNumber,CommandContent,CreateTime,ValidDate,DisableDate,Urgent,IsDel) values(@commandNumber,@commandContent,@createTime,@validDate,@disableDate,@urgent,@isDel)";

            SqlParameter[] pms =
            {
                //new SqlParameter("@commandLevelID",fun.CommandLevelID),
                //new SqlParameter("@userID",fun.UserID),
                //new SqlParameter("@themeID",fun.ThemeID),
                //new SqlParameter("@commandSerialNumber",fun.CommandSerialNumber),
                new SqlParameter("@commandNumber",  fun.CommandNumber),
                //new SqlParameter("@serverName",fun.ServerName),
                new SqlParameter("@commandContent", fun.CommandContent),
                new SqlParameter("@validDate",      fun.ValidDate),
                new SqlParameter("@disableDate",    fun.DisableDate),
                new SqlParameter("@urgent",         fun.Urgent),
                //new SqlParameter("@commandState",fun.CommandState),
                //new SqlParameter("@isReview",fun.IsReview),
                //new SqlParameter("@sendState",fun.SendState),
                //new SqlParameter("@organID",fun.OrganID),
                //new SqlParameter("@commandEventID",fun.CommandEventID),
                //new SqlParameter("@isMessage",fun.IsMessage),
                //new SqlParameter("@possyURL",fun.PossyURL),
                //new SqlParameter("@feedbackCount",fun.FeedbackCount),
                new SqlParameter("@createTime",     fun.CreateTime),
                new SqlParameter("@updateTime",     fun.UpdateTime),
                new SqlParameter("@isDel",          fun.IsDel)
            };
            return((int)DBHelper.ExecuteNonQuery(sql, type, pms));
        }
Exemplo n.º 4
0
 public void RunEdit(TaskInfoModel model)
 {
     task = model;
     data = model.Data.Clone();
     Initialize();
     Text += " - 编辑";
     Show();
 }
Exemplo n.º 5
0
 /// <summary>
 /// 模型数据改变
 /// </summary>
 /// <param name="obj"></param>
 private void dataChanged(TaskInfoModel taskInfoModel)
 {
     getPageData(pageRepuestParams.PageIndex, pageRepuestParams.PageSize);
     if (!Equals(taskInfoModel, null))
     {
         var tmpModel = TaskInfoList.FirstOrDefault(a => a.Id == taskInfoModel.Id);
         this.TaskInfoModel = TaskInfoList.FirstOrDefault();
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 从任务队列中删除
 /// </summary>
 /// <param name="data"></param>
 /// <returns>true=删除成功,false=删除失败</returns>
 public static bool Delete(TaskInfoModel data)
 {
     if (TaskList.Remove(data))
     {
         return(true);
     }
     else
     {
         return(Delete(data.Id));
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// 添加新任务到队列
        /// </summary>
        /// <param name="data">模板数据</param>
        /// <param name="pluginData">插件自定义数据</param>
        /// <returns>返回创建的任务</returns>
        public static TaskInfoModel Add(TemplateModel data, object pluginData = null)
        {
            TaskInfoModel model = new TaskInfoModel()
            {
                Data       = data.Clone(),
                PluginData = pluginData,
            };

            TaskList.Add(model);
            return(model);
        }
Exemplo n.º 8
0
        public bool ModifyTask(int taskId, int projectID, int teamID, string title, string content, string assignedEmail, string typeName, int time, int state, string currentUserMail)
        {
            assignedEmail = string.IsNullOrEmpty(assignedEmail) ? assignedEmail : assignedEmail.ToLower();
            var currentUserRepoModel = this._userRepository.GetUser(currentUserMail);

            if (currentUserRepoModel == null)
            {
                Enforce.Throw(new LogicErrorException("当前用户已被删除"));
            }
            string assignedUserName = null;

            if (assignedEmail != null)
            {
                var assignedUserRepoModel = this._userRepository.GetUser(assignedEmail);
                if (assignedUserRepoModel == null)
                {
                    Enforce.Throw(new LogicErrorException("指派的用户已被删除"));
                }
                assignedUserName = assignedUserRepoModel.info.userName;
            }

            T_TASK task = _taskBll.GetEntity(new DapperExQuery <T_TASK>()
                                             .AndWhere(s => s.ID, OperationMethod.Equal, taskId));

            if (task == null)
            {
                Enforce.Throw(new LogicErrorException("当前任务不存在"));
            }
            //TeamRepoModel teamRepoModel = _teamRepository.GetTeamDetail(teamID);
            //if (!teamRepoModel.members.Any(A => A.memberMail == currentUserMail))
            //{
            //    Enforce.Throw(new LogicErrorException("该用户不属于当前团队"));
            //}
            if (projectID > 0)
            {
                ProjectRepoModel projectRepoModel = _projectRepository.GetProjectDetail(projectID);
                if (!projectRepoModel.members.Any(A => A.memberMail == assignedEmail))
                {
                    Enforce.Throw(new LogicErrorException("该用户不属于当前项目"));
                }
            }
            TaskInfoModel taskInfoModel = Mapper.Map <T_TASK, TaskInfoModel>(task);

            taskInfoModel.title         = title != null ? title : taskInfoModel.title;
            taskInfoModel.content       = content != null ? content : taskInfoModel.content;
            taskInfoModel.assignedName  = assignedEmail != null ? assignedUserName : taskInfoModel.assignedName;
            taskInfoModel.assignedEmail = assignedEmail != null ? assignedEmail : taskInfoModel.assignedEmail;
            taskInfoModel.typeName      = typeName != null ? typeName : taskInfoModel.typeName;
            taskInfoModel.time          = time != 0 ? time : taskInfoModel.time;
            taskInfoModel.state         = state;
            return(_taskBll.ModifyTask(AutoMapper.Mapper.Map <TaskInfoModel, T_TASK>(taskInfoModel), currentUserRepoModel.info.userName, currentUserMail, DateTime.Now));
        }
Exemplo n.º 9
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="fun"></param>
        /// <returns></returns>
        public int Update(TaskInfoModel fun)
        {
            string sql = "update CMT_Command set UserID=@userID,CommandNumber=@commandNumber,CommandContent=@commandContent,CreateTime=@createTime,IsDel=@isDel where ID=@id";

            SqlParameter[] pms =
            {
                new SqlParameter("@userID",         fun.UserID),
                new SqlParameter("@commandNumber",  fun.CommandNumber),
                new SqlParameter("@commandContent", fun.CommandContent),
                new SqlParameter("@createTime",     fun.CreateTime),
                new SqlParameter("@isDel",          fun.IsDel),
            };
            return((int)DBHelper.ExecuteNonQuery(sql, type, pms));
        }
Exemplo n.º 10
0
        /// <summary>
        /// 窗体加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void TaskInfoForm_Load(object sender, EventArgs e)
        {
            isTaskBindEvent     = false;
            isDrawTaskBindEvent = false;

            TaskInfoData         = GetTaskInfoData();
            DesignTaskResultData = GetDesignTaskResultData();
            DrawTaskInfoData     = GetDrawTaskInfoData();

            //绑定-是否完成-下拉框选项
            List <object> AchieveTypeData = new List <object>()
            {
                new { Value = 0, Text = "全部" },
                new { Value = 1, Text = "未完成" },
                new { Value = 2, Text = "已完成" }
            };

            cmbAchieveType.DataSource    = AchieveTypeData;
            cmbAchieveType.DisplayMember = "Text";
            cmbAchieveType.ValueMember   = "Value";

            //下拉框、单选按钮 设置默认值
            cmbAchieveType.SelectedIndex = 1;
            rdbDesignDeptA.Checked       = true;
            rdbTaskTypeA.Checked         = true;

            //绑定-是否完成-下拉框选项 选择修改事件
            cmbAchieveType.SelectedIndexChanged += new EventHandler(this.CmbAchieveType_SelectedIndexChanged);

            //绑定-任务类型-单选按钮 选择修改事件
            for (int i = 0; i < pnlTaskType.Controls.Count; i++)
            {
                if (pnlTaskType.Controls[i] is RadioButton)
                {
                    ((RadioButton)pnlTaskType.Controls[i]).CheckedChanged += new EventHandler(this.Rdb_CheckedChanged);
                }
            }

            //绑定-设计部门-单选按钮 选择修改事件
            for (int i = 0; i < pnlDesignDept.Controls.Count; i++)
            {
                if (pnlDesignDept.Controls[i] is RadioButton)
                {
                    ((RadioButton)pnlDesignDept.Controls[i]).CheckedChanged += new EventHandler(this.Rdb_CheckedChanged);
                }
            }

            //默认加载数据
            LoadTaskData(string.Empty, string.Empty);
        }
Exemplo n.º 11
0
        public int CreateTask(int backLogID, int teamID, string title, string content, string assignedEmail, string typeName, int time, int state, string currentUserMail)
        {
            assignedEmail = string.IsNullOrEmpty(assignedEmail) ? assignedEmail : assignedEmail.ToLower();
            var currentUserRepoModel = this._userRepository.GetUser(currentUserMail);

            if (currentUserRepoModel == null)
            {
                Enforce.Throw(new LogicErrorException("当前用户已被删除"));
            }

            var assignedUserRepoModel = this._userRepository.GetUser(assignedEmail);

            if (assignedUserRepoModel == null)
            {
                Enforce.Throw(new LogicErrorException("指派的用户已被删除"));
            }

            var backLogInfo = this._backlogRepository.GetBacklogInfoModel(teamID, backLogID);
            //TeamRepoModel teamRepoModel = _teamRepository.GetTeamDetail(teamID);
            //if (!teamRepoModel.members.Any(A => A.memberMail == currentUserMail))
            //{
            //    Enforce.Throw(new LogicErrorException("该用户不属于当前团队"));
            //}

            ProjectRepoModel projectRepoModel = _projectRepository.GetProjectDetail(backLogInfo.projectID);

            if (!projectRepoModel.members.Any(A => A.memberMail.ToLower() == assignedEmail))
            {
                Enforce.Throw(new LogicErrorException("该用户不属于当前项目"));
            }

            TaskInfoModel taskInfoModel = new TaskInfoModel();

            taskInfoModel.backLogID       = backLogID;
            taskInfoModel.projectID       = backLogInfo.projectID;
            taskInfoModel.projectName     = backLogInfo.projectName;
            taskInfoModel.title           = title;
            taskInfoModel.content         = content;
            taskInfoModel.assignedName    = assignedUserRepoModel.info.userName;
            taskInfoModel.assignedEmail   = assignedEmail;
            taskInfoModel.typeName        = typeName;
            taskInfoModel.time            = time;
            taskInfoModel.state           = state;
            taskInfoModel.currentUserMail = currentUserMail;
            taskInfoModel.createTime      = DateTime.Now;
            return(this._taskBll.CreateTask(AutoMapper.Mapper.Map <TaskInfoModel, T_TASK>(taskInfoModel), currentUserRepoModel.info.userName));
        }
Exemplo n.º 12
0
        public TaskRepoModel getTaskInfo(int taskID)
        {
            TaskRepoModel taskRepoModel = new TaskRepoModel();
            T_TASK        task          = _taskBll.GetEntity(new DapperExQuery <T_TASK>()
                                                             .AndWhere(s => s.ID, OperationMethod.Equal, taskID));

            if (task == null)
            {
                Enforce.Throw(new LogicErrorException("当前任务不存在"));
            }

            TaskInfoModel taskInfoModel = Mapper.Map <T_TASK, TaskInfoModel>(task);

            taskRepoModel.info = taskInfoModel;
            taskRepoModel.logs = this.getTaskLog(taskID);
            return(taskRepoModel);
        }
Exemplo n.º 13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request["commandNumber"] == null)
     {
         LoadData();
     }
     else
     {
         task = new TaskInfoModel();
         TaskInfoBll BLL            = new TaskInfoBll();
         int         commandContent = Convert.ToInt32(Request["commandNumber"]);
         task.CommandNumber  = commandContent;
         task.CommandContent = Request["commandContent"];
         //task.UpdateTime = DateTime.Now;
         int rows = BLL.Update(task);
         task = BLL.GetById(Convert.ToInt32(Request["commandNumber"]));
         Response.Write(rows);
     }
 }
Exemplo n.º 14
0
        public async Task Add([FromBody] TaskInfoModel taskInfoModel)
        {
            var taskInfo = new TaskInfo
            {
                Name           = taskInfoModel.Name,
                Description    = taskInfoModel.Description,
                Priority       = taskInfoModel.Priority,
                Added          = DateTime.Now,
                FeatureId      = taskInfoModel.FeatureId,
                TimeToComplete = DateTime.Now
                                 .AddDays(taskInfoModel.TimeToComplete.Days + taskInfoModel.TimeToComplete.Weeks * 7)
                                 .AddHours(taskInfoModel.TimeToComplete.Hours)
            };

            using (_context.Scope())
            {
                await _taskDataProvider.AddAsync(HttpContext.User.GetUserId(), taskInfo);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// 根据单个ID进行获取
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public TaskInfoModel GetById(int id)
        {
            TaskInfoModel taskInfo = null;
            string        sql      = string.Format("select ID,UserID,CommandNumber,CommandContent,(date,CreateTime,23),IsDel from CMT_Command where ID={0}", id);

            using (SqlDataReader reader = DBHelper.ExecuteReader(sql, type))
            {
                if (reader.HasRows)
                {
                    if (reader.Read())
                    {
                        taskInfo                = new TaskInfoModel();
                        taskInfo.Id             = reader.GetInt32(0);
                        taskInfo.CommandContent = reader.GetString(1);
                        taskInfo.CommandNumber  = reader.GetInt32(2);
                    }
                }
            }
            return(taskInfo);
        }
Exemplo n.º 16
0
        public IActionResult SaveMeetingData([FromQuery] string meetingId, [FromQuery] string status, [FromBody] TaskInfoModel taskInfo)
        {
            var currentMeetingList = new List <TaskInfoModel>();

            if (status == "todo")
            {
                var isPresent = _taskService.ToDoDictionary.TryGetValue(meetingId, out currentMeetingList);
                if (isPresent)
                {
                    currentMeetingList.Add(taskInfo);
                }
                else
                {
                    var newMeetingList = new List <TaskInfoModel> {
                        taskInfo
                    };
                    _taskService.ToDoDictionary.AddOrUpdate(meetingId, newMeetingList, (key, newValue) => newMeetingList);
                }
            }

            if (status == "doing")
            {
                var isPresent = _taskService.DoingDictionary.TryGetValue(meetingId, out currentMeetingList);
                if (isPresent)
                {
                    currentMeetingList.Add(taskInfo);
                    _taskService.DoingDictionary.AddOrUpdate(meetingId, currentMeetingList, (key, newValue) => currentMeetingList);
                }
                else
                {
                    var newMeetingList = new List <TaskInfoModel> {
                        taskInfo
                    };
                    _taskService.DoingDictionary.AddOrUpdate(meetingId, newMeetingList, (key, newValue) => newMeetingList);
                }
            }

            if (status == "done")
            {
                var isPresent = _taskService.DoneDictionary.TryGetValue(meetingId, out currentMeetingList);
                if (isPresent)
                {
                    currentMeetingList.Add(taskInfo);
                    _taskService.DoneDictionary.AddOrUpdate(meetingId, currentMeetingList, (key, newValue) => currentMeetingList);
                }
                else
                {
                    var newMeetingList = new List <TaskInfoModel> {
                        taskInfo
                    };
                    _taskService.DoingDictionary.AddOrUpdate(meetingId, newMeetingList, (key, newValue) => newMeetingList);
                }
            }

            return(this.Ok(currentMeetingList));
        }
Exemplo n.º 17
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="role"></param>
 /// <returns></returns>
 public int Update(TaskInfoModel task)
 {
     return(dal.Update(task));
 }
Exemplo n.º 18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request["commandNumber"] != null)
     {
         #region 从前台得到数据
         //int commandLevelID = Convert.ToInt32(Request["commandLevelID"]);
         //string userName =Request["userID"];
         //int themeID = Convert.ToInt32(Request["themeID"]);
         //string commandSerialNumber = Request["commandSerialNumber"];//任务流水号
         //int commandNumber = Convert.ToInt32(Request["commandNumber"]);
         //string serverName=Request["serverName"];
         string commandContent = Request["commandContent"];
         //DateTime validDate = Convert.ToDateTime(Request["validDate"]);
         //DateTime disableDate = Convert.ToDateTime(Request["disableDate"]);
         double urgent      = Convert.ToDouble(Request["urgent"]);
         string vaildDate   = Request["vaildDate"];
         string disableDate = Request["disableDate"];
         //int isReview = Convert.ToInt32(Request["isReview"]);
         //int organID = Convert.ToInt32(Request["organID"]);
         //int commandEventID = Convert.ToInt32(Request["commandEventID"]);
         //string possyURL = Request["possyURL"];
         //int isMessage = Convert.ToInt32(Request["isMessage"]);
         //int feedbackCount = Convert.ToInt32(Request["feedbackCount"]);
         #endregion
         //插入数据库
         #region TaskInfoMode对象
         TaskInfoModel task = new TaskInfoModel();
         TaskInfoBll   tib  = new TaskInfoBll();
         //task.CommandLevelID = commandLevelID;
         //task.UserID = userID;
         //task.ThemeID = themeID;
         //task.CommandSerialNumber = ("{0}{1}{2}",);
         task.CommandNumber = tib.GetTaskNumber();
         //task.ServerName = serverName;
         task.CommandContent = commandContent;
         //task.ValiDate = DateTime.Now;
         //task.DisableDate = DateTime.Now;
         //task.Urgent = urgent;
         //task.CommandState = 0;
         //task.IsReview = isReview;
         //task.SendState = 0;
         //task.OrganID = organID;
         //task.CommandEventID = commandEventID;
         //task.PossyURL = possyURL;
         //task.IsMessage = isMessage;
         //task.FeedbackCount = feedbackCount;
         task.ValidDate   = vaildDate;
         task.DisableDate = disableDate;
         task.CreateTime  = Convert.ToString(DateTime.Now);
         task.UpdateTime  = Convert.ToString(DateTime.Now);
         task.IsDel       = 0;
         #endregion
         TaskInfoBll BLL  = new TaskInfoBll();
         int         rows = -1;
         rows = BLL.Add(task);
         //返回执行结果
         Response.Clear();
         Response.ContentType     = "text/plain";
         Response.ContentEncoding = System.Text.Encoding.UTF8;
         Response.Write(rows);
         Response.End();
     }
 }
Exemplo n.º 19
0
 /// <summary>
 ///增加任务
 /// </summary>
 /// <param name="task"></param>
 /// <returns></returns>
 public int Add(TaskInfoModel task)
 {
     //调用DAL层的add方法并返回
     return(dal.Add(task));
 }
Exemplo n.º 20
0
 private void tsbAddTask_Click(object sender, EventArgs e)
 {
     task = TaskController.Add(data);
     tsbSaveTask.Visible = true;
     tsbDelete.Visible   = true;
 }
Exemplo n.º 21
0
        /// <summary>
        /// 打开数据录入模式窗口,编辑
        /// </summary>
        private void OpenInputMode(TaskInfoModel data)
        {
            IMode mode = PluginLoader.CreateMode((ModeInfoModel)cbInputMode.SelectedItem);

            mode.RunEdit(data);
        }