protected void GetAllDropDowns() { IIQTouchPatientRegistration ptnMgr = (IIQTouchPatientRegistration)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BIQTouchPatientRegistration, BusinessProcess.Clinical"); BindFunctions theBind = new BindFunctions(); string GetSex = "select ID, Name from mst_decode where codeid = 4 and deleteflag = 0"; string GetFacility = "select FacilityID,FacilityName from mst_facility"; theBind.BindCombo(rcbSex, ptnMgr.ReturnDatatableQuery(GetSex), "Name", "ID"); theBind.BindCombo(cmbsex, ptnMgr.ReturnDatatableQuery(GetSex), "Name", "ID"); theBind.BindCombo(cmbfacility, ptnMgr.ReturnDatatableQuery(GetFacility), "FacilityName", "FacilityID"); }
protected void Init_Form() { objRegistration theRegistration = new objRegistration(); IIQTouchPatientRegistration ptnMgr = (IIQTouchPatientRegistration)ObjectFactory.CreateInstance(ObjFactoryParameter); patientID = int.Parse(Request.QueryString["patientId"].ToString()); DataSet regDT = ptnMgr.GetRegistrationDetails(patientID, Session["AppLocationId"].ToString()); SetFieldVals(regDT.Tables[0]); SetFormVals(regDT.Tables[0]); DataSet theDS = ptnMgr.GetPatientRegistration(patientID, 12); }
protected void btnAdd_Click(object sender, EventArgs e) { try { IIQTouchPatientRegistration ptnMgr = (IIQTouchPatientRegistration)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BIQTouchPatientRegistration, BusinessProcess.Clinical"); if ((bool)ptnMgr.CheckPatientFolderNo(txtNewFolderNo.Text)) { FolderNoExists = true; } else { FolderNoExists = false; int theRes = (int)ptnMgr.SavePatientRecord(Session["AppLocationId"].ToString(), txtAFName.Text, txtALName.Text, rcbSex.SelectedValue, dtpDOB.SelectedDate.ToString(), txtMidName.Text, txtNewFolderNo.Text); txtAFName.Text = string.Empty; txtALName.Text = string.Empty; rcbSex.SelectedIndex = 0; dtpDOB.Clear(); txtMidName.Text = string.Empty; txtNewFolderNo.Text = string.Empty; IsError = false; updtWindow.Update(); Session["JustAddedPatient"] = true; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "saveSuc", "alert('Patient record saved successfully');window.location = 'frmTouchPatientHome.aspx?PatientID=" + theRes + "';", true); } } catch (Exception ex) { IsError = true; } finally { if (IsError) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "saveFail", "alert('An errror occured please contact your Administrator')", true); } if (FolderNoExists) { var FolderExistsMessage = "'A patient with this folder number already exists. " + " \\n" + "Please use the Find Patient window to locate this patient '"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "saveFail", "alert(" + FolderExistsMessage + ")", true); } } }
protected void btnlogin_Click(object sender, EventArgs e) { if (ValidateLogin() == false) { Init_Form(true); return; } IUser LoginManager; try { string ObjFactoryParameter = "BusinessProcess.Clinical.BIQTouchPatientRegistration, BusinessProcess.Clinical"; IIQTouchPatientRegistration ptnMgr = (IIQTouchPatientRegistration)ObjectFactory.CreateInstance(ObjFactoryParameter); string sqlQuery1 = string.Empty; sqlQuery1 = string.Format("select SystemId from mst_facility where FacilityID=" + Convert.ToInt32(ddFacility.SelectedValue) + ""); DataTable DT = ptnMgr.ReturnDatatableQuery(sqlQuery1); if (Convert.ToInt32(DT.Rows[0]["SystemId"]) != Convert.ToInt32(Session["SystemId"])) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AFail", "alert('Access Denied for this Facility-Contact Administrator')", true); } else { LoginManager = (IUser)ObjectFactory.CreateInstance("BusinessProcess.Security.BUser, BusinessProcess.Security"); DataSet theDS = LoginManager.GetUserCredentials(txtUname.Text.Trim(), Convert.ToInt32(ddFacility.SelectedValue), Convert.ToInt32(Session["SystemId"])); if (theDS.Tables.Count > 0) { int FacilityExist = 1; if (theDS.Tables[5].Rows.Count > 0) { DataView theDV = new DataView(); FacilityExist = 0; foreach (DataRow theDR in theDS.Tables[5].Rows) { if (Convert.ToInt32(theDR["GroupId"]) > 1) { theDV = new DataView(theDS.Tables[1]); theDV.RowFilter = "FacilityID= " + ddFacility.SelectedValue + ""; if (theDV.ToTable().Rows.Count > 0) { FacilityExist = 1; } } else if (Convert.ToInt32(theDR["GroupId"]) == 1) { FacilityExist = 1; } } } if (FacilityExist == 0) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AFail", "alert('Access Denied for this Facility-Contact Administrator')", true); //IQCareMsgBox.Show("AccessDenied", this); return; } Utility theUtil = new Utility(); if (theDS.Tables[0].Rows.Count > 0) { if (theUtil.Decrypt(Convert.ToString(theDS.Tables[0].Rows[0]["Password"])) != txtPass.Text.Trim()) { if ((Request.Browser.Cookies)) { HttpCookie theCookie = Request.Cookies[txtUname.Text]; if (theCookie == null) { HttpCookie theNCookie = new HttpCookie(txtUname.Text); theNCookie.Value = txtUname.Text + ",1"; DateTime theNewDTTime = Convert.ToDateTime(ViewState["theCurrentDate"]).AddMinutes(5); theNCookie.Expires = theNewDTTime; Response.Cookies.Add(theNCookie); } else { string[] theVal = (theCookie.Value.ToString()).Split(','); if (Convert.ToInt32(theVal[1]) >= 3 && theCookie.Name == txtUname.Text) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = "User Account Locked. Try again after 5 Mins."; IQCareMsgBox.Show("#C1", theBuilder, this); return; } else { theVal[1] = (Convert.ToInt32(theVal[1]) + 1).ToString(); theCookie.Value = txtUname.Text + "," + theVal[1]; DateTime theAddNewDTTime = Convert.ToDateTime(ViewState["theCurrentDate"]).AddMinutes(5); theCookie.Expires = theAddNewDTTime; Response.Cookies.Add(theCookie); } } } IQCareMsgBox.Show("PasswordNotMatch", this); Init_Form(true); return; } else { HttpCookie theCookie = Request.Cookies[txtUname.Text]; if (theCookie != null) { string[] theVal = (theCookie.Value.ToString()).Split(','); if (Convert.ToInt32(theVal[1]) >= 3) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = "User Account Locked. Try again after 5 Mins."; IQCareMsgBox.Show("#C1", theBuilder, this); return; } } } } else { IQCareMsgBox.Show("InvalidLogin", this); Init_Form(true); return; } Session["AppUserId"] = Convert.ToString(theDS.Tables[0].Rows[0]["UserId"]); Session["AppUserName"] = Convert.ToString(theDS.Tables[0].Rows[0]["UserFirstName"]) + " " + Convert.ToString(theDS.Tables[0].Rows[0]["UserLastName"]); Session["EnrollFlag"] = theDS.Tables[1].Rows[0]["EnrollmentFlag"].ToString(); Session["CareEndFlag"] = theDS.Tables[1].Rows[0]["CareEndFlag"].ToString(); Session["IdentifierFlag"] = theDS.Tables[1].Rows[0]["IdentifierFlag"].ToString(); Session["UserRight"] = theDS.Tables[1]; DataTable theDT = theDS.Tables[2]; Session["AppLocationId"] = theDT.Rows[0]["FacilityID"].ToString(); Session["AppLocation"] = theDT.Rows[0]["FacilityName"].ToString(); Session["AppCountryId"] = theDT.Rows[0]["CountryID"].ToString(); Session["AppPosID"] = theDT.Rows[0]["PosID"].ToString(); Session["AppSatelliteId"] = theDT.Rows[0]["SatelliteID"].ToString(); Session["GracePeriod"] = theDT.Rows[0]["AppGracePeriod"].ToString(); Session["AppDateFormat"] = theDT.Rows[0]["DateFormat"].ToString(); Session["BackupDrive"] = theDT.Rows[0]["BackupDrive"].ToString(); Session["SystemId"] = theDT.Rows[0]["SystemId"].ToString(); Session["AppCurrency"] = theDT.Rows[0]["Currency"].ToString(); Session["AppUserEmployeeId"] = theDS.Tables[0].Rows[0]["EmployeeId"].ToString(); //Session["AppSystemId"] = theDT.Rows[0]["SystemId"].ToString(); #region "ModuleId" Session["AppModule"] = theDS.Tables[3]; DataView theSCMDV = new DataView(theDS.Tables[3]); theSCMDV.RowFilter = "ModuleId=201"; if (theSCMDV.Count > 0) { Session["SCMModule"] = theSCMDV[0]["ModuleName"]; } #endregion IQWebUtils theIQUtils = new IQWebUtils(); //theIQUtils.CreateSessionObject(Session.SessionID); Session["Paperless"] = theDT.Rows[0]["Paperless"].ToString(); Session["Program"] = ""; LoginManager = null; /////////////// Appointment Updates////////////////// //UpdateAppointment(); ///////////////////////////////////////////////////// if (theDS.Tables[3].Rows[0]["ExpPwdFlag"] != null) { if (Convert.ToInt32(theDS.Tables[0].Rows[0]["UserId"]) != 1) { if (Convert.ToInt32(theDS.Tables[3].Rows[0]["ExpPwdFlag"]) == 1) { //DateTime lastcontDate = Convert.ToDateTime(theDS.Tables[0].Rows[0]["PwdDate"]).AddDays(Convert.ToInt32(theDS.Tables[3].Rows[0]["ExpPwdDays"])); //lastcontDate.AddDays(90); DateTime lastcontDate = Convert.ToDateTime(theDS.Tables[0].Rows[0]["PwdDate"]); TimeSpan t = Convert.ToDateTime(theDS.Tables[4].Rows[0]["CurrentDate"]) - lastcontDate; double NrOfDaysdiffernce = t.TotalDays; //int result = Convert.ToInt32(theDS.Tables[3].Rows[0]["ExpPwdDays"]) - Convert.ToInt32(NrOfDays); string msgString; string theUrl = string.Format("{0}", "./AdminForms/frmAdmin_ChangePassword.aspx"); if (NrOfDaysdiffernce > Convert.ToInt32(theDS.Tables[3].Rows[0]["ExpPwdDays"])) { msgString = "Your Password has expired. Please Change it now.\\n"; string script = "<script language = 'javascript' defer ='defer' id = 'changePwdfunction2'>\n"; script += "alert('" + msgString + "');\n"; string url = Request.RawUrl.ToString(); Application["PrvFrm"] = url; Session["MandatoryChange"] = "1"; script += "window.location.href='" + theUrl + "'\n"; script += "</script>\n"; ClientScript.RegisterStartupScript(Page.GetType(), "changePwdfunction2", script); } else { Response.Redirect("frmTouchFacilityHome.aspx"); } } else { Response.Redirect("frmTouchFacilityHome.aspx"); } } else { LoginManager = null; Response.Redirect("frmTouchFacilityHome.aspx"); } } //Response.Redirect("frmFacilityHomenew.aspx"); } else { IQCareMsgBox.Show("InvalidLogin", this); return; } } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); } finally { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "CloseLoadingasdf", "CloseLoading();", true); LoginManager = null; } }