protected void gvOffice_RowDeleting(object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(gvOffice.DataKeys[e.RowIndex].Value); WorkToolSumInfo.DelWt(id); gvDataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int wtid = Convert.ToInt32(Request["OfficeApplyId"].ToString()); WorkToolSumInfo wt = new WorkToolSumInfo(wtid); wt.ManagerView = txtManagerView.Text.ToString(); if (rblOver.Items[0].Selected) { wt.State = 5; wt.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('您让申请人修正!');</script>"); } else if (rblOver.Items[1].Selected) { wt.State = 4; wt.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 gvOffice_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(gvOffice.DataKeys[e.Row.RowIndex].Value)) { int id = Convert.ToInt32(gvOffice.DataKeys[e.Row.RowIndex].Value); WorkToolSumInfo wt = new WorkToolSumInfo(id); if (wt.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 (wt.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 btnSubmit_Click(object sender, EventArgs e) { int id = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); WorkToolSumInfo wt = new WorkToolSumInfo(id); wt.State = 3; wt.ApplyTime = DateTime.Now.ToString(); wt.Save(); gvDataBind(); }
protected void PageInit() { int wtid = Convert.ToInt32(Request["OfficeApplyId"].ToString()); WorkToolSumInfo wt = new WorkToolSumInfo(wtid); txtFuTime.Text = wt.FuTime.ToString(); txtUseDepart.Text = wt.UseDepartName.ToString(); txtBigMoney.Text = wt.BigMoney.ToString(); txtFuMoney.Text = wt.MoneyStyle.ToString(); txtReason.Text = wt.Reason.ToString(); txtSmallMoney.Text = wt.SmaMoney.ToString(); lblBanDepart.Text = wt.DepartName.ToString(); lblJieDepart.Text = wt.DepartName.ToString(); lblJinEmployee.Text = wt.ApplyName.ToString(); }
protected void gvDataBind() { DataTable dt = WorkToolSumInfo.getList(); 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, gvOffice, AspNetPager1); gvOffice.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gvOffice, AspNetPager1); } }
protected void btnSave_Click(object sender, EventArgs e) { try { int wtid = Convert.ToInt32(Request["OfficeApplyId"].ToString()); WorkToolSumInfo wt = new WorkToolSumInfo(wtid); wt.FuTime = txtFuTime.Text.ToString(); wt.UseDepartName = txtUseDepart.Text.ToString(); wt.Reason = txtReason.Text.ToString(); wt.BigMoney = txtBigMoney.Text.ToString(); wt.SmaMoney = txtSmallMoney.Text.ToString(); wt.MoneyStyle = txtFuMoney.Text.ToString(); wt.DepartView = txtDepartView.Text.ToString(); wt.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 btnSave_Click(object sender, EventArgs e) { try { WorkToolSumInfo wt = new WorkToolSumInfo(); wt.DepartName = Session["DepartName"].ToString(); wt.ApplyName = Session["EmployeeName"].ToString(); wt.State = 0; wt.FuTime = txtFuTime.Text.ToString(); wt.UseDepartName = txtUseDepart.Text.ToString(); wt.Reason = txtReason.Text.ToString(); wt.BigMoney = txtBigMoney.Text.ToString(); wt.SmaMoney = txtSmallMoney.Text.ToString(); wt.MoneyStyle = txtFuMoney.Text.ToString(); wt.DepartView = txtDepartView.Text.ToString(); wt.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('Ìí¼Ó³É¹¦£¡');</script>"); } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('Ìí¼Óʧ°Ü£º" + Ex.Message + "');", true); } }