/// <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> /// <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 Button_applyfor_Click(object sender, EventArgs e) { try { string projectName = NAME.Text.ToString(); //检查是否有该项目名称 bool checkName = pagecontrol.Exists_Name("Project_Projects", "NAMES", projectName, "ID", ""); if (checkName) { tag.Text = "该项目名称已经存在,请修改!"; } else { //string content = FCL.UpFile(_FileUp, "/AllFileUp/fileup"); if (FileUpload1.FileName.Length > 2) { string[] content = fileup.UpFile_COMMONS(FileUpload1, "/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; } project_model.Attachments = content[1]; } Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"]; int statusflag = Convert.ToInt32(((Button)sender).CommandArgument.ToString());//获取到触发源 //ID int ids = project_bll.GetMaxId(); project_model.ID = ids; //项目类型 project_model.ProjectType = int.Parse(RL_ProjectType.SelectedValue.ToString()); //项目名称 project_model.NAMES = NAME.Text.ToString(); //删除标记 project_model.DELFLAG = 0; //状态 if (RL_ProjectType.SelectedValue.ToString().Equals("1")) { project_model.Status = statusflag; } else { project_model.Status = 1;//项目状态设置为正常运行的项目 } //项目负责人 //project_model.LeaderID = DDL_LeaderID.SelectedValue.ToString(); if (CheckBox_Newleader.Checked == true) { if (Session["new_leaderid"] != null && Session["new_leaderid"] != "") { project_model.LeaderID = Session["new_leaderid"].ToString(); } else { tag.Text = "未设置项目创建人!无法新建项目!"; return; } } else { string[] Leader = DDL_LeaderID.SelectedValue.ToString().Split('|'); project_model.LeaderID = Leader[0].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_model.StartTime = Convert.ToDateTime(TB_StartTime.Value.ToString()); //项目预计结束时间 project_model.EndTime = Convert.ToDateTime(TB_EndTime.Value.ToString()); //预计经费 if (RL_ProjectType.SelectedValue.ToString().Equals("1"))//当项目类型为正常项目时才有预计经费项 { //审核的用户ID project_model.DoUserID = DDL_CheckUserID.SelectedValue.ToString(); if (!CashTotal.Text.ToString().Equals("")) { 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 { //审核的用户ID project_model.DoUserID = ""; } //资金卡选择 project_model.CashCardID = 0; //if (RB_CashCardID.Checked == true)//如果选择的是资金卡则设为资金卡的ID; //{ // project_model.CashCardID = Int16.Parse(DDL_CashCardID.SelectedValue.ToString()); //} //else//如果选择的是新建资金卡则设为0,并且需要向cash_message表中加一条记录 //{ // project_model.CashCardID = 0; // //资金卡名称(暂时写的留空) // 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()); //申请的用户的ID project_model.SendUserID = user_model.ID; //所属分类 project_model.ColumnsID = int.Parse(DDL_COLUMN.SelectedValue); //向项目表中添加 project_bll.Add(project_model); //******************在项目申请成功以后将项目负责人默认为项目组成员,即向Project_UserList加条记录 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 = ids; // 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); //再将项目的创建者添加到项目组成员列表中--唐春龙2011-02-17 project_userlist_model.ProjectID = ids; project_userlist_model.UserID = project_model.SendUserID.ToString(); project_userlist_model.Status = 1; project_userlist_model.DATETIME = DateTime.Now; project_userlist_bll.Add(project_userlist_model); //******************在项目申请成功以后要根据所选择的项目审批人,将此项目发送给这个人,即向Project_ShenheList加条记录 //如果项目类型是“正常项目”才做如下操作 if (RL_ProjectType.SelectedValue.ToString().Equals("1")) { Dianda.BLL.Project_ShenheList Shenhe_bll = new Dianda.BLL.Project_ShenheList(); Dianda.Model.Project_ShenheList Shenhe_model = new Dianda.Model.Project_ShenheList(); //ID Shenhe_model.ID = Shenhe_bll.GetMaxId(); //需要审核的项目ID Shenhe_model.ProjectID = project_model.ID; //审核人的ID Shenhe_model.UserID = DDL_CheckUserID.SelectedValue.ToString(); //审核状态(新建默认时默认为0:待审核) Shenhe_model.Status = 0; //是否到当前的用户审核:0表示未到;1表示到;2表示已经审核过 Shenhe_model.Isturn = 1; //审核意见 Shenhe_model.Infors = ""; //向Project_ShenheList加条记录 Shenhe_bll.Add(Shenhe_model); } // ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入我的项目页面');javascript:location='manage.aspx?projecttype=4&projectStatus=0';</script>", false); if (statusflag == 4) { ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入立项草稿箱页面');javascript:location='manage.aspx?projectStatus=4';</script>", false); } else { if (RL_ProjectType.SelectedValue.ToString().Equals("0"))//临时项目 { ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入我的项目页面');javascript:location='manage.aspx?projectStatus=1';</script>", false); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "ok", "<script>alert('操作成功!现在进入我的项目页面');javascript:location='manage.aspx?projectStatus=0';</script>", false); } } //清空Session new_leaderid Session["new_leaderid"] = ""; //添加操作日志 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; //添加立项申请的前台提醒信息 mFaceshowMessage.DATETIME = DateTime.Now; mFaceshowMessage.FromTable = "立项申请"; mFaceshowMessage.IsRead = 0; mFaceshowMessage.NewsType = "立项申请"; mFaceshowMessage.Receive = project_model.DoUserID.ToString(); mFaceshowMessage.DELFLAG = 0; mFaceshowMessage.ProjectID = project_model.ID; mFaceshowMessage.URLS = "<a href='/Admin/SystemProjectManage/ProjectCheck/check.aspx?ID=" + ids.ToString() + "&pageindex=1&Status=0' target='_self' title='新建项目:提交时间" + DateTime.Now.ToString() + "'>新建项目:" + NAME.Text.ToString() + "</a> (" + user_model.REALNAME + ")"; bFaceshowMessage.Add(mFaceshowMessage); //如果是个人或者是临时项目的话,就没有审批一环了。所以就直接在创建项目时建一个档案目录 if (RL_ProjectType.SelectedValue.ToString().Equals("0")) { //项审批成功以后,要向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 = ids; //栏目显示的顺序 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); } } } catch { tag.Text = "立项过程中发生错误,请检查输入项是否正确!"; } }