Exemplo n.º 1
0
        protected void DoNotContactPerMDClick(object sender, EventArgs e)
        {
            DataView dv = new DataView(GetSelectedPatients());

            dv.RowFilter = "DoNotContactPerMD = 1";
            int count = 0;

            foreach (DataRowView drv in dv)
            {
                // set patient status to 'DoNotContactPerPT'
                Patient ptObj = new Patient();
                ptObj.Get(Int32.Parse(drv[BOL.Patient.PatientId].ToString()));
                if (!ptObj.IsEmpty)
                {
                    ptObj[Patient.PtContactStatus] = "DoNotContactPerMD";

                    UserController userCt        = new UserController();
                    int            currentUserId = userCt.GetUserId();
                    UserDa         currentUserDa = new UserDa();
                    DataSet        currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId());
                    ptObj[Patient.UpdatedBy]   = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                    ptObj[Patient.UpdatedTime] = DateTime.Today;
                    ptObj.Save();
                    count++;
                }
            }

            if (count > 0)
            {
                Option3RB.Checked      = false;
                Option3RB.Enabled      = false;
                Option3Title.Text      = "No patients specified for no contact.";
                Option3Title.ForeColor = System.Drawing.Color.Gray;
                Option3Details.Text    = String.Empty;

                PopulateDoNotContactResults();
                RemovePatientFromNeedLetterList(dv, "DoNotContactPerMD");
                //PopulateResults();
            }
        }
Exemplo n.º 2
0
        public ActionResult ChangePassword()
        {
            CmnEntityModel currentUser = Session["CmnEntityModel"] as CmnEntityModel;

            if (currentUser == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            UserModel model = new UserModel();

            UserDa dataAccess = new UserDa();

            if (currentUser.ID > 0)
            {
                UserModel infor = new UserModel();
                infor = dataAccess.getInfoUser(currentUser.ID);

                model = infor != null ? infor : model;
            }

            return(View(model));
        }
Exemplo n.º 3
0
        public long UpdatePassword(UserModel model)
        {
            long res = 0;
            // Declare new DataAccess object
            UserDa dataAccess = new UserDa();

            using (var transaction = new TransactionScope())
            {
                TblUser entity = new TblUser();

                entity.ID       = model.ID;
                entity.Password = SafePassword.GetSaltedPassword(model.NEW_PASSWORD);

                res = dataAccess.UpdatePassword(entity);
                if (res <= 0)
                {
                    transaction.Dispose();
                }
                transaction.Complete();
            }
            return(res);
        }
Exemplo n.º 4
0
        protected void SaveActionClick(object sender, EventArgs e)
        {
            if (PatientId != 0)
            {
                // create ActionItem = 'MD_Contacted' for patients to check
                ActionDa   actionDa  = new ActionDa();
                BOL.Action actionObj = new Caisis.BOL.Action();
                actionObj[BOL.Action.PatientId]      = PatientId;
                actionObj[BOL.Action.ActionDateText] = DateTime.Today.ToShortDateString();
                actionObj[BOL.Action.ActionDate]     = DateTime.Today;
                actionObj[BOL.Action.ActionItem]     = "MD_Contacted";
                actionObj[BOL.Action.ActionNotes]    = !String.IsNullOrEmpty(PersonSpokeTo.Text) ? "Spoke to " + PersonSpokeTo.Text : String.Empty;

                UserController userCt        = new UserController();
                int            currentUserId = userCt.GetUserId();
                UserDa         currentUserDa = new UserDa();
                DataSet        currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId());
                actionObj[BOL.Action.EnteredBy] = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";

                actionObj[BOL.Action.EnteredTime] = DateTime.Now;

                actionObj.Save();

                // set patient status to 'MD_Contacted'
                Patient ptObj = new Patient();
                ptObj.Get(PatientId);
                if (!ptObj.IsEmpty)
                {
                    ptObj[Patient.PtContactStatus] = "MD_Contacted";
                    ptObj[Patient.UpdatedTime]     = DateTime.Now;
                    ptObj[Patient.UpdatedBy]       = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";

                    ptObj.Save();
                }
            }

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "_reloadMainPage", "reloadMainPage(); ", true);
        }
Exemplo n.º 5
0
        public long InsertUser(UserModel model)
        {
            long res = 0;
            // Declare new DataAccess object
            UserDa dataAccess = new UserDa();

            TblUser User = new TblUser();

            User.Email    = model.Email;
            User.UserName = model.UserName;
            User.Password = SafePassword.GetSaltedPassword(model.Password);
            User.Phone    = model.Phone;
            User.IsAdmin  = false;
            // Chưa xác nhận email
            User.Email_Confirm = Constant.ConfirmEmail.CONFIRMED;
            User.Status        = Constant.Status.ACTIVE;

            User.del_flg     = Constant.DeleteFlag.NON_DELETE;
            User.CreatedDate = DateTime.Now;

            res = dataAccess.InsertUser(User);
            return(res);
        }
Exemplo n.º 6
0
        public ActionResult UserList()
        {
            CmnEntityModel currentUser = Session["CmnEntityModel"] as CmnEntityModel;

            if (currentUser == null || currentUser.IsAdmin == false)
            {
                return(RedirectToAction("Login", "Login"));
            }

            UserModel model = new UserModel();

            CommonService comService = new CommonService();

            var tmpCondition = GetRestoreData() as UserModel;

            if (tmpCondition != null)
            {
                model = tmpCondition;
            }

            UserDa dataAccess = new UserDa();

            int HaNoiCity = 1;
            ManageDistrictDa daDistrict = new ManageDistrictDa();

            model.DISTRICT_LIST = daDistrict.getDistrictList(HaNoiCity).ToList().Select(
                f => new SelectListItem
            {
                Value = f.ID.ToString(),
                Text  = f.Name
            }).ToList();
            model.DISTRICT_LIST.Insert(0, new SelectListItem {
                Value = Constant.DEFAULT_VALUE, Text = "Chọn Quận/huyện"
            });

            return(View(model));
        }
Exemplo n.º 7
0
        /// <summary>
        /// 更新用户信息,可以更改用户密码
        /// </summary>
        /// <param name="user"></param>
        public void EditUserInfo(string itcode, string password, string firstname, string lastname, string phone)
        {
            User existUser = UserDa.GetUserByItCode(itcode);

            if (existUser == null)
            {
                throw new BusinessObjectLogicException("Invalid User!");
            }
            if (existUser.Disabled)
            {
                throw new BusinessObjectLogicException("User is disabled!");
            }

            if (!String.IsNullOrEmpty(password))
            {
                existUser.Password = password;
            }
            existUser.FirstName = firstname;
            existUser.LastName  = lastname;
            existUser.Phone     = phone;


            UserDa.UpdateUser(existUser);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Gets the table of search results
        /// </summary>
        /// <returns></returns>
        public HtmlGenericControl GetCallbackResult()
        {
            ProjectManagementDa da = new ProjectManagementDa();

            // Determine if need to filter by user id
            DataView projectsList = new DataView();

            if (FilterByUser)
            {
                string uName = new Caisis.Security.SecurityController().GetUserName();
                UserDa uda   = new UserDa();
                int    uId   = uda.GetUserId(uName);

                projectsList = da.ProjectMgmtSearch(callbackSearchValue, uId).DefaultView;
            }
            else
            {
                projectsList = da.ProjectMgmtSearch(callbackSearchValue).DefaultView;
            }

            BindProjectList(projectsList);

            return(ContentTableHolder);
        }
Exemplo n.º 9
0
        protected void Repeater1_ItemCommand(object o, RepeaterCommandEventArgs e)
        {
            try
            {
                string currentPatientId  = Convert.ToString(e.CommandArgument);
                string actionItemCommand = Convert.ToString(e.CommandName);

                HtmlImage   DataReceivedImg = (HtmlImage)e.Item.FindControl("DataReceivedImg");
                ImageButton DataReceivedBtn = (ImageButton)e.Item.FindControl("DataReceivedBtn");
                Label       DataReceivedLBL = (Label)e.Item.FindControl("DataReceivedLBL");

                HtmlImage   NeedMD_ContactImg = (HtmlImage)e.Item.FindControl("NeedMD_ContactImg");
                ImageButton NeedMD_ContactBtn = (ImageButton)e.Item.FindControl("NeedMD_ContactBtn");
                Label       NeedMD_ContactLBL = (Label)e.Item.FindControl("NeedMD_ContactLBL");

                UserController userCt        = new UserController();
                int            currentUserId = userCt.GetUserId();
                UserDa         currentUserDa = new UserDa();
                DataSet        currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId());

                if (actionItemCommand == "DataReceived")
                {
                    if (DataReceivedBtn != null && DataReceivedImg != null)
                    {
                        DataReceivedBtn.Style["display"] = "none";
                    }

                    if (!String.IsNullOrEmpty(currentPatientId))
                    {
                        bool actionAlreadyExists = false;

                        ActionDa actionDa = new ActionDa();
                        DataSet  actionDs = actionDa.ValidateActionItem(Int32.Parse(currentPatientId), actionItemCommand);
                        if (actionDs.Tables.Count > 0)
                        {
                            DataView actionDv = new DataView(actionDs.Tables[0]);
                            actionDv.RowFilter = BOL.Action.ActionDateText + " = '" + DateTime.Today.ToShortDateString() + "' AND " + BOL.Action.ActionItem + " = '" + actionItemCommand + "' ";
                            if (actionDv.Count > 0)
                            {
                                actionAlreadyExists = true;
                            }
                        }

                        // if action item does not already exist for today
                        if (!actionAlreadyExists)
                        {
                            // create ActionItem = 'DataReceived' for patients to check
                            BOL.Action actionObj = new Caisis.BOL.Action();
                            actionObj[BOL.Action.PatientId]      = int.Parse(currentPatientId);
                            actionObj[BOL.Action.ActionDateText] = DateTime.Today.ToShortDateString();
                            actionObj[BOL.Action.ActionDate]     = DateTime.Today;
                            actionObj[BOL.Action.ActionItem]     = actionItemCommand;

                            actionObj[BOL.Action.EnteredBy]   = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                            actionObj[BOL.Action.EnteredTime] = DateTime.Today;

                            actionObj.Save();
                        }

                        // set patient status to 'NeedDataEntry'
                        Patient ptObj = new Patient();
                        ptObj.Get(Int32.Parse(currentPatientId));
                        if (!ptObj.IsEmpty)
                        {
                            ptObj[Patient.PtContactStatus] = "NeedDataEntry";
                            ptObj[Patient.UpdatedTime]     = DateTime.Today;
                            ptObj[Patient.UpdatedBy]       = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                            ptObj.Save();
                        }

                        if (DataReceivedLBL != null && DataReceivedImg != null)
                        {
                            DataReceivedImg.Style["display"] = "";
                            DataReceivedLBL.Text             = actionItemCommand;
                        }

                        // show "NeedMD_Contact" btn
                        if (NeedMD_ContactBtn != null)
                        {
                            NeedMD_ContactBtn.Style["display"] = "";
                        }

                        if (NeedMD_ContactLBL != null && NeedMD_ContactImg != null)
                        {
                            NeedMD_ContactImg.Style["display"] = "none";
                            NeedMD_ContactLBL.Text             = String.Empty;
                        }
                    }
                }
                else if (actionItemCommand == "NeedMD_Contact")
                {
                    if (NeedMD_ContactBtn != null && NeedMD_ContactImg != null)
                    {
                        NeedMD_ContactBtn.Style["display"] = "none";
                    }

                    if (!String.IsNullOrEmpty(currentPatientId))
                    {
                        // if any action item was created for "DataReceived", delete

                        ActionDa actionDa = new ActionDa();
                        DataSet  actionDs = actionDa.ValidateActionItem(Int32.Parse(currentPatientId), "DataReceived");
                        if (actionDs.Tables.Count > 0)
                        {
                            DataView actionDv = new DataView(actionDs.Tables[0]);
                            actionDv.RowFilter = BOL.Action.ActionDateText + " = '" + DateTime.Today.ToShortDateString() + "' AND " + BOL.Action.ActionItem + " = 'DataReceived' ";
                            if (actionDv.Count > 0)
                            {
                                BOL.Action actionObj = new Caisis.BOL.Action();
                                actionObj.Get(Int32.Parse(actionDv[0][BOL.Action.ActionId].ToString()));
                                actionObj.Delete();
                            }
                        }


                        // set patient status to 'NeedMD_Contact'
                        Patient ptObj = new Patient();
                        ptObj.Get(Int32.Parse(currentPatientId));
                        if (!ptObj.IsEmpty)
                        {
                            ptObj[Patient.PtContactStatus] = "NeedMD_Contact";
                            ptObj[Patient.UpdatedTime]     = DateTime.Today;
                            ptObj[Patient.UpdatedBy]       = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                            ptObj.Save();
                        }

                        if (NeedMD_ContactLBL != null && NeedMD_ContactImg != null)
                        {
                            NeedMD_ContactImg.Style["display"] = "";
                            NeedMD_ContactLBL.Text             = actionItemCommand;
                        }

                        // show "Data Received" btn
                        if (DataReceivedBtn != null)
                        {
                            DataReceivedBtn.Style["display"] = "";
                        }

                        if (DataReceivedLBL != null && DataReceivedImg != null)
                        {
                            DataReceivedImg.Style["display"] = "none";
                            DataReceivedLBL.Text             = String.Empty;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                // publish raw error
                ExceptionHandler.Publish(ex);
            }
        }
Exemplo n.º 10
0
        protected override void Page_Load(object sender, System.EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!string.IsNullOrEmpty(Request.QueryString["userId"]))
            {
                //admin is coming from update password or just added new user.. populate send email fieds with new password info
                userId = int.Parse(Request.QueryString["userId"]);
                string pswd = Request.QueryString["pswd"];
                if (!string.IsNullOrEmpty(EncPassword))
                {
                    pswd = Security.CustomCryptoHelper.Decrypt(EncPassword);
                }

                UserDa  user = new UserDa();
                DataSet ds   = user.GetByUserId(userId);

                //populate to address
                if (ds.Tables[0].Rows.Count > 0)
                {
                    emailAddress = ds.Tables[0].Rows[0]["UserEmail"].ToString();
                    userName     = ds.Tables[0].Rows[0]["UserName"].ToString();
                    userLast     = ds.Tables[0].Rows[0]["UserLastName"].ToString();
                    userFirst    = ds.Tables[0].Rows[0]["UserFirstName"].ToString();

                    if (!string.IsNullOrEmpty(emailAddress))
                    {
                        txtTo.Text = emailAddress;
                    }
                }

                // Default Admin Mail Address
                MailManager m = new MailManager();
                txtFrom.Text = m.AdminEmailAddress;

                if (Request.QueryString["newUser"] != null && Request.QueryString["newUser"].Equals("yes"))
                {
                    newUserBool.Value = bool.TrueString;
                    //new user default message
                    txtSubject.Text   = "Caisis Account Information";
                    txtContent.Value  = userFirst + " " + userLast + ",\n\nYour new Caisis account has been created by a system administrator. You may now use the information below to login to the system.\n\n";
                    txtContent.Value += "UserName:  "******"\n";

                    // if using LDAP
                    if (UseLDAP)
                    {
                        txtContent.Value += "Password:  Log in using your network (Windows) password.";
                    }
                    // otherwise, normal auth
                    else
                    {
                        txtContent.Value += "Password:  "******"\n\n";
                        txtContent.Value += "Please update this password on your first use of the system.  You may do this by clicking the \"Change Your Password\" button on the login page.";
                    }
                }
                else
                {
                    // only notify about valid password updates
                    if (!string.IsNullOrEmpty(pswd))
                    {
                        txtSubject.Text   = "Password Update";
                        txtContent.Value  = userFirst + " " + userLast + ",\n\nYour Caisis password has been updated by a system administrator.\n\nYour new password is:  " + pswd + "\n\n";
                        txtContent.Value += "Please update this password on your next use of the system.  You may do this by clicking the \"Change Your Password\" button on the login page.";
                    }
                }
                // append sent date to existing content
                if (!string.IsNullOrEmpty(txtSubject.Text))
                {
                    txtContent.Value += "\n\n\nThe Caisis Team";
                    txtContent.Value += "\n\nMessage Sent:  " + System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToShortTimeString();
                }
            }
        }
Exemplo n.º 11
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            // set dataset message
            if (!hasInstitutionDataset)
            {
                NewPatientInstitution.Visible = true;
            }

            if (!Page.IsPostBack)
            {
                int protocolId = int.Parse(BaseProtocolId);
                // Get an auto-generate screening id
                ScreeningID.Value = PatientProtocolController.GenerateScreeningId().ToString();
                // study id
                string autoStudyId = PatientProtocolController.GenerateStudyId(protocolId);
                StudyID.Value = autoStudyId;
                bool calculateStudyIdBySite = ProtocolMgmtUtil.GenerateStudyIdByOrganization();
                // custom auto-generation
                if (calculateStudyIdBySite)
                {
                    OrganizationStudyIds.Visible = true;

                    StudyIdTooltip.Attributes["title"] = "An Id created to identify a patient on a study in the form: Site Id (2 digits) + Protocol Id (3 digits) + Incremental Patient Id (3 digits)";

                    // get associated Project (to select organizations)
                    Protocol protocol = new Protocol();
                    protocol.Get(protocolId);
                    string protocolNum = protocol[Protocol.ProtocolNum].ToString();

                    // get a list of associated organizations
                    if (!protocol.IsNull(Protocol.ProjectId) && !string.IsNullOrEmpty(protocolNum))
                    {
                        ProjectManagementDa da = new ProjectManagementDa();
                        int projectId          = (int)protocol[Protocol.ProjectId];

                        // get a list of organizations associated with project
                        var projectOrganizations = BusinessObject.GetByFields <Project_ProjectOrganization>(new Dictionary <string, object> {
                            { Project_ProjectOrganization.ProjectId, projectId }
                        });

                        // get a list of user's organizations
                        int       userId              = new UserController().GetUserId();
                        DataTable userOrganizations   = new UserDa().GetUserOrganizations(userId);
                        var       userOrganizationIds = userOrganizations.AsEnumerable().Select(r => (int)r["OrganizationId"]);

                        // get the intersect of user's sites and lead sites
                        var userLeadSites = from po in projectOrganizations
                                            let organizationType = po["OrganizationType"].ToString()
                                                                   let organizationId = (int)po[Project_ProjectOrganization.OrganizationId]
                                                                                        where organizationType.Contains("Lead Site")
                                                                                        join userOrgId in userOrganizationIds on organizationId equals userOrgId
                                                                                        select userOrgId;
                        // if user is part of a lead site, allow to select organization
                        if (userLeadSites.Count() > 0)
                        {
                            // TODO: centralize call to get project organizations
                            var organizations = da.GetAllOrganizationsByProjectId(projectId);
                            // get a list of organizations and calculate study id per organization
                            var organizationToStudyId = from row in organizations.AsEnumerable()
                                                        let orgName                         = row["Name"].ToString()
                                                                                  let orgId = (int)row["OrganizationId"]
                                                                                              let isAssociated = userOrganizationIds.Contains(orgId) ? 0 : 1
                                                                                                                 orderby
                                                                                                                 //isAssociated ascending,
                                                                                                                 orgName ascending
                                                                                                                 select new
                            {
                                OrganizationName    = orgName,
                                OrganizationId      = orgId,
                                OrganizationStudyId = GenerateStudyIdByOrganization(protocolId, protocolNum, orgId)
                            };

                            OrganizationStudyIds.DataSource = organizationToStudyId;
                            OrganizationStudyIds.DataBind();

                            // a list of insitutions where institution = organization in project
                            var allInstitutions = from inst in BOL.BusinessObject.GetAll <Institution>()
                                                  let institutionId = (int)inst[BOL.Institution.InstitutionId]
                                                                      let institutionName = inst[BOL.Institution.Institution_Field].ToString()
                                                                                            select new
                            {
                                InstitutionId = institutionId,
                                Institution   = institutionName
                            };
                            var orgs = from org in userOrganizations.AsEnumerable()
                                       select new
                            {
                                Name      = org["Name"].ToString(),
                                ShortName = org["ShortName"].ToString()
                            };
                            // get institution where name matches an organization's name or short name
                            var institutions = from inst in allInstitutions
                                               let institutionName = inst.Institution
                                                                     let organization = orgs.Where(org => org.Name == institutionName || org.ShortName == institutionName).FirstOrDefault()
                                                                                        where organization != null
                                                                                        select new
                            {
                                Text  = organization.Name,
                                Value = inst.InstitutionId
                            };

                            // build institutions
                            NewPatientInstitutionSelect.DataSource = institutions;
                            NewPatientInstitutionSelect.DataBind();

                            // set default study id: user's organization
                            // get user's site
                            int userLeadSiteId = userLeadSites.First();
                            // get study id for user's site
                            var userSites = organizationToStudyId.Where(o => o.OrganizationId == userLeadSiteId);
                            autoStudyId = userSites.Count() == 1 ? userSites.First().OrganizationStudyId : "";

                            // update field and select
                            OrganizationStudyIds.Value = autoStudyId;
                            StudyID.Value = autoStudyId;
                        }
                        // show a list of all user's organizations
                        else
                        {
                            if (userOrganizations.Rows.Count > 0)
                            {
                                string organizationName = userOrganizations.Rows[0]["Name"].ToString();
                                int    organizationId   = (int)userOrganizations.Rows[0]["OrganizationId"];

                                // a list of orgaizations associated with the project
                                var organizations = from o in userOrganizations.AsEnumerable()
                                                    let orgId = (int)o["OrganizationId"]
                                                                select
                                                                new
                                {
                                    OrganizationName    = o["Name"].ToString(),
                                    OrganizationId      = orgId,
                                    OrganizationStudyId = GenerateStudyIdByOrganization(protocolId, protocolNum, orgId)
                                };

                                // a list of insitutions where institution = organization in project
                                var allInstitutions = from inst in BOL.BusinessObject.GetAll <Institution>()
                                                      let institutionId = (int)inst[BOL.Institution.InstitutionId]
                                                                          let institutionName = inst[BOL.Institution.Institution_Field].ToString()
                                                                                                select new
                                {
                                    InstitutionId = institutionId,
                                    Institution   = institutionName
                                };
                                var orgs = from org in userOrganizations.AsEnumerable()
                                           select new
                                {
                                    Name      = org["Name"].ToString(),
                                    ShortName = org["ShortName"].ToString()
                                };
                                // get institution where name matches an organization's name or short name
                                var institutions = from inst in allInstitutions
                                                   let institutionName = inst.Institution
                                                                         let organization = orgs.Where(org => org.Name == institutionName || org.ShortName == institutionName).FirstOrDefault()
                                                                                            where organization != null
                                                                                            select new
                                {
                                    Text  = organization.Name,
                                    Value = inst.InstitutionId
                                };

                                // build organizations
                                OrganizationStudyIds.DataSource = organizations;
                                OrganizationStudyIds.DataBind();


                                // build institutions
                                NewPatientInstitutionSelect.DataSource = institutions;
                                NewPatientInstitutionSelect.DataBind();


                                autoStudyId = organizations.Count() == 1? organizations.First().OrganizationStudyId : "";

                                OrganizationStudyIds.Value = autoStudyId;

                                //OrganizationStudyIds.Enabled = false;
                                StudyID.Value = autoStudyId;
                            }
                        }
                    }

                    if (string.IsNullOrEmpty(autoStudyId))
                    {
                        StudyIdError.Visible = true;
                    }
                }

                // default screeing date
                //ScreeningDate.Value = DateTime.Today.ToShortDateString();

                PopulatePhysicians();

                // set search by particpant id type
                SeachTypeParticipantID.Text = PROTOCOL_PARTICIPANT_ID_CODE;

                // default participant id field
                ParticipantIdField.Text = GetNextParticipantId();

                // default radios and panel which can be seen by user
                DetermineUserSearchAccess();
            }
        }
Exemplo n.º 12
0
 public List <User> GetUserAll()
 {
     return(UserDa.GetUserAll());
 }
Exemplo n.º 13
0
        public static bool ResetPassword(string email, string token, string password)
        {
            var result = new UserDa().ResetPassword(email, token, password);

            return(result);
        }
Exemplo n.º 14
0
        public bool create(User user)
        {
            UserDa userDa = new UserDa();

            return(userDa.create(user));
        }
Exemplo n.º 15
0
 public List <UserRole> GetUserRole(string user, string bu)
 {
     return(UserDa.GetUserRole(user, null, bu));
 }
Exemplo n.º 16
0
        protected void PrintingCompleteClick(object sender, EventArgs e)
        {
            DataView dv = new DataView(GetSelectedPatients());

            dv.RowFilter = "Mail = 1";
            int count = 0;

            foreach (DataRowView drv in dv)
            {
                // set patient status and create action items for either Letter1_Sent, Letter2_Sent, or Letter3_Sent
                ActionDa   actionDa  = new ActionDa();
                BOL.Action actionObj = new Caisis.BOL.Action();
                Patient    ptObj     = new Patient();
                ptObj.Get(Int32.Parse(drv[BOL.Patient.PatientId].ToString()));

                if (!ptObj.IsEmpty)
                {
                    if (ptObj[Patient.PtContactStatus].ToString() == "NeedLetter1")
                    {
                        ptObj[Patient.PtContactStatus]   = "Letter1_Sent";
                        actionObj[BOL.Action.ActionItem] = "Letter1_Sent";
                    }
                    else if (ptObj[Patient.PtContactStatus].ToString() == "NeedLetter2")
                    {
                        ptObj[Patient.PtContactStatus]   = "Letter2_Sent";
                        actionObj[BOL.Action.ActionItem] = "Letter2_Sent";
                    }
                    else if (ptObj[Patient.PtContactStatus].ToString() == "NeedLetter3")
                    {
                        ptObj[Patient.PtContactStatus]   = "Letter3_Sent";
                        actionObj[BOL.Action.ActionItem] = "Letter3_Sent";
                    }

                    UserController userCt        = new UserController();
                    int            currentUserId = userCt.GetUserId();
                    UserDa         currentUserDa = new UserDa();
                    DataSet        currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId());
                    ptObj[Patient.UpdatedBy]   = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                    ptObj[Patient.UpdatedTime] = DateTime.Today;
                    ptObj.Save();

                    actionObj[BOL.Action.PatientId]      = Int32.Parse(drv[BOL.Patient.PatientId].ToString());
                    actionObj[BOL.Action.ActionDateText] = DateTime.Today.ToShortDateString();
                    actionObj[BOL.Action.ActionDate]     = DateTime.Today;
                    actionObj[BOL.Action.EnteredBy]      = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                    actionObj[BOL.Action.EnteredTime]    = DateTime.Now;
                    actionObj.Save();

                    count++;
                }
            }

            if (count > 0)
            {
                Option2RB.Checked                 = false;
                Option2RB.Enabled                 = false;
                Option2Title.Text                 = "No packages to print.";
                Option2Title.ForeColor            = System.Drawing.Color.Gray;
                Option2ResultDiv.Style["display"] = "none";
                Option2Details.Text               = String.Empty;

                RemovePatientFromNeedLetterList(dv, "Mail");
            }
        }
Exemplo n.º 17
0
 public List <User> GetUserByItCodes(params string[] itcodes)
 {
     return(UserDa.GetUserByItCode(itcodes));
 }
Exemplo n.º 18
0
 public void UpdateDefaultBu(string itcode, string bu)
 {
     UserDa.UpdateDefaultBu(itcode, bu);
 }
Exemplo n.º 19
0
 public List <User> GetUser(Guid organ)
 {
     return(UserDa.GetUser(null, organ, null, null));
 }
Exemplo n.º 20
0
        public static bool InsertUser(string userName, string password, string fullName, string phone, string email)
        {
            var result = new UserDa().Insert(userName, password, fullName, phone, email);

            return(result);
        }
Exemplo n.º 21
0
        public static bool CreateResetPasswordToken(string usermail)
        {
            var result = new UserDa().CreateResetPasswordToken(usermail);

            return(result);
        }
Exemplo n.º 22
0
        protected void Repeater1_ItemCommand(object o, RepeaterCommandEventArgs e)
        {
            if (Convert.ToString(e.CommandName) == "DataEntered")
            {
                string currentPatientId  = Convert.ToString(e.CommandArgument);
                string actionItemCommand = Convert.ToString(e.CommandName);

                try
                {
                    HtmlImage   DataEnteredImg = (HtmlImage)e.Item.FindControl("DataEnteredImg");
                    ImageButton DataEnteredBtn = (ImageButton)e.Item.FindControl("DataEnteredBtn");
                    Label       DataEnteredLBL = (Label)e.Item.FindControl("DataEnteredLBL");

                    DropDownList HipaaDDL        = (DropDownList)e.Item.FindControl("HipaaDDL");
                    Label        StatusLBL       = (Label)e.Item.FindControl("StatusLBL");
                    Label        StatusPatientId = (Label)e.Item.FindControl("StatusPatientId");

                    // if hipaa status has been selected
                    if (!String.IsNullOrEmpty(HipaaDDL.SelectedValue))
                    {
                        StatusLBL.Text = String.Empty;

                        if (DataEnteredBtn != null && DataEnteredImg != null)
                        {
                            DataEnteredBtn.Style["display"] = "none";
                        }
                        if (!String.IsNullOrEmpty(currentPatientId))
                        {
                            // create ActionItem = 'DataEntered' for patients to check
                            ActionDa   actionDa  = new ActionDa();
                            BOL.Action actionObj = new Caisis.BOL.Action();
                            actionObj[BOL.Action.PatientId]      = int.Parse(currentPatientId);
                            actionObj[BOL.Action.ActionDateText] = DateTime.Today.ToShortDateString();
                            actionObj[BOL.Action.ActionDate]     = DateTime.Today;
                            actionObj[BOL.Action.ActionItem]     = actionItemCommand;

                            UserController userCt        = new UserController();
                            int            currentUserId = userCt.GetUserId();
                            UserDa         currentUserDa = new UserDa();
                            DataSet        currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId());
                            actionObj[BOL.Action.EnteredBy] = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";

                            actionObj[BOL.Action.EnteredTime] = DateTime.Today;

                            actionObj.Save();

                            // set patient status to 'NeedMD_Contact' if HIPAA = 'Yes"
                            // set patient status to 'NeedPtAuthorization' if HIPAA = 'No'
                            Patient ptObj = new Patient();
                            ptObj.Get(Int32.Parse(currentPatientId));
                            if (!ptObj.IsEmpty && !String.IsNullOrEmpty(HipaaDDL.SelectedValue))
                            {
                                if (HipaaDDL.SelectedValue.ToLower() == "yes")
                                {
                                    ptObj[Patient.PtContactStatus] = "NeedMD_Contact";
                                }
                                else if (HipaaDDL.SelectedValue.ToLower() == "no")
                                {
                                    ptObj[Patient.PtContactStatus] = "NeedPtAuthorization";
                                }
                                ptObj[Patient.UpdatedTime] = DateTime.Today;
                                ptObj[Patient.UpdatedBy]   = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";

                                ptObj.Save();
                            }

                            if (DataEnteredLBL != null && DataEnteredImg != null)
                            {
                                DataEnteredImg.Style["display"] = "";
                                DataEnteredLBL.Text             = actionItemCommand;
                            }
                        }
                    }
                    else
                    {
                        StatusLBL.Text      = "<br/>* specify HIPPA authorization";
                        StatusLBL.ForeColor = System.Drawing.Color.Red;
                    }
                }
                catch (Exception ex)
                {
                    // publish raw error
                    ExceptionHandler.Publish(ex);
                }
            }
        }
Exemplo n.º 23
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            //rGen = new Random();

            FormTable.Visible = true;
            SentTable.Visible = false;

            if (Page.IsPostBack)
            {
                if (Request.Form["userName"] != null && Request.Form["userName"].ToString().Length > 0)
                {
                    FormTable.Visible = false;
                    SentTable.Visible = true;

                    //take username and get password
                    UserDa  da = new UserDa();
                    DataSet ds = da.GetByUserName(userName.Value);


                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        string userStatus = da.GetUserStatus(userName.Value);
                        if (userStatus.Equals("Valid"))
                        {
                            string userEmail     = ds.Tables[0].Rows[0]["UserEmail"].ToString();
                            string userFirstName = ds.Tables[0].Rows[0]["UserFirstName"].ToString();
                            string userLastName  = ds.Tables[0].Rows[0]["UserLastName"].ToString();

                            //set new password in database
                            string newPassword = this.SetRandomPassword(userEmail);

                            if (!newPassword.Equals("false"))
                            {
                                //email new random password
                                this.EmailNewPassword(userEmail, userFirstName, userLastName, newPassword);

                                emailMessage.Text = "An email with a new password has been sent to " + userEmail + ".\n\n<br>Please update this password on first login. Thank you.";
                            }
                            else
                            {
                                //update of password failed
                                emailMessage.Text = "There was a problem updating your password. Please contact " + CaisisConfiguration.GetWebConfigValue("adminEmail") + " to request a new password.";
                            }
                        }
                        else if (userStatus.Equals("InvalidDeactivated"))
                        {
                            //Deactivated user
                            emailMessage.Text = "User has been deactivated. Please contact " + CaisisConfiguration.GetWebConfigValue("adminEmail") + ".";
                        }
                        else
                        {
                            //InvalidUnknown. InvalidUsername should never get here because of 'if(ds.Tables[0].Rows.Count > 0)' above.
                            emailMessage.Text = "There was an unknown problem updating your password. Please contact " + CaisisConfiguration.GetWebConfigValue("adminEmail") + " to request a new password.";
                        }
                    }
                    else
                    {
                        emailMessage.Text = "The username you entered does not have an email address on file. Please contact the Administrator to obtain a new password.";
                    }

                    ValidationMsg.Visible = false;
                }
                else
                {
                    ValidationMsg.InnerText = "You must enter your username to request a new password.";
                }
            }
        }
Exemplo n.º 24
0
 public List <User> GetUserWithBuRole(string bu, int role, string department)
 {
     return(UserDa.GetUserWithBuRole(bu, role, department));
 }
Exemplo n.º 25
0
        public ActionResult processRegister()
        {
            VerifyDbContext context = new VerifyDbContext();
            //check đã chụp ảnh chưa
            string path1 = Server.MapPath(IMAGE_DIR + "RegisterImage1.jpg");
            string path2 = Server.MapPath(IMAGE_DIR + "RegisterImage2.jpg");
            string path3 = Server.MapPath(IMAGE_DIR + "RegisterImage3.jpg");

            string dir1 = Directory.GetParent(path1).FullName;
            string dir2 = Directory.GetParent(path2).FullName;
            string dir3 = Directory.GetParent(path3).FullName;

            if (!System.IO.File.Exists(path1) && !System.IO.File.Exists(path2) && !System.IO.File.Exists(path3))
            {
                TempData["error"] = "Bạn chưa chụp ảnh";
                return(RedirectToAction("Register", "Login"));
            }
            else
            {
                NameValueCollection form = Request.Form;
                string fullName = "", email = "", personId = "";
                string sex;
                fullName = form["fullName"];
                email    = form["email"];
                sex      = form["optradio"];
                Debug.WriteLine(fullName + email + sex);


                //Goi hàm kiểm tra email đã tồn tại checkEmail(email); trả về true nếu đã tồn tại trong database
                var userDa = new UserDa();
                var verificationDa = new VerificationDa();
                if (userDa.HasMailExisted(email))
                {
                    TempData["error"] = "Email " + email + " đã được sử dụng để đăng ký trước đây";
                    return(RedirectToAction("Register", "Login"));
                }
                else
                {
                    try
                    {
                        Debug.WriteLine(1);
                        //Tao mới person
                        var request =
                            (HttpWebRequest)
                            WebRequest.Create(
                                "https://api.projectoxford.ai/face/v1.0/persongroups/open_source_net1/persons");
                        var postData = "{\"name\":\"" + email + "\",\"userData\":\"user-provided data attached to the person group\"}";
                        //var imgBinary = File.ReadAllBytes(_imgPath1);

                        byte[] byteData = Encoding.UTF8.GetBytes(postData);
                        //var data = Encoding.ASCII.GetBytes(postData);

                        request.Method        = "POST";
                        request.ContentType   = "application/json";
                        request.ContentLength = byteData.Length;
                        request.Host          = "api.projectoxford.ai";
                        request.Headers.Add("Ocp-Apim-Subscription-Key", "1c056c36ece84f14a0619803ee4f0ceb");

                        using (var stream = request.GetRequestStream())
                        {
                            stream.Write(byteData, 0, byteData.Length);
                        }

                        var response = (HttpWebResponse)request.GetResponse();

                        var     responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                        string  json           = responseString.ToString();
                        dynamic stuff          = JObject.Parse(json);
                        personId = stuff.personId;

                        //Vi - TODO: goi ham luu person moi vao database addPerson(fullName, email, personId);
                        var addedUser = userDa.Add(new User {
                            Email = email, Gender = sex, Name = fullName, PersonId = personId
                        });
                        int userID = addedUser.Id;

                        //add ảnh vào person
                        if (Directory.Exists(dir1))
                        {
                            Debug.WriteLine(2);
                            var request1 =
                                (HttpWebRequest)
                                WebRequest.Create(
                                    "https://api.projectoxford.ai/face/v1.0/persongroups/open_source_net1/persons/" + personId + "/persistedFaces");

                            Debug.WriteLine(path1);
                            var imgBinary = System.IO.File.ReadAllBytes(path1);


                            request1.Method        = "POST";
                            request1.ContentType   = "application/octet-stream";
                            request1.ContentLength = imgBinary.Length;
                            request1.Host          = "api.projectoxford.ai";
                            request1.Headers.Add("Ocp-Apim-Subscription-Key", "1c056c36ece84f14a0619803ee4f0ceb");

                            using (var stream = request1.GetRequestStream())
                            {
                                stream.Write(imgBinary, 0, imgBinary.Length);
                            }

                            var response1 = (HttpWebResponse)request1.GetResponse();

                            responseString = new StreamReader(response1.GetResponseStream()).ReadToEnd();
                            json           = responseString.ToString();
                            Debug.WriteLine(json);
                            stuff = JObject.Parse(json);

                            string persistedFaceId = stuff.persistedFaceId;
                            Debug.WriteLine(persistedFaceId);
                            //addIdentification(userId, persistedFaceId)
                            verificationDa.Add(new Verification {
                                PersistedFaceId = persistedFaceId, UserId = userID
                            });
                        }
                        if (System.IO.File.Exists(path2))
                        {
                            Debug.WriteLine(Directory.Exists(dir2));
                            var request1 =
                                (HttpWebRequest)
                                WebRequest.Create(
                                    "https://api.projectoxford.ai/face/v1.0/persongroups/open_source_net1/persons/" + personId + "/persistedFaces");


                            var imgBinary = System.IO.File.ReadAllBytes(path2);

                            request1.Method        = "POST";
                            request1.ContentType   = "application/octet-stream";
                            request1.ContentLength = imgBinary.Length;
                            request1.Host          = "api.projectoxford.ai";
                            request1.Headers.Add("Ocp-Apim-Subscription-Key", "1c056c36ece84f14a0619803ee4f0ceb");

                            using (var stream = request1.GetRequestStream())
                            {
                                stream.Write(imgBinary, 0, imgBinary.Length);
                            }

                            var response1 = (HttpWebResponse)request1.GetResponse();

                            responseString = new StreamReader(response1.GetResponseStream()).ReadToEnd();
                            json           = responseString.ToString();
                            stuff          = JObject.Parse(json);

                            string persistedFaceId = stuff.persistedFaceId;
                            Debug.WriteLine(persistedFaceId);
                            //addIdentification(userId, persistedFaceId)
                            verificationDa.Add(new Verification {
                                PersistedFaceId = persistedFaceId, UserId = userID
                            });
                        }
                        if (System.IO.File.Exists(path3))
                        {
                            Debug.WriteLine(4);
                            var request1 =
                                (HttpWebRequest)
                                WebRequest.Create(
                                    "https://api.projectoxford.ai/face/v1.0/persongroups/open_source_net1/persons/" + personId + "/persistedFaces");


                            var imgBinary = System.IO.File.ReadAllBytes(path3);

                            request1.Method        = "POST";
                            request1.ContentType   = "application/octet-stream";
                            request1.ContentLength = imgBinary.Length;
                            request1.Host          = "api.projectoxford.ai";
                            request1.Headers.Add("Ocp-Apim-Subscription-Key", "1c056c36ece84f14a0619803ee4f0ceb");

                            using (var stream = request1.GetRequestStream())
                            {
                                stream.Write(imgBinary, 0, imgBinary.Length);
                            }

                            var response1 = (HttpWebResponse)request1.GetResponse();

                            responseString = new StreamReader(response1.GetResponseStream()).ReadToEnd();
                            json           = responseString.ToString();
                            stuff          = JObject.Parse(json);

                            string persistedFaceId = stuff.persistedFaceId;
                            Debug.WriteLine(persistedFaceId);
                            //addIdentification(userId, persistedFaceId)
                            verificationDa.Add(new Verification {
                                PersistedFaceId = persistedFaceId, UserId = userID
                            });
                        }
                    }
                    catch (Exception ex)
                    {
                        //MessageBox.Show(ex.Message);
                        Debug.WriteLine(ex.Message);
                        TempData["error"] = "Xảy ra lỗi trong quá trình giao tiếp với API, bạn vui long tiến hành đăng ký lại";
                        return(RedirectToAction("Register", "Login"));
                    }
                }
            }



            return(RedirectToAction("Index", "Login"));
        }
        protected void NeedMDContactClick(object sender, EventArgs e)
        {
            if (PatientId != 0)
            {
                // create ActionItem = 'DataReceived'
                UserController userCt        = new UserController();
                int            currentUserId = userCt.GetUserId();
                UserDa         currentUserDa = new UserDa();
                DataSet        currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId());

                bool actionAlreadyExists = false;

                ActionDa actionDa = new ActionDa();
                DataSet  actionDs = actionDa.ValidateActionItem(PatientId, "DataReceived");
                if (actionDs.Tables.Count > 0)
                {
                    DataView actionDv = new DataView(actionDs.Tables[0]);
                    actionDv.RowFilter = BOL.Action.ActionDateText + " = '" + DateTime.Today.ToShortDateString() + "' AND " + BOL.Action.ActionItem + " = 'DataReceived' ";
                    if (actionDv.Count > 0)
                    {
                        actionAlreadyExists = true;
                    }
                }

                // if action item does not already exist for today
                if (!actionAlreadyExists)
                {
                    BOL.Action actionObj = new Caisis.BOL.Action();
                    actionObj[BOL.Action.PatientId]      = PatientId;
                    actionObj[BOL.Action.ActionDateText] = DateTime.Today.ToShortDateString();
                    actionObj[BOL.Action.ActionDate]     = DateTime.Today;
                    actionObj[BOL.Action.ActionItem]     = "DataReceived";
                    actionObj[BOL.Action.EnteredBy]      = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                    actionObj[BOL.Action.EnteredTime]    = DateTime.Today;

                    actionObj.Save();
                }

                // set patient status to 'NeedMD_ToCallPt'
                Patient ptObj = new Patient();
                ptObj.Get(PatientId);
                if (!ptObj.IsEmpty)
                {
                    ptObj[Patient.PtContactStatus] = "NeedMD_ToCallPt";
                    ptObj[Patient.UpdatedBy]       = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";
                    ptObj[Patient.UpdatedTime]     = DateTime.Now;

                    ptObj.Save();

                    if (AddressUpdatedLBL != null && AddressUpdatedImg != null)
                    {
                        AddressUpdatedImg.Style["display"] = "none";
                        AddressUpdatedLBL.Text             = String.Empty;
                    }
                    if (NeedMDContactLBL != null && NeedMDContactImg != null)
                    {
                        NeedMDContactImg.Style["display"] = "";
                        NeedMDContactLBL.Text             = "Pt Status: " + ptObj[Patient.PtContactStatus].ToString();
                    }
                }
            }

            //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "_reloadMainPage", "reloadMainPage(); ", true);
        }
Exemplo n.º 27
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (Request.QueryString["toUser"] != null && Request.QueryString["toUser"].ToString() != "")
            {
                toUserName = Request.QueryString["toUser"].ToString();

                // emails regarding datafeed records are sent to the admin
                if (toUserName.ToUpper().StartsWith("DATAFEED"))
                {
                    toUserEmail    = CaisisConfiguration.GetWebConfigValue("adminEmail");
                    txtTo.Text     = "Caisis Administrators";
                    txtTo.ReadOnly = true;
                    noToEmail      = false;
                    toDataFeed     = true;
                }
                else
                {
                    UserDa  toUser   = new UserDa();
                    DataSet toUserDs = toUser.GetByUserName(toUserName);

                    //populate to address
                    if (toUserDs.Tables[0].Rows.Count > 0)
                    {
                        bool activeUser = false;
                        if ((toUserDs.Tables[0].Rows[0][BOL.User.DeactivatedTime] == null) || (toUserDs.Tables[0].Rows[0][BOL.User.DeactivatedTime].ToString().Length < 1))
                        {
                            activeUser = true;
                        }
                        else
                        {
                            deactivatedToUser = true;
                        }


                        string emailAddress = toUserDs.Tables[0].Rows[0]["UserEmail"].ToString();
                        toFirstName = toUserDs.Tables[0].Rows[0]["UserFirstName"].ToString();
                        toLastName  = toUserDs.Tables[0].Rows[0]["UserLastName"].ToString();


                        if (emailAddress == null || emailAddress.Equals(""))
                        {
                            noToEmail = true;
                        }



                        if (activeUser == true && noToEmail == false)
                        {
                            toUserEmail    = emailAddress;
                            txtTo.Text     = toFirstName + " " + toLastName + " (email not shown)";
                            txtTo.ReadOnly = true;
                        }
                        else if (deactivatedToUser)
                        {
                            toUserEmail    = CaisisConfiguration.GetWebConfigValue("adminEmail");
                            txtTo.Text     = "Caisis Administrator";
                            txtTo.ReadOnly = true;
                        }
                        else if (noToEmail)// active but no email address
                        {
                            toUserEmail    = CaisisConfiguration.GetWebConfigValue("adminEmail");
                            txtTo.Text     = "Caisis Administrator";
                            txtTo.ReadOnly = true;
                        }
                    }
                    // no user identified
                    else
                    {
                        toUserEmail = CaisisConfiguration.GetWebConfigValue("adminEmail");
                        noToEmail   = true;
                    }
                }
            }

            txtSubject.Text = "Locked Record in Caisis";


            MailForm.Visible         = true;
            sentMessageTable.Visible = false;

            if (Page.IsPostBack)
            {
                this.btnSend_Click(sender, e);

                MailForm.Visible         = false;
                sentMessageTable.Visible = true;
            }
            else
            {
                UserDa  user = new UserDa();
                DataSet ds   = user.GetByUserName(User.Identity.Name);

                //populate from address
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string emailAddress = ds.Tables[0].Rows[0]["UserEmail"].ToString();
                    fromFName.Value = ds.Tables[0].Rows[0]["UserFirstName"].ToString();
                    fromLName.Value = ds.Tables[0].Rows[0]["UserLastName"].ToString();
                    if (emailAddress != null && !emailAddress.Equals(""))
                    {
                        txtFrom.Text     = emailAddress;
                        txtFrom.ReadOnly = true;
                    }
                }
            }
        }
Exemplo n.º 28
0
        protected void Repeater1_ItemCommand(object o, RepeaterCommandEventArgs e)
        {
            if (Convert.ToString(e.CommandName) == "TumorRegistryChecked")
            {
                string currentPatientId  = Convert.ToString(e.CommandArgument);
                string actionItemCommand = Convert.ToString(e.CommandName);

                try
                {
                    HtmlImage   TumorRegCheckedImg = (HtmlImage)e.Item.FindControl("TumorRegCheckedImg");
                    ImageButton TumorRegCheckedBtn = (ImageButton)e.Item.FindControl("TumorRegCheckedBtn");
                    Label       TumorRegCheckedLBL = (Label)e.Item.FindControl("TumorRegCheckedLBL");

                    DropDownList StatusDDL       = (DropDownList)e.Item.FindControl("StatusDDL");
                    Label        StatusLBL       = (Label)e.Item.FindControl("StatusLBL");
                    Label        StatusPatientId = (Label)e.Item.FindControl("StatusPatientId");

                    if (TumorRegCheckedBtn != null && TumorRegCheckedImg != null)
                    {
                        TumorRegCheckedBtn.Style["display"] = "none";
                    }
                    if (!String.IsNullOrEmpty(currentPatientId))
                    {
                        // create ActionItem = 'TumorRegistryChecked' for patients to check
                        ActionDa   actionDa  = new ActionDa();
                        BOL.Action actionObj = new Caisis.BOL.Action();
                        actionObj[BOL.Action.PatientId]      = int.Parse(currentPatientId);
                        actionObj[BOL.Action.ActionDateText] = DateTime.Today.ToShortDateString();
                        actionObj[BOL.Action.ActionDate]     = DateTime.Today;
                        actionObj[BOL.Action.ActionItem]     = actionItemCommand;

                        UserController userCt        = new UserController();
                        int            currentUserId = userCt.GetUserId();
                        UserDa         currentUserDa = new UserDa();
                        DataSet        currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId());
                        actionObj[BOL.Action.EnteredBy] = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";

                        actionObj[BOL.Action.EnteredTime] = DateTime.Today;

                        actionObj.Save();

                        // set patient status to 'Current'
                        Patient ptObj = new Patient();
                        ptObj.Get(Int32.Parse(currentPatientId));
                        if (!ptObj.IsEmpty)
                        {
                            ptObj[Patient.PtContactStatus] = "Current";
                            ptObj[Patient.UpdatedTime]     = DateTime.Today;
                            ptObj[Patient.UpdatedBy]       = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified";

                            ptObj.Save();
                        }

                        if (TumorRegCheckedLBL != null && TumorRegCheckedImg != null)
                        {
                            TumorRegCheckedImg.Style["display"] = "";
                            TumorRegCheckedLBL.Text             = actionItemCommand;
                        }

                        // show status options
                        if (StatusDDL != null && StatusLBL != null)
                        {
                            StatusDDL.Style["display"] = "";
                            StatusDDL.Width            = Unit.Pixel(150);
                            StatusLBL.Style["display"] = "none";

                            ptObj.Get(Int32.Parse(StatusPatientId.Text));
                            if (!ptObj.IsEmpty)
                            {
                                ListItem statusLi = new ListItem(ptObj[Patient.PtContactStatus].ToString(), ptObj[Patient.PtContactStatus].ToString());
                                if (StatusDDL.Items.Contains(statusLi))
                                {
                                    StatusDDL.SelectedValue = statusLi.Value;
                                }
                                else
                                {
                                    StatusDDL.SelectedValue = "Current";
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    // publish raw error
                    ExceptionHandler.Publish(ex);
                }
            }
        }
Exemplo n.º 29
0
        protected void SetReferralMDList()
        {
            XmlNode configNode = CaisisConfiguration.GetEFormNode(this.EFormName);

            if (configNode != null)
            {
                XmlAttribute att = configNode.Attributes["enableReferrals"];
                if (att != null)
                {
                    bool doEnable = bool.Parse(att.Value);
                    if (doEnable)
                    {
                        referToPanelContainer.Visible = true;

                        //UserDa uDa = new UserDa();
                        //DataTable uDt = uDa.GetUsersByAttributeValue("EForm Referee", "true");
                        //DataView uDv = uDt.DefaultView;
                        //uDv.Sort = BOL.User.UserLastName + " ASC";

                        //AppointmentDa da = new AppointmentDa();
                        //DataTable dt = da.GetUsersWithAppointments();
                        //DataView uDv = dt.DefaultView;

                        AppointmentDa da = new AppointmentDa();
                        DataTable     dt = da.GetUsersWithAppointments();
                        List <string> UsersWithAppointments = (from row in dt.AsEnumerable()
                                                               select row.Field <string>(BOL.User.UserName)).ToList <string>();

                        // add referral recipients
                        DataTable     uDt = ReferralRecipientsToGetLimitedData();
                        List <string> RECIPIENTS_TO_GET_LIMITED_DATA = (from row in uDt.AsEnumerable()
                                                                        select row.Field <string>(BOL.User.UserName)).ToList <string>();

                        UserDa userDa = new UserDa();

                        foreach (string refUserName in RECIPIENTS_TO_GET_LIMITED_DATA)
                        {
                            // check if user is already in list
                            if (!UsersWithAppointments.Contains(refUserName))
                            {
                                // include the "additional" users in list even if they don't have appointments
                                DataTable userDt = userDa.GetByUserName(refUserName).Tables[0];
                                if (userDt.Rows.Count > 0)
                                {
                                    dt.Rows.Add(userDt.Rows[0].ItemArray);
                                }
                            }
                        }


                        DataView uDv = dt.DefaultView;
                        uDv.Sort = "UserLastName ASC";


                        if (uDv.Count > 0)
                        {
                            NoEFormReferees.Visible = false;
                            ReferToRptr.DataSource  = uDv;
                            ReferToRptr.DataBind();
                        }
                    }
                }
            }
        }
Exemplo n.º 30
0
 public User GetUserByItCode(string itcode)
 {
     return(UserDa.GetUserByItCode(itcode));
 }