protected void Page_Load(object sender, EventArgs e) { int id = Convert.ToInt16(Request.QueryString["Id"]); DAO.Center aCenter = aCenterManager.DisplayNewCenter(id); nameLabel.InnerText = aCenter.Name; codeLabel.InnerText = aCenter.Code; passwordLabel.InnerText = aCenter.Password; }
public int SaveCenter(DAO.Center aCenter) { string query = "insert into Center_tbl(Name,Code,Password,ThanaID) values('" + aCenter.Name + "', '" + aCenter.Code + "','" + aCenter.Password + "','" + aCenter.ThanaID + "')"; aGateway.sqlConnection.Open(); aGateway.command.CommandText = query; int rowAffected = aGateway.command.ExecuteNonQuery(); aGateway.sqlConnection.Close(); return(rowAffected); }
protected void saveButton_Click(object sender, EventArgs e) { aDoctor = new Doctor(); DAO.Center aCenter = aCenterManager.GetCenter(Convert.ToInt32(Session["CenterId"])); aDoctor.Name = nameTextBox.Text; aDoctor.Degree = degreeTextBox.Text; aDoctor.CenterId = aCenter.Id; string msg = aCenterManager.Save(aDoctor); msgLabel.Text = msg; }
protected void saveButton_Click(object sender, EventArgs e) { DAO.Center aCenter = new DAO.Center(); aCenter.Name = nameTextBox.Text; aCenter.DistrictId = Convert.ToInt16(districtDropDownList.SelectedValue); aCenter.ThanaId = Convert.ToInt16(thanaDropDownList.SelectedValue); int centerId = aCenterManager.Save(aCenter); if (centerId > 0) { Response.Redirect("DisplayNewCenter.aspx?Id=" + centerId); } else { msgLabel.Text = "error"; } }
public List <CenterMedicineStock> ListofStocks(DAO.Center aCenter) { List <CenterMedicineStock> stock = new List <CenterMedicineStock>(); aGateway.command.CommandText = "SELECT * FROM Quantity_tbl WHERE CenterID='" + aCenter.ID + "'"; aGateway.sqlConnection.Open(); SqlDataReader reader = aGateway.command.ExecuteReader(); while (reader.Read()) { CenterMedicineStock newMedicine = new CenterMedicineStock(); newMedicine.Quantity = int.Parse(reader[1].ToString()); newMedicine.MedicineID = int.Parse(reader[3].ToString()); stock.Add(newMedicine); } reader.Close(); aGateway.sqlConnection.Close(); return(stock); }
protected void loginButton_Click(object sender, EventArgs e) { string msg = ""; DAO.Center aCenter = new DAO.Center(); aCenter.Code = codeTextBox.Text; aCenter.Password = passwordTextBox.Text; CenterManager aCenterManager = new CenterManager(); aCenter = aCenterManager.CheckCodePassword(aCenter); if (aCenter == null) { msg = "Error code & password...!!!!"; } else { Session["CenterId"] = aCenter.Id; Session["user"] = "******"; Response.Redirect("CenterMainUI.aspx"); } }
public bool IsCenterExist(string Code, string password, out DAO.Center centerInfo) { bool result = false; aGateway.command.CommandText = "SELECT * FROM Center_tbl WHERE Code='" + Code + "' AND Password='******'"; aGateway.sqlConnection.Open(); SqlDataReader reader = aGateway.command.ExecuteReader(); centerInfo = new DAO.Center(); while (reader.Read()) { centerInfo.ID = int.Parse(reader[0].ToString()); centerInfo.Name = reader[1].ToString(); result = true; break; } reader.Close(); aGateway.sqlConnection.Close(); return(result); }
public List <DAO.Center> GetAllCenterByThana(int ThanaID) { aGateway.command.CommandText = "SELECT * FROM Center_tbl WHERE ThanaID='" + ThanaID + "'"; aGateway.sqlConnection.Open(); SqlDataReader reader = aGateway.command.ExecuteReader(); List <DAO.Center> centersList = new List <DAO.Center>(); if (reader != null) { while (reader.Read()) { DAO.Center aCenter = new DAO.Center(); aCenter.ID = int.Parse(reader["ID"].ToString()); aCenter.Name = reader["Name"].ToString(); aCenter.Code = reader["Code"].ToString(); aCenter.Password = reader["Password"].ToString(); aCenter.ThanaID = Convert.ToInt16(reader["ThanaID"].ToString()); centersList.Add(aCenter); } } reader.Close(); aGateway.sqlConnection.Close(); return(centersList); }
public List<DAO.Center> GetAllCenterByThana(int ThanaID) { aGateway.command.CommandText = "SELECT * FROM Center_tbl WHERE ThanaID='" + ThanaID + "'"; aGateway.sqlConnection.Open(); SqlDataReader reader = aGateway.command.ExecuteReader(); List<DAO.Center> centersList = new List<DAO.Center>(); if (reader != null) while (reader.Read()) { DAO.Center aCenter =new DAO.Center(); aCenter.ID = int.Parse(reader["ID"].ToString()); aCenter.Name = reader["Name"].ToString(); aCenter.Code = reader["Code"].ToString(); aCenter.Password = reader["Password"].ToString(); aCenter.ThanaID = Convert.ToInt16(reader["ThanaID"].ToString()); centersList.Add(aCenter); } reader.Close(); aGateway.sqlConnection.Close(); return centersList; }
public bool IsCenterExist(string Code, string password, out DAO.Center centerInfo) { bool result = false; aGateway.command.CommandText = "SELECT * FROM Center_tbl WHERE Code='" + Code + "' AND Password='******'"; aGateway.sqlConnection.Open(); SqlDataReader reader = aGateway.command.ExecuteReader(); centerInfo =new DAO.Center(); while (reader.Read()) { centerInfo.ID = int.Parse(reader[0].ToString()); centerInfo.Name = reader[1].ToString(); result = true; break; } reader.Close(); aGateway.sqlConnection.Close(); return result; }