protected void Page_Load(object sender, EventArgs e) { LoadData(); if (!IsPostBack) { btndelete.Visible = false; btnupdate.Visible = false; Approvedid.Visible = false; Repairedid.Visible = false; Repairedidd.Visible = false; Repairedidd.Visible = false; if (Request.QueryString["id"] != null) { btndelete.Visible = true; btnupdate.Visible = true; Button1.Visible = false; damageID = Request.QueryString["id"]; REF_Damages oREF_Damages = new REF_Damages(); oREF_Damages.id = Convert.ToInt32(damageID); } else { } LoadService(); } damageID = Request.QueryString["id"]; }
public void UpdateRepair(REF_Damages oREF_Damages) { DBConnecton db; db = new DBConnecton(); string sqlQuery; SqlCommand oSqlCommand; try { sqlQuery = "UPDATE `tbldamage` SET `repaired` = 'Repaired' WHERE `tbldamage`.`id` = " + oREF_Damages.id + "; "; //open connection if (db.OpenConnection() == true) { //create command and assign the query and connection from the constructor MySqlCommand cmd = new MySqlCommand(sqlQuery, db.getConnetion()); //Execute command cmd.ExecuteNonQuery(); //close connection db.CloseConnection(); } } catch (Exception ex) { throw ex; } }
public void Insert(REF_Damages oREF_Damages) { DBConnecton db; db = new DBConnecton(); string sqlQuery; SqlCommand oSqlCommand; try { sqlQuery = "INSERT INTO `tbldamage` (`id`, `itemname`,`discription`) VALUES (NULL, '" + oREF_Damages.itemname + "', '" + oREF_Damages.discription + "');"; //open connection if (db.OpenConnection() == true) { //create command and assign the query and connection from the constructor MySqlCommand cmd = new MySqlCommand(sqlQuery, db.getConnetion()); //Execute command cmd.ExecuteNonQuery(); //close connection db.CloseConnection(); } } catch (Exception ex) { throw ex; } }
public void Delete(REF_Damages oREF_Damages) { DBConnecton db; db = new DBConnecton(); string sqlQuery; SqlCommand oSqlCommand; try { sqlQuery = "DELETE FROM `tbldamage` WHERE `id` = " + oREF_Damages.id + ""; //open connection if (db.OpenConnection() == true) { //create command and assign the query and connection from the constructor MySqlCommand cmd = new MySqlCommand(sqlQuery, db.getConnetion()); //Execute command cmd.ExecuteNonQuery(); //close connection db.CloseConnection(); } } catch (Exception ex) { throw ex; } }
protected void dropService_SelectedIndexChanged(object sender, EventArgs e) { REF_Damages oREF_Damages = new REF_Damages(); oREF_Damages.id = Convert.ToInt32(dropService.SelectedValue.ToString()); DAC_Damage oDAC_Damage = new DAC_Damage(); }
protected void btndelete_Click(object sender, EventArgs e) { DAC_Damage oDAC_Damage = new DAC_Damage(); REF_Damages oREF_Damages = new REF_Damages(); oREF_Damages.id = Convert.ToInt32(damageID); oDAC_Damage.Delete(oREF_Damages); LoadData(); Response.Redirect("./frmAddDamageForReview.aspx", true); }
protected void btnupdate_Click(object sender, EventArgs e) { DAC_Damage oDAC_Damage = new DAC_Damage(); REF_Damages oREF_Damages = new REF_Damages(); oREF_Damages.id = Convert.ToInt32(damageID); oREF_Damages.itemname = dropService.SelectedItem.Text; oREF_Damages.discription = Discriptionid.Text; oDAC_Damage.Update(oREF_Damages); LoadData(); Response.Redirect("./frmAddDamageForReview.aspx", true); }
protected void Page_Load(object sender, EventArgs e) { LoadData(); if (Request.QueryString["ID"] != null) { DAC_Damage oDAC_Damage = new DAC_Damage(); REF_Damages oREF_Damages = new REF_Damages(); oREF_Damages.id = Convert.ToInt32(Request.QueryString["ID"]); oDAC_Damage.UpdateFinance(oREF_Damages); LoadData(); } }
protected void btnsubmitDamage_Click(object sender, EventArgs e) { try { DAC_Damage oDAC_Damage = new DAC_Damage(); REF_Damages oREF_Damages = new REF_Damages(); oREF_Damages.itemname = dropService.SelectedItem.Text; oREF_Damages.discription = Discriptionid.Text; oDAC_Damage.Insert(oREF_Damages); // ShowMessage("Data Insert successfully!", MessageType.Success); } catch (Exception ex) { //ShowMessage("Something went wrong! Please try again!", MessageType.Error); } LoadData(); }