예제 #1
0
    protected void btdel_Click(object sender, EventArgs e)
    {
        LinkButton btn     = (LinkButton)sender;
        int        i_Index = ((GridViewRow)(btn.Parent.Parent)).RowIndex;

        string s_NID = ((Label)((GridViewRow)(btn.Parent.Parent)).FindControl("lblHYZH")).Text.ToString();

        KFB_HYGL mo_hygl = new KFB_HYGL();

        mo_hygl = objAgentManageDB.GetModelHYGL(s_NID);
        Hashtable mo_Ht    = new Hashtable();
        int       i_Count  = objAgentManageDB.GetZD(s_NID);
        int       i_OCount = objAgentManageDB.GetOZD(s_NID);

        i_Count = i_Count + i_OCount;

        DataSet ds = objAgentManageDB.GetList("N_HYZH='" + s_NID + "'");

        if (i_Count > 0)
        {
            this.ShowMsg("本賬號已有" + i_Count + "筆注單,無法刪除");
        }
        else if (ds.Tables[0].Rows.Count > 0)
        {
            this.ShowMsg("本賬號已有現金流操作,無法刪除");
        }
        else if (objAgentManageDB.Exists(s_NID))
        {
            objAgentManageDB.Delete(s_NID, mo_Ht);
            objAgentManageDB.SetDLSED(mo_hygl.N_DLDH.ToString(), -Convert.ToDecimal(mo_hygl.N_SYED.ToString()), mo_Ht);
            objAgentManageDB.SetTran(mo_Ht);
            drpDLS_SelectedIndexChanged(sender, e);
        }
        else
        {
            this.ShowMsg("本賬號已經刪除");
        }
    }
예제 #2
0
    protected void btdel_Click(object sender, EventArgs e)
    {
        KFB_ZHGL   mo_zhgl = new KFB_ZHGL();
        LinkButton btn     = (LinkButton)sender;
        int        i_Index = ((GridViewRow)(btn.Parent.Parent)).RowIndex;

        string s_NID = "";

        s_NID   = ((GridView)(btn.Parent.Parent.Parent.Parent)).Rows[i_Index].Cells[0].Text.ToString().Trim();
        mo_zhgl = objAgentManageDB.GetModel(s_NID);

        //判断是否有注單
        int i_Count = objAgentManageDB.GetZD(s_NID, Comm.GetZHCol(mo_zhgl.N_HYDJ.ToString()));

        if (i_Count > 0)
        {
            this.ShowMsg("本賬號已有注單,無法删除!");
            return;
        }

        int i_HYCount = objAgentManageDB.GetHYZD(s_NID, Comm.GetZHCol(mo_zhgl.N_HYDJ.ToString()));

        if (i_HYCount > 0)
        {
            this.ShowMsg("本賬號下級會員已有注單,無法删除!");
            return;
        }

        int i_oCount = objAgentManageDB.GetOZD(s_NID, Comm.GetZHCol(mo_zhgl.N_HYDJ.ToString()));

        if (i_oCount > 0)
        {
            this.ShowMsg("本賬號已有歷史注單,無法删除!");
            return;
        }

        int i_oHYCount = objAgentManageDB.GetOHYZD(s_NID, Comm.GetZHCol(mo_zhgl.N_HYDJ.ToString()));

        if (i_oHYCount > 0)
        {
            this.ShowMsg("本賬號下級會員已有歷史注單,無法删除!");
            return;
        }

        try
        {
            //判斷是否存在
            bool chuser = objAgentManageDB.Exists(s_NID);
            if (!chuser)
            {
                this.ShowMsg("該會員已被刪除!");
            }
            else//存在則修改
            {
                #region "修改上级剩余额度"
                objAgentManageDB.UpSJED(mo_zhgl);

                #endregion
                //o_KFB_ZHGL.Delete(strparid, Convert.ToInt32(strlvl));
                objAgentManageDB.DeleteAll(s_NID, Comm.GetZHCol(mo_zhgl.N_HYDJ.ToString()));

                SetGrid(this.drzdl.SelectedValue);
            }
        }
        catch (Exception ex)
        {
            this.WriteLog("用户名=" + mUserID + ex.ToString());
            this.ShowMsg("删除失败");
        }
    }