protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { PopulateHospitalId(); testidhidden.Value = e.CommandArgument.ToString(); if (e.CommandName == "U") { MultiView1.ActiveViewIndex = 0; btnsave.Text = "Update"; db1.strCommand = "Select * from AddCalibrationTest where ActiveStatus='True' and TestID='" + testidhidden.Value + "'"; DataTable dt = db1.selecttable(); if (dt.Rows.Count > 0) { txttestname.Text = dt.Rows[0]["TestName"].ToString(); txtdescrption.Text = dt.Rows[0]["Description"].ToString(); } } if (e.CommandName == "D") { string query = "Update AddCalibrationTest set ActiveStatus='False' where TestID='" + testidhidden.Value + "'"; db1.executeQuery(query); BindGrid(); lblmsg.Text = "Deleted Successfully"; lblmsg.Style.Add("color", "green"); } }
protected void CustomersGridView_RowDeleting(object sender, GridViewDeleteEventArgs e) { logidgrid_hidden.Value = (CustomersGridView.DataKeys[e.RowIndex].Values["LoginID"].ToString()); string qry = "delete from Hospital where LoginID='" + logidgrid_hidden.Value + "'"; int i = db1.executeQuery(qry); db1.strCommand = "delete from LoginTb where LoginID='" + logidgrid_hidden.Value + "'"; db1.insertqry(); PopulateHospitalInfo(); }
public void InsertPreMaintenance() { string productname = "", Manufacture = "", Model = "", Devicetype = "", Deviceclassi = "", supply = "", power = "", serialno = "", biomedicalid = "", location = "", description = ""; productname = txtproname.Text.Trim(); Manufacture = txtmanufact.Text.Trim(); Model = txtModel.Text.Trim(); Devicetype = txtdevicetype.Text.Trim(); Deviceclassi = txtdeviceclass.Text.Trim(); supply = txtsupply.Text.Trim(); power = txtpower.Text.Trim(); serialno = txtserialno.Text.Trim(); biomedicalid = txtbiomedical.Text.Trim(); location = txtlocation.Text.Trim(); description = txtdescrption.Text.Trim(); string query = "Insert into Prevention(ProductName,Manufacture,Model,DeviceType,DeviceClassi,Supply,Power,Serial_No," + "BiomedicalID,Location,Description,HospitalID) values('" + productname + "','" + Manufacture + "','" + Model + "','" + Devicetype + "'," + "'" + Deviceclassi + "','" + supply + "','" + power + "','" + serialno + "','" + biomedicalid + "','" + location + "','" + description + "','" + hospitalidhidden.Value + "')"; int s = db.executeQuery(query); if (s > 0) { int preventid = 0; db.strCommand = "Select max(PreventID) as PreventID from Prevention where ActiveStatus=1"; DataTable dt = db.selecttable(); if (dt.Rows.Count > 0) { preventid = Convert.ToInt32(dt.Rows[0]["PreventID"]); } for (int i = 0; i < chktest.Items.Count; i++) { if (chktest.Items[i].Selected == true) { int testid = Convert.ToInt32(chktest.Items[i].Value); string qry = "Insert into Prevent_Join_Calibration(PreventID,TestID,ActiveStatus) values('" + preventid + "','" + testid + "',1)"; db.executeQuery(qry); } } } else { lblMsg.Text = "Insertion Failed"; } }