コード例 #1
0
ファイル: VIPCardManage.aspx.cs プロジェクト: 892182825/SP
    /// <summary>
    /// 新增卡号
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button1_Click(object sender, EventArgs e)
    {
        int    RangeID   = CommonDataBLL.getMaxqishu() + 1;
        string ToStoreID = "";
        string inuse     = "0";
        int    count     = VIPCardManageBll.valiStore(DisposeString.DisString(this.txt_ToStoreID.Text.Trim(), "<,>,',-", "&lt;,&gt;,&#39;,&nbsp;", ","));

        if (count == 0)
        {
            ToStoreID = "";
            inuse     = "0";
            ScriptHelper.SetAlert(Page, GetTran("000388", "店铺") + txt_ToStoreID.Text.Trim() + GetTran("001584", "不存在!"));
            return;
        }
        else
        {
            ToStoreID = txt_ToStoreID.Text.Trim();
            inuse     = "1";
        }
        VIPCardRangeModel vipmodel = new VIPCardRangeModel();

        vipmodel.RangeID   = RangeID;
        vipmodel.StoreID   = ToStoreID;
        vipmodel.BeginCard = Convert.ToInt32(txt_BeginCard.Text.Trim());
        vipmodel.EndCard   = Convert.ToInt32(txt_EndCard.Text.Trim());
        vipmodel.InUse     = Convert.ToInt32(inuse);
        int vipcard = VIPCardManageBll.Addvipcard(vipmodel);

        if (vipcard > 0)
        {
            ScriptHelper.SetAlert(Page, GetTran("001583", "新增卡号范围成功,") + ((inuse == "1") ? GetTran("001581", "分配到店铺") + ToStoreID : GetTran("001580", "未分配到店铺")));
        }
        else
        {
            ScriptHelper.SetAlert(Page, GetTran("001541", "操作失败!!!"));
            return;
        }

        btn_Query_Click1(null, null);
        Translations();
    }
コード例 #2
0
ファイル: VIPCardManage.aspx.cs プロジェクト: 892182825/SP
    protected void DataGrid1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        GridViewRow Row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;

        if (e.CommandName.ToString().Trim() == "Sort")
        {
            return;
        }

        int RangeID;

        try
        {
            RangeID = Convert.ToInt32(Row.Cells[0].Text);
        }
        catch
        {
            RangeID = 0;
        }

        int BeginCard;

        try
        {
            BeginCard = Convert.ToInt32(Row.Cells[4].Text);
        }
        catch
        {
            BeginCard = 0;
        }

        int EndCard;

        try
        {
            EndCard = Convert.ToInt32(Row.Cells[5].Text);
        }
        catch
        {
            EndCard = 0;
        }

        string ToStoreID = ((TextBox)Row.FindControl("txt_ToStore")).Text.Trim();
        int    count1    = VIPCardManageBll.BetweenCard(Convert.ToInt32(BeginCard.ToString()), Convert.ToInt32(EndCard.ToString()));

        switch (e.CommandName.Trim())
        {
        case "DELETE":
            if (count1 > 0)
            {
                ScriptHelper.SetAlert(Page, GetTran("001578", "该卡号段中的一些卡号已分配到会员,不能取消分配"));
                return;
            }
            VIPCardManageBll.Uptvipcard(Convert.ToInt32(RangeID.ToString().Trim()));
            ScriptHelper.SetAlert(Page, GetTran("001577", "卡号范围“") + RangeID.ToString() + GetTran("001576", "”取消分配成功!"));
            break;

        case "UPDATE":
            if (count1 > 0)
            {
                ScriptHelper.SetAlert(Page, GetTran("001573", "该卡号段中的一些卡号已分配到会员,不能重新分配"));
                return;
            }
            int count2 = VIPCardManageBll.valiStore(ToStoreID);
            if (count2 == 0)
            {
                ScriptHelper.SetAlert(Page, GetTran("001571", "店铺“") + ToStoreID + GetTran("001569", "”不存在,不能将卡号范围重分配到该店铺"));
                return;
            }
            VIPCardManageBll.Uptvipcardstore(Convert.ToInt32(ToStoreID), RangeID.ToString().Trim());
            ScriptHelper.SetAlert(Page, GetTran("001568", "卡号范围“") + RangeID.ToString() + GetTran("001565", "”重分配到店铺“") + ToStoreID + GetTran("001563", "”成功!"));
            break;
        }
        btn_Query_Click1(null, null);
    }