protected void gvFileApply_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //鼠标移动到每项时颜色交替效果 e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e"); //设置悬浮鼠标指针形状为"小手" e.Row.Attributes["style"] = "Cursor:hand"; if (!Convert.IsDBNull(gvFileApply.DataKeys[e.Row.RowIndex].Value)) { int fid = Convert.ToInt32(gvFileApply.DataKeys[e.Row.RowIndex].Value); FileApplyInfo fa = new FileApplyInfo(fid); if (fa.State != 0) { Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; Button btnEdit = e.Row.FindControl("btnEdit") as Button; Button btnDelete = e.Row.FindControl("btnDelete") as Button; btnSubmit.Enabled = false; btnEdit.Enabled = false; btnDelete.Enabled = false; } Label lblState = e.Row.FindControl("lblState") as Label; switch (fa.State) { case 0: lblState.Text = "未提交"; break; case 1: lblState.Text = "待部门领导审批"; break; case 2: lblState.Text = "部门:修正"; break; case 3: lblState.Text = "待总经理审批"; break; case 4: lblState.Text = "通过"; break; case 5: lblState.Text = "总经理:修正"; break; default: lblState.Text = "其他状态"; break; } } } }
protected void btnSave_Click(object sender, EventArgs e) { if (UpFile.HasFile) { this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/File/" + UpFile.FileName)); FileOfApplyInfo ffa = new FileOfApplyInfo(); ffa.FileOfName = UpFile.FileName.ToString(); ffa.PhysicalName = UpFile.PostedFile.FileName.ToString(); ffa.Save(); FileApplyInfo fa = new FileApplyInfo(); fa.ApplyName = lblEm.Text.ToString(); fa.ApplyTime = txtTime.Text.ToString(); fa.DepartName = Session["DepartName"].ToString(); fa.DepartView = txtSectionView.Text.ToString(); fa.FileDes = txtFileDes.Text.ToString(); fa.FilesName = txtFileName.Text.ToString(); fa.FileType = txtFileType.Text.ToString(); fa.State = 0; fa.FileOfApplyId = ffa.FileOfApplyId; fa.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('新增成功,确认无误后需要您进一步提交!');</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请上传文件!');</script>"); } }
protected void btnSave_Click(object sender, EventArgs e) { if (rblOver.SelectedIndex == -1) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请选择修正或通过!');</script>"); } else { try { int fid = Convert.ToInt32(Request["FileApplyId"].ToString()); FileApplyInfo fa = new FileApplyInfo(fid); fa.DepartView = txtView.Text.ToString(); if (rblOver.Items[0].Selected) { fa.State = 5; fa.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('您让申请人修正!');</script>"); } else if (rblOver.Items[1].Selected) { fa.State = 4; fa.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('审批通过!');</script>"); } } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('保存失败:" + Ex.Message + "');", true); } } }
protected void gvFileApply_RowDeleting(object sender, GridViewDeleteEventArgs e) { int FileApplyId = Convert.ToInt32(gvFileApply.DataKeys[e.RowIndex].Value); FileApplyInfo.FileApplyDel(FileApplyId); gvDataBind(); }
protected void btnDownLoad_Click(object sender, EventArgs e) { int fid = Convert.ToInt32(Request["FileApplyId"].ToString()); FileApplyInfo fa = new FileApplyInfo(fid); int fileid = Convert.ToInt32(fa.FileOfApplyId); Response.Redirect("DownLoadFile.aspx?fileid=" + fileid); }
protected void btnSubmit_Click(object sender, EventArgs e) { int fid = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); FileApplyInfo fa = new FileApplyInfo(fid); fa.State = 3; fa.Save(); gvDataBind(); }
protected void PageInit() { FileApplyInfo fa = new FileApplyInfo(Convert.ToInt32(Request["FileApplyId"].ToString())); lblDes.Text = fa.FileDes.ToString(); lblEm.Text = fa.ApplyName.ToString(); lblName.Text = fa.FilesName.ToString(); lblTime.Text = fa.ApplyTime.ToString(); lblType.Text = fa.FileType.ToString(); }
protected void PageInit() { ViewState["BackUrl"] = Request.UrlReferrer.ToString(); FileApplyInfo fa = new FileApplyInfo(Convert.ToInt32(Request["FileApplyId"].ToString())); lblEm.Text = fa.ApplyName.ToString(); txtTime.Text = fa.ApplyTime.ToString(); txtSectionView.Text = fa.DepartView.ToString(); txtFileDes.Text = fa.FileDes.ToString(); txtFileName.Text = fa.FilesName.ToString(); txtFileType.Text = fa.FileType.ToString(); }
protected void gvDataBind() { DataTable dt = FileApplyInfo.ManagerGv(); DataView view = dt.DefaultView; string sort = (string)ViewState["SortExpression"] + " " + (string)ViewState["SortDir"]; view.Sort = sort; if (dt.Rows.Count == 0) { dt.Rows.Add(dt.NewRow()); UI.BindCtrl(dt.DefaultView, gvFileApply, AspNetPager1); gvFileApply.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gvFileApply, AspNetPager1); } }
protected void btnSave_Click(object sender, EventArgs e) { if (UpFile.HasFile) { FileApplyInfo fa = new FileApplyInfo(Convert.ToInt32(Request["FileApplyId"].ToString())); FileOfApplyInfo ffa = new FileOfApplyInfo(Convert.ToInt32(fa.FileOfApplyId)); ffa.FileOfName = UpFile.FileName.ToString(); ffa.PhysicalName = UpFile.PostedFile.FileName.ToString(); ffa.Save(); fa.ApplyTime = txtTime.Text.ToString(); fa.DepartView = txtSectionView.Text.ToString(); fa.FileDes = txtFileDes.Text.ToString(); fa.FilesName = txtFileName.Text.ToString(); fa.FileType = txtFileType.Text.ToString(); fa.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('保存成功,确认无误后需要您进一步提交!');</script>"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请重新修改文件名并上传!');</script>"); } }