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 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 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 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 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); } }
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 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; }
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 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); } }
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); } }
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 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 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 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(); } } }
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); }