Пример #1
0
 protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     try
     {
         ACMS.BO.UnitBO bbl  = new ACMS.BO.UnitBO();
         int            id   = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
         string         name = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtname_edit")).Text;
         if (bbl.chkDuplicateName(id, name))
         {
             clsMyObj.ShowMessage(name + "已重覆.無法存檔");
             e.Cancel = true;
             return;
         }
     }
     catch (Exception ex)
     {
         WriteErrorLog("Updating", ex.Message, "0");
     }
 }
Пример #2
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            ACMS.BO.UnitBO bbl = new ACMS.BO.UnitBO();
            int id = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
            string name = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtname_edit")).Text;
            if (bbl.chkDuplicateName(id, name))
            {
                clsMyObj.ShowMessage(name + "已重覆.無法存檔");
                e.Cancel = true;
                return;
            }
        }
        catch (Exception ex)
        {
            WriteErrorLog("Updating", ex.Message, "0");

        }
    }
Пример #3
0
 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         ACMS.BO.UnitBO bbl  = new ACMS.BO.UnitBO();
         int            id   = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
         string         name = ((Label)GridView1.Rows[e.RowIndex].FindControl("Label1")).Text;
         if (bbl.isStart(id))
         {
             clsMyObj.ShowMessage(name + "已使用無法刪除資料");
             e.Cancel = true;
             return;
         }
         bbl.Delete(id);
         GridView1.DataBind();
         e.Cancel = true;
     }
     catch (Exception ex)
     {
         WriteErrorLog("Delete", ex.Message, "0");
     }
 }
Пример #4
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            ACMS.BO.UnitBO bbl = new ACMS.BO.UnitBO();
            int id = int.Parse(GridView1.DataKeys[e.RowIndex].Value.ToString());
            string name = ((Label)GridView1.Rows[e.RowIndex].FindControl("Label1")).Text;
            if (bbl.isStart(id))
            {
                clsMyObj.ShowMessage(name + "已使用無法刪除資料");
                e.Cancel = true;
                return;
            }
            bbl.Delete(id);
            GridView1.DataBind();
            e.Cancel = true;

        }
        catch (Exception ex)
        {
            WriteErrorLog("Delete", ex.Message, "0");

        }
    }