Ejemplo n.º 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     #region 检查
     if (nbxAmount.Text == "0")
     {
         Alert.ShowInTop("数量不能为0!", "错误", MessageBoxIcon.Error);
         nbxAmount.Focus();
         return;
     }
     #endregion
     #region 保存
     Model.tb_JC_BOMSub modelBOMSub = new Model.tb_JC_BOMSub();
     modelBOMSub.ID             = Request.QueryString["id"].ToString();
     modelBOMSub.MaterialNO     = txbMaterialNO.Text;
     modelBOMSub.MaterialType   = hdfPropertyNO.Text;
     modelBOMSub.ParentNO       = Request.QueryString["parentNO"].ToString();
     modelBOMSub.Amount         = decimal.Parse(nbxAmount.Text);
     modelBOMSub.BackFlush      = ddlBackFlush.SelectedValue;
     modelBOMSub.LeadTimeOffset = decimal.Parse(nbxLeadTimeOffset.Text + ".00");
     BLL.tb_JC_BOMSub bllBOMSub = new BLL.tb_JC_BOMSub();
     bool             result    = bllBOMSub.Update(modelBOMSub);
     if (result)
     {
         if (result)
         {
             Alert.ShowInTop("更新成功!", "信息", MessageBoxIcon.Information, ActiveWindow.GetHidePostBackReference("Sub_Modify_Success"));
         }
         else
         {
             Alert.ShowInTop("更新失败!", "错误", MessageBoxIcon.Error, ActiveWindow.GetHidePostBackReference("Sub_Modify_Fail"));
         }
     }
     #endregion
 }
Ejemplo n.º 2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     #region 检查
     //重复查询
     StringBuilder strwhere = new StringBuilder();
     strwhere.AppendFormat("ParentNO='{0}' and MaterialNO = '{1}'", Request.QueryString["parentNO"], tgbMaterialNO.Text);
     BLL.tb_JC_BOMSub bllBOMSub = new BLL.tb_JC_BOMSub();
     DataTable        dtBOMSub  = bllBOMSub.GetList(strwhere.ToString()).Tables[0];
     if (dtBOMSub.Rows.Count > 0)
     {
         Alert.ShowInTop("该项已存在!", "错误", MessageBoxIcon.Error);
         return;
     }
     if (nbxAmount.Text == "0")
     {
         Alert.ShowInTop("数量不能为0!", "错误", MessageBoxIcon.Error);
         nbxAmount.Focus();
         return;
     }
     //嵌套查询
     BLL.proc_BOM bllBOM_proc = new BLL.proc_BOM();
     int          exit        = bllBOM_proc.isNesting(Request.QueryString["parentNO"], tgbMaterialNO.Text);
     if (Request.QueryString["parentNO"].Equals(tgbMaterialNO.Text))
     {
         exit = 1;
     }
     if (exit == 1)
     {
         Alert.ShowInTop("存在嵌套,不能添加此物料!", "错误", MessageBoxIcon.Error);
         return;
     }
     #endregion
     #region 保存
     Model.tb_JC_BOMSub modelBOMSub = new Model.tb_JC_BOMSub();
     modelBOMSub.ID             = Guid.NewGuid().ToString();
     modelBOMSub.MaterialNO     = tgbMaterialNO.Text;
     modelBOMSub.MaterialType   = hdfPropertyNO.Text;
     modelBOMSub.ParentNO       = Request.QueryString["parentNO"].ToString();
     modelBOMSub.Amount         = decimal.Parse(nbxAmount.Text);
     modelBOMSub.BackFlush      = ddlBackFlush.SelectedValue;
     modelBOMSub.LeadTimeOffset = decimal.Parse(nbxLeadTimeOffset.Text + ".00");
     bool result = bllBOMSub.Add(modelBOMSub);
     if (result)
     {
         if (result)
         {
             Alert.ShowInTop("添加成功!", "信息", MessageBoxIcon.Information, ActiveWindow.GetHidePostBackReference("Sub_Add_Success"));
         }
         else
         {
             Alert.ShowInTop("添加失败!", "错误", MessageBoxIcon.Error, ActiveWindow.GetHidePostBackReference("Sub_Add_Fail"));
         }
     }
     #endregion
 }