/// <summary> /// 查询任务详细信息 /// </summary> /// <returns></returns> public M_TaskInfo SelTaskInfox(int tid) { M_TaskInfo ti = new M_TaskInfo(); try { SqlParameter[] sql = new SqlParameter[] { new SqlParameter("@TID", tid) }; SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "[dbo].[M_SelTaskInfo]", sql); while (reader.Read()) { ti.TID = int.Parse(reader["TID"].ToString()); ti.TaskName = reader["TaskName"].ToString(); U_Department d = new U_Department(); d.DID = int.Parse(reader["DID"].ToString()); d.DName = reader["DName"].ToString(); ti.DID = d; ti.ReleaseTime = (DateTime)reader["ReleaseTime"]; ti.Remark = reader["Remark"].ToString(); ti.State = reader["State"].ToString(); ti.Content = reader["Content"].ToString(); } } catch (Exception ex) { Common.JsMessage.jsAlert(ex.Message); } return(ti); }
/// <summary> /// 确认修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnUpd_Click(object sender, EventArgs e) { try { int I = int.Parse(Request.QueryString["TID"]); M_TaskInfo ta = new M_TaskInfo(); ta.TID = I; ta.TaskName = this.TbName.Text.Trim(); ta.ReleaseTime = DateTime.Now.ToLocalTime(); int dd = int.Parse(this.DdlDids.SelectedValue.ToString()); U_Department d = new U_Department(); d.DID = dd; ta.DID = d; ta.Content = this.TbContent.Text.Trim(); ta.Remark = this.TbRemark.Text.Trim(); if (string.IsNullOrEmpty(this.TbName.Text) || string.IsNullOrEmpty(this.TbContent.Text)) { JsMessage.jsAlert("修改信息不能为空"); return; } if (new ManageBll().M_UpdTaskInfos(ta) > 0) { JsMessage.jsAlert("修改成功"); bind(); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } }
/// <summary> /// 通过DID查询任务信息 /// </summary> /// <param name="did"></param> /// <returns></returns> public List <M_TaskInfo> M_SelTaskByDID(int did) { List <M_TaskInfo> ta = new List <M_TaskInfo>(); try { string sql = "select * from M_TaskInfo as a left join [dbo].[U_Department] as b on a.DID=b.DID where a.DID='" + did + "' order by ReleaseTime desc"; SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, sql, null); while (reader.Read()) { M_TaskInfo ti = new M_TaskInfo(); ti.TID = string.IsNullOrEmpty(reader["TID"].ToString()) ? 0 : (int)reader["TID"]; ti.TaskName = reader["TaskName"].ToString(); U_Department de = new U_Department(); de.DID = int.Parse(reader["DID"].ToString()); de.DName = reader["DName"].ToString(); ti.DID = de; ti.ReleaseTime = (DateTime)reader["ReleaseTime"]; ti.Remark = reader["Remark"].ToString(); ti.State = reader["State"].ToString(); ti.Content = reader["Content"].ToString(); ta.Add(ti); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } return(ta); }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSubmission_Click(object sender, EventArgs e) { M_TaskInfo ti = new M_TaskInfo(); ti.TaskName = this.TbTaskName.Text.Trim(); int dd = int.Parse(this.DdlDID.SelectedValue.ToString()); U_Department dt = new U_Department(); dt.DID = dd; dt.DName = this.DdlDID.Text.ToString(); ti.DID = dt; ti.ReleaseTime = DateTime.Now.ToLocalTime(); ti.Content = this.TbContent.Text.ToString(); ti.Remark = this.TbRemark.Text.Trim(); if (string.IsNullOrEmpty(this.TbTaskName.Text) || string.IsNullOrEmpty(this.TbContent.Text)) { JsMessage.jsAlert("任务信息不能为空!"); return; } if (new ManageBll().AddTaskInfo(ti) > 0) { JsMessage.jsAlert("添加成功"); use = (U_User)Session["U_USER"]; Model.M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = use.UserName + "发布任务!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = use.LoginName; new UserBll().AddJournalInfo(ji); //内容清零 this.TbTaskName.Text = ""; this.TbContent.Text = ""; this.TbRemark.Text = ""; bind(); } }
/// <summary> /// 发布任务信息 /// </summary> /// <param name="ti"></param> /// <returns></returns> public int AddTaskInfo(M_TaskInfo ti) { try { SqlParameter[] mysql = new SqlParameter[] { new SqlParameter("@TaskName", ti.TaskName), new SqlParameter("@ReleaseTime", ti.ReleaseTime), new SqlParameter("@DID", ti.DID.DID), new SqlParameter("@Content", ti.Content), new SqlParameter("@Remark", ti.Remark) }; return(SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, "M_TaskInfoAdd", mysql)); } catch (Exception) { throw; } }
/// <summary> /// 发布任务信息 /// </summary> /// <param name="ti"></param> /// <returns></returns> public int AddTaskInfo(M_TaskInfo ti) { return(md.AddTaskInfo(ti)); }
/// <summary> /// 修改任务信息 /// </summary> /// <param name="ta"></param> /// <returns></returns> public int M_UpdTaskInfos(M_TaskInfo ta) { return(md.M_UpdTaskInfos(ta)); }