/// <summary> /// Save the details of Item to the database /// </summary> protected void lnk_save_Click(object sender, EventArgs e) { int isactive = (chk_isactive.Checked)?1:0; string filepath = ""; string ext = Path.GetExtension(fu_picture.PostedFile.FileName).ToLower(); if (fu_picture.HasFile) { if (ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".gif") { filepath = Guid.NewGuid().ToString() + ext; fu_picture.SaveAs(Server.MapPath("~/project_files/items/") + filepath); } } st = "insert into tbl_items([item_name],[price],[item_image],[item_desc],[qty],[added_by],[is_active],[category_id]) values" + "('" + txt_name.Text + "', " + txt_price.Text + ",'" + filepath + "','" + txt_desc.Text + "'," + txt_qty.Text + "," + Session["admin_id"].ToString() + "," + isactive + "," + ddl_category.SelectedValue + ")"; int x = db.ExeQuery(st); if (x > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Item added successfully.');", true); txt_desc.Text = txt_name.Text = ""; fill_data(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Unable to add, please try later.');", true); } }
/// <summary> /// Method to save the combos in tbl_combos table, image will be saved to "project_files/combos" folder /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnk_save_Click(object sender, EventArgs e) { string filepath = ""; string ext = Path.GetExtension(fu_picture.PostedFile.FileName).ToLower(); if (fu_picture.HasFile) { if (ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".gif") { filepath = Guid.NewGuid().ToString() + ext; fu_picture.SaveAs(Server.MapPath("~/project_files/combos/") + filepath); } } st = "insert into tbl_combos(title,description,price,combo_picture) values('" + txt_title.Text + "','" + txt_desc.Text + "'," + txt_price.Text + ",'" + filepath + "')"; int x = db.ExeQuery(st); if (x > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Combo added successfully.');", true); txt_desc.Text = txt_price.Text = txt_title.Text = ""; fill_data(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Unable to add, please try later.');", true); } }
protected void lnk_delete_Click(object sender, EventArgs e) { LinkButton lnk = sender as LinkButton; st = "delete from Notice where notice_id=" + lnk.CommandArgument; db.ExeQuery(st); fill_repeater(); }
protected void lnk_save_Click(object sender, EventArgs e) { st = "insert into assignment values('" + dd_dept.Text + "','" + dd_sub.Text + "'," + dd_sem.Text + ",'" + txt_que.Text + "','" + txt_date.Text + "')"; int y = db.ExeQuery(st); if (y > 0) { Response.Write("<script>alert('Assignment Added, Thank you...')</script>"); } else { Response.Write("<script>alert('Failed, Try again...')</script>"); } }
protected void lnkSave_Click(object sender, EventArgs e) { st = "Insert into subjects values('" + txt_title.Text + "','" + txt_Code.Text + "','" + dd_dept.Text + "'," + dd_sem.Text + "," + txt_units.Text + "," + txt_cr.Text + ")"; int x = db.ExeQuery(st); if (x > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Subject Added successfully.');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Failed ');", true); } fill_repeater(); txt_Code.Text = txt_cr.Text = txt_title.Text = txt_units.Text = ""; }
protected void rpt_ItemCommand(object source, RepeaterCommandEventArgs e) { LinkButton lnkTime = (LinkButton)e.Item.FindControl("lnkTime"); if (e.CommandName == "Select") { if (txt_date.Text != "") { st = "Select * from Appointment where date='" + txt_date.Text + "' and Time='" + lnkTime.Text + "' and DoctId=" + docid + " "; dr = db.readall(st); if (dr.Read()) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Already Appointment Taken ');", true); } else { dr.Dispose(); st = "Insert into Appointment(PatientId,DoctId,date,Time) values (" + Session["Patient"] + "," + docid + " ,'" + txt_date.Text + "','" + lnkTime.Text + "')"; int x = db.ExeQuery(st); if (x > 0) { //Response.Redirect("MyAppointmentStatus.aspx"); ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Appointeted');", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Try Again');", true); } } } } }
protected void lnk_delete_Click(object sender, EventArgs e) { LinkButton lnk = sender as LinkButton; st = "delete from Appointment where PatientId=" + Session["Patient"] + " and id=" + lnk.CommandArgument; db.ExeQuery(st); fill_repeater(); }
protected void lnk_delete_Click(object sender, System.EventArgs e) { LinkButton lnk = sender as LinkButton; st = "delete from patient where id=" + lnk.CommandArgument; db.ExeQuery(st); fill_repeater(); }
protected void proceed_Click(object sender, EventArgs e) { LinkButton lnk = sender as LinkButton; st = "delete from Appointment where PatientId=" + lnk.CommandArgument; db.ExeQuery(st); Response.Redirect("treatment.aspx?pid=" + lnk.CommandArgument + "&did=" + Session["doctor"] + ""); }
/// <summary> /// deletes Theme /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnk_delete_Click(object sender, EventArgs e) { LinkButton lnk = sender as LinkButton; st = "delete from tbl_themes where theme_id = " + (sender as LinkButton).CommandArgument; int x = db.ExeQuery(st); if (x > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','theme deleted successfully.');", true); fill_data(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Unable to delete, please try later.');", true); } }
protected void LinkButton1_Click(object sender, EventArgs e) { gender = (string)(this.rdFemale.Checked ? "Female" : "Male"); st = "insert into owner values ('" + txt_name.Text + "','" + txt_emailid.Text + "','" + gender + "','" + txt_address.Text + "'," + txt_mobile.Text + ",'" + txt_password.Text + "')"; x = db.ExeQuery(st); if (x > 0) { Label1.Text = "Owner Added Success"; Label1.ForeColor = Color.Green; } else { Label1.Text = "Failed to Add"; Label1.ForeColor = Color.Red; } fill_empty(); fill_repeater(); }
protected void LinkButton1_Click(object sender, EventArgs e) { st = "insert into treatment values(" + Request.QueryString["pid"].ToString() + "," + Request.QueryString["did"].ToString() + ",'" + txt_name.Text + "','" + txt_emailid.Text + "','" + txt_qual.Text + "','" + dd_spl.Text + "'," + txt_mobile.Text + ",'" + txt_desc.Text + "')"; int x = db.ExeQuery(st); if (x > 0) { String result; string apiKey = "tqVqMWIp0G4-3KEbGW4xElG4dBnvujyg4zRx1YHX6C"; string numbers; // in a comma seperated list // string message = "This is your message"; string senders = "TXTLCL"; string mobile = m; string msg = "Prescriprion Details \n Name : '" + txt_name.Text + "'\n Mobile:" + txt_mobile.Text + "\n Prescription:'" + txt_desc.Text + "'"; String url = "https://api.textlocal.in/send/?apikey=" + apiKey + "&numbers=" + mobile + "&message=" + msg + "&sender=" + senders; //refer to parameters to complete correct url string StreamWriter myWriter = null; HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url); objRequest.Method = "POST"; objRequest.ContentLength = Encoding.UTF8.GetByteCount(url); objRequest.ContentType = "application/x-www-form-urlencoded"; try { myWriter = new StreamWriter(objRequest.GetRequestStream()); myWriter.Write(url); } catch (Exception ex) { Response.Write("<script>alert('" + ex.ToString() + "')</script>"); } finally { myWriter.Close(); } HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse(); using (StreamReader sr = new StreamReader(objResponse.GetResponseStream())) { result = sr.ReadToEnd(); // Close and clean up the StreamReader sr.Close(); } Response.Write("<script>alert('" + result.ToString() + "')</script>"); Response.Write("<script>alert('Submitted ...')</script>"); } else { Response.Write("<script>alert('failed ...')</script>"); } }
protected void lnk_delete_Click(object sender, EventArgs e) { LinkButton lnk = sender as LinkButton; st = "delete from booking where customer_id=" + Session["customer"] + " and hall_id=" + lnk.CommandArgument + ""; db.ExeQuery(st); Response.Write("<script>alert('Hall Deleted')</script>"); fill_repeater(); }
protected void lnk_save_Click(object sender, EventArgs e) { st = "insert into sprtselected (name,email,sport,dept) values ('" + txt_name.Text + "','" + txt_emailid.Text + "','" + txt_sports.Text + "','" + dd_dept.Text + "')"; int x = db.ExeQuery(st); if (x > 0) { emailaccount _emailaccount = new emailaccount(); string mail_body = _emailaccount.email_content1("You are selected for inter college sports <br/><b>Sports : '" + txt_sports.Text + "'</b> ", "", "", "", "Sports Event"); _emailaccount.SendEmail(txt_emailid.Text, "", "", "Sports selection", mail_body, true); fill_empty(); ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Students selected successfully.');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Failed ');", true); } }
public static string song_status(int song_id, int status) { // 1 = playing, 2- finished mydb db = new mydb(); string st = ""; if (status == 1) { st = "update tbl_player set is_playing = 1 where song_id = " + song_id; db.ExeQuery(st); } else { st = "update tbl_player set is_played = 1 where song_id = " + song_id; db.ExeQuery(st); } return(""); }
protected void lnk_submit_Click(object sender, EventArgs e) { //(condition)?true:false char Present; foreach (RepeaterItem item in Repeater1.Items) { HiddenField hf_RegNo = item.FindControl("Hf_regnum") as HiddenField; CheckBox cb_present = item.FindControl("chk_status") as CheckBox; if (dd_period.Text == "1") { st = "insert into prd1(student_id,date,sub,status,dept,sem) values('" + hf_RegNo.Value + "','" + time.ToString(format) + "','" + dd_sub.Text + "'," + ((cb_present.Checked) ? 1 : 0) + ",'" + dd_dept.Text + "'," + dd_sem.Text + ")"; x = db.ExeQuery(st); } else if (dd_period.Text == "2") { st = "insert into prd2(student_id,date,sub,status,dept,sem) values('" + hf_RegNo.Value + "','" + time.ToString(format) + "','" + dd_sub.Text + "'," + ((cb_present.Checked) ? 1 : 0) + ",'" + dd_dept.Text + "'," + dd_sem.Text + ")"; x = db.ExeQuery(st); } else if (dd_period.Text == "3") { st = "insert into prd3(student_id,date,sub,status,dept,sem) values('" + hf_RegNo.Value + "','" + time.ToString(format) + "','" + dd_sub.Text + "'," + ((cb_present.Checked) ? 1 : 0) + ",'" + dd_dept.Text + "'," + dd_sem.Text + ")"; x = db.ExeQuery(st); } else if (dd_period.Text == "4") { st = "insert into period4(student_id,date,sub,status,dept,sem) values('" + hf_RegNo.Value + "','" + time.ToString(format) + "','" + dd_sub.Text + "'," + ((cb_present.Checked) ? 1 : 0) + ",'" + dd_dept.Text + "'," + dd_sem.Text + ")"; x = db.ExeQuery(st); } if (x > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Attendace Complete');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Attendace In-Complete');", true); } } }
protected void lnk_save_Click(object sender, EventArgs e) { // string path = Server.MapPath("upload1/"); st = "insert into quiz values ('" + dd_sub.Text + "','" + txt_que.Text + "','" + txt_a.Text + "','" + txt_b.Text + "','" + txt_c.Text + "','" + txt_d.Text + "'," + txt_ans.Text + ",'" + dd_dept.Text + "'," + dd_sem.Text + ")"; int x = db.ExeQuery(st); if (x > 0) { fill_repeater1(); ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Question Added successfully.');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Failed ');", true); } fill_repeater(); }
protected void lnk_save_Click(object sender, EventArgs e) { st = "insert into faculty (name,email,password,address,dept)values('" + txt_name.Text + "','" + txt_emailid.Text + "','" + txt_password.Text + "','" + txt_address.Text + "','" + dd_dept.Text + "')"; int x = db.ExeQuery(st); if (x > 0) { emailaccount _emailaccount = new emailaccount(); string mail_body = _emailaccount.email_content1("Your account has been created in Student Activity. <br/><b>Password : "******"</b> ", "", "", "", "Account Created"); _emailaccount.SendEmail(txt_emailid.Text, "", "", "Your account created", mail_body, true); fill_empty(); fill_repeater(); ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Faculty Added successfully.');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Failed to add faculty');", true); } }
protected void lnk_save_Click(object sender, EventArgs e) { st = "INSERT INTO student(fullname,dob,gender,address,email,mobile,password,dept,sem) VALUES('" + txt_name.Text + "','" + txt_date.Text + "','" + dd_gender.Text + "','" + txt_address.Text + "','" + txt_emailid.Text + "'," + txt_mobile.Text + ",'" + txt_password.Text + "','" + dd_dept.Text + "'," + dd_sem.Text + ")"; int x = db.ExeQuery(st); if (x > 0) { emailaccount _emailConfig = new emailaccount(); string mail_body = _emailConfig.email_content1("Your account has been created in Student IA. <br/><b>Password : "******"</b> ", "", "", "", "Account Created"); _emailConfig.SendEmail(txt_emailid.Text, "", "", "Your account created", mail_body, true); fill_empty(); ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Student Added successfully.');", true); fill_repeater(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Failed ');", true); } }
public static string play_song(string songid) { mydb db = new mydb(); string st = ""; st = "select order_number from tbl_player where song_id = (select max(isnull(song_id,1)) from tbl_player where is_playing =1 or is_requested = 1)"; string val = db.read_val(st); st = "update tbl_player set is_requested=1 , requested_time = getdate(),order_number=" + val + " where song_id=" + songid; db.ExeQuery(st); return("done"); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkCheckout_Click(object sender, EventArgs e) { LinkButton lnk = sender as LinkButton; st = "update tbl_orders set isclosed=1 where order_id=" + lnk.CommandArgument; db.ExeQuery(st); st = "select tablenumber,order_id,amount from tbl_orders where isClosed=0 "; db.fill_rptr_ret_sqlda(st, rpt_tables); upnl_repeater.Update(); }
/// <summary> /// updates paasword in database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnk_save_Click(object sender, EventArgs e) { st = "update tbl_admin set admin_password ='******' where admin_id=" + Session["admin_id"].ToString() + " and admin_password='******'"; if (db.ExeQuery(st) > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Password updated successfully');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Old password doesn't match');", true); } }
protected void LinkButton1_Click(object sender, EventArgs e) { gender = (string)(this.rdFemale.Checked ? "Female" : "Male"); st = "insert into doctor values ('" + txt_name.Text + "','" + txt_emailid.Text + "','" + gender + "','" + txt_qual.Text + "','" + dd_spl.Text + "'," + txt_mobile.Text + ",'" + txt_password.Text + "')"; x = db.ExeQuery(st); if (x > 0) { emailaccount _emailConfig = new emailaccount(); string mail_body = _emailConfig.email_content1("Your account has been created in Health Care Organisation. <br/><b>Password : "******"</b> ", "", "", "", "Account Created"); _emailConfig.SendEmail(txt_emailid.Text, "", "", "Your Account Created", mail_body, true); Label1.Text = "Doctor Added Success"; Label1.ForeColor = Color.Green; } else { Label1.Text = "Failed to Add"; Label1.ForeColor = Color.Red; } fill_empty(); fill_repeater(); }
protected void search_Click(object sender, EventArgs e) { if (search.Text == "Submit") { if (FileUpload1.HasFile) { string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName); FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Image/") + fileName); st = "insert into hall values('" + txt_name.Text + "','" + txt_owner.Text + "'," + Session["owner"] + ",'" + txt_address.Text + "','" + txt_area.Text + "','" + dd_hall.Text + "','" + fileName + "'," + txt_mobile.Text + ",'" + dd_range.Text + "'," + txt_price.Text + ",'" + txt_desc.Text + "')"; x = db.ExeQuery(st); if (x > 0) { Response.Write("<script>alert('Failed')</script>"); } else { Response.Write("<script>alert('Failed')</script>"); } txt_address.Text = txt_mobile.Text = txt_name.Text = txt_owner.Text = ""; } main.Visible = false; add.Visible = true; } else { string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName); FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Image/") + fileName); st = "update hall set hall_name='" + txt_name.Text + "',owner_name='" + txt_owner.Text + "',address='" + txt_address.Text + "',area='" + txt_area.Text + "',category='" + dd_hall.Text + "',image='" + fileName + "',mobile='" + txt_mobile.Text + "',range='" + dd_range.Text + "',price='" + txt_price.Text + "' where id=" + Request.QueryString["id"] + ""; x = db.ExeQuery(st); if (x > 0) { Response.Write("<script>alert('Updated')</script>"); } else { Response.Write("<script>alert('Failed')</script>"); } } }
protected void signup_Click(object sender, System.EventArgs e) { gender = (string)(this.rdFemale.Checked ? "Female" : "Male"); if (owner.Checked) { st = "insert into owner values ('" + txt_name.Text + "','" + txt_emailid.Text + "','" + gender + "','" + txt_address.Text + "'," + txt_mobile.Text + ",'" + txt_password.Text + "')"; x = db.ExeQuery(st); if (x > 0) { fill_repeater(); Label1.Text = "Sign-up Success"; Label1.ForeColor = Color.Green; } else { fill_repeater(); Label1.Text = "Failed to Sign-up"; Label1.ForeColor = Color.Red; } } else { st = "insert into customer values ('" + txt_name.Text + "','" + txt_emailid.Text + "','" + gender + "','" + txt_address.Text + "'," + txt_mobile.Text + ",'" + txt_password.Text + "')"; x = db.ExeQuery(st); if (x > 0) { fill_repeater(); Label1.Text = "Sign-up Success"; Label1.ForeColor = Color.Green; } else { fill_repeater(); Label1.Text = "Failed to Sign-up"; Label1.ForeColor = Color.Red; } } }
/// <summary> /// Updates the Admin details /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnk_save_Click(object sender, EventArgs e) { st = "update tbl_admin set admin_name='" + txt_fullname.Text + "',emailid='" + txt_emailid.Text + "' where admin_id='" + Session["admin_id"].ToString() + "'"; int x = db.ExeQuery(st); if (x > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Details Updated successfully.');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Updation failed please try later.');", true); } }
public void insertion(string sub, int max, int asssignment, int max_assign, int minor1, int minor2, int grand) { string s = "insert into MarksCard values('" + dd_dept.Text + "'," + dd_sem.Text + "," + DropDownList1.Text + ",'" + sub + "'," + maximum + "," + assignment + "," + max_assign + "," + minor1 + "," + minor2 + "," + grand + ")"; int b = db.ExeQuery(s); if (b > 0) { Response.Write("<script>alert('Marks added Succesfully , Thank you....')</script>"); } else { Response.Write("<script>alert('Failed')</script>)"); } }
protected void LinkButton1_Click(object sender, EventArgs e) { st = "insert into treatment values(" + Request.QueryString["pid"].ToString() + "," + Request.QueryString["did"].ToString() + ",'" + txt_name.Text + "','" + txt_emailid.Text + "','" + txt_qual.Text + "','" + dd_spl.Text + "'," + txt_mobile.Text + ",'" + txt_desc.Text + "')"; int x = db.ExeQuery(st); if (x > 0) { Response.Write("<script>alert('Submitted ...')</script>"); } else { Response.Write("<script>alert('failed ...')</script>"); } }
protected void lnk_save_Click(object sender, EventArgs e) { st = "INSERT INTO sports(Name,gender,address,email,mobile,sport,dept) VALUES('" + txt_name.Text + "','" + dd_gender.Text + "','" + txt_address.Text + "','" + txt_emailid.Text + "'," + txt_mobile.Text + ",'" + dd_sports.Text + "','" + dd_dept.Text + "')"; int x = db.ExeQuery(st); if (x > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Applied Successfully.');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Failed.');", true); } fill_clear(); }
protected void lnk_save_Click(object sender, EventArgs e) { st = "insert into SelectedRessume (name,email) values('" + txt_name.Text + "','" + txt_email.Text + "')"; int x = db.ExeQuery(st); if (x > 0) { emailaccount _emailaccount = new emailaccount(); string mail_body = _emailaccount.email_content1("You have been selected for placement interview , Please contact faculty <br/><b></b> ", "", "", "", "Ressume Selected"); _emailaccount.SendEmail(txt_email.Text, "", "", "You have been Selected ", mail_body, true); ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('success','Student selected');", true); fill_clear(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Failed');", true); } }