/*Making this function to work independently for Loading Data*/ protected void loadData() { try { EntryUserClass euc = new EntryUserClass(); DataTable dt = euc.SelectForViewEntryUserRecords(); if (dt.Rows.Count > 0) { ltrMessage.Text = ""; GridView1.DataSource = dt; GridView1.DataBind(); } else { GridView1.DataSource = dt; GridView1.DataBind(); ltrMessage.Text = "No data found!"; } } catch (Exception ex) { ltrMessage.Text = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { /*Data loading for the DataList1*/ try { EntryUserClass euc = new EntryUserClass(); UserClass uc = new UserClass(); String selectedRow_Username = Session["selectedRow_Username"].ToString(); DataTable dt1 = uc.GetUserIdFromUsername(selectedRow_Username); if (dt1.Rows.Count > 0) { Session["selectedRow_UserId"] = dt1.Rows[0]["userId"].ToString(); int selectedRow_UserId = Convert.ToInt32(Session["selectedRow_UserId"].ToString()); DataTable dt = euc.homeEntryUserFrom_userId(selectedRow_UserId); if (dt.Rows.Count > 0) { ltrMessage.Text = ""; DataList1.DataSource = dt; DataList1.DataBind(); } else { DataList1.DataSource = dt; DataList1.DataBind(); ltrMessage.Text = "No any data before!"; } } } catch (Exception ex) { ltrMessage.Text = ex.Message; } }
protected void lnkbtn_C_Click(object sender, EventArgs e) { try { EntryUserClass euc = new EntryUserClass(); DataTable dt = euc.SelectForViewEntryUserRecords_SpecificLetter("C"); if (dt.Rows.Count > 0) { ltrMessage.Text = ""; GridView1.DataSource = dt; GridView1.DataBind(); } else { GridView1.DataSource = dt; GridView1.DataBind(); ltrMessage.Text = "No data found!"; } } catch (Exception ex) { ltrMessage.Text = ex.Message; } }
protected void btnLogIn_Click1(object sender, EventArgs e) { try { UserClass uc = new UserClass(); EntryUserClass euc = new EntryUserClass(); DataTable dt = uc.Checklogin(txtboxUsername.Text, txtboxPasswd.Text); if (dt.Rows.Count > 0) { ltrMessage.Text = ""; Session["username"] = txtboxUsername.Text; Session["userPasswd"] = txtboxPasswd.Text; String userType = dt.Rows[0]["userType"].ToString(); Session["userType"] = dt.Rows[0]["userType"].ToString(); Session["userId"] = dt.Rows[0]["userId"].ToString(); String userIdString = dt.Rows[0]["userId"].ToString(); int userId = Convert.ToInt32(userIdString); if (userType == "Patient") { Response.Redirect("Home_Patient.aspx"); } else if (userType == "Entry") { /*Check if the Entry User is Active or not*/ DataTable dtEntryUser = euc.SelectAllEntryUserFromUserId(userId); if (dtEntryUser.Rows.Count > 0) { String entryUserInactiveOrActive = dtEntryUser.Rows[0]["entryUserInactiveOrActive"].ToString(); if (entryUserInactiveOrActive == "Active") { Response.Redirect("Home_EntryUser.aspx"); } else { ltrMessage.Text = "The User is Inactive!"; } } } else if (userType == "Other") { Response.Redirect("Home_OtherUser.aspx"); } } else { ltrMessage.Text = "Invalid Username or Password!"; } } catch (Exception ex) { ltrMessage.Text = ex.Message; } }
/*Insert on Log_EntryUserWholeField table with the insert Operation */ public void insertOn_Log_EntryUserWholeField_WithInsertOperation(String username) { SqlCommand cmd = new SqlCommand(); cmd.Connection = gc.cn; String entryUserWholeFieldLog_Date; String entryUserWholeFieldLog_Operation = "Insert"; /*Current date and time calculated*/ DateTime currentDateNTime = DateTime.Now; entryUserWholeFieldLog_Date = currentDateNTime.ToString("dd/MM/yyyy hh:mm:ss tt"); cmd.CommandText = "sp_Log_entryUserWholeField"; cmd.CommandType = CommandType.StoredProcedure; /*Getting Patient Id from Patient's username and putting that userId value*/ try { UserClass uc = new UserClass(); EntryUserClass euc = new EntryUserClass(); int userId, entryUserId; DataTable dt = uc.GetUserIdFromUsername(username); if (dt.Rows.Count > 0) { String userIdString = dt.Rows[0]["userId"].ToString(); userId = Convert.ToInt32(userIdString); cmd.Parameters.Add("@userId", userId); /*Getting entryUserId from EntryUser's userId*/ DataTable dtEntryUser = euc.SelectAllEntryUserFromUserId(userId); if (dtEntryUser.Rows.Count > 0) { String entryUserIdString = dtEntryUser.Rows[0]["entryUserId"].ToString(); entryUserId = Convert.ToInt32(entryUserIdString); cmd.Parameters.Add("@entryUserId", entryUserId); } } } catch (Exception ex) { throw ex; } cmd.Parameters.Add("@entryUserWholeFieldLog_Date", entryUserWholeFieldLog_Date); cmd.Parameters.Add("@entryUserWholeFieldLog_Operation", entryUserWholeFieldLog_Operation); cmd.ExecuteNonQuery(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { GlobalConnection gc = new GlobalConnection(); EntryUserClass euc = new EntryUserClass(); DataTable dt = euc.SelectForViewEntryUserRecords_ForReport(); if (dt.Rows.Count > 0) { ltrMessage.Text = ""; ReportViewer1.Reset(); // OR Set Report Path ReportViewer1.LocalReport.ReportPath = HttpContext.Current.Server.MapPath("Report_EntryUser_OtherUserMaster.rdlc"); // Clear the Data Source ReportViewer1.LocalReport.DataSources.Clear(); // Set a DataSource to the report ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt)); ReportViewer1.DataBind(); // Refresh and Display Report ReportViewer1.LocalReport.Refresh(); } else { ReportViewer1.Reset(); ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.DataBind(); ReportViewer1.LocalReport.Refresh(); ltrMessage.Text = "No data found!"; } } catch (Exception ex) { ltrMessage.Text = ex.Message; } } }
protected void btnOk_CurrentHospital_Click(object sender, EventArgs e) { int selectedRow_UserId; UserClass uc = new UserClass(); UserEntryUserClass uouc = new UserEntryUserClass(); EntryUserClass euc = new EntryUserClass(); LogEntryUserClass leuc = new LogEntryUserClass(); String entryUserIndivFieldLog_Operation = "Update"; String entryUserIndivFieldLog_Field = "entryUserContact"; String entryUserIndivFieldLog_DataLater = dropdownlist_Hospital.SelectedValue; String entryUserIndivFieldLog_DataBefore = Session["selectedRow_EntryUserHospital"].ToString();; /*Update Record of EntryUser's Current Hospital * Insert values on Log_UsersIndivField table*/ try { selectedRow_UserId = Convert.ToInt32(Session["selectedRow_UserId"]); DataTable dtEntryUser = euc.SelectAllEntryUserFromUserId(selectedRow_UserId); if (dtEntryUser.Rows.Count > 0) { uouc.updateProfile_EntryUser_entryUserHospital(selectedRow_UserId, dropdownlist_Hospital.SelectedValue); int userId = Convert.ToInt32(Session["userId"]); leuc.insertOn_Log_EntryUserIndivField_WithUpdateOperation(entryUserIndivFieldLog_Operation, selectedRow_UserId, entryUserIndivFieldLog_Field, entryUserIndivFieldLog_DataBefore, entryUserIndivFieldLog_DataLater, userId); } } catch (Exception ex) { ltrMessage.Text = ex.Message; } finally { Session["selectedRow_EntryUserHospital"] = dropdownlist_Hospital.SelectedValue; lblHospital.Text = dropdownlist_Hospital.SelectedValue; dropdownlist_Hospital.Visible = false; btnOk_Hospital.Visible = false; } }
protected void Load() { /*Getting values from Users and EntryUser tables*/ try { int selectedRow_UserId; UserClass uc = new UserClass(); EntryUserClass euc = new EntryUserClass(); String selectedRow_Username = Session["selectedRow_Username"].ToString(); hprlnk_header.Text = "Edit Entry User: "******"'s Record"; /*Getting userId of Users table*/ DataTable dtUsers = uc.SelectAllUsersFromUsername(selectedRow_Username); if (dtUsers.Rows.Count > 0) { Session["selectedRow_UserId"] = dtUsers.Rows[0]["userId"].ToString(); } /*Getting values of EntryUser table*/ selectedRow_UserId = Convert.ToInt32(Session["selectedRow_UserId"]); DataTable dtEntryUser = euc.SelectAllEntryUserFromUserId(selectedRow_UserId); if (dtEntryUser.Rows.Count > 0) { //Session["selectedRow_EntryUserId"] = dtEntryUser.Rows[0]["entryUserId"].ToString(); Session["selectedRow_EntryUserHospital"] = dtEntryUser.Rows[0]["entryUserHospital"].ToString(); Session["selectedRow_EntryUserInactiveOrActive"] = dtEntryUser.Rows[0]["entryUserInactiveOrActive"].ToString(); } } catch (Exception ex) { throw ex; } lblHospital.Visible = true; lblHospital.Text = Session["selectedRow_EntryUserHospital"].ToString(); lblHospitalLabel.Visible = false; lblStatus.Visible = true; lblStatus.Text = Session["selectedRow_EntryUserInactiveOrActive"].ToString(); lblStatusLabel.Visible = false; }
protected void btn_Ok_Click(object sender, EventArgs e) { try { PatientClass pc = new PatientClass(); LogPatientClass lpc = new LogPatientClass(); DiseaseClass dc = new DiseaseClass(); EntryUserClass euc = new EntryUserClass(); /*Current date and time calculated*/ DateTime currentDateNTime = DateTime.Now; String checkedPatDate = currentDateNTime.ToString("dd/MM/yyyy hh:mm:ss tt"); int checkedPatBy = Convert.ToInt32(Session["userId"]); /*selectPatientIdFromPatientUsername*/ String selected_PatUsername = Session["selectedRow_Username"].ToString(); DataTable dt = pc.selectPatientIdFromPatientUsername(selected_PatUsername); if (dt.Rows.Count > 0) { int selectedRow_patientId = Convert.ToInt32(dt.Rows[0]["patientId"].ToString()); /*selectEntryUserHospitalFrom_EntryUserUsername*/ String entryUser_username = Session["username"].ToString(); DataTable dt2 = euc.selectEntryUserHospitalFrom_EntryUserUsername(entryUser_username); if (dt2.Rows.Count > 0) { String entryUserHospital = dt2.Rows[0]["entryUserHospital"].ToString(); ltrMessage1.Text = ""; /*insertIn_CheckedPat*/ pc.insertIn_CheckedPat(selectedRow_patientId, checkedPatDate, txtbox_DiseaseName.Text, txtbox_Remarks.Text, entryUserHospital, checkedPatBy); } else { ltrMessage1.Text = "No data found!"; } } else { ltrMessage1.Text = "No data found!"; } /*get_checkedPatIdFrom_checkedPatDateNcheckedPatBy*/ DataTable dt1 = pc.get_checkedPatIdFrom_checkedPatDateNcheckedPatBy(checkedPatDate, checkedPatBy); if (dt1.Rows.Count > 0) { int checkedPatId = Convert.ToInt32(dt1.Rows[0]["checkedPatId"].ToString()); //Session["checkedPatId"] = dt.Rows[0]["checkedPatId"].ToString(); /*insertIn_Log_CheckedPatWholeField*/ lpc.insertIn_Log_CheckedPatWholeField(checkedPatDate, checkedPatId); } else { ltrMessage1.Text = "No data found!"; } /*insertIn_Disease*/ dc.insertIn_Disease(txtbox_DiseaseName.Text, txtbox_Remarks.Text, checkedPatBy, checkedPatDate); Response.Redirect("Patient_CheckupWithHistory_EntryUserMaster.aspx"); //txtbox_DiseaseName.Text = ""; //txtbox_Remarks.Text = ""; } catch (Exception ex) { ltrMessage.Text = ex.Message; } }