private void btSave_Click(object sender, EventArgs e) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("INSERT INTO tbPatient" + "(PID,PName,Gender,PType,Nation,Birhtdate,PAddress,Phone,illstatus,BloodType,Occupation) VALUES " + "('" + txtID.Text + "'," + "'" + txtName.Text + "'," + "'" + cmbSex.Text + "'," + "'" + cmbType.Text + "'," + "'" + txtNation.Text + "'," + "'" + txtBD.Text + "'," + "'" + txtAddress.Text + "'," + "'" + txtPhone.Text + "'," + "'" + txtIllStatus.Text + "'," + "'" + cmbBtype.Text + "'," + "'" + txtOccupation.Text + "'" + ")"); if (cmbType.Text == "Inpatient ") { MessageBox.Show("go to checkin"); } Clear cn = new Clear(); cn.ClearTextBoxes(this); }
private void btSave_Click(object sender, EventArgs e) { if (btclick == 1) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("INSERT INTO tbSupplier (SupplierID, SupplierName, SupplierPhone,country) " + "VALUES ('" + txtSupplierID.Text + "','" + txtName.Text + "','" + txtPhone.Text + "','" + txtAdress.Text + "')"); SupplierModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); listViewShow lst = new listViewShow(); lst.ShowData("Select SupplierName from tbSupplier", "SupplierName", lstView); btNew_Click(this, null); } if (btclick == 2) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("Update tbSupplier Set SupplierID='" + txtSupplierID.Text + "', SupplierName='" + txtName.Text + "', SupplierPhone='" + txtPhone.Text + "', Country='" + txtAdress.Text + "' Where SupplierID='" + txtSupplierID.Text + "'"); SupplierModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); listViewShow lst = new listViewShow(); lst.ShowData("Select SupplierName from tbSupplier", "SupplierName", lstView); btNew_Click(this, null); MessageBox.Show("Record was Updated!!"); } btSave.Enabled = false; }
private void btSave_Click(object sender, EventArgs e) { if (btclick == 1) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("INSERT INTO tbRoom(RoomNo,Availablebed,Building,Rfloor,RtypeID) " + "VALUES (" + "'" + txtRoomNo.Text + "'," + "'" + txtAvaliable.Text + "'," + "'" + cmbBuiding.Text + "'," + "'" + txtFloor.Text + "'," + "'" + cmbRoomTID.Text + "'" + ")"); RoomModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); } if (btclick == 2) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("Update tbRoom Set " + " Availablebed='" + txtAvaliable.Text + "'," + " Building='" + cmbBuiding.Text + "'," + " Rfloor='" + txtFloor.Text + "', " + " RtypeID='" + cmbRoomTID.Text + "'" + " Where RoomNo ='" + txtRoomNo.Text + "'"); RoomModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); } }
private void btSave_Click(object sender, EventArgs e) { if (btclick == 1) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("INSERT INTO tbRoomType" + "(RTypeID,RType,NumofBed,Price) VALUES " + "('" + txtRTID.Text + "'," + "'" + cmbType.Text + "'," + "'" + txtNumofBed.Text + "'," + "'" + txtPrice.Text + "'" + ")"); RoomType_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); } if (btclick == 2) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("Update tbRoomType Set " + " RType='" + cmbType.Text + "'," + " NumofBed='" + txtNumofBed.Text + "'," + " Price='" + txtPrice.Text + "'" + " Where RTypeID ='" + txtRTID.Text + "'"); RoomType_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); } }
private void btSave_Click(object sender, EventArgs e) { if (btclick == 1) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("INSERT INTO tbUser (UserID, UserName, UserPassword, AccountType, RegisterDate, StaffID) " + "VALUES ('" + txtUserID.Text + "','" + txtUserName.Text + "','" + txtPassword.Text + "','" + cmbAccType.Text + "','" + txtRegisterDate.Text + "','" + cmbStaff.Text + "')"); UserModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); listViewShow lst = new listViewShow(); lst.ShowData("Select UserName from tbUser", "UserName", lstView); btNew_Click(this, null); } if (btclick == 2) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("Update tbUser Set UserID='" + txtUserID.Text + "', UserName='******', UserPassword='******', AccountType='" + cmbAccType.Text + "', RegisterDate='" + txtRegisterDate.Text + "', StaffID='" + cmbStaff.Text + "' Where UserID='" + txtUserID.Text + "'"); UserModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); listViewShow lst = new listViewShow(); lst.ShowData("Select UserName from tbUser", "UserName", lstView); } btSave.Enabled = false; btEdit.Enabled = true; btNew.Enabled = true; }
private void btSave_Click(object sender, EventArgs e) { if (btclick == 1) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("Insert Into tbMedicine(MeID,MeName,MeType,StockQty,MeCategoryID,Cost) " + "VALUES (" + "'" + txtMeID.Text + "'," + "'" + txtName.Text + "'," + "'" + cmbCategory.Text + "'," + "'" + txtStockqty.Text + "'," + "'" + txtCategoryID.Text + "'," + "'" + txtCost.Text + "'" + ")"); MedicineModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); } if (btclick == 2) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("Update tbMedicine Set " + " MeName='" + txtName.Text + "'," + " MeType='" + cmbCategory.Text + "'," + " StockQty='" + txtStockqty.Text + "'," + " Cost='" + txtCost.Text + "'," + " MeCategoryID='" + txtCategoryID.Text + "'" + " Where MeID ='" + txtMeID.Text + "'"); MedicineModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); } }
private void btSave_Click(object sender, EventArgs e) { if (btclick == 1) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("INSERT INTO tbMeCategory" + "(MeCategoryID,Category,Country,Usage) VALUES " + "('" + txtcategoryID.Text + "'," + "'" + txtCategoryName.Text + "'," + "'" + cmbCountry.Text + "'," + "'" + txtUsage.Text + "'" + ")"); MecCategory_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); } if (btclick == 2) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("Update tbMeCategorySet " + " Category='" + txtCategoryName.Text + "'," + " Country='" + cmbCountry.Text + "'," + " Usage='" + txtUsage.Text + "'" + " Where MeCategoryID='" + txtcategoryID.Text + "'"); MecCategory_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); } }
private void btSave_Click(object sender, EventArgs e) { if (btclick == 1) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("INSERT INTO tbServices" + "(ServiceID,ServiceName,cost,Info) VALUES " + "('" + txtServiceID.Text + "'," + "'" + txtName.Text + "'," + "'" + txtCost.Text + "'," + "'" + txtInfo.Text + "'" + ")"); ServiceModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); } if (btclick == 2) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("Update tbServices Set " + " ServiceName='" + txtName.Text + "'," + " cost='" + txtCost.Text + "'," + " Info='" + txtInfo.Text + "'" + " Where ServiceID ='" + txtServiceID.Text + "'"); ServiceModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); } }
public void ShowData(String SelectStatment, String ColumnName, ListBox listView) { listView.Items.Clear(); dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); SqlDataReader dr = dbcon.DataReader(SelectStatment); while (dr.Read()) { listView.Items.Add(dr[ColumnName]); } }
private void btSave_Click(object sender, EventArgs e) { if (btclick == 1) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("INSERT INTO tbPatient" + "(PID,PName,Gender,PType,Nation,Birhtdate,PAddress,Phone,illstatus,BloodType,Occupation) VALUES " + "('" + txtID.Text + "'," + "'" + txtName.Text + "'," + "'" + cmbSex.Text + "'," + "'" + cmbType.Text + "'," + "'" + txtNation.Text + "'," + "'" + txtBD.Text + "'," + "'" + txtAddress.Text + "'," + "'" + txtPhone.Text + "'," + "'" + txtIllStatus.Text + "'," + "'" + cmbBtype.Text + "'," + "'" + txtOccupation.Text + "'" + ")"); if (cmbType.Text == "Inpatient ") { MessageBox.Show("go to checkin"); } ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); } if (btclick == 2) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("Update tbPatient Set " + " PID='" + txtID.Text + "', " + " PName='" + txtName.Text + "'," + " Gender='" + cmbSex.Text + "'," + " PType='" + cmbType.Text + "', " + " Nation='" + txtNation.Text + "', " + " Birhtdate='" + txtBD.Text + "', " + " PAddress='" + txtAddress.Text + "', " + " Phone='" + txtPhone.Text + "', " + " illstatus='" + txtIllStatus.Text + "', " + " BloodType='" + cmbBtype.Text + "', " + " Occupation='" + txtOccupation.Text + "'" + " Where PID ='" + txtID.Text + "'"); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); listViewShow lst = new listViewShow(); lst.ShowData("Select PName from tbPatient", "PName", lstView); } }
private void btSave_Click(object sender, EventArgs e) { if (btclick == 1) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("INSERT INTO tbStaff (staffID, Staffname, Gender,Birthdate,Position,salary,Phone,Email,SAddress,Hireddate,Stopwork) " + "VALUES (" + "'" + txtStaffID.Text + "'," + "'" + txtName.Text + "'," + "'" + cmbSex.Text + "'," + "'" + txtBD.Text + "'," + "'" + cmbPosition.Text + "'," + "'" + txtSalary.Text + "'," + "'" + txtphone.Text + "'," + "'" + txtEmail.Text + "'," + "'" + txtAddress.Text + "'," + "'" + txtHD.Text + "'," + "'" + cmbStopWork.Text + "'" + ")"); StaffModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); listViewShow lst = new listViewShow(); lst.ShowData("Select StaffName from tbStaff", "StaffName", lstView); } if (btclick == 2) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("Update tbStaff Set " + " staffID='" + txtStaffID.Text + "', " + " Staffname='" + txtName.Text + "'," + " Gender='" + cmbSex.Text + "'," + " Birthdate='" + txtBD.Text + "', " + " Position='" + cmbPosition.Text + "', " + " salary='" + txtSalary.Text + "', " + " Email='" + txtEmail.Text + "', " + " SAddress='" + txtAddress.Text + "', " + " Phone='" + txtphone.Text + "', " + " Hireddate='" + txtHD.Text + "', " + " Stopwork='" + cmbStopWork.Text + "'" + " Where StaffID ='" + txtStaffID.Text + "'"); StaffModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); listViewShow lst = new listViewShow(); lst.ShowData("Select StaffName from tbStaff", "StaffName", lstView); } }
public void ListData(String SelectStatment, String ColumnName1, String ColumnName2, ListView listView) { listView.Items.Clear(); dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); SqlDataReader dr = dbcon.DataReader(SelectStatment); while (dr.Read()) { listView.Items.Add(dr[ColumnName1].ToString()); listView.Items.Add(dr[ColumnName2].ToString()); } }
private void lstView_SelectedIndexChanged(object sender, EventArgs e) { int x = lstView.SelectedIndex + 1; txtServiceID.Text = x.ToString(); dbConnection conn = new dbConnection(); SqlDataAdapter dr = new SqlDataAdapter("select * from tbServices where ServiceID= '" + txtServiceID.Text + "'", "Database=DBHospital;Server=SEAKHENG\\KSH;Integrated Security=True;connect timeout = 30"); DataSet ds = new DataSet(); dr.Fill(ds, "tbServices"); txtName.Text = ds.Tables["tbServices"].Rows[0].ItemArray[1].ToString(); txtCost.Text = ds.Tables["tbServices"].Rows[0].ItemArray[2].ToString(); txtInfo.Text = ds.Tables["tbServices"].Rows[0].ItemArray[3].ToString(); }
private void btSave_Click(object sender, EventArgs e) { if (btclick == 1) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("INSERT INTO tbDoctor" + "(DocID, Docname, Gender, Birthdate, DAddress, Specialize,Nation,Degree,salary," + "Phone,Email,Contractdate,ExpiredDate,Stopwork) VALUES " + "('" + txtDoctorID.Text + "','" + txtName.Text + "'," + "'" + cmbSex.Text + "','" + txtBD.Text + "','" + txtEmail.Text + "'," + "'" + txtSkill.Text + "','" + txtNation.Text + "','" + txtDegree.Text + "'," + "'" + txtSalary.Text + "','" + txtPhone.Text + "','" + txtEmail.Text + "'," + "'" + txtContractdate.Text + "','" + txtExpireDate.Text + "','" + cmbStopWork.Text + "')"); DoctorModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); listViewShow lst = new listViewShow(); lst.ShowData("Select docname from tbDoctor", "docname", lstView); btNew_Click(this, null); } if (btclick == 2) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); dbcon.ExecuteQueries("Update tbDoctor Set " + " DocID='" + txtDoctorID.Text + "', " + " Docname='" + txtName.Text + "'," + " Gender='" + cmbSex.Text + "'," + " Birthdate='" + txtBD.Text + "', " + " DAddress='" + txtEmail.Text + "', " + " Specialize='" + txtSkill.Text + "', " + " Nation='" + txtNation.Text + "', " + " Degree='" + txtDegree.Text + "', " + " salary='" + txtSalary.Text + "', " + " Phone='" + txtPhone.Text + "', " + " Email='" + txtEmail.Text + "', " + " Contractdate='" + txtContractdate.Text + "', " + " ExpiredDate='" + txtExpireDate.Text + "', " + " Stopwork='" + cmbStopWork.Text + "'" + " Where DocID ='" + txtDoctorID.Text + "'"); DoctorModule_Load(this, null); ClearControl cn = new ClearControl(); cn.ClearTextBoxes(this); listViewShow lst = new listViewShow(); lst.ShowData("Select docname from tbDoctor", "docname", lstView); } }
private void lstView_SelectedIndexChanged(object sender, EventArgs e) { // select* from tbMedicine Inner Join tbMeCategory on tbMedicine.MeCategoryID = tbMeCategory.MeCategoryID where tbMedicine.MeID = '" + txtMeID.Text + "'" int x = lstView.SelectedIndex + 1; txtMeID.Text = x.ToString(); dbConnection conn = new dbConnection(); SqlDataAdapter dr = new SqlDataAdapter("select * from tbMedicine where MeID = '" + txtMeID.Text + "'", "Database=DBHospital;Server=SEAKHENG\\KSH;Integrated Security=True;connect timeout = 30"); DataSet ds = new DataSet(); dr.Fill(ds, "tbMedicine"); txtName.Text = ds.Tables["tbMedicine"].Rows[0].ItemArray[1].ToString(); cmbCategory.Text = ds.Tables["tbMedicine"].Rows[0].ItemArray[2].ToString(); txtStockqty.Text = ds.Tables["tbMedicine"].Rows[0].ItemArray[3].ToString(); txtCategoryID.Text = ds.Tables["tbMedicine"].Rows[0].ItemArray[4].ToString(); txtCost.Text = ds.Tables["tbMedicine"].Rows[0].ItemArray[5].ToString(); }
private void lstView_SelectedIndexChanged(object sender, EventArgs e) { int x = lstView.SelectedIndex + 1; txtSupplierID.Text = x.ToString(); dbConnection conn = new dbConnection(); SqlDataAdapter dr = new SqlDataAdapter("select * from tbSupplier where SupplierID= '" + txtSupplierID.Text + "'", "Database=DBHospital;Server=SEAKHENG\\KSH;Integrated Security=True;connect timeout = 30"); DataSet ds = new DataSet(); dr.Fill(ds, "tbSupplier"); txtName.Text = ds.Tables["tbSupplier"].Rows[0].ItemArray[1].ToString(); txtPhone.Text = ds.Tables["tbSupplier"].Rows[0].ItemArray[2].ToString(); // txtMail.Text = ds.Tables["tbSupplier"].Rows[0].ItemArray[3].ToString(); txtAdress.Text = ds.Tables["tbSupplier"].Rows[0].ItemArray[3].ToString(); btSave.Enabled = false; btEdit.Enabled = true; btNew.Enabled = true; }
private void cmbRType_SelectedIndexChanged(object sender, EventArgs e) { int Cmb = cmbRType.SelectedIndex + 1; cmbRoomTID.Text = Cmb.ToString(); //txtRoomNo.Text = Cmb.ToString(); dbConnection conn = new dbConnection(); SqlDataAdapter dr = new SqlDataAdapter("select * from tbRoomType where RTypeID = '" + cmbRoomTID.Text + "'", "Database=DBHospital;Server=SEAKHENG\\KSH;Integrated Security=True;connect timeout = 30"); DataSet ds = new DataSet(); dr.Fill(ds, "tbRoomType"); txtTotalBed.Text = ds.Tables["tbRoomType"].Rows[0].ItemArray[2].ToString(); txtprice.Text = ds.Tables["tbRoomType"].Rows[0].ItemArray[3].ToString(); if (btclick == 1) { txtAvaliable.Text = ds.Tables["tbRoomType"].Rows[0].ItemArray[2].ToString(); } }
private void cmbRType_MouseUp(object sender, MouseEventArgs e) { cmbRType.Items.Clear(); dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); SqlDataReader dr = dbcon.DataReader("select RType from tbRoomType"); dr.Read(); if (dr.HasRows) { cmbRType.Items.Add(dr["RType"]).ToString(); while (dr.Read()) { cmbRType.Items.Add(dr["RType"]).ToString(); } } }
private void lstView_SelectedIndexChanged(object sender, EventArgs e) { int x = lstView.SelectedIndex + 1; txtUserID.Text = x.ToString(); dbConnection conn = new dbConnection(); SqlDataAdapter dr = new SqlDataAdapter("select * from tbUser where UserID= '" + txtUserID.Text + "'", "Database=DBHospital;Server=SEAKHENG\\KSH;Integrated Security=True;connect timeout = 30"); DataSet ds = new DataSet(); dr.Fill(ds, "tbUser"); txtUserName.Text = ds.Tables["tbUser"].Rows[0].ItemArray[1].ToString(); txtPassword.Text = ds.Tables["tbUser"].Rows[0].ItemArray[2].ToString(); cmbAccType.Text = ds.Tables["tbUser"].Rows[0].ItemArray[3].ToString(); txtConPass.Text = ds.Tables["tbUser"].Rows[0].ItemArray[2].ToString(); txtRegisterDate.Text = ds.Tables["tbUser"].Rows[0].ItemArray[4].ToString(); cmbStaff.Text = ds.Tables["tbUser"].Rows[0].ItemArray[5].ToString(); btSave.Enabled = true; btEdit.Enabled = true; }
private void cmbCategory_MouseUp(object sender, MouseEventArgs e) { cmbCategory.Items.Clear(); dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); SqlDataReader dr = dbcon.DataReader("select Category from tbMeCategory"); dr.Read(); if (dr.HasRows) { cmbCategory.Items.Add(dr["Category"]).ToString(); while (dr.Read()) { cmbCategory.Items.Add(dr["Category"]).ToString(); } } }
private void lstView_SelectedIndexChanged(object sender, EventArgs e) { int x = lstView.SelectedIndex + 1; txtID.Text = x.ToString(); dbConnection conn = new dbConnection(); SqlDataAdapter dr = new SqlDataAdapter("select * from tbPatient where PID= '" + txtID.Text + "'", "Database=DBHospital;Server=SEAKHENG\\KSH;Integrated Security=True;connect timeout = 30"); DataSet ds = new DataSet(); dr.Fill(ds, "tbPatient"); txtName.Text = ds.Tables["tbPatient"].Rows[0].ItemArray[1].ToString(); cmbSex.Text = ds.Tables["tbPatient"].Rows[0].ItemArray[2].ToString(); cmbType.Text = ds.Tables["tbPatient"].Rows[0].ItemArray[3].ToString(); txtNation.Text = ds.Tables["tbPatient"].Rows[0].ItemArray[4].ToString(); txtBD.Text = ds.Tables["tbPatient"].Rows[0].ItemArray[5].ToString(); txtAddress.Text = ds.Tables["tbPatient"].Rows[0].ItemArray[6].ToString(); txtPhone.Text = ds.Tables["tbPatient"].Rows[0].ItemArray[7].ToString(); txtIllStatus.Text = ds.Tables["tbPatient"].Rows[0].ItemArray[8].ToString(); cmbBtype.Text = ds.Tables["tbPatient"].Rows[0].ItemArray[9].ToString(); txtOccupation.Text = ds.Tables["tbPatient"].Rows[0].ItemArray[10].ToString(); }
private void lstView_SelectedIndexChanged(object sender, EventArgs e) { int x = lstView.SelectedIndex + 1; txtStaffID.Text = x.ToString(); dbConnection conn = new dbConnection(); SqlDataAdapter dr = new SqlDataAdapter("select * from tbStaff where StaffID= '" + txtStaffID.Text + "'", "Database=DBHospital;Server=SEAKHENG\\KSH;Integrated Security=True;connect timeout = 30"); DataSet ds = new DataSet(); dr.Fill(ds, "tbStaff"); txtName.Text = ds.Tables["tbStaff"].Rows[0].ItemArray[1].ToString(); cmbSex.Text = ds.Tables["tbStaff"].Rows[0].ItemArray[2].ToString(); cmbPosition.Text = ds.Tables["tbStaff"].Rows[0].ItemArray[4].ToString(); txtAddress.Text = ds.Tables["tbStaff"].Rows[0].ItemArray[8].ToString(); txtphone.Text = ds.Tables["tbStaff"].Rows[0].ItemArray[6].ToString(); txtEmail.Text = ds.Tables["tbStaff"].Rows[0].ItemArray[7].ToString(); txtSalary.Text = ds.Tables["tbStaff"].Rows[0].ItemArray[5].ToString(); txtBD.Text = ds.Tables["tbStaff"].Rows[0].ItemArray[3].ToString(); txtHD.Text = ds.Tables["tbStaff"].Rows[0].ItemArray[9].ToString(); cmbStopWork.Text = ds.Tables["tbStaff"].Rows[0].ItemArray[11].ToString(); }
private void lstView_SelectedIndexChanged(object sender, EventArgs e) { int x = lstView.SelectedIndex + 1; txtRoomNo.Text = x.ToString(); dbConnection conn = new dbConnection(); SqlDataAdapter dr = new SqlDataAdapter("select tbRoom.RoomNo,tbRoom.Availablebed,tbRoom.Building," + "tbRoom.Rfloor,tbRoom.RtypeID,tbRoomType.RType,tbRoomType.NumofBed,tbRoomType.Price,tbRoomType.RTypeID" + " from tbRoom Inner Join tbRoomType on tbRoom.RtypeID = tbRoomType.RTypeID where tbRoom.RoomNo = '" + txtRoomNo.Text + "'", "Database=DBHospital;Server=SEAKHENG\\KSH;Integrated Security=True;connect timeout = 30"); DataSet ds = new DataSet(); dr.Fill(ds, "tbRoom"); txtAvaliable.Text = ds.Tables["tbRoom"].Rows[0].ItemArray[1].ToString(); txtFloor.Text = ds.Tables["tbRoom"].Rows[0].ItemArray[3].ToString();; txtprice.Text = ds.Tables["tbRoom"].Rows[0].ItemArray[7].ToString();; txtTotalBed.Text = ds.Tables["tbRoom"].Rows[0].ItemArray[6].ToString();; cmbBuiding.Text = ds.Tables["tbRoom"].Rows[0].ItemArray[2].ToString();; cmbRoomTID.Text = ds.Tables["tbRoom"].Rows[0].ItemArray[4].ToString();; cmbRType.Text = ds.Tables["tbRoom"].Rows[0].ItemArray[5].ToString();; }
public void RoomModule_Load(object sender, EventArgs e) { listViewShow lst = new listViewShow(); lst.ShowData("select RoomNo from tbRoom", "RoomNo", lstView); dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); SqlDataReader dr = dbcon.DataReader("select RType from tbRoomType"); dr.Read(); if (dr.HasRows) { cmbRType.Items.Add(dr["RType"]).ToString(); while (dr.Read()) { cmbRType.Items.Add(dr["RType"]).ToString(); } } }
public int getID(string Selectstatment, string ColumName) { dbConnection dbcon = new dbConnection(); dbcon.OpenConection(); SqlDataReader dr = dbcon.DataReader(Selectstatment); dr.Read(); string ID = null; if (dr.HasRows) { ID = dr[ColumName].ToString(); if (ID == null) { int y = 1; return(y); } while (dr.Read()) { ID = dr[ColumName].ToString(); } if (ID == null) { int y = 2; return(y); } if (ID != null) { int y = Int32.Parse(ID) + 1; return(y); } } return(1); }
private void RoomType_Load(object sender, EventArgs e) { dbConnection dbcon = new dbConnection(); dbcon.DataAdapter("select * from tbRoomType", dataView); }