zoukankan      html  css  js  c++  java
  • 删除判断

    JS

    function SupplierProductte(id) {
    var record = Store2.getById(id);
    Store2.remove(record);
    SupplierProductSave.setDisabled(false);
    }

    //SupplierProduct Qty与Delete
    function Supplier_ProductDelete(e, a, d, f, g, c) {
    if (e == "Detail") {
    QtyHideId.setValue(a.data.ID);
    SupplierProductInventoryQty.show();
    Store3.reload();
    }
    else if (e == "Delete") {
    Ext.Msg.confirm('Delete', 'Are you sure to delete this SupplierName?', function (result) {
    if (result == 'yes') {
    Ecom.JudgeSupplierProductDelete(a.data.ID);
    }
    });
    }
    return true;
    }

    前台

    <ext:CommandColumn Width="120">
    <Commands>
    <ext:GridCommand Icon="NoteDelete" Text="Delete" CommandName="Delete">
    <ToolTip Text="Delete" />
    </ext:GridCommand>
    <ext:GridCommand Icon="Note" Text="Detail" CommandName="Detail">
    <ToolTip Text="Detail" />
    </ext:GridCommand>
    </Commands>
    </ext:CommandColumn>

    后台

    /// <summary>
    /// Product删除字段判断
    /// </summary>
    /// <param name="id"></param>
    [DirectMethod(Namespace = "Ecom")]
    public void JudgeSupplierProductDelete(int ID)
    {
    List<IDataParameter> pList = new List<IDataParameter>();
    pList.Add(DataProvider.Instance().NewParameter("@Type", DbType.String, 400, "DeleteProduce"));
    pList.Add(DataProvider.Instance().NewParameter("@SupplierName", DbType.String, 400, ""));
    pList.Add(DataProvider.Instance().NewParameter("@FieldOne", DbType.String, 400, ID));
    pList.Add(DataProvider.Instance().NewParameter("@FieldTwo", DbType.String, 400, ""));
    DataSet ds = DataProvider.Instance().ExecProcedure("R_Supplier_ProductDataJudge", pList);
    string ReturnMes = ds.Tables[0].Rows[0][0].ToString();
    if (ReturnMes == "0")
    {
    X.Msg.Show(new MessageBoxConfig
    {
    Title = "",
    Message = "The data are using cannot be deleted!",
    Icon = Ext.Net.MessageBox.Icon.INFO,
    Buttons = Ext.Net.MessageBox.Button.OK
    });
    return;
    }
    else if (ReturnMes == "1")
    {
    X.Js.AddScript("SupplierProductte({0});", ID);
    }
    }

    SQL存储过程

    Create PROCEDURE [dbo].[R_Supplier_ProductDataJudge]
    @Type Nvarchar(400),
    @SupplierName nvarchar(400),
    @FieldOne nvarchar(400),
    @FieldTwo nvarchar(400)
    AS
    BEGIN
    if(@Type = 'InsertProduce')
    begin
    DECLARE @F int,@H int,@G int
    SELECT @F=ID FROM Supplier WHERE SupplierName = @SupplierName
    SELECT @H=ID FROM Supplier_Product WHERE SupplierID = @F and SupplierPartNumber=@FieldOne
    IF(@H > 0)
    select '0'
    ELSE
    begin
    SELECT @G=ID FROM Supplier_Product WHERE SupplierID = @F and HMNUM=@FieldTwo
    if(@G > 0)
    select '0'
    else
    select '1'
    end
    end
    -------------------------------------------------------------------------------------
    else if(@Type = 'DeleteProduce')
    begin
    Declare @InventoryID int
    SELECT @InventoryID=ID FROM Supplier_Inventory WHERE S_ProductID=@FieldOne
    if(@InventoryID>0)
    select '0'
    else
    select '1'
    end
    END

  • 相关阅读:
    session和cookie
    数据库备份
    使用pip安装.whl文件时出现is not a supported wheel on this platform的解决办法
    multiprocessing模块
    threading模块
    python中多线程相关
    python中实现单例模式
    Flask-SQLAlchemy相关与Flask-Migrate相关
    redis模块
    Flask-Login中装饰器@login_manager.user_loader的作用及原理
  • 原文地址:https://www.cnblogs.com/dwuge/p/5301924.html
Copyright © 2011-2022 走看看