protected void btnDelete_Click(object sender, EventArgs e) { #region 检查 string amount = gridPlanSource.Rows[gridPlanSource.SelectedRowIndex].Values[8].ToString(); if (amount != "0.00") { Alert.ShowInTop("已分解,不能删除", "警告", MessageBoxIcon.Warning); return; } #endregion #region 除 string id = gridPlanSource.DataKeys[gridPlanSource.SelectedRowIndex][0].ToString(); BLL.tb_JH_PlannedSource bllPlannedSource = new BLL.tb_JH_PlannedSource(); bool result = bllPlannedSource.Delete(id); if (result) { Alert.ShowInTop("删除成功", "信息", MessageBoxIcon.Information); BindGrid(); } else { Alert.ShowInTop("删除失败", "错误", MessageBoxIcon.Error); } #endregion }
protected void btnSave_Click(object sender, EventArgs e) { #region 检查 #endregion #region 保存 Model.tb_JH_PlannedSource modelPlannedSource = new Model.tb_JH_PlannedSource(); modelPlannedSource.ID = Request.QueryString["ID"]; modelPlannedSource.BillNO = txbBillNO.Text; modelPlannedSource.BillType = ddlBillType.SelectedValue; modelPlannedSource.MaterialNO = tgbMaterialNO.Text; modelPlannedSource.PlanAmount = Decimal.Parse(nbxPlanAmount.Text); modelPlannedSource.DownAmount = (Decimal)0.00; modelPlannedSource.EndDate = dapEndDate.SelectedDate; modelPlannedSource.Status = "I"; BLL.tb_JH_PlannedSource bllPlannedSource = new BLL.tb_JH_PlannedSource(); bool result = bllPlannedSource.Update(modelPlannedSource); if (result) { Alert.ShowInTop("更新成功!", "信息", MessageBoxIcon.Information, ActiveWindow.GetHidePostBackReference("Main_Modify_Success")); } else { Alert.ShowInTop("更新失败!", "错误", MessageBoxIcon.Error, ActiveWindow.GetHidePostBackReference("Main_Modify_Fail")); } #endregion }
protected void btnAdd_Click(object sender, EventArgs e) { string strWhere = string.Format("ID='{0}'", gridSource.DataKeys[gridSource.SelectedRowIndex][0].ToString()); BLL.tb_JH_PlannedSource bllPlannedSource = new BLL.tb_JH_PlannedSource(); string status = bllPlannedSource.GetList(strWhere).Tables[0].Rows[0]["Status"].ToString(); if (status == "Y") { Alert.ShowInTop("无法新增,您可以选择删除已分解的MPS单", "错误", MessageBoxIcon.Error); return; } else { string url = string.Format("Add.aspx?PlannedSourceID={0}", gridSource.DataKeys[gridSource.SelectedRowIndex][0].ToString()); windowPop.Hidden = false; windowPop.IFrameUrl = url; windowPop.Title = "新增MPS单-" + gridSource.Rows[gridSource.SelectedRowIndex].Values[4]; } }