protected void btnDelete_Click(object sender, EventArgs e) { BLL.tb_JC_Material_B bllMaterial_B = new BLL.tb_JC_Material_B(); string id = gridMaterial.DataKeys[gridMaterial.SelectedRowIndex][0].ToString(); Model.tb_JC_Material_B modelMaterial_B = bllMaterial_B.GetModel(id); modelMaterial_B.Status = "N"; bool result = bllMaterial_B.Update(modelMaterial_B); if (result) { Alert.ShowInTop("删除成功", "信息", MessageBoxIcon.Information); BindGrid(); } else { Alert.ShowInTop("删除失败", "错误", MessageBoxIcon.Error); } }
protected void btnSave_Click(object sender, EventArgs e) { #region 检查 #endregion #region 保存 Model.tb_JC_Material_B modelMaterial_B = new Model.tb_JC_Material_B(); modelMaterial_B.ID = Request.QueryString["id"].ToString(); modelMaterial_B.MaterialNO = txbMaterialNO.Text; modelMaterial_B.MaterialName = txbMaterialName.Text; modelMaterial_B.Specification = txbSpecification.Text; modelMaterial_B.Model = txbModel.Text; modelMaterial_B.Property = ddlPropertyName.SelectedValue; modelMaterial_B.Unit = txbUnit.Text; modelMaterial_B.UnitStandardCost = decimal.Parse(nbxUnitStandardCost.Text); modelMaterial_B.FixedLeadTime = int.Parse(nbxFixedLeadTime.Text); modelMaterial_B.VariableLeadTime = int.Parse(nbxVariableLeadTime.Text); modelMaterial_B.VariableBatch = int.Parse(nbxVariableBatch.Text); modelMaterial_B.Status = "Y"; BLL.tb_JC_Material_B bllMaterial_B = new BLL.tb_JC_Material_B(); bool result = bllMaterial_B.Update(modelMaterial_B); Model.tb_JC_Material_P modelMaterial_P = new Model.tb_JC_Material_P(); modelMaterial_P.ID = modelMaterial_B.ID; modelMaterial_P.MaterialNO = modelMaterial_B.MaterialNO; modelMaterial_P.UnitStandardTime = decimal.Parse(nbxUnitStandardTime.Text); modelMaterial_P.ProcessRouteNO = tgbProcessRouteNO.Text; modelMaterial_P.ProductionVolume = decimal.Parse(nbxProductionVolume.Text); modelMaterial_P.IncreaseAmount = decimal.Parse(nbxIncreaseAmount.Text); BLL.tb_JC_Material_P bllMaterial_P = new BLL.tb_JC_Material_P(); result = result && bllMaterial_P.Update(modelMaterial_P); if (result) { Alert.ShowInTop("更新成功!", "信息", MessageBoxIcon.Information, ActiveWindow.GetHidePostBackReference("Main_Modify_Success")); } else { Alert.ShowInTop("更新失败!", "错误", MessageBoxIcon.Error, ActiveWindow.GetHidePostBackReference("Main_Modify_Fail")); } #endregion }
//Grid绑定数据源 private void BindGrid() { StringBuilder strWhere = new StringBuilder("1=1"); if (Request.QueryString["Type"] != null) { string[] except = Request.QueryString["Type"].Split('_'); strWhere.Append(" and Property not in ("); foreach (string item in except) { strWhere.Append("'").Append(item).Append("',"); } strWhere.Remove(strWhere.Length - 1, 1).Append(")"); } BLL.tb_JC_Material_B bllMaterial = new BLL.tb_JC_Material_B(); DataSet dsMaterial = bllMaterial.GetList(strWhere.ToString()); DataTable dtSource = dsMaterial.Tables[0]; gridMaterial.DataSource = dtSource; gridMaterial.DataBind(); }