예제 #1
0
파일: Modify.aspx.cs 프로젝트: Marveliu/erp
 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
 }
예제 #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
 }
예제 #3
0
 //删除事件
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     FineUI.Button btn = (FineUI.Button)sender;
     #region  除主表记录
     if (btn.ID == "btnDelete")
     {
         if (gridBOMSub.RecordCount > 0)
         {
             Alert.ShowInTop("在删除该项前,请删除所有子项", "错误", MessageBoxIcon.Error);
             return;
         }
         else
         {
             BLL.tb_JC_BOM bllBOM = new BLL.tb_JC_BOM();
             string        id     = gridBOMParent.DataKeys[gridBOMParent.SelectedRowIndex][0].ToString();
             bool          result = bllBOM.Delete(id);
             if (result)
             {
                 Alert.ShowInTop("删除成功", "信息", MessageBoxIcon.Information);
                 BindGrid();
             }
             else
             {
                 Alert.ShowInTop("删除失败", "错误", MessageBoxIcon.Error);
             }
             return;
         }
     }
     #endregion
     #region  除子表记录
     if (btn.ID == "btnDeleteSub")
     {
         BLL.tb_JC_BOMSub bllBOMSub = new BLL.tb_JC_BOMSub();
         string           id        = gridBOMSub.DataKeys[gridBOMSub.SelectedRowIndex][0].ToString();
         bool             result    = bllBOMSub.Delete(id);
         if (result)
         {
             Alert.ShowInTop("删除成功", "信息", MessageBoxIcon.Information);
             BindGridSub(gridBOMParent.Rows[gridBOMParent.SelectedRowIndex].Values[1].ToString());
         }
         else
         {
             Alert.ShowInTop("删除失败", "错误", MessageBoxIcon.Error);
         }
         return;
     }
     #endregion
 }