Exemple #1
0
    //刪除
    protected void btnDel_Click(object sender, EventArgs e)
    {
        if (slpCNT_CONFIRM_CODE.SelectedValue == "1")
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022_alert", "alert('請先進行合約解除再刪除');", true);
            return;
        }
        try
        {
            DataSet ds = new DataSet();
            DateTime DTime = DateTime.Now;
            ds = (DataSet)Session["VDM022_" + PageTimeStamp.Value];

            ArrayList ArrList1 = new ArrayList();
            ArrList1.Add(ds.Tables["Table_0"].Rows[0]["VENDOR_CODE"].ToString());//V_OLD_VENDOR_CODE
            ArrList1.Add(ds.Tables["Table_0"].Rows[0]["CNT_NO"].ToString());//V_OLD_CNT_NO
            ArrList1.Add(GetValueSetParameter(ds.Tables["Table_0"].Rows[0]["EDIT_NO"].ToString(), "int", false));//N_OLD_EDIT_NO
            ArrList1.Add(GetValueSetParameter(ds.Tables["Table_0"].Rows[0]["CREATEDATE"].ToString(), "datetime", false));//D_OLD_CREATEDATE
            ArrList1.Add(ds.Tables["Table_0"].Rows[0]["CREATEUID"].ToString());//V_OLD_CREATEUID
            ArrList1.Add(GetValueSetParameter(ds.Tables["Table_0"].Rows[0]["UPDATEDATE"].ToString(), "datetime", false));//D_OLD_UPDATEDATE
            ArrList1.Add(ds.Tables["Table_0"].Rows[0]["UPDATEUID"].ToString());//V_OLD_UPDATEUID
            ArrList1.Add(DTime);//D_NEW_UPDATEDATE
            ArrList1.Add(Session["UID"].ToString());//V_NEW_UPDATEUID

            BCO.MaintainVendorAgm bco = new BCO.MaintainVendorAgm(ConntionDB);
            bco.DeleteVDM022(ArrList1, null);
            ScriptManager.RegisterStartupScript(this, this.GetType(), "DelComplete", "alert('刪除完成!');location.replace('VDM021.aspx?Code=VDM02');", true);
        }
        catch (Exception ex)
        {
            if (ex.Message.IndexOf("資料已被他人異動") >= 0)
                ScriptManager.RegisterStartupScript(this, this.GetType(), "DelComplete", "alert('刪除失敗,此資料已被其他使用者異動,請重新查詢!');", true);
            else
            {
                ErrorMsgLabel.Text = ex.Message;
                UpdatePanel6.Update();
            }
        }
    }