protected void btn_update_Click(object sender, EventArgs e) { tbl_inquiry_BAL objbal = new tbl_inquiry_BAL(); tbl_inquiry_DAL objdal = new tbl_inquiry_DAL(); objdal.int_inquiry_id = Convert.ToInt16(ViewState["id"]); //objdal.int_user_id =txt_User_name.Text; //objdal.str_description = txt_description.Text; //objdal.date_date = Convert.ToDateTime(txt_date.Text); //objdal.str_time = txt_time.Text; //objdal.int_voluntar_id = Convert.ToInt16(txt_voluntar_name.Text); objdal.int_voluntar_id = Convert.ToInt16(ddl_voluntar.SelectedItem.Value); objdal.str_ans_description = txt_ans_description.Text; objdal.date_ans_date = Convert.ToDateTime(txt_ans_date.Text); objdal.str_ans_time = txt_ans_time.Text; //lblmsg.Visible = true; int val = objbal.update_data(objdal); objbal.update_data(objdal); binddata(""); changepanel(1, 0); if (val > 0) { lblmsg.Text = "Data Update"; lblmsg.ForeColor = System.Drawing.Color.Green; } else { lblmsg.Text = "Error in Process,try again"; lblmsg.ForeColor = System.Drawing.Color.Red; } }
public int update_data(tbl_inquiry_DAL objdal) { SqlConnection cn = new SqlConnection(ConfigurationSettings.AppSettings["dbconnect"]); SqlCommand cm = new SqlCommand("demo", cn); cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("@int_inquiry_id", objdal.int_inquiry_id); //cm.Parameters.AddWithValue("@int_user_id", objdal.int_user_id); //cm.Parameters.AddWithValue("@str_description", objdal.str_description); //cm.Parameters.AddWithValue("@date_date", objdal.date_date); //cm.Parameters.AddWithValue("@str_time", objdal.str_time); cm.Parameters.AddWithValue("@int_voluntar_id", objdal.int_voluntar_id); cm.Parameters.AddWithValue("@str_ans_description", objdal.str_ans_description); cm.Parameters.AddWithValue("@date_ans_date", objdal.date_ans_date); cm.Parameters.AddWithValue("@str_ans_time", objdal.str_ans_time); SqlDataAdapter da = new SqlDataAdapter(cm); DataSet ds = new DataSet(); da.Fill(ds); cn.Open(); int val = Convert.ToInt16(cm.ExecuteNonQuery()); cn.Close(); return(val); }
public int insert_data(tbl_inquiry_DAL objdal) { SqlCommand cm = new SqlCommand("insert_tbl_inquiry", cn); cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("@int_user_id", objdal.int_user_id); cm.Parameters.AddWithValue("@str_description", objdal.str_description); cm.Parameters.AddWithValue("@date_date", objdal.date_date); cm.Parameters.AddWithValue("@str_time", objdal.str_time); //cm.Parameters.AddWithValue("@int_voluntar_id", objdal.int_voluntar_id); //cm.Parameters.AddWithValue("@str_ans_description", objdal.str_ans_description); //cm.Parameters.AddWithValue("@date_ans_date", objdal.date_ans_date); //cm.Parameters.AddWithValue("@str_ans_time", objdal.str_ans_time); cn.Open(); int val = Convert.ToInt16(cm.ExecuteScalar()); cn.Close(); return(val); }
public int delete_data(tbl_inquiry_DAL objdal) { SqlCommand cm = new SqlCommand("delete_tbl_inquiry", cn); cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("@int_inquiry_id", objdal.int_inquiry_id); cn.Open(); int val = Convert.ToInt16(cm.ExecuteScalar()); cn.Close(); return(val); }
protected void btn_select_delete_Click(object sender, EventArgs e) { try { tbl_inquiry_BAL objbal = new tbl_inquiry_BAL(); tbl_inquiry_DAL objdal = new tbl_inquiry_DAL(); foreach (GridViewRow row in gvlist.Rows) { var check = row.FindControl("chkselect") as CheckBox; if (check.Checked) { var id = row.FindControl("Hiddenid") as HiddenField; objdal.int_user_id = Convert.ToInt16(id.Value); objbal.delete_data(objdal); binddata(""); } } } catch (Exception ex) { } }
protected void btn_add_Click(object sender, EventArgs e) { try { tbl_inquiry_BAL objbal = new tbl_inquiry_BAL(); tbl_inquiry_DAL objdal = new tbl_inquiry_DAL(); objdal.int_user_id = Convert.ToInt16(Session["uid"]); objdal.str_description = txt_description.Text; objdal.date_date = Convert.ToDateTime(date1); objdal.str_time = time1; //objdal.int_voluntar_id = Convert.ToInt16(ddl_voluntar.SelectedItem.Value); //objdal.str_ans_description = txt_ans_discription.Text; //objdal.date_ans_date = Convert.ToDateTime(txt_adate.Text); //objdal.str_ans_time = txt_atime.Text; int val = objbal.insert_data(objdal); if (val > 0) { lblmsg.Text = "inquiry successfully submited"; lblmsg.ForeColor = System.Drawing.Color.Green; } cleardata(); } catch (Exception ex) { } }