protected void ddl_reduce_SelectedIndexChanged1(object sender, EventArgs e) { string u = ddl_reduce.SelectedItem.Value; class_list_tutors obj = new class_list_tutors(); ds = obj.showdata1(u); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string a = ds.Tables[0].Rows[i]["tut_id"].ToString(); int o = obj.findleads(ds.Tables[0].Rows[i]["tut_id"].ToString()); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } }
protected void row_updating(object sender, GridViewUpdateEventArgs e) { int id = Convert.ToInt32((grd_list_tutors.DataKeys[e.RowIndex].Value)); GridViewRow row = (GridViewRow)grd_list_tutors.Rows[e.RowIndex]; TextBox t1 = (TextBox)row.FindControl("txt_name"); TextBox t2 = (TextBox)row.FindControl("txt_email"); TextBox t3 = (TextBox)row.FindControl("txt_phone"); TextBox t4 = (TextBox)row.FindControl("txt_posted_on"); RadioButtonList t5 = (RadioButtonList)row.FindControl("rbl_status"); class_list_tutors cls = new class_list_tutors(); int i = cls.update(t1.Text, t2.Text, t3.Text, t4.Text, t5.SelectedItem.Text.ToString(), id); if (i > 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record updated successfully')", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record not updated successfully')", true); } grd_list_tutors.EditIndex = -1; databind1(); }
protected void btn_see_earning_Click(object sender, EventArgs e) { decimal d = 0.0M; start = Convert.ToDateTime(txt_start_date.Text); end = Convert.ToDateTime(txt_end_date.Text); class_list_tutors cls = new class_list_tutors(); ds = cls.see_earning(start, end, "see_earnings"); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { d = d + Convert.ToDecimal(ds.Tables[0].Rows[j].ItemArray[5]); } txt_total_earning.Text = d.ToString(); }
protected void btn_search_Click1(object sender, EventArgs e) { string search = txt_search.Text; class_list_tutors obj = new class_list_tutors(); ds1 = obj.filter(search); if (ds1.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds1; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { string a = ds1.Tables[0].Rows[i]["tut_id"].ToString(); int o = obj.findleads(ds1.Tables[0].Rows[i]["tut_id"].ToString()); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds1.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } }
protected void ddl_sort_SelectedIndexChanged(object sender, EventArgs e) { class_list_tutors obj = new class_list_tutors(); if (ddl_sort.SelectedValue == "taken_on") { ds = obj.select_from_id(0, "sort_taken_on"); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } } else if (ddl_sort.SelectedValue == "days_remaining_to_expiry") { ds = obj.select_from_id(0, "sort_expiry_date"); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } } else { ds = obj.select_from_id(0, "sort_leads_remaining"); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } } }
private void bind() { class_list_tutors cls = new class_list_tutors(); int i = cls.count_totals("count_total_tutors"); txt_tot_tutors.Text = i.ToString(); int j = cls.count_totals("count_total_students"); txt_tot_students.Text = j.ToString(); txt_tot_users.Text = (i + j).ToString(); int k = cls.count_totals("count_total_earning"); txt_tot_earn.Text = k.ToString(); }
protected void row_deleting(object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32((grd_list_tutors.DataKeys[e.RowIndex].Value)); class_list_tutors cls2 = new class_list_tutors(); int i = cls2.delete(id); if (i > 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record deleted successfully')", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Record not deleted successfully')", true); } databind1(); }
private void databind() { class_list_tutors cls = new class_list_tutors(); ds = cls.see_earning(DateTime.Now, DateTime.Now, "see_monthwise_earnings"); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } }
private void databind1() { //try //{ class_list_tutors obj = new class_list_tutors(); string str1 = ""; if (Request.QueryString["Loc_id"] != null) { str1 = Request.QueryString["Loc_id"].ToString(); ds = obj.select_from_id(Convert.ToInt32(str1), "select_location_from_id"); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string a = ds.Tables[0].Rows[i]["tut_id"].ToString(); int o = obj.findleads(ds.Tables[0].Rows[i]["tut_id"].ToString()); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } } else if (Request.QueryString["sub_id"] != null) { str1 = Request.QueryString["sub_id"].ToString(); ds = obj.select_from_id(Convert.ToInt32(str1), "select_subject_from_id"); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string a = ds.Tables[0].Rows[i]["tut_id"].ToString(); int o = obj.findleads(ds.Tables[0].Rows[i]["tut_id"].ToString()); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } } else if (Request.QueryString["pac_id"] != null) { str1 = Request.QueryString["pac_id"].ToString(); ds = obj.select_from_id(Convert.ToInt32(str1), "select_package_from_id"); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string a = ds.Tables[0].Rows[i]["tut_id"].ToString(); int o = obj.findleads(ds.Tables[0].Rows[i]["tut_id"].ToString()); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } } else if (ddl_reduce.SelectedItem.Text == "Show Active" || ddl_reduce.SelectedItem.Text == "Show Inactive") { string u = ddl_reduce.SelectedItem.Value; ds = obj.showdata1(u); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string a = ds.Tables[0].Rows[i]["tut_id"].ToString(); int o = obj.findleads(a); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } } else { ds = obj.showdata(); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string a = ds.Tables[0].Rows[i]["tut_id"].ToString(); int o = obj.findleads(ds.Tables[0].Rows[i]["tut_id"].ToString()); if (o > 0) { grd_list_tutors.Rows[i].Cells[6].Text = "<a href='list_students.aspx?tut_id=" + ds.Tables[0].Rows[i]["tut_id"].ToString() + "'>" + o.ToString() + "</a>"; } else { grd_list_tutors.Rows[i].Cells[6].Text = "0"; } } } //} //catch (Exception ex) //{ } }
private void databind() { string str = ""; string str1 = ""; if (Request.QueryString["Name"] != null && Request.QueryString["ID"] != null) { str1 = Request.QueryString["Name"].ToString(); str = Request.QueryString["ID"].ToString(); class_list_tutors cls = new class_list_tutors(); ds = cls.select_from_id(Convert.ToInt32(str), "select_from_id"); if (ds.Tables[0].Rows.Count > 0) { txt_name.Text = ds.Tables[0].Rows[0].ItemArray[1].ToString(); txt_email.Text = ds.Tables[0].Rows[0].ItemArray[2].ToString(); txt_phone.Text = ds.Tables[0].Rows[0].ItemArray[3].ToString(); txt_status.Text = ds.Tables[0].Rows[0].ItemArray[4].ToString(); txt_posted_on.Text = ds.Tables[0].Rows[0].ItemArray[5].ToString(); txt_pic.ImageUrl = ds.Tables[0].Rows[0].ItemArray[6].ToString(); txt_qualification.Text = ds.Tables[0].Rows[0].ItemArray[7].ToString(); } else { } ds1 = cls.select_from_id(Convert.ToInt32(str), "select_subjects"); if (ds1.Tables[0].Rows.Count > 0) { txt_sub.DataSource = ds1.Tables[0]; txt_sub.DataTextField = "sub_name"; txt_sub.DataBind(); } ds1 = cls.select_from_id(Convert.ToInt32(str), "select_locations"); if (ds1.Tables[0].Rows.Count > 0) { txt_loc.DataSource = ds1.Tables[0]; txt_loc.DataTextField = "loc_name"; txt_loc.DataBind(); } ds1 = cls.select_from_id(Convert.ToInt32(str), "select_packages"); if (ds1.Tables[0].Rows.Count > 0) { txt_pac.DataSource = ds1.Tables[0]; txt_pac.DataTextField = "pac_name"; txt_pac.DataBind(); } ds1 = cls.select_from_id(Convert.ToInt32(str), "select_class"); if (ds1.Tables[0].Rows.Count > 0) { txt_class.DataSource = ds1.Tables[0]; txt_class.DataTextField = "tut_class"; txt_class.DataBind(); } ds1 = cls.select_from_id(Convert.ToInt32(str), "select_board"); if (ds1.Tables[0].Rows.Count > 0) { txt_board.DataSource = ds1.Tables[0]; txt_board.DataTextField = "board_name"; txt_board.DataBind(); } } }
private void databind1() { try { class_list_tutors obj = new class_list_tutors(); string str1 = ""; if (Request.QueryString["Loc_id"] != null) { str1 = Request.QueryString["Loc_id"].ToString(); ds = obj.select_from_id(Convert.ToInt32(str1), "select_location_from_id"); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } } else if (Request.QueryString["sub_id"] != null) { str1 = Request.QueryString["sub_id"].ToString(); ds = obj.select_from_id(Convert.ToInt32(str1), "select_subject_from_id"); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } } else if (Request.QueryString["pac_id"] != null) { str1 = Request.QueryString["pac_id"].ToString(); ds = obj.select_from_id(Convert.ToInt32(str1), "select_package_from_id"); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } } else { string stat = ddl_reduce.SelectedValue.ToString(); ds = obj.select_from_id(0, stat); if (ds.Tables[0].Rows.Count > 0) { grd_list_tutors.DataSource = ds; grd_list_tutors.DataBind(); lbl_error.Visible = false; } else { grd_list_tutors.DataSource = null; grd_list_tutors.DataBind(); lbl_error.Visible = true; } } //DateTime dt = new DateTime(); //for(int i=0;i<ds.Tables[0].Rows.Count();i++) //dt=ds.Tables[0].Rows[i].ItemArray[5].ToString(); } catch (Exception ex) { } }