private void LoadHospital() { FacilityDAL facilityDAL = new FacilityDAL(); ddlHospitalName.DataSource = facilityDAL.SelectAllHealthCare(); ddlHospitalName.DataTextField = "FacilityName"; ddlHospitalName.DataValueField = "id"; ddlHospitalName.DataBind(); }
private void SaveData() { string sUserName = Session["User"].ToString(); oDAL = new FacilityDAL(); oClass = new FacilityModel(); oClass.FacilityName = FacilityName.Value; oClass.ContactPerson = ContactPerson.Value; oClass.Designation = Designation.Value; oClass.FacilityType = ddlFacilityType.SelectedValue; oClass.Province = ddlProvince.SelectedValue; oClass.Address = txtAddress.InnerText; oClass.Phone = txtContact.Value; oClass.Email = txtEmail.Value; oClass.StatusID = ddlStatus.SelectedValue; if (Accreditation.Value == "") { Accreditation.Value = DateTime.Today.ToShortDateString(); } oClass.DateAccredit = Convert.ToDateTime(Accreditation.Value); if (Expiration.Value == "") { Expiration.Value = DateTime.Today.AddYears(1).ToShortDateString(); } oClass.DateExpire = Convert.ToDateTime(Expiration.Value); if (CashBond.Value == "") { CashBond.Value = "0"; } oClass.CashBond = Convert.ToDouble(CashBond.Value); oClass.Notes = txtNote.Value; string id = FacilityID.Value; if (id == "") { oDAL.InsertData(sUserName, oClass); //lblMsg.Text = "New Record has been saved"; } else { oClass.ID = Convert.ToInt16(id); oDAL.UpdateData(sUserName, oClass); // lblMsg.Text = "Record has been updated"; } }
protected void Ok_ServerClick(object sender, EventArgs e) { string UserName = Session["User"].ToString(); int ID = Convert.ToInt32(HiddenFieldItem.Value); oDAL = new FacilityDAL(); oClass = new FacilityModel(); oDs = new DataSet(); oClass.IsDeleted = true; oClass.ReasonDelete = itemname.InnerText; string lbl = lblSelectedItem.Text; oClass.ID = ID; oDAL.DeleteData(UserName, oClass); PopulateGrid(); }
private void PopulateGrid() { oDAL = new FacilityDAL(); oDs = new DataSet(); if (searchKeyword.Value != "") { oDs = oDAL.SeachData(searchKeyword.Value); } else { oDs = oDAL.SelectAllContacts(); } if (oDs != null) { gvList.DataSource = oDs.Tables[0]; gvList.DataBind(); } }
private void PopulateData(int id) { oDAL = new FacilityDAL(); oClass = new FacilityModel(); oDs = new DataSet(); oClass.ID = id; oDs = oDAL.SelectByID(oClass); FacilityID.Value = oDs.Tables[0].Rows[0][0].ToString(); FacilityName.Value = oDs.Tables[0].Rows[0][1].ToString(); ContactPerson.Value = oDs.Tables[0].Rows[0][2].ToString(); ddlFacilityType.SelectedValue = oDs.Tables[0].Rows[0][3].ToString(); txtAddress.Value = oDs.Tables[0].Rows[0][4].ToString(); txtEmail.Value = oDs.Tables[0].Rows[0][5].ToString(); txtContact.Value = oDs.Tables[0].Rows[0][6].ToString(); Accreditation.Value = oDs.Tables[0].Rows[0][7].ToString(); Expiration.Value = oDs.Tables[0].Rows[0][8].ToString(); ddlProvince.SelectedValue = oDs.Tables[0].Rows[0][9].ToString(); CashBond.Value = oDs.Tables[0].Rows[0][10].ToString(); ddlStatus.SelectedValue = oDs.Tables[0].Rows[0][11].ToString(); txtNote.Value = oDs.Tables[0].Rows[0][12].ToString(); Designation.Value = oDs.Tables[0].Rows[0][13].ToString(); }