Ejemplo n.º 1
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
 }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            BLL.tb_JC_BOM bllBOM = new BLL.tb_JC_BOM();
            #region 检查
            DataSet dsBOM = bllBOM.GetList("MaterialNO='" + tgbMaterialNO.Text + "'");
            if (dsBOM.Tables[0].Rows.Count > 0)
            {
                Alert.ShowInTop("该项已存在!", "错误", MessageBoxIcon.Error);
                return;
            }
            #endregion
            #region 保存
            Model.tb_JC_BOM modelBOM = new Model.tb_JC_BOM();
            modelBOM.ID           = Guid.NewGuid().ToString();
            modelBOM.MaterialNO   = tgbMaterialNO.Text;
            modelBOM.MaterialType = hdfPropertyNO.Text;
            modelBOM.CheckStatus  = "C";
            modelBOM.Status       = "N";
            bool result = bllBOM.Add(modelBOM);

            if (Request.Cookies["RootNO"] != null)
            {
                Request.Cookies["RootNO"].Value = tgbMaterialNO.Text;
            }
            else
            {
                HttpCookie rootNO = new HttpCookie("RootNO", tgbMaterialNO.Text);
                Response.Cookies.Add(rootNO);
            }

            if (result)
            {
                Alert.ShowInTop("添加成功!", "信息", MessageBoxIcon.Information, ActiveWindow.GetHidePostBackReference("Main_Add_Success"));
            }
            else
            {
                Alert.ShowInTop("添加失败!", "错误", MessageBoxIcon.Error, ActiveWindow.GetHidePostBackReference("Main_Add_Fail"));
            }
            #endregion
        }
Ejemplo n.º 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            BLL.tb_JC_BOM bllBOM = new BLL.tb_JC_BOM();

            Model.tb_JC_BOM modelBOM = new Model.tb_JC_BOM();
            modelBOM.ID           = Request.QueryString["id"].ToString();
            modelBOM.MaterialNO   = txbMaterialNO.Text;
            modelBOM.MaterialType = hdfPropertyNO.Text;
            modelBOM.CheckNO      = hdfCheckNO.Text;
            modelBOM.CheckDate    = dapCheckDate.SelectedDate;
            modelBOM.CheckStatus  = ddlCheckStatus.SelectedValue;
            modelBOM.Status       = ddlStatus.SelectedValue;

            bool result = bllBOM.Update(modelBOM);

            if (result)
            {
                Alert.ShowInTop("更新成功", "信息", MessageBoxIcon.Information, ActiveWindow.GetHidePostBackReference("Main_Modify_Success"));
            }
            else
            {
                Alert.ShowInTop("更新失败", "错误", MessageBoxIcon.Error, ActiveWindow.GetHidePostBackReference("Main_Modify_Fail"));
            }
        }