//选择随工单 protected void Button1_Com(object sender, EventArgs e) { bool temp = false; string Pname = ""; bool bl = false; Guid gd = new Guid(Label_SchduleID.Text.ToString()); DataSet ds = pl.SelectPRMProjectSchedule_One(gd); DataTable dt = ds.Tables[0]; string str = ""; if (dt.Rows.Count > 0) { str = dt.Rows[0][4].ToString(); } string[] sArray = Regex.Split(str, ";", RegexOptions.IgnoreCase); foreach (GridViewRow item in Gridview_WorkOrder.Rows) { CheckBox cb = item.FindControl("CheckBox1") as CheckBox; if (cb.Checked) { foreach (string i in sArray) { if (Gridview_WorkOrder.DataKeys[item.RowIndex].Value.ToString() == i) { bl = true; ScriptManager.RegisterClientScriptBlock(UpdatePanel_WorkOrder, GetType(), "aa", "alert('已重复选择随工单!')", true); return; } } if (!bl) { Pname += Gridview_WorkOrder.DataKeys[item.RowIndex].Value.ToString() + ";"; temp = true; Label_Pname.Text = Pname; } } } TextBox10.Text = TextBox10.Text + Label_Pname.Text.ToString(); UpdatePanel_Pschedule.Update(); if (!temp) { ScriptManager.RegisterClientScriptBlock(UpdatePanel_WorkOrder, GetType(), "aa", "alert('请选择随工单')", true); return; } else { TextBox12.Text = ""; TextBox_SPTime2.Text = ""; TextBox13.Text = ""; Panel3.Visible = false; UpdatePanel3.Update(); Panel_WorkOrder.Visible = false; UpdatePanel_WorkOrder.Update(); } }
protected void Button_Cancel(object sender, EventArgs e) { Panel_Pschedule.Visible = false; UpdatePanel_Pschedule.Update(); Panel3.Visible = false; UpdatePanel3.Update(); Panel_WorkOrder.Visible = false; UpdatePanel_WorkOrder.Update(); }
protected void Button1_Fox(object sender, EventArgs e) { string fileExrensio = Path.GetExtension(FileUpload1.FileName).ToLower(); //ToLower转化为小写,获得扩展名 string UploadURL = Server.MapPath("~/file/"); //上传的目录 string fullname = FileUpload1.FileName; //上传文件的原名 string newname = DateTime.Now.ToString("yyyyMMddhhmmss"); //上传文件重命名 if (FileUpload1.PostedFile.FileName != "" || FileUpload1.PostedFile.FileName != null) { if (fileExrensio == ".doc" || fileExrensio == ".docx" || fileExrensio == ".pdf" || fileExrensio == ".xls" || fileExrensio == ".xlsx" || fileExrensio == ".txt" || fileExrensio == ".ppt" || fileExrensio == ".pptx" || fileExrensio == ".rar" || fileExrensio == ".zip" || fileExrensio == ".bmp" || fileExrensio == ".jpg" || fileExrensio == ".gif")//判断文件扩展名 { try { if (!Directory.Exists(UploadURL)) //判断文件夹是否已经存在 { Directory.CreateDirectory(UploadURL); //创建文件夹 } FileUpload1.PostedFile.SaveAs(UploadURL + newname + fullname); //保存上传的文件 } catch { ScriptManager.RegisterClientScriptBlock(UpdatePanel_Pschedule, GetType(), "aa", "alert('上传失败!')", true); return; } } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_Pschedule, GetType(), "aa", "alert('不支持此文件格式!')", true); return; } string filePath = "file/" + newname + fullname; if (TextBox14.Text == "" || TextBox15.Text == "" || FileUpload1.PostedFile.FileName == "" || FileUpload1.PostedFile.FileName == null) { ScriptManager.RegisterClientScriptBlock(UpdatePanel4, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } else { label_AccNum.Text = TextBox14.Text.ToString(); label_AccName.Text = TextBox15.Text.ToString(); Label_FilePath.Text = filePath;//相对路径 LabelQ_SaveDirectory.Text = "上传"; PRMProjectinfo.PRMP_ID = new Guid(label_projectid.Text); BindGridview2(PRMProjectinfo); ClosePanel(); UpdatePanel4.Update(); Panel_Pschedule.Visible = true; UpdatePanel_Pschedule.Update(); } } }
//关闭进度表 protected void ButtonPClose(object sender, EventArgs e) { Panel2.Visible = false; UpdatePanel2.Update(); Panel_Postpone.Visible = false; UpdatePanel_Postpone.Update(); Panel_Pschedule.Visible = false; UpdatePanel_Pschedule.Update(); Panel3.Visible = false; UpdatePanel3.Update(); Panel_WorkOrder.Visible = false; UpdatePanel_WorkOrder.Update(); Panel1.Visible = false; UpdatePanel1.Update(); }
//检索项目 protected void Button1_Sh(object sender, EventArgs e) { string Condition = GetCondition(); BindGridView_Projectinfo(Condition); Panel_ProjectInfo.Visible = true; UpdatePanel_ProjectInfo.Update(); Panel2.Visible = false; UpdatePanel2.Update(); Panel_Postpone.Visible = false; UpdatePanel_Postpone.Update(); Panel_Pschedule.Visible = false; UpdatePanel_Pschedule.Update(); Panel3.Visible = false; UpdatePanel3.Update(); Panel_WorkOrder.Visible = false; UpdatePanel_WorkOrder.Update(); Panel1.Visible = false; UpdatePanel1.Update(); }
protected void Page_Load(object sender, EventArgs e) { if (!((Session["UserRole"].ToString().Contains("项目进度维护")))) { Response.Redirect("~/Default.aspx"); } ClosePanel(); UpdatePanel_Pschedule.Update(); if (!IsPostBack) { Title = "项目进度维护"; Gridview_ProjectInfo.Columns[9].Visible = false; //this.Panel_ProjectSearch.Visible = true; string condition = " and PRMP_ProjectStates='" + "进度设置完成" + "'" + " or PRMP_ProjectStates='" + "进行中" + "'" + " or PRMP_ProjectStates='" + "进度延期" + "'"; BindGridView_Projectinfo(condition); Panel_ProjectInfo.Visible = true; //this.UpdatePanel_ProjectInfo.Update(); //try //{ //} //catch (Exception) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "alert", "alert('可能您没有权限操作和查看本页面,请退出选择其他账号登陆,或联系管理员!')", true); // Response.Redirect("~/Default.aspx"); //} label_pagestate.Text = Request.QueryString["state"]; string state = label_pagestate.Text; if (state == "Look") { Title = "项目进度查看"; Gridview_ProjectInfo.Columns[10].Visible = false;//进度维护 Gridview_ProjectInfo.Columns[9].Visible = true; } } }
//项目进度表 protected void Gridview2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Lay")//延期 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview2.SelectedIndex = row.RowIndex; Label_SchduleID.Text = e.CommandArgument.ToString(); Guid gd = new Guid(Label_SchduleID.Text.ToString()); DataSet ds = pl.SelectPRMProjectSchedule_One(gd); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { TextBox6.Text = dt.Rows[0][5].ToString(); } TextBox4.Text = Gridview2.Rows[row.RowIndex].Cells[2].Text.ToString().Trim().Replace(" ", ""); //this.TextBox2.Text = this.Gridview_ProjectInfo.Rows[row.RowIndex].Cells[1].Text.ToString().Trim().Replace(" ", ""); TextBox3.Text = Gridview2.Rows[row.RowIndex].Cells[1].Text.ToString().Trim().Replace(" ", ""); TextBox5.Text = Gridview2.Rows[row.RowIndex].Cells[10].Text.ToString().Trim().Replace(" ", ""); //this.TextBox6.Text = this.Gridview2.Rows[row.RowIndex].Cells[10].Text.ToString().Trim().Replace(" ", ""); Panel_Postpone.Visible = true; UpdatePanel_Postpone.Update(); Panel_Pschedule.Visible = false; UpdatePanel_Pschedule.Update(); Panel1.Visible = false; UpdatePanel1.Update(); Panel3.Visible = false; UpdatePanel3.Update(); Panel_WorkOrder.Visible = false; UpdatePanel_WorkOrder.Update(); } if (e.CommandName == "Protect")//维护 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview2.SelectedIndex = row.RowIndex; Label_SchduleID.Text = e.CommandArgument.ToString(); Guid gd = new Guid(Label_SchduleID.Text.ToString()); DataSet ds = pl.SelectPRMProjectSchedule_One(gd); DataTable dt = ds.Tables[0]; Panel_Pschedule.Visible = true; if (dt.Rows.Count > 0) { TextBox10.Text = dt.Rows[0][4].ToString(); TextBox11.Text = dt.Rows[0][6].ToString(); label_AccNum.Text = dt.Rows[0][7].ToString(); label_AccName.Text = dt.Rows[0][8].ToString(); Label_FilePath.Text = dt.Rows[0][9].ToString(); if (Label_FilePath.Text.ToString() != "") { LabelQ_SaveDirectory.Text = "上传"; } } TextBox7.Text = Gridview2.Rows[row.RowIndex].Cells[2].Text.ToString().Replace(" ", ""); TextBox8.Text = Gridview_ProjectInfo.Rows[Gridview_ProjectInfo.SelectedIndex].Cells[1].Text.ToString().Replace(" ", ""); TextBox9.Text = Gridview2.Rows[row.RowIndex].Cells[1].Text.ToString().Replace(" ", ""); DropDownList3.SelectedValue = Gridview2.Rows[row.RowIndex].Cells[5].Text.ToString().Replace(" ", ""); //this.TextBox14.Text = this.Gridview2.Rows[row.RowIndex].Cells[11].Text.ToString().Replace(" ", ""); //this.TextBox15.Text = this.Gridview2.Rows[row.RowIndex].Cells[12].Text.ToString().Replace(" ", ""); //this.TextBox10.Text = this.Gridview2.Rows[row.RowIndex].Cells[6].Text.ToString().Replace(" ", ""); //this.TextBox11.Text = this.Gridview2.Rows[row.RowIndex].Cells[5].Text.ToString().Replace(" ", ""); //ShowPanel(); UpdatePanel_Pschedule.Update(); Panel_Postpone.Visible = false; UpdatePanel_Postpone.Update(); Panel1.Visible = false; UpdatePanel1.Update(); } if (e.CommandName == "Look")//附件证明查看 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview2.SelectedIndex = row.RowIndex; Label_SchduleID.Text = e.CommandArgument.ToString(); } if (e.CommandName == "Follow")//随工单跟踪 { GridViewRow row = ((LinkButton)e.CommandSource).Parent.Parent as GridViewRow; Gridview2.SelectedIndex = row.RowIndex; Label_SchduleID.Text = e.CommandArgument.ToString(); string item = ""; Guid gd = new Guid(Label_SchduleID.Text.ToString()); DataSet ds = pl.SelectPRMProjectSchedule_One(gd); DataTable dt = ds.Tables[0]; string str = ""; if (dt.Rows.Count > 0) { str = dt.Rows[0][4].ToString(); } string[] sArray = Regex.Split(str, ";", RegexOptions.IgnoreCase); for (int i = 0; i < sArray.Length; i++) { if (i == 0) { item = "and WO_Num='" + sArray[0] + "'"; } else { item += " or WO_Num='" + sArray[i] + "'"; } } labelcondition.Text = item; BindGridview1(labelcondition.Text); Panel1.Visible = true; UpdatePanel1.Update(); Panel_Postpone.Visible = false; UpdatePanel_Postpone.Update(); Panel_Pschedule.Visible = false; UpdatePanel_Pschedule.Update(); Panel3.Visible = false; UpdatePanel3.Update(); Panel_WorkOrder.Visible = false; UpdatePanel_WorkOrder.Update(); } }
//protected void Button1_TJ(object sender, EventArgs e) //{ // ClosePanel(); // // ShowPanel(); //} //进度填写提交 protected void Button1_TJWH(object sender, EventArgs e) { if (DropDownList3.Text.ToString() != "请选择") { PRMProjectinfo.PRMPS_ScheduleFinish = DropDownList3.SelectedValue.ToString(); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_Pschedule, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox10.Text.ToString() != "") { PRMProjectinfo.PRMPS_WorkOrderNum = TextBox10.Text.ToString(); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_Pschedule, typeof(Page), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } if (TextBox11.Text.ToString() != "") { PRMProjectinfo.PRMPS_ProcessCondition = TextBox11.Text.ToString(); } else { ScriptManager.RegisterClientScriptBlock(UpdatePanel_Pschedule, GetType(), "aa", "alert('标记*的为必填项,请填写完整!')", true); return; } // //ok_upload_Click(); Guid gd = new Guid(Label_SchduleID.Text); PRMProjectinfo.PRMPS_ID = gd; if (LabelQ_SaveDirectory.Text != "上传") { PRMProjectinfo.PRMPS_Accessory = "否"; PRMProjectinfo.PRMPS_AccNum = ""; PRMProjectinfo.PRMPS_AccName = ""; } else if (LabelQ_SaveDirectory.Text == "上传") { PRMProjectinfo.PRMPS_Accessory = "是"; PRMProjectinfo.PRMPS_AccNum = label_AccNum.Text.ToString(); PRMProjectinfo.PRMPS_AccName = label_AccName.Text.ToString(); } PRMProjectinfo.PRMPS_AccessoryPath = Label_FilePath.Text; PRMProjectinfo.PRMPS_ProcessMan = Session["UserName"].ToString().Trim(); ppm.InsertPRMProject_Schedule(PRMProjectinfo); Guid lp = new Guid(label_projectid.Text.ToString()); PRMProjectinfo.PRMP_ID = lp; BindGridview2(PRMProjectinfo); int i = 0; bool lio = false; foreach (GridViewRow item in Gridview2.Rows) { if (item.Cells[5].Text == "是") { i++; } if (item.Cells[9].Text == "是") { lio = true; } } if (i == Gridview2.Rows.Count) { prp.UpdatePRMP_ProjectStates(lp, "已完成"); } else if (lio) { prp.UpdatePRMP_ProjectStates(lp, "进度延期"); } else if (!lio) { prp.UpdatePRMP_ProjectStates(lp, "进行中"); } BindGridview2(PRMProjectinfo); UpdatePanel2.Update(); string condition = " and PRMP_ProjectStates='" + "进度设置完成" + "'" + " or PRMP_ProjectStates='" + "进行中" + "'" + " or PRMP_ProjectStates='" + "进度延期" + "'" + " or PRMP_ProjectStates='" + "已完成" + "'"; BindGridView_Projectinfo(condition); UpdatePanel_ProjectInfo.Update(); TextBox7.Text = ""; TextBox8.Text = ""; TextBox9.Text = ""; TextBox14.Text = ""; TextBox15.Text = ""; TextBox10.Text = ""; TextBox11.Text = ""; DropDownList3.SelectedValue = "请选择"; Panel_Pschedule.Visible = false; UpdatePanel_Pschedule.Update(); PRMProjectinfo.PRMP_ID = new Guid(label_projectid.Text); BindGridview2(PRMProjectinfo); UpdatePanel2.Update(); string condition1 = " and PRMP_ProjectStates='" + "进度设置完成" + "'" + " or PRMP_ProjectStates='" + "进行中" + "'" + " or PRMP_ProjectStates='" + "进度延期" + "'" + " or PRMP_ProjectStates='" + "已完成" + "'"; BindGridView_Projectinfo(condition1); UpdatePanel_ProjectInfo.Update(); Panel3.Visible = false; UpdatePanel3.Update(); Panel_WorkOrder.Visible = false; UpdatePanel_WorkOrder.Update(); //this.LabelQ_SaveDirectory.Text = ""; //this.Label_FilePath.Text = ""; }