protected void btnAdd_Click(object sender, EventArgs e) { strSql = @"insert into tms_project_group (project_id, project_group, project_dept, create_dttm, create_user, last_update_dttm, last_update_user) values(project_seq.nextval,'{0}','{1}',sysdate,'{2}',sysdate,'{3}') "; strSql = string.Format(strSql, txtProjectGroup.Text, Session["user_dept"].ToString(), Session["user_name"].ToString(), Session["user_name"].ToString()); DBUtil.ExecuteStatement(strSql); set_data_list(); }
//protected void CheckBox1_CheckedChanged(object sender, EventArgs e) //{ // string src = string.Empty; // string src1 = string.Empty; // CheckBox ck = (CheckBox)sender; // GridViewRow gr = (GridViewRow)ck.Parent.Parent; // bool checkState = ck.Checked; // lblCheckState.Text = checkState.ToString(); // src = ((HyperLink)gvTask.Rows[gr.RowIndex].FindControl("HyLinkTaskID")).Text; // src1 = lblEmpno.Text; // string str_Sql = string.Empty; // if (lblCheckState.Text == "True") // str_Sql = " insert into tms_trace_list (task_id, member_id) values ( '" + src + "', '" + src1 + "')"; // else // str_Sql = "delete from tms_trace_list where task_id='" + src + "'and member_id='" + src1 + "'"; // DBUtil.ExecuteStatement(str_Sql); //} //public bool Checked_State(string task_id) //{ // string strSql = string.Empty; // strSql = "select count(*) from tms_trace_list where task_id = '" + task_id + "'"; // if (lblEmpno.Text.Equals("")) // { // strSql += ""; // } // else // { // strSql += "and member_id='" + lblEmpno.Text.Replace("'","") + "'"; // } // if (lblUser.Text.Equals("")) // { // strSql += ""; // } // else // { // strSql += "and member_id='" + lblUser.Text + "'"; // } // ds = DBUtil.GetDataset(strSql); // DataView dv = ds.Tables[0].DefaultView; // string rowCount = dv[0][0].ToString(); // if (Convert.ToInt32(rowCount) > 0) // return true; // else // return false; //} //public void My_Trace_Click() //{ // string src = ""; // string src1 = ""; // string str_Sql = string.Empty; // foreach (GridViewRow row in gvTask.Rows) // { // if (row.RowType == DataControlRowType.DataRow) // { // CheckBox cb = (CheckBox)row.Cells[0].FindControl("CheckBox1"); // bool CheckState = cb.Checked; // src = ((HyperLink)row.FindControl("HyLinkTaskID")).Text; // src1 = lblEmpno.Text; // if (CheckState.ToString() == "True") // str_Sql = " insert into tms_trace_list (task_id, member_id) values ( '" + src + "', '" + src1 + "')"; // else // str_Sql = "delete from tms_trace_list where task_id='" + src + "'and member_id='" + src1 + "'"; // try // { // DBUtil.ExecuteStatement(str_Sql); // } // catch (Exception) // { // } // } // } // ds = DBUtil.GetDataset(lblSql.Text); // gvTask.DataSource = ds; // gvTask.DataBind(); //} public void Add_Trace_Click() { string src = ""; string src1 = ""; string str_Sql = string.Empty; foreach (GridViewRow row in gvTask.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox cb = (CheckBox)row.Cells[0].FindControl("CheckBox1"); bool CheckState = cb.Checked; src = ((HyperLink)row.FindControl("HyLinkTaskID")).Text; //src1 = lblDept.Text.Replace("'", ""); src1 = lblUser.Text; if (CheckState.ToString() == "True") { str_Sql = " insert into tms_trace_list (task_id, member_id) values ( '" + src + "', '" + src1 + "')"; } try { DBUtil.ExecuteStatement(str_Sql); } catch (Exception) { } } } ds = DBUtil.GetDataset(lblSql.Text); gvTask.DataSource = ds; gvTask.DataBind(); }