/// <summary> /// 删除一个项目立项申请 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button_delete_Click(object sender, EventArgs e) { try { string ID = Request["ID"]; project_model = project_bll.GetModel(int.Parse(ID)); project_model.DELFLAG = 1; project_bll.Update(project_model); //同时删除faceshowmessage中的projectid = ID,的数据,同时置DELFLAG=1; Dianda.BLL.Project_ProjectsExt projectsExt = new Dianda.BLL.Project_ProjectsExt(); string sqlwhere = " ProjectID = '" + ID + "'"; projectsExt.DeleteTableData(sqlwhere, "FaceShowMessage"); ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入我的项目页面');javascript:location='manage.aspx?projectstatus=" + Request["status"] + "';</script>", false); //tag.Text = "操作成功! 点击“返回”按钮进入我的项目页面!"; //addproject.Visible = false; //goback.Visible = true; } catch { } }
//项目负责人确定按钮 protected void Button4_Click(object sender, EventArgs e) { project_model = project_bll.GetModel(int.Parse(Session["Work_ProjectId"].ToString())); project_model.LeaderID = DropDownList_UserAdmin.SelectedValue.ToString(); project_bll.Update(project_model); //添加操作日志 Dianda.BLL.SYS_LogsExt bsyslog = new Dianda.BLL.SYS_LogsExt(); Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "添加项目创建人", "添加成功"); string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!\");location.href='manage.aspx';</script>"; Response.Write(coutws); }
//编辑部门 protected void Button2_Click(object sender, EventArgs e) { CheckboxShowUser.Visible = false; DDL_COLUMN.Visible = true; Tr_3.Visible = false; ShowUser.Visible = false; //显示可供参与的部门信息 。 project_model = project_bll.GetModel(int.Parse(Session["Work_ProjectId"].ToString())); DataTable dt_dep = new DataTable(); string sql1 = " SELECT ID, NAME FROM USER_Groups WHERE (DELFLAG = 0) AND (TAGS = '部门') ORDER BY ISMOREN "; dt_dep = pagedosql.doSql(sql1).Tables[0]; if (dt_dep.Rows.Count > 0) { CB_DepartmentID.DataSource = dt_dep.DefaultView; CB_DepartmentID.DataTextField = "NAME"; CB_DepartmentID.DataValueField = "ID"; CB_DepartmentID.DataBind(); //在项目表中的部门字段 string DepartmentID = project_model.DepartmentID.ToString(); //因为在项目表中部门以‘,’分开。故以‘,’将其分割 string[] Department = DepartmentID.Split(','); for (int i = 0; i < dt_dep.Rows.Count; i++) { for (int j = 0; j < Department.Length; j++) { if (Department[j].ToString() == CB_DepartmentID.Items[i].Value.ToString()) { CB_DepartmentID.Items[i].Selected = true; } } } } else//因为参与部门是非空项,所以如果没有可供参与的部门的话,是不可以进行项目的申请的。 { CB_DepartmentID.Enabled = false; Button_sumbit2.Enabled = false; } }
//编辑项目负责人 protected void Button3_Click(object sender, EventArgs e) { CheckboxShowUser.Visible = false; DDL_COLUMN.Visible = false; Tr_3.Visible = true; ShowUser.Visible = false; //显示项目负责人下拉列表 DataTable dt = new DataTable(); Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; string sql = " SELECT ID,DepartMentID, USERNAME, REALNAME FROM USER_Users WHERE (DELFLAG = 0) AND (IsManager = 1 or IsManager = 9) AND (WorkStats = 1) ORDER BY REALNAME,ID "; dt = pageControl.doSql(sql).Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string ID = dt.Rows[i]["ID"].ToString(); string REALNAME = dt.Rows[i]["REALNAME"].ToString(); string USERNAME = dt.Rows[i]["USERNAME"].ToString(); ListItem li = new ListItem(REALNAME + "(" + USERNAME + ")", ID); DropDownList_UserAdmin.Items.Add(li); if (user_model.ID.Equals(ID)) { li.Selected = true; } } } else//因为项目负责人是非空项,如果没有项目负责人的话是不可以进行项目的申请的。 { ListItem li = new ListItem("没有可选项目负责人", ""); DropDownList_UserAdmin.Items.Add(li); } project_model = project_bll.GetModel(int.Parse(Session["Work_ProjectId"].ToString())); Label_UserAdmin.Text = bUSER_Users.GetModel(project_model.LeaderID).REALNAME + "(" + bUSER_Users.GetModel(project_model.LeaderID).USERNAME + ")"; }
/// <summary> /// 确定按钮触发事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button_submit_Click(object sender, EventArgs e) { try { project_model = project_bll.GetModel(int.Parse(Session["Work_ProjectId"].ToString())); if (null != Request["role"] && Request["role"].ToString().Equals("manager")) { //说明是领导审批项目经费时重新上传的预算表单 } else { if (project_model.TEMP1.Equals("1") || project_model.TEMP1.Equals("3")) { tag.Text = "该项目上传的预算表单已经审核通过!不能再次上传!"; return; } if (FileUpload_list.FileName.Length <= 0) { tag.Text = "上传预算表单项不能为空!"; return; } } if (FileUpload_list.FileName.Length > 2) { string[] content = fileup.UpFile_COMMONS(FileUpload_list, "/AllFileUp/fileup", ""); //1-成功;0-失败;2-类型不支持;3-大小不符合;文件的路径;文件名称;文件类型;图标;大小;操作结果 if (content[0] == "0") { tag.Text = "文件上传失败,请重新上传!"; return; } else if (content[0] == "2") { tag.Text = "系统不允许此类文件上传,文件上传失败,请重新上传!"; return; } else if (content[0] == "3") { tag.Text = "文件上传大小不符合,文件上传失败,请重新上传!"; return; } if (null != Request["role"] && Request["role"].ToString().Equals("manager")) { project_model.BudgetList = project_model.BudgetList + "@" + content[1]; } else { project_model.BudgetList = content[1]; } } if (!CashTotal.Text.ToString().Equals("")) { if (null != Request["role"] && Request["role"].ToString().Equals("manager")) { if (RB_cashtotal.SelectedValue.ToString().Equals("1"))//表示经费单位选择的是万元 { //领导在审批时重新上传预算表单时重新写的经费额。 project_model.TEMP2 = (Convert.ToDecimal(CashTotal.Text.ToString())).ToString() + "万元"; } else { project_model.TEMP2 = (Convert.ToDecimal(CashTotal.Text.ToString())).ToString() + "元"; } } else { if (RB_cashtotal.SelectedValue.ToString().Equals("1"))//表示经费单位选择的是万元 { //经费额度存放的是元 project_model.CashTotal = Convert.ToDecimal(CashTotal.Text.ToString()) * 10000; //经费单位 project_model.CashDw = "万元"; } else { project_model.CashTotal = Convert.ToDecimal(CashTotal.Text.ToString()); //经费单位 project_model.CashDw = "元"; } } } //预算表单的审核状态 if (null != Request["role"] && Request["role"].ToString().Equals("manager")) { // } else { project_model.TEMP1 = "0"; } project_bll.Update(project_model); //给业务申请者发信息 Model.FaceShowMessage mFaceShowMessage = new Dianda.Model.FaceShowMessage(); Model.FaceShowMessage mFaceShowMessage2 = new Dianda.Model.FaceShowMessage(); BLL.FaceShowMessage bFaceShowMessage = new Dianda.BLL.FaceShowMessage(); //DataTable dt = bFaceShowMessage.GetList("FromTable='预算表单' and NewsType='预算表单审批' and ProjectID='" + project_model.ID.ToString() + "'").Tables[0]; List <Model.FaceShowMessage> facelist = bFaceShowMessage.GetModelList("FromTable='预算表单' and NewsType='预算表单审批' and ProjectID='" + project_model.ID.ToString() + "'"); mFaceShowMessage.DATETIME = DateTime.Now; mFaceShowMessage.FromTable = "预算表单"; mFaceShowMessage.IsRead = 0; mFaceShowMessage.NewsID = null; mFaceShowMessage.NewsType = "预算表单审批"; mFaceShowMessage.ReadTime = null; mFaceShowMessage.DELFLAG = 0; mFaceShowMessage.ProjectID = project_model.ID; mFaceShowMessage.Receive = project_model.DoUserID.ToString();//当前项目的审核人的ID mFaceShowMessage.URLS = "<a href='/Admin/budgetManage/manage.aspx?role=manager' target='_self' title='项目预算表单'>" + project_model.NAMES.ToString() + " 预算表单 待审</a>"; if (facelist.Count > 0) { mFaceShowMessage2 = facelist[0]; mFaceShowMessage2.DELFLAG = 1; // mFaceShowMessage.ID = int.Parse(dt.Rows[0]["ID"].ToString()); bFaceShowMessage.Update(mFaceShowMessage2); bFaceShowMessage.Add(mFaceShowMessage); } else { bFaceShowMessage.Add(mFaceShowMessage); } //给业务申请者发信息 string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"预算表单上传成功! \");window.close();</script>"; Response.Write(coutws); } catch { } }
/// <summary> /// 点击删除按钮触发的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button_delete_onclick(object sender, EventArgs e) { int num = 0; int rows = GridView1.Rows.Count; if (rows > 0) { for (int i = 0; i < rows; i++) { CheckBox cb = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox_choose"); if (cb.Checked) { num = num + 1; } } if (num == 0) { tag.Text = "删除时最少选择一条数据!"; } else { tag.Text = ""; for (int j = 0; j < rows; j++) { CheckBox cb1 = (CheckBox)GridView1.Rows[j].Cells[0].FindControl("CheckBox_choose"); HiddenField hid = (HiddenField)GridView1.Rows[j].Cells[0].FindControl("Hid_ID"); if (cb1.Checked) { //获取到当前项目的基本信息 projects_model = projects_bll.GetModel(int.Parse(hid.Value.ToString())); //将删除标记设为1 projects_model.DELFLAG = 1; projects_bll.Update(projects_model); //同时删除faceshowmessage中的projectid = ID,的数据,同时置DELFLAG=1; Dianda.BLL.Project_ProjectsExt projectsExt = new Dianda.BLL.Project_ProjectsExt(); string sqlwhere = " ProjectID = '" + hid.Value.ToString() + "'"; projectsExt.DeleteTableData(sqlwhere, "FaceShowMessage"); //添加操作日志 Dianda.BLL.SYS_LogsExt bsyslog = new Dianda.BLL.SYS_LogsExt(); Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "系统项目管理", "删除" + projects_model.NAMES + "项目成功"); //添加操作日志 } } //tag.Text = "操作成功!"; //string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!现在进入列表页面\"); location.href = \"manage.aspx?pageindex=" + Request["pageindex"] + "\";</script>"; //Response.Write(coutws); ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入我的项目页面');javascript:location='manage.aspx?projectStatus=" + Request["projectstatus"].ToString() + "';</script>", false); } } }
//编辑部门确定 protected void Button_sumbit2_Click(object sender, EventArgs e) { //修改部门ID project_model = project_bll.GetModel(int.Parse(Session["Work_ProjectId"].ToString())); //是否刷新用户数据列表(可能造成误删!) if (CheckBox1.Checked) { //创建SQL语句 StringBuilder sql_dep = new StringBuilder("delete from project_userlist where projectid='" + Session["Work_ProjectId"].ToString() + "'"); //获得参加项目的部门ID string dep = project_model.DepartmentID; //创建一个数字,指示是否是有值变更 int sum = 0; //循环所有的部门 for (int i = 0; i < CB_DepartmentID.Items.Count; i++) { //判断是否是变更的值 if (dep.Contains(CB_DepartmentID.Items[i].Value)) { //判断是否是去除有过的部门 if (CB_DepartmentID.Items[i].Selected == false) { //判断是否是首次 if (sum == 0) { sum += 1; sql_dep.Append(" and ID in(select ID from vproject_userlist where "); sql_dep.Append(" departmentid like '%" + CB_DepartmentID.Items[i].Value + "%'"); } else { sum += 1; sql_dep.Append(" or departmentid like '%" + CB_DepartmentID.Items[i].Value + "%'"); } } } } //当发生有部门去除时 if (sum != 0) { sql_dep.Append(")"); pageControl.doSql(sql_dep.ToString()); } } //参与部门 project_model.DepartmentID = ""; //参与部门名称 project_model.DepartmentNames = ""; for (int i = 0; i < CB_DepartmentID.Items.Count; i++) { if (CB_DepartmentID.Items[i].Selected == true) { project_model.DepartmentID = project_model.DepartmentID + CB_DepartmentID.Items[i].Value + ","; project_model.DepartmentNames = project_model.DepartmentNames + CB_DepartmentID.Items[i].Text + ","; } } /* 截掉最后一个逗号*/ if (project_model.DepartmentID.Length > 0) { project_model.DepartmentID = project_model.DepartmentID.Substring(0, project_model.DepartmentID.Length - 1); project_model.DepartmentNames = project_model.DepartmentNames.Substring(0, project_model.DepartmentNames.Length - 1); } //修改项目 project_bll.Update(project_model); //添加操作日志 Dianda.BLL.SYS_LogsExt bsyslog = new Dianda.BLL.SYS_LogsExt(); Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "添加部门", "添加成功"); string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!\");location.href='manage.aspx';</script>"; Response.Write(coutws); }
/// <summary> /// /// </summary> /// <param name="ProjectId"></param> protected void ShowProjectInfo(string ProjectId) { //获取到项目的基本信息 project_model = project_bll.GetModel(int.Parse(ProjectId)); //项目类型 if (project_model.ProjectType.ToString().Equals("0"))//如果是个人/临时项目 { //审批人 div_CheckUserID.Visible = false; //预计经费 div_CashTotal.Visible = false; RL_ProjectType.SelectedValue = "0"; } else { //审批人 div_CheckUserID.Visible = true; //预计经费 div_CashTotal.Visible = true; RL_ProjectType.SelectedValue = "1"; } //项目类型是不可以进行编辑的 RL_ProjectType.Enabled = false; //项目名称 NAME.Text = project_model.NAMES; //项目预计起始时间 TB_StartTime.Value = Convert.ToDateTime(project_model.StartTime.ToString()).ToString("yyyy-MM-dd"); //项目预计结束时间 TB_EndTime.Value = Convert.ToDateTime(project_model.EndTime.ToString()).ToString("yyyy-MM-dd"); //项目概要 Overviews.Value = project_model.Overviews.ToString(); if (RL_ProjectType.SelectedValue.ToString().Equals("1"))//当项目类型为正常项目时才有预计经费项 { //经费单位 if (project_model.CashDw != null && project_model.CashDw.ToString().Equals("万元")) { RB_cashtotal.SelectedValue = "1"; //预计经费 CashTotal.Text = (Convert.ToDecimal(project_model.CashTotal.ToString()) / 10000).ToString(); } else { RB_cashtotal.SelectedValue = "0"; //预计经费 CashTotal.Text = project_model.CashTotal.ToString(); } } //资金卡选择 string CashCardID = project_model.CashCardID.ToString(); if (!project_model.Attachments.Equals("")) { //老的文件的地址 HiddenField_oldpath.Value = project_model.Attachments.ToString(); LB_view.Text = "<a href='" + project_model.Attachments.ToString() + "' target='_blank'>点击查看附件</a>"; } else { LB_view.Visible = false; } //如果资金卡为0,说明在新建项目时选择的是新建资金卡 //if (CashCardID.Equals("0")) //{ // div_cash.Visible = true; // RB_NewAddCashCard.Checked = true; // RB_CashCardID.Checked = false; // DataSet ds = cashmessage_bll.GetList(" ProjectID = " + project_model.ID); // if (ds.Tables[0].Rows.Count>0) // { // //资金卡初始金额 // TB_LimitNums.Text = ds.Tables[0].Rows[0]["LimitNums"].ToString(); // //新建备注说明 // TB_Notes.Text = ds.Tables[0].Rows[0]["Notes"].ToString(); // } //} //else //{ // div_cash.Visible = false; // RB_NewAddCashCard.Checked = false; // RB_CashCardID.Checked = true; //} }
/// <summary> /// 得到一个对象实体 /// </summary> public Dianda.Model.Project_Projects GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,NAMES,DELFLAG,Status,LeaderID,DepartmentID,DepartmentNames,StartTime,EndTime,CashTotal,CashCardID,Overviews,Attachments,DATETIME,SendUserID,DoUserID,ReadTime,DoNote,ColumnsID,CashDw,ProjectType,BudgetList,TEMP1,TEMP2,TEMP3,TEMP4 from Project_Projects "); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = ID; Dianda.Model.Project_Projects model = new Dianda.Model.Project_Projects(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ID"].ToString() != "") { model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); } model.NAMES = ds.Tables[0].Rows[0]["NAMES"].ToString(); if (ds.Tables[0].Rows[0]["DELFLAG"].ToString() != "") { model.DELFLAG = int.Parse(ds.Tables[0].Rows[0]["DELFLAG"].ToString()); } if (ds.Tables[0].Rows[0]["Status"].ToString() != "") { model.Status = int.Parse(ds.Tables[0].Rows[0]["Status"].ToString()); } model.LeaderID = ds.Tables[0].Rows[0]["LeaderID"].ToString(); model.DepartmentID = ds.Tables[0].Rows[0]["DepartmentID"].ToString(); model.DepartmentNames = ds.Tables[0].Rows[0]["DepartmentNames"].ToString(); if (ds.Tables[0].Rows[0]["StartTime"].ToString() != "") { model.StartTime = DateTime.Parse(ds.Tables[0].Rows[0]["StartTime"].ToString()); } if (ds.Tables[0].Rows[0]["EndTime"].ToString() != "") { model.EndTime = DateTime.Parse(ds.Tables[0].Rows[0]["EndTime"].ToString()); } if (ds.Tables[0].Rows[0]["CashTotal"].ToString() != "") { model.CashTotal = decimal.Parse(ds.Tables[0].Rows[0]["CashTotal"].ToString()); } if (ds.Tables[0].Rows[0]["CashCardID"].ToString() != "") { model.CashCardID = int.Parse(ds.Tables[0].Rows[0]["CashCardID"].ToString()); } model.Overviews = ds.Tables[0].Rows[0]["Overviews"].ToString(); model.Attachments = ds.Tables[0].Rows[0]["Attachments"].ToString(); if (ds.Tables[0].Rows[0]["DATETIME"].ToString() != "") { model.DATETIME = DateTime.Parse(ds.Tables[0].Rows[0]["DATETIME"].ToString()); } model.SendUserID = ds.Tables[0].Rows[0]["SendUserID"].ToString(); model.DoUserID = ds.Tables[0].Rows[0]["DoUserID"].ToString(); if (ds.Tables[0].Rows[0]["ReadTime"].ToString() != "") { model.ReadTime = DateTime.Parse(ds.Tables[0].Rows[0]["ReadTime"].ToString()); } model.DoNote = ds.Tables[0].Rows[0]["DoNote"].ToString(); if (ds.Tables[0].Rows[0]["ColumnsID"].ToString() != "") { model.ColumnsID = int.Parse(ds.Tables[0].Rows[0]["ColumnsID"].ToString()); } model.CashDw = ds.Tables[0].Rows[0]["CashDw"].ToString(); if (ds.Tables[0].Rows[0]["ProjectType"].ToString() != "") { model.ProjectType = int.Parse(ds.Tables[0].Rows[0]["ProjectType"].ToString()); } model.BudgetList = ds.Tables[0].Rows[0]["BudgetList"].ToString(); model.TEMP1 = ds.Tables[0].Rows[0]["TEMP1"].ToString(); model.TEMP2 = ds.Tables[0].Rows[0]["TEMP2"].ToString(); model.TEMP3 = ds.Tables[0].Rows[0]["TEMP3"].ToString(); model.TEMP4 = ds.Tables[0].Rows[0]["TEMP4"].ToString(); return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Dianda.Model.Project_Projects model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Project_Projects set "); strSql.Append("NAMES=@NAMES,"); strSql.Append("DELFLAG=@DELFLAG,"); strSql.Append("Status=@Status,"); strSql.Append("LeaderID=@LeaderID,"); strSql.Append("DepartmentID=@DepartmentID,"); strSql.Append("DepartmentNames=@DepartmentNames,"); strSql.Append("StartTime=@StartTime,"); strSql.Append("EndTime=@EndTime,"); strSql.Append("CashTotal=@CashTotal,"); strSql.Append("CashCardID=@CashCardID,"); strSql.Append("Overviews=@Overviews,"); strSql.Append("Attachments=@Attachments,"); strSql.Append("DATETIME=@DATETIME,"); strSql.Append("SendUserID=@SendUserID,"); strSql.Append("DoUserID=@DoUserID,"); strSql.Append("ReadTime=@ReadTime,"); strSql.Append("DoNote=@DoNote,"); strSql.Append("ColumnsID=@ColumnsID,"); strSql.Append("CashDw=@CashDw,"); strSql.Append("ProjectType=@ProjectType,"); strSql.Append("BudgetList=@BudgetList,"); strSql.Append("TEMP1=@TEMP1,"); strSql.Append("TEMP2=@TEMP2,"); strSql.Append("TEMP3=@TEMP3,"); strSql.Append("TEMP4=@TEMP4"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Int, 4), new SqlParameter("@NAMES", SqlDbType.VarChar, 50), new SqlParameter("@DELFLAG", SqlDbType.Int, 4), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@LeaderID", SqlDbType.VarChar, 50), new SqlParameter("@DepartmentID", SqlDbType.VarChar, 5000), new SqlParameter("@DepartmentNames", SqlDbType.VarChar, 5000), new SqlParameter("@StartTime", SqlDbType.DateTime), new SqlParameter("@EndTime", SqlDbType.DateTime), new SqlParameter("@CashTotal", SqlDbType.Float, 8), new SqlParameter("@CashCardID", SqlDbType.Int, 4), new SqlParameter("@Overviews", SqlDbType.Text), new SqlParameter("@Attachments", SqlDbType.VarChar, 200), new SqlParameter("@DATETIME", SqlDbType.DateTime), new SqlParameter("@SendUserID", SqlDbType.VarChar, 50), new SqlParameter("@DoUserID", SqlDbType.VarChar, 50), new SqlParameter("@ReadTime", SqlDbType.DateTime), new SqlParameter("@DoNote", SqlDbType.VarChar, 5000), new SqlParameter("@ColumnsID", SqlDbType.Int, 4), new SqlParameter("@CashDw", SqlDbType.VarChar, 50), new SqlParameter("@ProjectType", SqlDbType.Int, 4), new SqlParameter("@BudgetList", SqlDbType.VarChar, 5000), new SqlParameter("@TEMP1", SqlDbType.VarChar, 100), new SqlParameter("@TEMP2", SqlDbType.VarChar, 100), new SqlParameter("@TEMP3", SqlDbType.VarChar, 100), new SqlParameter("@TEMP4", SqlDbType.VarChar, 100) }; parameters[0].Value = model.ID; parameters[1].Value = model.NAMES; parameters[2].Value = model.DELFLAG; parameters[3].Value = model.Status; parameters[4].Value = model.LeaderID; parameters[5].Value = model.DepartmentID; parameters[6].Value = model.DepartmentNames; parameters[7].Value = model.StartTime; parameters[8].Value = model.EndTime; parameters[9].Value = model.CashTotal; parameters[10].Value = model.CashCardID; parameters[11].Value = model.Overviews; parameters[12].Value = model.Attachments; parameters[13].Value = model.DATETIME; parameters[14].Value = model.SendUserID; parameters[15].Value = model.DoUserID; parameters[16].Value = model.ReadTime; parameters[17].Value = model.DoNote; parameters[18].Value = model.ColumnsID; parameters[19].Value = model.CashDw; parameters[20].Value = model.ProjectType; parameters[21].Value = model.BudgetList; parameters[22].Value = model.TEMP1; parameters[23].Value = model.TEMP2; parameters[24].Value = model.TEMP3; parameters[25].Value = model.TEMP4; DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 确定添加新任务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button_sumbit_Click(object sender, EventArgs e) { try { project_model = project_bll.GetModel(Convert.ToInt16(Session["Work_ProjectId"])); string taskname = NAME.Text.ToString(); //检查是否有该用户组名称 bool checkName = pagecontrol.Exists_TaskName("Project_Task", "NAMES", taskname, "ID", "", Convert.ToInt16(Session["Work_ProjectId"])); if (checkName) { tag.Text = "该任务标题已经存在,请修改!"; } else { //ID task_model.ID = task_bll.GetMaxId(); //项目ID task_model.ProjectID = Convert.ToInt16(Session["Work_ProjectId"]); //任务标题 task_model.NAMES = taskname; //删除标记录 task_model.DELFLAG = 0; //状态 task_model.Status = int.Parse(RadioButtonList_status.SelectedValue.ToString()); string time = TB_StartTime.Value.ToString() + " 00:00:00"; //if (time == DateTime.Now.ToShortDateString()) //{ // time += " " + DateTime.Now.ToString("HH:mm:ss"); //} //else //{ // time += " 00:00:00"; //} //开始时间 task_model.StartTime = Convert.ToDateTime(time); //结束时间 task_model.EndTime = Convert.ToDateTime(TB_EndTime.Value.ToString() + " 23:59:59"); //任务描述 task_model.Overviews = Overviews.Text.ToString(); //任务的发布时间 task_model.DATETIME = Convert.ToDateTime(DateTime.Now.ToShortDateString()); //发布这个任务的用户的ID Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; task_model.SendUserID = user_model.ID; string userids = ""; string usernames = ""; for (int i = 0; i < CB_usersID.Items.Count; i++) { if (CB_usersID.Items[i].Selected == true) { userids = userids + CB_usersID.Items[i].Value + ",0" + ";"; if (usernames.Equals("")) { usernames = CB_usersID.Items[i].Text; } else { usernames = usernames + "; " + CB_usersID.Items[i].Text; } //给参与此任务的用户发信息 Model.FaceShowMessage mFaceShowMessage = new Dianda.Model.FaceShowMessage(); BLL.FaceShowMessage bFaceShowMessage = new Dianda.BLL.FaceShowMessage(); mFaceShowMessage.DATETIME = DateTime.Now; mFaceShowMessage.FromTable = "项目任务"; mFaceShowMessage.IsRead = 0; mFaceShowMessage.NewsID = null; mFaceShowMessage.NewsType = "项目任务"; mFaceShowMessage.ReadTime = null; mFaceShowMessage.Receive = CB_usersID.Items[i].Value; mFaceShowMessage.DELFLAG = 0; mFaceShowMessage.ProjectID = project_model.ID; mFaceShowMessage.URLS = "<a href='/Admin/personalProjectManage/OAtask/manage.aspx?ID=" + task_model.ProjectID + "' target='_self' title='新建任务:新建时间" + DateTime.Now.ToString() + "'>新建任务:" + taskname + "</a> " + project_model.NAMES + " (" + user_model.REALNAME + ")"; bFaceShowMessage.Add(mFaceShowMessage); //给参与此任务的用户发信息 } } //参与的用户的ID try { task_model.UserIDs = userids.Substring(0, userids.Length - 1); } catch { tag.Text = "请至少选择一个参与人员!"; return; } //参与人员名称:真实姓名+'('+用户名+‘)’; task_model.UserInfo = usernames; if (!DDL_UpID.SelectedValue.ToString().Equals("")) { //父任务 task_model.UpID = int.Parse(DDL_UpID.SelectedValue.ToString()); } else { //父任务 task_model.UpID = 0; } //是否可建子任务 task_model.IsFather = int.Parse(RadioButtonList_IsFather.SelectedValue.ToString()); //上传文档 task_model.CompleteType = int.Parse(RadioButtonList_doc.SelectedValue.ToString()); task_bll.Add(task_model); //tag.Text = "操作成功!"; //string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!现在进入列表页面\"); location.href = \"manage.aspx?ID=" + project_model.ID+ "\";</script>"; //Response.Write(coutws); //ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入列表页面');javascript:location='manage.aspx?ID=" + project_model.ID +"&status=" + Request.QueryString["status"].ToString()+"';</script>", false); ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入列表页面');javascript:location='manage.aspx?ID=" + project_model.ID + "';</script>", false); //ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入我的项目页面');javascript:location='manage.aspx?projecttype=4&projectStatus=0';</script>", false); //添加操作日志 Dianda.BLL.SYS_LogsExt bsyslog = new Dianda.BLL.SYS_LogsExt(); bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "项目中新增任务", project_model.NAMES + "项目" + task_model.NAMES + "任务:添加成功!"); //添加操作日志 } } catch { tag.Text = "操作失败,请重试!"; } }
/// <summary> /// 返回按钮触发的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button_goback_Click(object sender, EventArgs e) { project_model = project_bll.GetModel(Convert.ToInt16(Session["Work_ProjectId"])); Response.Redirect("manage.aspx?pageindex=" + Request["pageindex"].ToString() + "&ID=" + project_model.ID + "&status=" + Request.QueryString["status"]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ApplyCount = 0; //项目ID if (Session["Work_ProjectId"] != null) { projectid = Session["Work_ProjectId"].ToString(); GetddlStatas(); string count = dtrowsHidden.Value.ToString(); if (count.Length == 0) { setRowCout();//获取当前状态下有多少条数据记录,为分页提供页数和全部条数服务 count = dtrowsHidden.Value.ToString(); } else { count = "0"; } int countint = int.Parse(count); string pageindex = null;//这里是为分页服务的 if (pageindex == null || pageindex == "") { pageindex = "1"; } int pageindex_int = int.Parse(pageindex); BindData(pageindex_int); /*设置模板页中的管理值*/ (Master.FindControl("Label_navigation") as Label).Text = "项目 > 我的项目 > 项目经费 > 经费列表 "; /*设置模板页中的管理值*/ //项目状态 bool Project_Status = BProject_Status.ProjectStatus(Session["Work_ProjectId"].ToString()); //根据项目状态设置页面按钮状态 if (Project_Status == false) { Button_add.Enabled = Project_Status; Button_sumbit.Enabled = Project_Status; Button_list.Enabled = Project_Status; } project_model = project_bll.GetModel(int.Parse(Session["Work_ProjectId"].ToString())); if (project_model.ProjectType == 0)//个人/临时项目不存在经费和项目审批人。。所以是不可以上传预算表单的 { Button_list.Visible = false; } else { //只有项目的创建者和负责人才能点击此功能,并且该预算表单状态是待审核或审核不通过 Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; if ((project_model.SendUserID.ToString() == user_model.ID.ToString() || project_model.LeaderID.ToString() == user_model.ID.ToString()) && !(project_model.TEMP1.ToString() == "1" || project_model.TEMP1.ToString() == "3")) { Button_list.Visible = true; } else { Button_list.Visible = false; } } } } }
///// <summary> ///// 根据项目负责人来动态显示资金卡下拉列表 ///// </summary> ///// <param name="CashflagID"></param> //protected void SetDDL_CashCardID(string CashflagID) //{ // DataTable dt3 = new DataTable(); // string sql2 = " SELECT ID, CardNum, CardName, LimitNums FROM Cash_Cards WHERE (CardholderID = '" + CashflagID + "') "; // dt3 = pagecontrol.doSql(sql2).Tables[0]; // if (dt3.Rows.Count > 0) // { // DDL_CashCardID.Enabled = true; // DDL_CashCardID.Items.Clear(); // for (int j = 0; j < dt3.Rows.Count; j++) // { // string ID = dt3.Rows[j]["ID"].ToString(); // string CardNum = dt3.Rows[j]["CardNum"].ToString(); // string CardName = dt3.Rows[j]["CardName"].ToString(); // string LimitNums = dt3.Rows[j]["LimitNums"].ToString(); // string showinfo = CardName + "[" + CardNum + "," + LimitNums + "]"; // ListItem li = new ListItem(showinfo, ID); // DDL_CashCardID.Items.Add(li); // } // Button_applyfor.Enabled = true; // Button_reset.Enabled = true; // Button_draft.Enabled = true; // } // else // { // DDL_CashCardID.Items.Clear(); // ListItem li = new ListItem("暂无可选资金卡", ""); // DDL_CashCardID.Items.Add(li); // DDL_CashCardID.Enabled = false; // Button_applyfor.Enabled = false; // Button_reset.Enabled = false; // Button_draft.Enabled = false; // } //} /// <summary> /// 资金卡选择切换 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> //protected void RB_NewAddCashCard_CheckedChanged(object sender, EventArgs e) //{ // RB_CashCardID.Checked = false; // RB_NewAddCashCard.Checked = true; // div_cash.Visible = true; // Button_applyfor.Enabled = true; // Button_reset.Enabled = true; // Button_draft.Enabled = true; //} /// <summary> /// 资金卡选择切换 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> //protected void RB_CashCardID_CheckedChanged(object sender, EventArgs e) //{ // RB_CashCardID.Checked = true; // RB_NewAddCashCard.Checked = false; // div_cash.Visible = false; //} /// <summary> /// 根据项目负责人来动态显示资金卡下拉列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> //protected void DDL_LeaderID_Changed(object sender, EventArgs e) //{ // string ID = DDL_LeaderID.SelectedValue.ToString(); // SetDDL_CashCardID(ID); //} /// <summary> /// 点击重置触发事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> //protected void Button_reset_Click(object sender, EventArgs e) //{ // NAME.Text = ""; // for (int i = 0; i < CB_DepartmentID.Items.Count; i++) // { // if (CB_DepartmentID.Items[i].Selected == true) // { // CB_DepartmentID.Items[i].Selected = false; // } // } // TB_StartTime.Value = ""; // TB_EndTime.Value = ""; // CashTotal.Text = ""; // RB_CashCardID.Checked = true; // RB_NewAddCashCard.Checked = false; // Overviews.Value = ""; // div_cash.Visible = false; // TB_LimitNums.Text = ""; // TB_Notes.Text = ""; //} /// <summary> /// 点击申请触发事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button_applyfor_Click(object sender, EventArgs e) { try { string ID = Request["ID"]; project_model = project_bll.GetModel(int.Parse(ID)); //项目审核人 string douserid = project_model.DoUserID.ToString(); string projectName = NAME.Text.ToString(); //检查是否有该项目名称 bool checkName = pagecontrol.Exists_Name("Project_Projects", "NAMES", projectName, "ID", ID); if (checkName) { tag.Text = "该项目名称已经存在,请修改!"; } else { if (FileUpload1.FileName.Length > 2) { string[] content = fileup.UpFile_COMMONS(FileUpload1, "/AllFileUp/fileup", HiddenField_oldpath.Value.ToString()); //1-成功;0-失败;2-类型不支持;3-大小不符合;文件的路径;文件名称;文件类型;图标;大小;操作结果 if (content[0] == "0") { tag.Text = "文件上传失败,请重新上传!"; return; } else if (content[0] == "2") { tag.Text = "系统不允许此类文件上传,文件上传失败,请重新上传!"; return; } else if (content[0] == "3") { tag.Text = "文件上传大小不符合,文件上传失败,请重新上传!"; return; } project_model.Attachments = content[1]; } Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; int statusflag = Convert.ToInt32(((Button)sender).CommandArgument.ToString());//获取到触发源 //项目名称 project_model.NAMES = NAME.Text.ToString(); //状态 project_model.Status = statusflag; //项目负责人 project_model.LeaderID = DDL_LeaderID.SelectedValue.ToString().Split('|')[0].ToString(); ////参与部门--参与部门的编辑工作放在了项目成员的功能处-唐春龙-2011-02-17 //project_model.DepartmentID = ""; ////参与部门名称 //project_model.DepartmentNames = ""; //for (int i = 0; i < CB_DepartmentID.Items.Count; i++) //{ // if (CB_DepartmentID.Items[i].Selected == true) // { // project_model.DepartmentID = project_model.DepartmentID + CB_DepartmentID.Items[i].Value + ","; // project_model.DepartmentNames = project_model.DepartmentNames + CB_DepartmentID.Items[i].Text + ","; // } //} ///* 截掉最后一个逗号*/ //if (project_model.DepartmentID.Length > 0) //{ // project_model.DepartmentID = project_model.DepartmentID.Substring(0, project_model.DepartmentID.Length - 1); // project_model.DepartmentNames = project_model.DepartmentNames.Substring(0, project_model.DepartmentNames.Length - 1); //}--参与部门的编辑工作放在了项目成员的功能处-唐春龙-2011-02-17 //项目预计起始时间 project_model.StartTime = Convert.ToDateTime(TB_StartTime.Value.ToString()); //项目预计结束时间 project_model.EndTime = Convert.ToDateTime(TB_EndTime.Value.ToString()); //预计经费 if (RL_ProjectType.SelectedValue.ToString().Equals("1"))//当项目类型为正常项目时才有预计经费项 { //项目审核人 project_model.DoUserID = DDL_CheckUserID.SelectedValue.ToString(); if (!CashTotal.Text.ToString().Equals("")) { //project_model.CashTotal = Convert.ToDecimal(CashTotal.Text.ToString()); if (RB_cashtotal.SelectedValue.ToString().Equals("1"))//表示经费单位选择的是万元 { //经费额度存放的是元 project_model.CashTotal = Convert.ToDecimal(CashTotal.Text.ToString()) * 10000; //经费单位 project_model.CashDw = "万元"; } else { project_model.CashTotal = Convert.ToDecimal(CashTotal.Text.ToString()); //经费单位 project_model.CashDw = "元"; } } else { project_model.CashTotal = null; } } else { //项目审核人 project_model.DoUserID = ""; } //资金卡选择 //DataSet ds1 = cashmessage_bll.GetList(" ProjectID = " + project_model.ID); //if (RB_CashCardID.Checked == true)//如果选择的是资金卡则设为资金卡的ID; //{ // project_model.CashCardID = Int16.Parse(DDL_CashCardID.SelectedValue.ToString()); // //如果编辑时选择的是资金卡,但是在cash_message表中发现有此项目的消息记录,则说明 // //在新建此项目时选择的是新建资金卡,而现在如果修改成资金卡,则要将这条消息记录删除 // if (ds1.Tables[0].Rows.Count > 0) // { // string cashid = ds1.Tables[0].Rows[0]["ID"].ToString(); // cashmessage_bll.Delete(int.Parse(cashid)); // } //} //else//如果选择的是新建资金卡则设为0,并且需要向cash_message表中加一条记录 //{ // project_model.CashCardID = 0; // //如果原来就有记录,则修改 // if (ds1.Tables[0].Rows.Count > 0) // { // //ID // string cashid = ds1.Tables[0].Rows[0]["ID"].ToString(); // cashmessage_model = cashmessage_bll.GetModel(int.Parse(cashid)); // //资金卡初始金额 // cashmessage_model.LimitNums = Convert.ToDecimal(TB_LimitNums.Text); // //新建备注说明 // cashmessage_model.Notes = TB_Notes.Text.ToString(); // cashmessage_bll.Update(cashmessage_model); // } // else // { // //资金卡名称(暂时写的留空) // cashmessage_model.CardName = ""; // //持卡人 // cashmessage_model.CardholderID = DDL_LeaderID.SelectedValue; // //项目的ID // cashmessage_model.ProjectID = project_model.ID; // //初始金额 // cashmessage_model.LimitNums = Convert.ToDecimal(TB_LimitNums.Text.ToString()); // //填写的时间 // cashmessage_model.DATETIME = Convert.ToDateTime(DateTime.Now.ToString()); // //发出这个消息的用户的ID // cashmessage_model.SendUserID = user_model.ID; // //备注说明 // cashmessage_model.Notes = TB_Notes.Text.ToString(); // //是否已经阅读 // cashmessage_model.IsRead = 0; // //消息的状态 // cashmessage_model.Status = 0; // Session["Cash_Message_temps"] = cashmessage_model; // //向信息表中添加一条新建资金卡的记录 // cashmessage_bll.Add(cashmessage_model); // } //} //项目概要 project_model.Overviews = Overviews.Value.ToString(); //申请时间 project_model.DATETIME = Convert.ToDateTime(DateTime.Now.ToString()); //所属分类 project_model.ColumnsID = int.Parse(DDL_COLUMN.SelectedValue); //修改项目 project_bll.Update(project_model); //根据项目负责人的改变来改变项目组成员 string sql_userlist = " SELECT ID, ProjectID, UserID, Status, DATETIME FROM Project_UserList WHERE (ProjectID = '" + ID + "') AND (UserID = '" + project_model.LeaderID + "') AND (Status = '1')"; DataTable dt = pagecontrol.doSql(sql_userlist).Tables[0]; if (!(dt.Rows.Count > 0)) { Dianda.BLL.Project_UserList project_userlist_bll = new Dianda.BLL.Project_UserList(); Dianda.Model.Project_UserList project_userlist_model = new Dianda.Model.Project_UserList(); // project_userlist_model.ID = project_userlist_bll.GetMaxId(); //项目ID project_userlist_model.ProjectID = project_model.ID; //项目组成员 project_userlist_model.UserID = project_model.LeaderID; //状态 project_userlist_model.Status = 1; //时间 project_userlist_model.DATETIME = DateTime.Now; //向Project_UserList加条记录 project_userlist_bll.Add(project_userlist_model); } //根据所选择的分类的改变来动态的改变项目审批人的下拉列表。这样原来这个项目的审核人就发生了更改则需要将原来审核表中的UserID改成新的 string sql_checkuser = "******" + DDL_CheckUserID.SelectedValue.ToString() + "' WHERE (ProjectID = " + project_model.ID + ") AND (Status = 0) AND (UserID = '" + douserid + "') "; pagecontrol.doSql(sql_checkuser); ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入我的项目页面');javascript:location='manage.aspx?projectstatus=" + Request["status"] + "';</script>", false); //添加操作日志 Dianda.BLL.SYS_LogsExt bsyslog = new Dianda.BLL.SYS_LogsExt(); bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "修改立项申请", "修改" + project_model.NAMES + "项目申请修改成功"); //添加操作日志 //tag.Text = "操作成功! 点击“返回”按钮进入我的项目页面!"; //addproject.Visible = false; //goback.Visible = true; } } catch { } }
/// <summary> /// 点击撤销按钮触发的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button_revoke_onclick(object sender, EventArgs e) { int num = 0; int rows = GridView1.Rows.Count; if (rows > 0) { for (int i = 0; i < rows; i++) { CheckBox cb = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox_choose"); if (cb.Checked) { num = num + 1; } } if (num == 0) { tag.Text = "撤销时最少选择一条数据!"; } else { tag.Text = ""; for (int j = 0; j < rows; j++) { CheckBox cb1 = (CheckBox)GridView1.Rows[j].Cells[0].FindControl("CheckBox_choose"); HiddenField hid = (HiddenField)GridView1.Rows[j].Cells[0].FindControl("Hid_ID"); if (cb1.Checked && cb1.Enabled) { //获取业务的基本信息 apply_model = apply_bll.GetModel(int.Parse(hid.Value.ToString())); //将删除标记设为1 //apply_model.DELFLAG = 1; //将状态调为不通过 apply_model.Status = 2; //申请类型 string applytype = apply_model.AppType; string tablename = ""; string typeflag = ""; if (applytype.Equals("orderFood")) { tablename = "Project_Apply_orderFood"; typeflag = "订饭申请"; } else if (applytype.Equals("orderCar")) { tablename = "Project_Apply_orderCar"; typeflag = "订车申请"; } else if (applytype.Equals("orderRoom")) { tablename = "Project_Apply_orderRoom"; typeflag = "订会议室申请"; } else if (applytype.Equals("orderSignet")) { tablename = "Project_Apply_signet"; typeflag = "印章申请"; } // string sql = " DELETE FROM " + tablename + " WHERE ApplyID = " + hid.Value.ToString(); apply_bll.Update(apply_model); // pageControl.doSql(sql); //添加操作日志 Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; Dianda.BLL.SYS_LogsExt bsyslog = new Dianda.BLL.SYS_LogsExt(); Dianda.Model.Project_Projects project_model = new Dianda.Model.Project_Projects(); Dianda.BLL.Project_Projects project_bll = new Dianda.BLL.Project_Projects(); project_model = project_bll.GetModel(Convert.ToInt16(Session["Work_ProjectId"])); bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "业务申请撤销", project_model.NAMES + "项目" + typeflag + "撤销:成功!"); //添加操作日志 } } //string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!现在进入列表页面\"); location.href = \"manage.aspx?pageindex=" + pageindexHidden.Value.ToString() + "&status=" + DDL_status.SelectedValue.ToString() + "\";</script>"; //Response.Write(coutws); ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入我的项目页面');javascript:location='manage.aspx?pageindex=" + pageindexHidden.Value.ToString() + "&type=" + DDL_type.SelectedValue + "&status=" + DDL_status.SelectedValue.ToString() + "';</script>", false); } } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Dianda.Model.Project_Projects model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Project_Projects("); strSql.Append("NAMES,DELFLAG,Status,LeaderID,DepartmentID,DepartmentNames,StartTime,EndTime,CashTotal,CashCardID,Overviews,Attachments,DATETIME,SendUserID,DoUserID,ReadTime,DoNote,ColumnsID,CashDw,ProjectType,BudgetList,TEMP1,TEMP2,TEMP3,TEMP4)"); strSql.Append(" values ("); strSql.Append("@NAMES,@DELFLAG,@Status,@LeaderID,@DepartmentID,@DepartmentNames,@StartTime,@EndTime,@CashTotal,@CashCardID,@Overviews,@Attachments,@DATETIME,@SendUserID,@DoUserID,@ReadTime,@DoNote,@ColumnsID,@CashDw,@ProjectType,@BudgetList,@TEMP1,@TEMP2,@TEMP3,@TEMP4)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@NAMES", SqlDbType.VarChar, 50), new SqlParameter("@DELFLAG", SqlDbType.Int, 4), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@LeaderID", SqlDbType.VarChar, 50), new SqlParameter("@DepartmentID", SqlDbType.VarChar, 5000), new SqlParameter("@DepartmentNames", SqlDbType.VarChar, 5000), new SqlParameter("@StartTime", SqlDbType.DateTime), new SqlParameter("@EndTime", SqlDbType.DateTime), new SqlParameter("@CashTotal", SqlDbType.Float, 8), new SqlParameter("@CashCardID", SqlDbType.Int, 4), new SqlParameter("@Overviews", SqlDbType.Text), new SqlParameter("@Attachments", SqlDbType.VarChar, 200), new SqlParameter("@DATETIME", SqlDbType.DateTime), new SqlParameter("@SendUserID", SqlDbType.VarChar, 50), new SqlParameter("@DoUserID", SqlDbType.VarChar, 50), new SqlParameter("@ReadTime", SqlDbType.DateTime), new SqlParameter("@DoNote", SqlDbType.VarChar, 5000), new SqlParameter("@ColumnsID", SqlDbType.Int, 4), new SqlParameter("@CashDw", SqlDbType.VarChar, 50), new SqlParameter("@ProjectType", SqlDbType.Int, 4), new SqlParameter("@BudgetList", SqlDbType.VarChar, 5000), new SqlParameter("@TEMP1", SqlDbType.VarChar, 100), new SqlParameter("@TEMP2", SqlDbType.VarChar, 100), new SqlParameter("@TEMP3", SqlDbType.VarChar, 100), new SqlParameter("@TEMP4", SqlDbType.VarChar, 100) }; parameters[0].Value = model.NAMES; parameters[1].Value = model.DELFLAG; parameters[2].Value = model.Status; parameters[3].Value = model.LeaderID; parameters[4].Value = model.DepartmentID; parameters[5].Value = model.DepartmentNames; parameters[6].Value = model.StartTime; parameters[7].Value = model.EndTime; parameters[8].Value = model.CashTotal; parameters[9].Value = model.CashCardID; parameters[10].Value = model.Overviews; parameters[11].Value = model.Attachments; parameters[12].Value = model.DATETIME; parameters[13].Value = model.SendUserID; parameters[14].Value = model.DoUserID; parameters[15].Value = model.ReadTime; parameters[16].Value = model.DoNote; parameters[17].Value = model.ColumnsID; parameters[18].Value = model.CashDw; parameters[19].Value = model.ProjectType; parameters[20].Value = model.BudgetList; parameters[21].Value = model.TEMP1; parameters[22].Value = model.TEMP2; parameters[23].Value = model.TEMP3; parameters[24].Value = model.TEMP4; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(1); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 点击确定触发事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button_sumbit_onclick(object sender, EventArgs e) { try { string flag = "审核不通过"; Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; //项目ID string ID = Request["ID"]; project_model = project_bll.GetModel(int.Parse(ID)); //审批结果 string Status = RadioButtonList_Check.SelectedValue; if (!(TB_DoNote.Text.ToString().Equals(""))) { //审批意见 project_model.DoNote = project_model.DoNote + user_model.REALNAME + "(" + user_model.USERNAME + "): " + DateTime.Now + "</br> " + TB_DoNote.Text.ToString() + "</br></br>"; } if (!(Status.Equals("3")))//只有当这个审批人直接将此项目定为通过或是不通过时才去更新审批时间和状态及审批人 { //审批时间 project_model.ReadTime = DateTime.Now; //审批人员 project_model.DoUserID = user_model.ID; //审批结果 project_model.Status = int.Parse(Status); project_bll.Update(project_model); //******************在移交了项目审批人之后。还需要将自己的审核意见更改过来,并且将Isturn改成已经审核过了 string sql_checkuser = "******" + Status + ", Infors = Infors + '" + TB_DoNote.Text.ToString() + "</br>' WHERE (ProjectID = " + project_model.ID + ") AND (UserID = '" + user_model.ID + "') "; pageControl.doSql(sql_checkuser); } else//如果是转交给别的人。则需要往Project_ShenheList里加一条记录 { //审批结果 project_model.Status = 0; //审批人 project_model.DoUserID = DDL_CheckUserList.SelectedValue.ToString();//改成新的审批人 project_bll.Update(project_model); //******************如果此审批者将此项目转给了其他人,则要根据所选择的移交审批人,将此项目发送给这个人,即向Project_ShenheList加条记录 Dianda.BLL.Project_ShenheList Shenhe_bll = new Dianda.BLL.Project_ShenheList(); Dianda.Model.Project_ShenheList Shenhe_model = new Dianda.Model.Project_ShenheList(); //在添加记录之前先检查是不是有该条记录了 //做这一步的目的是:在立项时已经根据当时所选择的审批人往Project_ShenheList里加了一条记录 //如果第一次移交给另一个人,而这个人审批时发现不属于自己审批,又转回给第一个人, //这样如果再添加就会出现同一个项目,同一个审批人出现多条数据了。 string sqlwhere = "(ProjectID = " + project_model.ID + ") AND (UserID = '" + DDL_CheckUserList.SelectedValue.ToString() + "') "; List <Dianda.Model.Project_ShenheList> Li = Shenhe_bll.GetModelList(sqlwhere); if (Li.Count > 0) { string sql_changecheckuser = "******" + sqlwhere; pageControl.doSql(sql_changecheckuser); } else { //ID Shenhe_model.ID = Shenhe_bll.GetMaxId(); //需要审核的项目ID Shenhe_model.ProjectID = project_model.ID; //审核人的ID Shenhe_model.UserID = DDL_CheckUserList.SelectedValue.ToString(); //审核状态(新建默认时默认为0:待审核) Shenhe_model.Status = 0; //是否到当前的用户审核:0表示未到;1表示到;2表示已经审核过 Shenhe_model.Isturn = 1; //审核意见 Shenhe_model.Infors = ""; //向Project_ShenheList加条记录 Shenhe_bll.Add(Shenhe_model); } //******************在移交了项目审批人之后。还需要将自己的审核意见更改过来,并且将Isturn改成已经审核过了 string sql_checkuser = "******" + TB_DoNote.Text.ToString() + "</br>' WHERE (ProjectID = " + project_model.ID + ") AND (UserID = '" + user_model.ID + "') "; pageControl.doSql(sql_checkuser); ////******************项目移交给别人审核后,需要将原来在Project_Project中的审核人改成新的审核人 //string sql_changechecker = " UPDATE Project_Projects SET Status = 0,DoUserID='" + DDL_CheckUserList.SelectedValue.ToString() + "' WHERE (ID = " + project_model.ID + ")"; //pageControl1.doSql(sql_changechecker); flag = "移交审核"; } if (Status.Equals("1"))//表示审批通过 { flag = "审核通过"; if (project_model.CashCardID == 0)//如果资金卡为0,表示新建资金卡 { string sql = " UPDATE Cash_Message SET Status = 1 WHERE (ProjectID = " + project_model.ID + ")"; pageControl.doSql(sql); } //项审批成功以后,要向Document_Folder中添加一个当前用户的顶级档案目录 Dianda.Model.Document_Folder docfolder_model = new Dianda.Model.Document_Folder(); Dianda.BLL.Document_Folder docfolder_bll = new Dianda.BLL.Document_Folder(); int id = docfolder_bll.GetMaxId(); docfolder_model.ID = id; //目录名称 docfolder_model.FolderName = project_model.NAMES; //上级目录 docfolder_model.UpID = 38; //文件夹的属性 docfolder_model.Types = "public"; //是否共享 docfolder_model.IsShare = 0; //创建的用户 docfolder_model.UserID = user_model.ID; //删除标记 docfolder_model.DELFLAG = 0; //当前时间 docfolder_model.DATETIME = Convert.ToDateTime(DateTime.Now.ToShortDateString()); //栏目的路径记录(用/来隔开) docfolder_model.COLUMNSPATH = "-1/38/" + docfolder_model.ID; //项目ID docfolder_model.ProjectID = int.Parse(ID); //栏目显示的顺序 docfolder_model.SHUNXU = 0; //栏目的路径名称 docfolder_model.PNAMES = "项目文档>" + project_model.NAMES; //当前文件夹中文件的大小 docfolder_model.SizeOf = "0"; docfolder_bll.Add(docfolder_model); if (null != project_model.Attachments && !(project_model.Attachments.ToString().Equals(""))) { setAttachmentsToDocument(user_model.ID, id.ToString(), project_model.Attachments.ToString());//将立项申请时的上传附件保存到项目的目录中 } //项审批成功以后往信息栏目表中添加一条记录 Dianda.BLL.News_ColumnsExt columnsext = new Dianda.BLL.News_ColumnsExt(); columnsext.addCloumns(project_model.NAMES, "PROJECT", project_model.ID.ToString(), 2); } //给业务申请者发信息 Model.FaceShowMessage mFaceShowMessage = new Dianda.Model.FaceShowMessage(); BLL.FaceShowMessage bFaceShowMessage = new Dianda.BLL.FaceShowMessage(); mFaceShowMessage.DATETIME = DateTime.Now; mFaceShowMessage.FromTable = "项目审核"; mFaceShowMessage.IsRead = 0; mFaceShowMessage.NewsID = null; mFaceShowMessage.NewsType = "项目审核"; mFaceShowMessage.ReadTime = null; mFaceShowMessage.DELFLAG = 0; mFaceShowMessage.ProjectID = project_model.ID; mFaceShowMessage.Receive = project_model.SendUserID.ToString(); mFaceShowMessage.URLS = "<a href='/Admin/personalProjectManage/OAproject/manage.aspx?projectstatus=1' target='_self' title='项目审核:审核时间" + DateTime.Now.ToString() + "'>" + project_model.NAMES.ToString() + " " + flag + "</a> (" + user_model.REALNAME + ")"; bFaceShowMessage.Add(mFaceShowMessage); //给业务申请者发信息 if (Status.Equals("3")) { //如果项目的审批者将此项目重新转移交给了另一个审批者,那么则需要发二个提示信息,一是新的项目审批者,第二个就是原来的项目审批者 //给新的项目审批者发送信息 mFaceShowMessage.DATETIME = DateTime.Now; mFaceShowMessage.FromTable = "立项申请"; mFaceShowMessage.IsRead = 0; mFaceShowMessage.NewsID = null; mFaceShowMessage.NewsType = "立项申请"; mFaceShowMessage.ReadTime = null; mFaceShowMessage.DELFLAG = 0; mFaceShowMessage.ProjectID = project_model.ID; mFaceShowMessage.Receive = DDL_CheckUserList.SelectedValue.ToString(); //mFaceShowMessage.URLS = "<a href='/Admin/personalProjectManage/OAproject/manage.aspx?projectstatus=1' target='_self' title='项目移交:移交时间" + DateTime.Now.ToString() + "'>" + project_model.NAMES.ToString() + " (移交审核)</a>"; mFaceShowMessage.URLS = "<a href='/Admin/SystemProjectManage/ProjectCheck/check.aspx?ID=" + project_model.ID.ToString() + "&pageindex=1&Status=0' target='_self' title='移交审核:移交时间" + DateTime.Now.ToString() + "'>" + project_model.NAMES.ToString() + " 移交审核</a> (" + user_model.REALNAME + ")"; bFaceShowMessage.Add(mFaceShowMessage); //给新的项目审批者发送信息 } //string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!现在进入列表页面\"); location.href = \"manage.aspx?pageindex=" + Request["pageindex"] + "&Status=" + Request["Status"] + "\";</script>"; //Response.Write(coutws); ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入列表页面');javascript:location='manage.aspx?pageindex=" + Request["pageindex"] + "&Status=" + Request["Status"] + "';</script>", false); //添加操作日志 Dianda.BLL.SYS_LogsExt bsyslog = new Dianda.BLL.SYS_LogsExt(); bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "系统项目管理", "审核" + flag + project_model.NAMES + "项目" + ":成功!"); //添加操作日志 } catch { } }
/// <summary> /// /// </summary> protected void InitInfo() { try { bool TnF = false; //判断当前是否是新建资源 string apply = ""; //表示并非从主菜单上点的“资源” if (null == Request["apply"]) { project_model = project_bll.GetModel(Convert.ToInt16(Session["Work_ProjectId"])); //显示项目名称 LB_Project.Text = project_model.NAMES.ToString(); DDL_Project.Visible = false; LB_Project.Visible = true; Control.Visible = true; //Button_viewhistroy.Visible = false; Button_reback.Visible = true; //ordertype.Visible = false } else { DataTable dt_project = (DataTable)Session["Project_Projects"]; apply = Request["apply"]; TnF = true; //ordertype.Visible = true; if (dt_project.Rows.Count > 0) { DDL_Project.Visible = true; LB_Project.Visible = false; for (int i = 0; i < dt_project.Rows.Count; i++) { //项目名称 string projectName = dt_project.Rows[i]["NAMES"].ToString(); //项目ID string projectID = dt_project.Rows[i]["ID"].ToString(); //删除标记 string DELFLAG = dt_project.Rows[i]["DELFLAG"].ToString(); if (DELFLAG.Equals("0"))//只选择Session["Project_Projects"]中没有被删除的项目 { ListItem li = new ListItem(projectName, projectID); DDL_Project.Items.Add(li); if (null != Request["project"] && Request["project"].ToString().Equals(li.Value.ToString())) { li.Selected = true; } } } } Control.Visible = false; //Button_viewhistroy.Visible = true; //如果是从主菜单的“资源汇总”列表页面上点的“新建”,则进入到新增页面是需要保留“返回”按钮的; if (null != Request["order"] && Request["order"].ToString().Equals("orderresource")) { Button_reback.Visible = true; } else { Button_reback.Visible = false; } for (int i = 0; i < DDL_AppType.Items.Count; i++) { if (DDL_AppType.Items[i].Value.ToString().Equals(Request["apply"].ToString())) { DDL_AppType.Items[i].Selected = true; } } } ShowMain(apply, TnF); //部门下拉列表 DataTable dt1 = new DataTable(); string sql1 = " SELECT ID,NAME FROM USER_Groups WHERE (TAGS = '部门') AND (DELFLAG = 0) GROUP BY ID,NAME "; dt1 = pageControl.doSql(sql1).Tables[0]; for (int i = 0; i < dt1.Rows.Count; i++) { string DepartName = dt1.Rows[i]["NAME"].ToString(); string ID = dt1.Rows[i]["ID"].ToString(); ListItem li = new ListItem(DepartName, ID); DDL_Department.Items.Add(li); } //设置部门列表的选定值 Dianda.Model.USER_Users userModel = new Dianda.Model.USER_Users(); userModel = (Model.USER_Users)Session["USER_Users"]; if (userModel.DepartMentID.IndexOf(',') > -1) { DDL_Department.SelectedValue = userModel.DepartMentID.Split(',')[0]; } else { DDL_Department.SelectedValue = userModel.DepartMentID; } //绑定人员列表 DataTable dtuser = new DataTable(); dtuser = pageControl.doSql("select ID,USERNAME,REALNAME from USER_Users where DepartMentID like '%" + DDL_Department.SelectedValue.ToString() + "%' and WorkStats='1' and DELFLAG=0 order by REALNAME ").Tables[0]; if (dtuser.Rows.Count > 0) { User_DPList.Enabled = true; Button_sumbit.Enabled = true; for (int i = 0; i < dtuser.Rows.Count; i++) { string ApplyUserName = dtuser.Rows[i]["REALNAME"].ToString() + "(" + dtuser.Rows[i]["USERNAME"].ToString() + ")"; string ID = dtuser.Rows[i]["ID"].ToString(); ListItem li = new ListItem(ApplyUserName, ID); User_DPList.Items.Add(li); } //设置人员列表的选中值 User_DPList.SelectedValue = userModel.ID; } else { ListItem li = new ListItem("本部门无人员", "0"); User_DPList.Items.Add(li); User_DPList.Enabled = false; Button_sumbit.Enabled = false; } } catch { tag.Text = "初始化页面属性值时发生错误!"; } }