protected void btngive_Click(object sender, EventArgs e) { DateTime d1 = DateTime.Now; AJ_DataClass ajdbClass = new AJ_DataClass(); DataSet ds = new DataSet(); string qryUpdate = "update tblRequestForBlood set tRecieved='true',tReceivedDate='" + DateTime.Now.ToShortDateString() + "' " + " where t_id='" + hftid.Value + "'"; lblmsg.Text = ajdbClass.UpdateDatabase(qryUpdate); string qryUpdate2_rejectOtherRequests = "update tblRequestForBlood set tRecieved='false',tRejected='true',tRejectionReason='Donor is not Eligible Now' " + " where tDonor_id='" + _UserID + "' and t_id <> '" + hftid.Value + "' and tAcceptedbyDonor='false'"; lblmsg.Text = ajdbClass.UpdateDatabase(qryUpdate2_rejectOtherRequests); string qryUpdateDnrEligibilityDate = "Update tblRegister set RBloodPointDate='" + d1.ToShortDateString() + "' " + " where r_id='" + _UserID + "'"; lblmsg.Text = ajdbClass.UpdateDatabase(qryUpdateDnrEligibilityDate); btngive.Enabled = false; }
//protected void btnUpdate_Click(object sender, EventArgs e) //{ // string _isAcceptor = "false"; // string _isDonor = "false"; // if (chkAcceptor.Checked == true) _isAcceptor = "True"; // if (chkDonor.Checked == true) _isDonor = "True"; // AJ_DataClass ajdbClass = new AJ_DataClass(); // string updateQry = "update tblRegister set rName = '" + txtName.Text.Replace("'", "''").Trim() + "'," + // "rcontact='" + txtcontact.Text.Trim().Replace("'", "''") + "'," + // "raddress='" + txtaddr.Text.Trim().Replace("'", "''") + "'," + // "rbl_id='" + cboBGroup.SelectedValue + "'," + // "rct_id='" + cboCities.SelectedValue + "'," + // "rgender='" + cboGender.SelectedValue + "'," + // "risAcceptor='" + _isAcceptor + "'," + // "risDonor='" + _isDonor + "' " + // " where r_id='" + _UserID + "'"; // lblmsg.Text = ajdbClass.UpdateDatabase(updateQry); //} protected void btnchngPwd_Click(object sender, EventArgs e) { if (txtopwd.Text.Trim().Length == 0) { lblmsg.Text = "Invalid Old Password or User Name ! "; txtopwd.Focus(); return; } if (txtnpwd.Text.Trim() != txtrpwd.Text.Trim()) { lblmsg.Text = "Password MissMatched !"; txtrpwd.Focus(); return; } AJ_DataClass ajdbClass = new AJ_DataClass(); string updateQry = "update tblRegister set rPassword = '******'", "''").Trim() + "' " + " where r_id='" + _UserID + "'"; lblmsg.Text = ajdbClass.UpdateDatabase(updateQry); if (lblmsg.Text == "Update Record(s) Succfully") { lblmsg.Text = "Password Changed Successfully"; txtnpwd.Text = ""; txtopwd.Text = ""; txtrpwd.Text = ""; } }
protected void btnUpdate_Click(object sender, EventArgs e) { string _isAcceptor = "false"; string _isDonor = "false"; if (chkAcceptor.Checked == true) { _isAcceptor = "True"; } if (chkDonor.Checked == true) { _isDonor = "True"; } AJ_DataClass ajdbClass = new AJ_DataClass(); string updateQry = "update tblRegister set rName = '" + txtName.Text.Replace("'", "''").Trim() + "'," + "rcontact='" + txtcontact.Text.Trim().Replace("'", "''") + "'," + "raddress='" + txtaddr.Text.Trim().Replace("'", "''") + "'," + "rbl_id='" + cboBGroup.SelectedValue + "'," + "rct_id='" + cboCities.SelectedValue + "'," + "rgender='" + cboGender.SelectedValue + "'," + "risAcceptor='" + _isAcceptor + "'," + "risDonor='" + _isDonor + "' " + " where r_id='" + _UserID + "'"; lblmsg.Text = ajdbClass.UpdateDatabase(updateQry); }
protected void btnchngPwd_Click(object sender, EventArgs e) { AJ_DataClass ajdbClass = new AJ_DataClass(); string updateQry = "update tblRegister set rPassword = '' " + " where r_id='" + _UserID + "'"; lblmsg.Text = ajdbClass.UpdateDatabase(updateQry); if (lblmsg.Text == "Update Record(s) Succfully") { lblmsg.Text = "Password Changed Successfully"; } }
// update student private void btnUpdateStudent_Click(object sender, EventArgs e) { // if (lblidStud.Text == "0") return; string QryUpdate = " FirstName='" + txtfname.Text.Trim().Replace("'", "''") + "', LastName='" + txtlname.Text.Trim().Replace("'", "''") + "', Contact='" + txtcon.Text.Trim().Replace("'", "''") + "', Email='" + txtemail.Text.Trim().Replace("'", "''") + "', RegistrationNumber='" + txtRegNo.Text.Trim().Replace("'", "''") + "', status='" + cmbStatus.SelectedValue + "'"; string Result = ajdbClass.UpdateDatabase("update Student set " + QryUpdate + " where id='" + lblidStud.Text + "'"); string qry = "SELECT Student.Id, Student.FirstName, Student.LastName, Student.Contact, Student.Email, Student.RegistrationNumber, Lookup.Name, Lookup.LookupId " + " FROM Student INNER JOIN " + " Lookup ON Student.Status = Lookup.LookupId "; ajdbClass.popGrid(gvStudents, qry); txtfname.Text = ""; txtlname.Text = ""; txtRegNo.Text = ""; txtemail.Text = ""; txtcon.Text = ""; MessageBox.Show("Record updated successfully"); }
protected void Page_Load(object sender, EventArgs e) { AJ_DataClass ajdbClass = new AJ_DataClass(); if (Request.QueryString["id"].ToString() != null) { _UserID = Request.QueryString["id"].ToString(); } bool chef = true; string s = ajdbClass.UpdateDatabase("update [Order] set OdFwdFoodCheff='" + chef + "' where OdId='" + _UserID + "'"); lblmsg.Text = s + " Order has been sent to chef "; }
protected void Button1_Click(object sender, EventArgs e) { AJ_DataClass ajdbClass = new AJ_DataClass(); if (Request.QueryString["id"].ToString() != null) { _UserID = Request.QueryString["id"].ToString(); } bool chef = true; bool deliver = true; // string s = ajdbClass.UpdateDatabase("update clo set name='" + _name + "',dateupdated='" + _dateupdated + "' where id='" + _id + "'"); string s = ajdbClass.UpdateDatabase("update [Order] set OdFwdFoodCheff='" + chef + "',OdDelivered='" + deliver + "' where OdId='" + _UserID + "'"); lblmsg.Text = s + " Order has been delivered !!! "; }
protected void Button1_Click(object sender, EventArgs e) { AJ_DataClass ajdbClass = new AJ_DataClass(); if (Request.QueryString["id"].ToString() != null) { _UserID = Request.QueryString["id"].ToString(); } bool chef = true; bool deliver = true; bool pay = true; string s = ajdbClass.UpdateDatabase("update [Order] set OdFwdFoodCheff='" + chef + "',OdDelivered='" + deliver + "',OdDeliveredTime='" + DateTime.Now + "',OdPaymentRecieved='" + pay + "' where OdId='" + _UserID + "'"); lblmsg.Text = s + " I deliver order and recieve payment !!!"; }
protected void btnSetAppointment_Click(object sender, EventArgs e) { DateTime temp; if (DateTime.TryParse(txtdate.Text, out temp)) { lblmsg.Text = ""; } else { lblmsg.Text = "Invalid Date"; txtdate.Focus(); return; } AJ_DataClass ajdbClass = new AJ_DataClass(); string updateQry = "update tblRequestForBlood set tAcceptedbyDonor='true',tMeetingPlace='" + txtPlace.Text.Trim().Replace("'", "''").Trim() + "',tMeetingAddress='" + txtmsg.InnerText + "',tMeetingDate='" + txtdate.Text.Trim().Replace("'", "''").Trim() + "' where t_id='" + hftid.Value + "'"; lblmsg.Text = ajdbClass.UpdateDatabase(updateQry); if (lblmsg.Text.Trim() == "Update Record(s) Succfully") { btnSetAppointment.Enabled = false; } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { int userid = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value.ToString()); GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex]; Label lblID = (Label)row.FindControl("lblID"); //TextBox txtname=(TextBox)gr.cell[].control[]; TextBox textName = (TextBox)row.Cells[1].Controls[0]; TextBox textprice = (TextBox)row.Cells[2].Controls[0]; TextBox textqty = (TextBox)row.Cells[3].Controls[0]; //TextBox textadd = (TextBox)row.FindControl("txtadd"); //TextBox textc = (TextBox)row.FindControl("txtc"); GridView1.EditIndex = -1; AJ_DataClass aj = new AJ_DataClass(); aj.UpdateDatabase("update Purchase set PrName='" + textName.Text + "',PrPrice='" + textprice.Text + "',PrQty='" + textqty.Text + "'where Prid='" + userid + "'"); // conn.Open(); //SqlCommand cmd = new SqlCommand("SELECT * FROM detail", conn); //SqlCommand cmd = new SqlCommand("update Purchase set PrName='" + textName.Text + "',PrPrice='" + textprice.Text + "',PrQty='" + textqty.Text + "'where id='" + userid + "'", conn); //cmd.ExecuteNonQuery(); //conn.Close(); gvbind(); //GridView1.DataBind(); }