Esempio n. 1
0
    protected override void grvRef_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        LoadHeader();

        //_sql = "select NAME,custom_control_name from DMIS_SYS_COLUMNS where TABLE_ID=" + Session["MainTableId"].ToString() + " and ISDISPLAY=1 order by ORDER_ID";
        //_dt = DBOpt.dbHelper.GetDataTable(_sql);
        //for (int i = 0; i < _dt.Rows.Count; i++)
        //{
        //    grvRef.Rows[e.RowIndex].Cells[i + 1].Controls[0].ID = _dt.Rows[i][1].ToString();
        //}


        string sql;
        int    tableID, tid;

        tableID = Convert.ToInt16(Session["MainTableId"]);
        tid     = Convert.ToInt16(grvRef.DataKeys[e.RowIndex].Value);
        GridViewRow row = grvRef.Rows[e.RowIndex];

        sql = GridViewEdit.GetGridViewRowUpdating(ref grvRef, tableID, e.RowIndex, tid);
        sql = "update t_dd_running_log_type set name='测试' where tid=8";
        if (DBOpt.dbHelper.ExecuteSql(sql) > 0)
        {
            grvRef.EditIndex = -1;
            GridViewBind();
        }
        else
        {
            JScript.Alert((String)GetGlobalResourceObject("WebGlobalResource", "SaveFailMessage"));
            return;
        }
    }
Esempio n. 2
0
    protected void grv_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        if (sender == null)
        {
            return;
        }

        GridView grv = (GridView)sender;
        int      tid, tableID;

        tid     = Convert.ToInt16(grv.DataKeys[e.RowIndex].Value);
        tableID = Convert.ToInt16(Session["MainTableId"]);

        _sql = GridViewEdit.GetGridViewRowUpdating(ref grv, tableID, e.RowIndex, tid);

        if (DBOpt.dbHelper.ExecuteSql(_sql) > 0)
        {
            grv.EditIndex = -1;
            GridViewBind();
        }
        else
        {
            //JScript.Alert("数据保存失败!");
            return;
        }
    }
Esempio n. 3
0
    protected void grv_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        if (sender == null)
        {
            return;
        }

        GridView grv = (GridView)sender;
        int      tid, tableID;

        string shiftDate = wdlDate.getTime().ToString("yyyyMMdd");

        tid     = Convert.ToInt16(grv.DataKeys[e.RowIndex].Value);
        tableID = Convert.ToInt16(Session["MainTableId"]);

        WebDate wdl发生时间, wdl结束时间;

        wdl发生时间 = (WebDate)grv.Rows[e.RowIndex].FindControl("wdl发生时间");
        wdl结束时间 = (WebDate)grv.Rows[e.RowIndex].FindControl("wdl结束时间");
        TimeSpan ts = DateTime.Now - DateTime.Now;   //不让两个相同时间相减,则会出现未赋局部变量的错误。
        string   updateSql;

        if (!(wdl结束时间.getTime() == null || wdl结束时间.getTime().ToString("yyyy") == "1900"))
        {
            DateTime dt1, dt2;
            dt1 = wdl发生时间.getTime();
            dt2 = wdl结束时间.getTime();
            if (dt1 > dt2)
            {
                JScript.Alert("发生时间不能大于结束时间!");
                return;
            }
            ts = dt2 - dt1;
        }
        else
        {
            updateSql = "update T_ZDH_自动化值班记事 set 小时数=NULL where TID=" + tid;   //取消小时数
            DBOpt.dbHelper.ExecuteSql(updateSql);
        }


        updateSql = GridViewEdit.GetGridViewRowUpdating(ref grv, tableID, e.RowIndex, tid);

        if (DBOpt.dbHelper.ExecuteSql(updateSql) > 0)
        {
            grv.EditIndex = -1;
            if (ts.TotalHours > 0)   //如果有时间再更新时间
            {
                updateSql = "update T_ZDH_自动化值班记事 set 小时数=" + ts.TotalHours.ToString() + " where TID=" + tid;
                DBOpt.dbHelper.ExecuteSql(updateSql);
            }
            GridViewBind();
        }
        else
        {
            JScript.Alert("数据保存失败!");
            return;
        }
    }
    protected virtual void grvList_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string sql;
        int    tableID, tid;

        tableID = Convert.ToInt16(Session["MainTableId"]);
        tid     = Convert.ToInt16(grvList.DataKeys[e.RowIndex].Value);
        sql     = GridViewEdit.GetGridViewRowUpdating(ref grvList, tableID, e.RowIndex, tid);
        if (DBOpt.dbHelper.ExecuteSql(sql) > 0)
        {
            grvList.EditIndex = -1;
            grvList_DataBind();
        }
        else
        {
            JScript.Alert((String)GetGlobalResourceObject("WebGlobalResource", "SaveFailMessage"));
            return;
        }
    }