protected void gvSelectedFeeList_RowUpdating(object sender, GridViewUpdateEventArgs e) { TextBox tbOrderNO = (TextBox)this.gvSelectedFeeList.Rows[e.RowIndex].FindControl("tbOrderNO"); TextBox tbReportFeeName = (TextBox)this.gvSelectedFeeList.Rows[e.RowIndex].FindControl("tbReportFeeName"); String OrderNO = tbOrderNO.Text.Trim(); String ReportFeeName = tbReportFeeName.Text; if (string.IsNullOrEmpty(OrderNO) || !StrHelper.IsValidDecimal(OrderNO)) { base.MessageBox("排序必须为数字!"); tbOrderNO.Focus(); return; } if (string.IsNullOrEmpty(ReportFeeName)) { base.MessageBox("请填写报表列名!"); tbReportFeeName.Focus(); return; } ReportFee reportFeeInfo = ReportInfoAdapter.Instance.LoadReportFee(this.reportID, this.gvSelectedFeeList.DataKeys[e.RowIndex][ReportFeeConst.FeeID].ToString()); reportFeeInfo.OrderNo = Int32.Parse(OrderNO); reportFeeInfo.ReportFeeName = ReportFeeName; ReportInfoAdapter.Instance.UpdateReportFee(reportFeeInfo); this.gvSelectedFeeList.EditIndex = -1; this.GridViewDataBind(); }
protected void gvTaxList_RowUpdating(object sender, GridViewUpdateEventArgs e) { TextBox tbQuantumStart = (TextBox)this.gvTaxList.Rows[e.RowIndex].FindControl("tbQuantumStart"); TextBox tbQuantumEnd = (TextBox)this.gvTaxList.Rows[e.RowIndex].FindControl("tbQuantumEnd"); TextBox tbRate = (TextBox)this.gvTaxList.Rows[e.RowIndex].FindControl("tbRate"); TextBox tbSubtract = (TextBox)this.gvTaxList.Rows[e.RowIndex].FindControl("tbSubtract"); TextBox tbSubtractMultiple = (TextBox)this.gvTaxList.Rows[e.RowIndex].FindControl("tbSubtractMultiple"); TextBox tbSubtractMoney = (TextBox)this.gvTaxList.Rows[e.RowIndex].FindControl("tbSubtractMoney"); string quantumStart = tbQuantumStart.Text, quantumEnd = tbQuantumEnd.Text, rate = tbRate.Text , subtract = tbSubtract.Text, subtractMultiple = tbSubtractMultiple.Text, subtractMoney = tbSubtractMoney.Text; if (string.IsNullOrEmpty(quantumStart.Trim()) || !StrHelper.IsValidDecimal(quantumStart)) { base.MessageBox("应税额必须为数字!"); tbQuantumStart.Focus(); return; } if (string.IsNullOrEmpty(quantumEnd.Trim()) || !StrHelper.IsValidDecimal(quantumEnd)) { base.MessageBox("应税额必须为数字!"); tbQuantumEnd.Focus(); return; } if (string.IsNullOrEmpty(rate.Trim()) || !StrHelper.IsValidDecimal(rate)) { base.MessageBox("税率必须为数字!"); tbRate.Focus(); return; } if (string.IsNullOrEmpty(subtract.Trim()) || !StrHelper.IsValidDecimal(subtract)) { base.MessageBox("速算扣除数必须为数字!"); tbSubtract.Focus(); return; } if (string.IsNullOrEmpty(subtractMultiple.Trim()) || !StrHelper.IsValidDecimal(subtractMultiple)) { base.MessageBox("速算扣除数倍数必须为数字!"); tbSubtractMultiple.Focus(); return; } if (string.IsNullOrEmpty(subtractMoney.Trim()) || !StrHelper.IsValidDecimal(subtractMoney)) { base.MessageBox("扣除金额必须为数字!"); tbSubtractMoney.Focus(); return; } TaxInfo taxInfo; string taxID = this.gvTaxList.DataKeys[e.RowIndex][TaxInfoConst.TaxID].ToString(); if (taxID == "") { taxInfo = String.IsNullOrEmpty(yearMonth) ? new TaxInfo() : new TaxMonthInfo(yearMonth); taxInfo.TaxID = Guid.NewGuid().ToString(); taxInfo.FeeID = feeID; taxInfo.FeeName = this.tbFeeName.Text; } else { taxInfo = TaxInfoAdapter.Instance.LoadTaxInfo(yearMonth, taxID); } taxInfo.QuantumStart = Decimal.Parse(quantumStart); taxInfo.QuantumEnd = Decimal.Parse(quantumEnd); taxInfo.Rate = Decimal.Parse(rate); taxInfo.Subtract = Decimal.Parse(subtract); taxInfo.SubtractMultiple = Decimal.Parse(subtractMultiple); taxInfo.SubtractMoney = Decimal.Parse(subtractMoney); if (taxID == "") { TaxInfoAdapter.Instance.InsertTaxInfo(taxInfo); } else { TaxInfoAdapter.Instance.UpdateTaxInfo(taxInfo); } base.MessageBox("税率保存成功!"); this.gvTaxList.EditIndex = -1; this.TaxGridViewDataBind(false);//this.btnAdd.Enabled = true; ImageButton ibtnAdd = this.gvTaxList.HeaderRow.FindControl("ibtnAdd") as ImageButton; ibtnAdd.Enabled = true; }
protected void gvBaseList_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridView gvList = (GridView)sender; TextBox tbFeeValue = (TextBox)gvList.Rows[e.RowIndex].FindControl("tbFeeValue"); string feeValue = tbFeeValue.Text.Trim().Equals(String.Empty) || tbFeeValue.Text.Trim().Equals(".00") ? "0" : tbFeeValue.Text.Trim(); if (!StrHelper.IsValidDecimal(feeValue)) { base.MessageBox("工资项目值必须为数字!"); tbFeeValue.Focus(); return; } ////Decimal oldFeeValue = Decimal.Parse(gv.DataKeys[e.RowIndex]["FeeValue"].ToString()); Decimal newFeeValue = Decimal.Parse(feeValue.Trim()); PersonBaseFeeInfo personBaseFeeInfo = String.IsNullOrEmpty(this.yearMonth) ? new PersonBaseFeeInfo() : new PersonBaseFeeMonthInfo(this.yearMonth); personBaseFeeInfo.PersonID = personID; personBaseFeeInfo.PersonName = this.tbPersonName.Text; personBaseFeeInfo.FeeValue = newFeeValue; personBaseFeeInfo.FeeID = gvList.DataKeys[e.RowIndex][PersonBaseFeeInfoConst.FeeID].ToString(); personBaseFeeInfo.FeeName = gvList.DataKeys[e.RowIndex][PersonBaseFeeInfoConst.FeeName].ToString(); if (gvList.ID == "gvCooperateList") { DropDownList ddlDepartment = (DropDownList)gvList.Rows[e.RowIndex].FindControl("ddlDepartment"); DropDownList ddlProject = (DropDownList)gvList.Rows[e.RowIndex].FindControl("ddlProject"); if (ddlDepartment.SelectedIndex == 0 && newFeeValue > 0) { base.MessageBox("请选择相关部门!"); ddlDepartment.Focus(); return; } if (ddlProject.SelectedIndex == 0 && newFeeValue > 0) { base.MessageBox("请选择相关项目!"); ddlProject.Focus(); return; } personBaseFeeInfo.DepartmentID = ddlDepartment.SelectedValue; personBaseFeeInfo.DepartmentName = ddlDepartment.SelectedIndex > 0?ddlDepartment.SelectedItem.Text:String.Empty; personBaseFeeInfo.ProjectID = ddlProject.SelectedValue; personBaseFeeInfo.ProjectName = ddlProject.SelectedIndex > 0 ? ddlProject.SelectedItem.Text : String.Empty; } PersonBaseFeeInfoAdapter.Instance.UpdatePersonBaseFeeInfo(personBaseFeeInfo); //base.MessageBox("工资项目保存成功!"); gvList.EditIndex = -1; switch (gvList.ID) { case "gvCommonList": this.BaseGridViewDataBind(gvList, CommonFeeType.CommonSalary); break; case "gvPositionList": this.BaseGridViewDataBind(gvList, CommonFeeType.Position); break; case "gvFloatList": this.BaseGridViewDataBind(gvList, CommonFeeType.Float); break; case "gvCooperateList": this.BaseGridViewDataBind(gvList, CommonFeeType.Cooperate); break; case "gvVirtualList": this.BaseGridViewDataBind(gvList, CommonFeeType.Virtual); break; case "gvServiceList": this.BaseGridViewDataBind(gvList, CommonFeeType.Service); break; } }