protected void btnSave_Click(object sender, EventArgs e) { BLL.tb_JH_MPS bllMPS = new BLL.tb_JH_MPS(); #region 检查 #endregion #region 保存 Model.tb_JH_MPS modelMPS = new Model.tb_JH_MPS(); modelMPS.ID = Guid.NewGuid().ToString(); modelMPS.PlannedSourceID = Request.QueryString["PlannedSourceID"].ToString(); modelMPS.PlanNO = txbPlanNO.Text; modelMPS.MaterialNO = txbMaterialNO.Text; modelMPS.PlanAmount = decimal.Parse(nbxPlanAmount.Text); modelMPS.EndDate = dapEndDate.SelectedDate; int result = bllMPS.insertMPS(modelMPS); if (result == 0) { Alert.ShowInTop("添加成功!", "信息", MessageBoxIcon.Information, ActiveWindow.GetHidePostBackReference("Main_Add_Success")); } else if (result == 1) { Alert.ShowInTop("能力不足!", "错误", MessageBoxIcon.Error, ActiveWindow.GetHidePostBackReference("Main_Add_Fail")); } else { Alert.ShowInTop("下达失败!", "错误", MessageBoxIcon.Error, ActiveWindow.GetHidePostBackReference("Main_Add_Fail")); } #endregion }
protected void gridMPS_RowCommand(object sender, FineUI.GridCommandEventArgs e) { if (e.CommandName == "ActionDel") { BLL.tb_JH_MPS bllMPS = new BLL.tb_JH_MPS(); string ID = gridMPS.DataKeys[gridMPS.SelectedRowIndex][0].ToString(); string materialNO = gridMPS.Rows[gridMPS.SelectedRowIndex].Values[4].ToString(); bool result = bllMPS.DeleteMPS(ID, materialNO); if (result) { Alert.ShowInTop("删除成功", "信息", MessageBoxIcon.Information); } else { Alert.ShowInTop("删除失败", "错误", MessageBoxIcon.Error); } } if (e.CommandName == "ActionAssign") { #region 检查 string PlanAmount = gridSource.Rows[e.RowIndex].Values[6].ToString(); string DownAmount = gridSource.Rows[e.RowIndex].Values[7].ToString(); if (PlanAmount == DownAmount) { Alert.ShowInTop("不能重复拆分", "警告", MessageBoxIcon.Warning); return; } #endregion #region 拆分 BLL.tb_JH_MPS bllMPS = new BLL.tb_JH_MPS(); int result = bllMPS.DownMPS(gridSource.DataKeys[e.RowIndex][0].ToString()); if (result == 0) { Alert.ShowInTop("拆分完毕", "信息", MessageBoxIcon.Information); } else if (result == 1) { Alert.ShowInTop("请先拆分日期在前的需求计划", "错误", MessageBoxIcon.Error); } else if (result == 3) { Alert.ShowInTop("能力不足", "错误", MessageBoxIcon.Error); } else { Alert.ShowInTop("拆分失败", "错误", MessageBoxIcon.Error); } #endregion } int selectedIndex = gridSource.SelectedRowIndex; BindGrid(); gridSource.SelectedRowIndex = selectedIndex; BindGridMPS(gridSource.DataKeys[selectedIndex][0].ToString()); }
protected void btnSave_Click(object sender, EventArgs e) { BLL.tb_JH_MPS bllMPS = new BLL.tb_JH_MPS(); #region 检查 #endregion #region 保存 string ID = Request.QueryString["ID"].ToString(); string planNO = txbPlanNO.Text; bool result = bllMPS.updateMPS(ID, planNO); if (result) { Alert.ShowInTop("更新成功!", "信息", MessageBoxIcon.Information, ActiveWindow.GetHidePostBackReference("Main_Modify_Success")); } else { Alert.ShowInTop("更新失败!", "错误", MessageBoxIcon.Error, ActiveWindow.GetHidePostBackReference("Main_Modify_Fail")); } #endregion }