protected void Button1_Click(object sender, EventArgs e) { WX.PRO.Project.MODEL model = WX.PRO.Project.GetModel("select * from PRO_Projects where ID=" + WX.Request.rProjectId); model.Manage.value = WX.Main.CurUser.UserID; model.Opinion.value = ui_Opinion.Text.Trim(); model.Stime.value = DateTime.Now; if (((Button)sender).ID == "Button1") { model.ProjectName.value = ui_Name.Text.Trim(); model.Days.value = ui_days.Text.Trim(); //model.Fee.value = ui_fee.Text.Trim(); string[] userarry = ui_Persons.Value.Trim().Split(','); model.Persons.value = ui_Persons.Value != null ? userarry.Length : 0; model.State.value = 2; //4.业务处理过程 model.Update(); if (ui_Persons.Value != null) { ULCode.QDA.XSql.Execute("delete from PRO_User where type=1 and pid=" + model.ID.ToString()); for (int i = 0; i < userarry.Length; i++) { WX.PRO.User.MODEL usermodel = WX.PRO.User.NewDataModel(); usermodel.PID.value = model.ID.ToString(); usermodel.type.value = 1; usermodel.UserID.value = userarry[i]; usermodel.Insert(); } } ULCode.QDA.XSql.Execute("delete from PRO_State where ProjID=" + model.ID.ToString()); WX.PRO.State.MODEL statemodel = WX.PRO.State.NewDataModel(); statemodel.ProjID.value = model.ID.value; if (ui_manage.Value != "") { statemodel.Manage.value = ui_manage.Value; } statemodel.Fee.value = ui_fee.Text.Trim(); statemodel.Percnt.value = 0; statemodel.Percnttime.value = 0; statemodel.State.value = 0; statemodel.YJStarttime.value = ui_yjstarttime.Text; statemodel.Insert(); WX.PRO.Process.SetTime(Convert.ToDateTime(statemodel.YJStarttime.ToString()), Convert.ToInt32(statemodel.ProjID.value), 1); //5.登记日志 WX.PRO.Log.AddLog(1, Convert.ToInt32(model.ID.value), "审核通过。审批意见:" + model.Opinion.ToString(), Request.UserHostAddress); } else { model.State.value = 3; model.Update(); WX.PRO.Log.AddLog(1, Convert.ToInt32(model.ID.ToString()), model.ProjectName.ToString() + "的申请被退回。原因:" + model.Opinion.ToString(), Request.UserHostAddress); } //6.返回处理结果或返回其它页面。 Response.Redirect("Proj_ProjectManage.aspx"); }
protected void btnDelete_Command(object sender, CommandEventArgs e) { string Id = e.CommandArgument.ToString(); WX.PRO.Project.MODEL model = WX.PRO.Project.GetModel("select * from PRO_Projects where ID=" + Id); if (e.CommandName == "del") { int row = ULCode.QDA.XSql.Execute("DELETE FROM PRO_Projects WHERE ID=" + Id); ULCode.QDA.XSql.Execute("DELETE FROM PRO_Process WHERE ProjID=" + Id); if (row > 0) { WX.PRO.Log.AddLog(3, Convert.ToInt32(Id), model.ProjectName.ToString() + "-删除项目。", Request.UserHostAddress); } } else if (e.CommandName == "qidong") { model.State.value = 4; model.Update(); WX.PRO.State.MODEL statemodel = WX.PRO.State.GetModel("select * from PRO_State where ProjID=" + model.ID.ToString()); statemodel.State.value = 1; statemodel.ProcID.value = 1; statemodel.Starttime.value = DateTime.Now; statemodel.Update(); WX.PRO.Process.SetTime(Convert.ToDateTime(statemodel.Starttime.value), Convert.ToInt32(statemodel.ProjID.value), 1); WX.PRO.Log.AddLog(2, Convert.ToInt32(Id), model.ProjectName.ToString() + "-启动。", Request.UserHostAddress); WX.PRO.Log.AddLog(5, Convert.ToInt32(Id), model.ProjectName.ToString() + "-第1步开始。", Request.UserHostAddress); } InitComponent(false); }
protected void Button1_Click(object sender, EventArgs e) { //1.验证当前用户页面权限 if (!this.Master.A_Edit) { Response.Write("你没有权限访问此功能!"); Response.End(); return; } //2.取得用户变量 WX.PRO.Project.MODEL model = WX.PRO.Project.NewDataModel(); if (Request["id"] != null) { model = WX.PRO.Project.GetModel("select * from PRO_Projects where ID=" + Request["id"]); } model.ProjectName.value = ui_Name.Text.Trim(); model.Days.value = ui_days.Text.Trim(); model.Fee.value = ui_fee.Text.Trim(); model.Content.value = ui_content.Value.Trim(); string[] userarry = ui_Persons.Value.Trim().Split(','); //4.业务处理过程 model.Persons.value = ui_Persons.Value != null ? userarry.Length : 0; string fileDir = ""; if (FileUpload1.HasFile) { string fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower(); if (!".rar.zip.doc.docx.ppt".Contains(fileExtension)) { ULCode.Debug.Alert(this, "照片格式必须为.rar.zip.doc.docx.ppt!"); return; } fileDir = "/UploadFiles/Proj/" + model.ProjectName.ToString() + DateTime.Now.ToString("-yyyyMMddHHmmss") + fileExtension; try { FileUpload1.SaveAs(Server.MapPath(fileDir)); } catch { fileDir = ""; } } if (fileDir != "") { model.Annex.value = fileDir; } model.Imagine.value = ui_Imagine.Text.Trim(); model.State.value = ((Button)sender).ID == "Button1" ? 0 : 1; int pid = 0; string logstr = model.ProjectName.ToString() + "-添加"; if (Request["id"] != null) { pid = Convert.ToInt32(model.ID.value); logstr = model.ProjectName.ToString() + "-修改"; model.Update(); } else { model.UserID.value = WX.Main.CurUser.UserID; pid = model.Insert(true); } if (ui_Persons.Value != null) { ULCode.QDA.XSql.Execute("delete from PRO_User where type=1 and pid=" + pid); for (int i = 0; i < userarry.Length; i++) { WX.PRO.User.MODEL usermodel = WX.PRO.User.NewDataModel(); usermodel.PID.value = pid; usermodel.type.value = 1; usermodel.UserID.value = userarry[i]; usermodel.Insert(); } } //5.登记日志 WX.PRO.Log.AddLog(0, pid, logstr + (((Button)sender).ID == "Button1" ? "" : "并申请"), Request.UserHostAddress); //6.返回处理结果或返回其它页面。 Response.Redirect("Proj_Project.aspx"); }