protected void createBtn_Click(object sender, EventArgs e)
    {
        try
        {
            User user = new User();
            AdminManager am = new AdminManager();
            user.FirstName = fNameTB.Text.Trim();
            user.LastName = lNameTB.Text.Trim();
            user.MiddleName = mNameTB.Text.Trim();
            user.empNo = empNoTB.Text;
            user.branch = branchDDL.SelectedValue;
            user.Role = roleDDL.SelectedValue;
            user.username = userTB.Text.Trim();
            user.password = passwordTB.Text.Trim();

            Membership.CreateUser(user.username, user.password);
            Roles.AddUserToRole(user.username, user.Role);
            //Roles.AddUserToRole(user.username, "Member");

            // add user to manager role if they are in upper management
            if (user.Role == "Director" || user.Role == "Executive" || user.Role == "Associate")
            {
                Roles.AddUserToRole(user.username, "Manager");
            }
            am.createUser(user);
            statusLBL.ForeColor = System.Drawing.Color.Green;
            statusLBL.Text = "User Created Successfully";
        }
        catch (Exception ex)
        {
            statusLBL.ForeColor = System.Drawing.Color.Red;
            statusLBL.Text = "Error User was not created due to: " + ex.Message;

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) {
            AdminManager am = new AdminManager();

            branchDDL.DataSource = am.getBranches();
            branchDDL.DataBind();

            roleDDL.DataSource = Roles.GetAllRoles();
            roleDDL.DataBind();

        }
    }
 private void OnEnable()
 {
     mQueue = new CoroutineQueue();
     mAdmin = AdminManager.Create(NPNFSettings.Instance, NPNFSettings.Instance, USER_ID, mQueue);
     ResetData();
 }
        private static string GetColumnValue(Dictionary <string, string> nameValueCacheDict, SiteInfo siteInfo, ContentInfo contentInfo, TableStyleInfo styleInfo)
        {
            var value = string.Empty;

            if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.AddUserName))
            {
                if (!string.IsNullOrEmpty(contentInfo.AddUserName))
                {
                    var key = ContentAttribute.AddUserName + ":" + contentInfo.AddUserName;
                    if (!nameValueCacheDict.TryGetValue(key, out value))
                    {
                        value = AdminManager.GetDisplayName(contentInfo.AddUserName, false);
                        nameValueCacheDict[key] = value;
                    }
                }
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.LastEditUserName))
            {
                if (!string.IsNullOrEmpty(contentInfo.LastEditUserName))
                {
                    var key = ContentAttribute.LastEditUserName + ":" + contentInfo.LastEditUserName;
                    if (!nameValueCacheDict.TryGetValue(key, out value))
                    {
                        value = AdminManager.GetDisplayName(contentInfo.LastEditUserName, false);
                        nameValueCacheDict[key] = value;
                    }
                }
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.CheckUserName))
            {
                var checkUserName = contentInfo.GetString(ContentAttribute.CheckUserName);
                if (!string.IsNullOrEmpty(checkUserName))
                {
                    var key = ContentAttribute.CheckUserName + ":" + checkUserName;
                    if (!nameValueCacheDict.TryGetValue(key, out value))
                    {
                        value = AdminManager.GetDisplayName(checkUserName, false);
                        nameValueCacheDict[key] = value;
                    }
                }
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.CheckCheckDate))
            {
                var checkDate = contentInfo.GetString(ContentAttribute.CheckCheckDate);
                if (!string.IsNullOrEmpty(checkDate))
                {
                    value = DateUtils.GetDateAndTimeString(TranslateUtils.ToDateTime(checkDate));
                }
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.CheckReasons))
            {
                value = contentInfo.GetString(ContentAttribute.CheckReasons);
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.AddDate))
            {
                value = DateUtils.GetDateAndTimeString(contentInfo.AddDate);
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.LastEditDate))
            {
                value = DateUtils.GetDateAndTimeString(contentInfo.LastEditDate);
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.SourceId))
            {
                value = SourceManager.GetSourceName(contentInfo.SourceId);
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.Tags))
            {
                value = contentInfo.Tags;
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.GroupNameCollection))
            {
                value = contentInfo.GroupNameCollection;
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.Hits))
            {
                value = contentInfo.Hits.ToString();
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.HitsByDay))
            {
                value = contentInfo.HitsByDay.ToString();
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.HitsByWeek))
            {
                value = contentInfo.HitsByWeek.ToString();
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.HitsByMonth))
            {
                value = contentInfo.HitsByMonth.ToString();
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.LastHitsDate))
            {
                value = DateUtils.GetDateAndTimeString(contentInfo.LastHitsDate);
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.IsTop) || StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.IsColor) || StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.IsHot) || StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.IsRecommend))
            {
                value = StringUtils.GetTrueImageHtml(contentInfo.GetString(styleInfo.AttributeName));
            }
            else
            {
                value = InputParserUtility.GetContentByTableStyle(contentInfo.GetString(styleInfo.AttributeName), siteInfo, styleInfo);
            }
            return(value);
        }
Beispiel #5
0
 protected override IServer CreateServer(bool passwordCheckSucceedIfNotFound = true)
 {
     PasswordManager = new PasswordManager
         {
             CheckSucceedIfNotFound = passwordCheckSucceedIfNotFound
         };
     BanManager = new BanManager(BanFilename);
     ClientManager = new ClientManager(10);
     AdminManager = new AdminManager(10);
     GameManager = new GameManager(10);
     return new Server(new Factory(), PasswordManager, BanManager, ClientManager, AdminManager, GameManager);
 }
Beispiel #6
0
        public List <int> GetChannelIdList(int siteId, string adminName)
        {
            var channelIdList = new List <int>();

            if (string.IsNullOrEmpty(adminName))
            {
                return(channelIdList);
            }

            if (AdminManager.HasChannelPermissionIsConsoleAdministrator(adminName) || AdminManager.HasChannelPermissionIsSystemAdministrator(adminName))//如果是超级管理员或站点管理员
            {
                channelIdList = DataProvider.ChannelDao.GetIdListBySiteId(siteId);
            }
            else
            {
                var         ps = new ProductAdministratorWithPermissions(adminName);
                ICollection channelIdCollection = ps.ChannelPermissionDict.Keys;
                foreach (int channelId in channelIdCollection)
                {
                    var allChannelIdList = DataProvider.ChannelDao.GetIdListForDescendant(channelId);
                    allChannelIdList.Insert(0, channelId);

                    foreach (var ownChannelId in allChannelIdList)
                    {
                        var nodeInfo = ChannelManager.GetChannelInfo(siteId, ownChannelId);
                        if (nodeInfo != null)
                        {
                            channelIdList.Add(nodeInfo.Id);
                        }
                    }
                }
            }
            return(channelIdList);
        }
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId", "channelId", "id", "ReturnUrl");

            _channelId = AuthRequest.GetQueryInt("channelId");
            if (_channelId < 0)
            {
                _channelId = -_channelId;
            }

            var channelInfo = ChannelManager.GetChannelInfo(SiteId, _channelId);

            _contentId = AuthRequest.GetQueryInt("id");
            _returnUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("returnUrl"));

            _contentInfo = ContentManager.GetContentInfo(SiteInfo, channelInfo, _contentId);

            if (IsPostBack)
            {
                return;
            }

            var styleInfoList = TableStyleManager.GetContentStyleInfoList(SiteInfo, channelInfo);

            RptContents.DataSource     = styleInfoList;
            RptContents.ItemDataBound += RptContents_ItemDataBound;
            RptContents.DataBind();

            LtlTitle.Text       = _contentInfo.Title;
            LtlChannelName.Text = channelInfo.ChannelName;

            LtlTags.Text = _contentInfo.Tags;
            if (string.IsNullOrEmpty(LtlTags.Text))
            {
                PhTags.Visible = false;
            }

            LtlContentGroup.Text = _contentInfo.GroupNameCollection;
            if (string.IsNullOrEmpty(LtlContentGroup.Text))
            {
                PhContentGroup.Visible = false;
            }

            LtlLastEditDate.Text     = DateUtils.GetDateAndTimeString(_contentInfo.LastEditDate);
            LtlAddUserName.Text      = AdminManager.GetDisplayName(_contentInfo.AddUserName, true);
            LtlLastEditUserName.Text = AdminManager.GetDisplayName(_contentInfo.LastEditUserName, true);

            LtlContentLevel.Text = CheckManager.GetCheckState(SiteInfo, _contentInfo);

            if (_contentInfo.ReferenceId > 0 && _contentInfo.GetString(ContentAttribute.TranslateContentType) != ETranslateContentType.ReferenceContent.ToString())
            {
                var referenceSiteId      = DataProvider.ChannelDao.GetSiteId(_contentInfo.SourceId);
                var referenceSiteInfo    = SiteManager.GetSiteInfo(referenceSiteId);
                var referenceContentInfo = ContentManager.GetContentInfo(referenceSiteInfo, _contentInfo.SourceId, _contentInfo.ReferenceId);

                if (referenceContentInfo != null)
                {
                    var pageUrl           = PageUtility.GetContentUrl(referenceSiteInfo, referenceContentInfo, true);
                    var referenceNodeInfo = ChannelManager.GetChannelInfo(referenceContentInfo.SiteId, referenceContentInfo.ChannelId);
                    var addEditUrl        =
                        WebUtils.GetContentAddEditUrl(referenceSiteInfo.Id,
                                                      referenceNodeInfo, _contentInfo.ReferenceId, AuthRequest.GetQueryString("ReturnUrl"));

                    LtlScripts.Text += $@"
<div class=""tips"">此内容为对内容 (站点:{referenceSiteInfo.SiteName},栏目:{referenceNodeInfo.ChannelName})“<a href=""{pageUrl}"" target=""_blank"">{_contentInfo.Title}</a>”(<a href=""{addEditUrl}"">编辑</a>) 的引用,内容链接将和原始内容链接一致</div>";
                }
            }
        }
Beispiel #8
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                if (string.IsNullOrEmpty(userName))
                {
                    var adminInfo = new AdministratorInfo
                    {
                        UserName            = tbUserName.Text.Trim(),
                        Password            = tbPassword.Text,
                        CreatorUserName     = Body.AdministratorName,
                        DisplayName         = tbDisplayName.Text,
                        Email               = tbEmail.Text,
                        Mobile              = tbMobile.Text,
                        DepartmentId        = TranslateUtils.ToInt(ddlDepartmentID.SelectedValue),
                        AreaId              = TranslateUtils.ToInt(ddlAreaID.SelectedValue),
                        PublishmentSystemId = Body.AdministratorInfo.PublishmentSystemId
                    };

                    if (!string.IsNullOrEmpty(BaiRongDataProvider.AdministratorDao.GetUserNameByEmail(tbEmail.Text)))
                    {
                        FailMessage("管理员添加失败,邮箱地址已存在");
                        return;
                    }

                    if (!string.IsNullOrEmpty(BaiRongDataProvider.AdministratorDao.GetUserNameByMobile(tbMobile.Text)))
                    {
                        FailMessage("管理员添加失败,手机号码已存在");
                        return;
                    }

                    string errorMessage;
                    if (!AdminManager.CreateAdministrator(adminInfo, out errorMessage))
                    {
                        FailMessage($"管理员添加失败:{errorMessage}");
                        return;
                    }

                    Body.AddAdminLog("添加管理员", $"管理员:{tbUserName.Text.Trim()}");
                    SuccessMessage("管理员添加成功!");
                    AddWaitAndRedirectScript(PageAdministrator.GetRedirectUrl(TranslateUtils.ToInt(ddlDepartmentID.SelectedValue)));
                }
                else
                {
                    var adminInfo = BaiRongDataProvider.AdministratorDao.GetByUserName(userName);

                    if (adminInfo.Email != tbEmail.Text && !string.IsNullOrEmpty(BaiRongDataProvider.AdministratorDao.GetUserNameByEmail(tbEmail.Text)))
                    {
                        FailMessage("管理员设置失败,邮箱地址已存在");
                        return;
                    }

                    if (adminInfo.Mobile != tbMobile.Text && !string.IsNullOrEmpty(BaiRongDataProvider.AdministratorDao.GetUserNameByMobile(adminInfo.Mobile)))
                    {
                        FailMessage("管理员设置失败,手机号码已存在");
                        return;
                    }

                    adminInfo.DisplayName  = tbDisplayName.Text;
                    adminInfo.Email        = tbEmail.Text;
                    adminInfo.Mobile       = tbMobile.Text;
                    adminInfo.DepartmentId = TranslateUtils.ToInt(ddlDepartmentID.SelectedValue);
                    adminInfo.AreaId       = TranslateUtils.ToInt(ddlAreaID.SelectedValue);

                    BaiRongDataProvider.AdministratorDao.Update(adminInfo);

                    Body.AddAdminLog("修改管理员属性", $"管理员:{tbUserName.Text.Trim()}");
                    SuccessMessage("管理员设置成功!");
                    AddWaitAndRedirectScript(PageAdministrator.GetRedirectUrl(TranslateUtils.ToInt(ddlDepartmentID.SelectedValue)));
                }
            }
        }
Beispiel #9
0
 public void setup()
 {
     _manager = new AdminManager(new AdminRepositoty(new EmartDBContext()));
 }
 public AdminController(UsersManager usersManager, AdminManager adminManager)
 {
     this._usersManager = usersManager;
     this._adminManager = adminManager;
 }
Beispiel #11
0
        public async Task <ActionResult> UploadAllMess()
        {
            //var str = Request.Cookies["userId"].Value;
            var str    = Session["userId"].ToString();
            var userid = Guid.Parse(str);

            string        _path         = Server.MapPath("~/App_Data/fileTemp/");//设定上传的文件路径
            DirectoryInfo directoryInfo = new DirectoryInfo(_path);

            if (!directoryInfo.Exists)
            {
                directoryInfo.Create();
            }

            //判断是否已经选择上传文件
            HttpPostedFileBase file      = Request.Files["excel"];
            string             filenName = file.FileName;
            string             filepath  = _path + filenName;

            file.SaveAs(filepath);//上传路径

            bool      hasTitle = true;
            string    fileType = filepath.Substring(filepath.LastIndexOf('.') + 1);
            DataTable table    = new DataTable();

            try
            {
                using (DataSet ds = new DataSet())
                {
                    string strCon = string.Format("Provider=Microsoft.{0}.0;Extended Properties=\"Excel {1}.0;HDR={2};IMEX=1;\";data source={3};", (fileType == ".xls" ? "Jet.OLEDB.4" : "ACE.OLEDB.12"), (fileType == ".xls" ? 8 : 12), (hasTitle ? "Yes" : "NO"), filepath);
                    string strCom = " SELECT * FROM [Sheet1$]";
                    using (OleDbConnection myConn = new OleDbConnection(strCon))
                        using (OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom, myConn))
                        {
                            myConn.Open();
                            myCommand.Fill(ds);
                        }
                    if (ds == null || ds.Tables.Count <= 0)
                    {
                        return(Content("<script language='javascript'>alert('导入失败!');history.go(-1);</script>"));
                    }
                    table = ds.Tables[0].Copy();
                }

                IAdminManager adminManager = new AdminManager();
                List <LogisticsSystem.DTO.StaffBsicInfoDto> messList = new List <LogisticsSystem.DTO.StaffBsicInfoDto>();
                foreach (DataRow row in table.Rows)
                {
                    //无记录时退出
                    if (string.IsNullOrEmpty(row[1].ToString()) || string.IsNullOrEmpty(row[2].ToString()) ||
                        string.IsNullOrEmpty(row[3].ToString()) || string.IsNullOrEmpty(row[4].ToString()) ||
                        string.IsNullOrEmpty(row[5].ToString()) || string.IsNullOrEmpty(row[7].ToString()))
                    {
                        break;
                    }

                    var staff = new LogisticsSystem.DTO.StaffBsicInfoDto();
                    staff.Name      = row[1].ToString();
                    staff.Tel       = row[2].ToString();
                    staff.Email     = row[3].ToString();
                    staff.Address   = row[4].ToString();
                    staff.IdCard    = row[5].ToString();
                    staff.ImagePath = "avatar-default.png";
                    staff.SectionId = await adminManager.GetSectionIdByName(row[6].ToString());

                    staff.Position = row[7].ToString();
                    messList.Add(staff);
                }

                var key = ConfigurationManager.AppSettings["EncryptAndDecryptPwdString"].ToString();
                await adminManager.AddGroupStaff(messList, userid, key, ConfigurationManager.AppSettings["originalRole"]);
            }
            catch (Exception)
            {
                return(Content("<script language='javascript'>alert('服务器错误,500!');history.go(-1);</script>"));
            }

            return(Content("<script language='javascript'>alert('导入成功!');history.go(-1);</script>"));
        }
Beispiel #12
0
        /// <summary>
        /// 登陆处理
        /// </summary>
        /// <param name="loginId">登陆账号</param>
        /// <param name="password">登录密码</param>
        /// <returns></returns>

        public ActionResult Login(string loginId, string password)
        {
            //1、获取数据

            string charge = Request.Form["identity"];

            //2、非空验证

            if (string.IsNullOrEmpty(loginId))
            {
                return(View("Login"));//返回login视图
            }
            if (string.IsNullOrEmpty("password"))
            {
                return(View("Login"));//返回login视图
            }
            //3、数据库验证,判定登陆是否成功
            if (charge == "教师")
            {
                TeacherManager tm      = new TeacherManager();
                Teacher        teacher = new Teacher();
                if (tm.TeacherLogIn(loginId, password, out teacher))
                {
                    //4、记住用户名和密码 cookie
                    string recordMe = Request.Form["RecordMe"];
                    if (!string.IsNullOrEmpty(recordMe))//记录用户名和密码
                    {
                        HttpCookie nameCookie = new HttpCookie("loginId", loginId);
                        nameCookie.Expires = DateTime.MaxValue;
                        Response.Cookies.Add(nameCookie);
                        HttpCookie passwordCookie = new HttpCookie("password", password);
                        nameCookie.Expires = DateTime.MaxValue;
                        Response.Cookies.Add(passwordCookie);
                    }
                    else
                    {
                        //让Cookie失效
                        Response.Cookies["loginId"].Expires  = DateTime.Now.AddDays(-1);
                        Response.Cookies["password"].Expires = DateTime.Now.AddDays(-1);
                    }
                    //5、保存用户的状态 sesion
                    teacher = new TeacherManager().GetTeacherById(loginId);
                    Session["CurrentUser"] = loginId;
                    Session["UserName"]    = teacher.TeacherName;
                    //登陆成功页面
                    return(Redirect("~/Teacher/Index"));
                }
                else
                {
                    //返回登陆页面

                    return(View("Login"));
                }
            }
            if (charge == "学生")
            {
                StuManager tm  = new StuManager();
                Stu        stu = new Stu();
                if (tm.StuLogIn(loginId, password, out stu))
                {
                    //4、记住用户名和密码 cookie
                    string recordMe = Request.Form["RecordMe"];
                    if (!string.IsNullOrEmpty(recordMe))//记录用户名和密码
                    {
                        HttpCookie nameCookie = new HttpCookie("loginId", loginId);
                        nameCookie.Expires = DateTime.MaxValue;
                        Response.Cookies.Add(nameCookie);
                        HttpCookie passwordCookie = new HttpCookie("password", password);
                        nameCookie.Expires = DateTime.MaxValue;
                        Response.Cookies.Add(passwordCookie);
                    }
                    else
                    {
                        //让Cookie失效
                        Response.Cookies["loginId"].Expires  = DateTime.Now.AddDays(-1);
                        Response.Cookies["password"].Expires = DateTime.Now.AddDays(-1);
                    }
                    //5、保存用户的状态 sesion

                    stu = new StuManager().GetStuById(loginId);
                    Session["CurrentUser"] = loginId;
                    Session["UserName"]    = stu.StuName;

                    //登陆成功页面
                    return(Redirect("~/Stu/Index"));
                }
                else
                {
                    //返回登陆页面
                    return(View("Login"));
                }
            }
            if (charge == "管理员")
            {
                AdminManager tm    = new AdminManager();
                Admin        admin = new Admin();
                if (tm.AdminLogIn(loginId, password, out admin))
                {
                    //4、记住用户名和密码 cookie
                    string recordMe = Request.Form["RecordMe"];
                    if (!string.IsNullOrEmpty(recordMe))//记录用户名和密码
                    {
                        HttpCookie nameCookie = new HttpCookie("loginId", loginId);
                        nameCookie.Expires = DateTime.MaxValue;
                        Response.Cookies.Add(nameCookie);
                        HttpCookie passwordCookie = new HttpCookie("password", password);
                        nameCookie.Expires = DateTime.MaxValue;
                        Response.Cookies.Add(passwordCookie);
                    }
                    else
                    {
                        //让Cookie失效
                        Response.Cookies["loginId"].Expires  = DateTime.Now.AddDays(-1);
                        Response.Cookies["password"].Expires = DateTime.Now.AddDays(-1);
                    }
                    //5、保存用户的状态 sesion


                    Session["CurrentUser"] = loginId;
                    Session["UserName"]    = loginId;

                    //登陆成功页面
                    return(Redirect("~/Admin/Index"));
                }
                else
                {
                    //返回登陆页面
                    return(View("Login"));
                }
            }
            else
            {
                //返回登陆页面
                return(View("Login"));
            }
        }
Beispiel #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //set menu count values
            PatientLookupManager        patientLookup             = new PatientLookupManager();
            PatientFamilyTestingManager patientFamilyTesting      = new PatientFamilyTestingManager();
            PatientAppointmentManager   patientAppointmentManager = new PatientAppointmentManager();

            lblPatientCount.Text      = patientLookup.GetTotalpatientCount().ToString();
            lblFamilyTesting.Text     = patientFamilyTesting.GetPatientFamilyCount(PatientId).ToString();
            lblAppointments.Text      = patientAppointmentManager.GetCountByPatientId(PatientId).ToString();
            patientLookup             = null;
            patientFamilyTesting      = null;
            patientAppointmentManager = null;
            //check session coming from stopped encounter
            if (Request.QueryString["reset"] != null)
            {
                Response.Clear();
                Session["PatientPK"] = 0;
            }
            //Create New sessions:
            Page.Header.DataBind();
            if (Session["AppLocation"] == null)
            {
                IQCareMsgBox.Show("SessionExpired", this);
                Response.Redirect("~/frmLogOff.aspx");
            }
            if (Session.Count == 0)
            {
                IQCareMsgBox.Show("SessionExpired", this);
                Response.Redirect("~/frmLogOff.aspx");
            }
            if ((Session["AppUserID"] == null && Session["AppUserID"].ToString() == "") || CurrentSession.Current == null)
            {
                IQCareMsgBox.Show("SessionExpired", this);
                Response.Redirect("~/frmLogOff.aspx");
            }
            lblTitle.Text = "International Quality Care Patient Management and Monitoring System [" + Session["AppLocation"].ToString() + "]";
            string url = Request.RawUrl.ToString();

            Application["PrvFrm"] = url;
            //string pageName = this.Page.ToString();
            System.IO.FileInfo fileinfo = new System.IO.FileInfo(Request.Url.AbsolutePath);
            string             pageName = fileinfo.Name;

            if (Session["PatientId"] != null)
            {
                if (int.Parse(Session["PatientId"].ToString()) > 0)
                {
                    //VY added 2014-10-14 for changing level one navigation Menu depending on whether patient has been selected or not
                    if (Session["TechnicalAreaId"] != null)
                    {
                        MenuItem facilityHome = (navUserControl.FindControl("mainMenu") as Menu).FindItem("Facility Home");
                        facilityHome.Text        = "<i class='fa fa-search-plus fa-1x text-muted' aria-hidden='true'></i> <span class='fa-1x text-muted'><strong> Find/Add Patient</strong></span>";
                        facilityHome.NavigateUrl = String.Format("~/Patient/FindAdd.aspx?srvNm={0}&mod={1}", Session["TechnicalAreaName"], Session["TechnicalAreaId"]);
                        MenuItem facilityStats = (navUserControl.FindControl("mainMenu") as Menu).FindItem("Facility Statistics");
                        facilityStats.Text        = "<i class='fa fa-cubes fa-1x text-muted' aria-hidden='true'></i> <span class='fa-1x text-muted'><strong>Select Service</strong></span>";
                        facilityStats.NavigateUrl = "~/frmFacilityHome.aspx";
                    }

                    if (pageName.Equals("frmPatient_Home.aspx") ||
                        pageName.ToLower().Equals("frmscheduler_appointmentnewhistory.aspx")

                        )
                    {
                        // level2Navigation.Style.Add("display", "inline");
                        // levelTwoNavigationUserControl1.CanExecute = true;
                    }
                }
                else
                {
                    //VY added 2014-10-14 for changing level one navigation Menu depending on whether patient has been selected or not
                    MenuItem facilityHome = (navUserControl.FindControl("mainMenu") as Menu).FindItem("Facility Home");
                    facilityHome.Text        = "<i class='fa fa-cubes fa-1x text-muted' aria-hidden='true'></i> <span class='fa-1x text-muted'><strong>Select Service</strong></span>";
                    facilityHome.NavigateUrl = "~/frmFacilityHome.aspx";
                    MenuItem facilityStats = (navUserControl.FindControl("mainMenu") as Menu).FindItem("Facility Statistics");
                    facilityStats.Text        = "<i class='fa fa-line-chart fa-1x text-muted' aria-hidden='true'></i> <span class='fa-1x text-muted'><strong>Facility Statistics</strong></span>";
                    facilityStats.NavigateUrl = "~/Statistics/Facility.aspx";
                }
            }
            else
            {
                // level2Navigation.Style.Add("display", "none");
                // levelTwoNavigationUserControl1.CanExecute = false;
            }

            if (Session["AppUserName"] != null)
            {
                lblUserName.Text = Session["AppUserName"].ToString();
            }
            if (Session["AppLocation"] != null)
            {
                lblLocation.Text = Session["AppLocation"].ToString();
            }
            IIQCareSystem AdminManager;

            AdminManager = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security");

            if (Session["AppDateFormat"].ToString() != "")
            {
                lblDate.Text = AdminManager.SystemDate().ToString(Session["AppDateFormat"].ToString());
            }
            else
            {
                lblDate.Text = AdminManager.SystemDate().ToString("dd-MMM-yyyy");
            }


            lblversion.Text = GblIQCare.VersionName; // AuthenticationManager.AppVersion;
            lblrelDate.Text = GblIQCare.ReleaseDate; //AuthenticationManager.ReleaseDate;
        }
        public IHttpActionResult GetConfig()
        {
            try
            {
                var request = new AuthenticatedRequest();
                if (!request.IsAdminLoggin ||
                    !request.AdminPermissionsImpl.HasSystemPermissions(ConfigManager.AppPermissions.SettingsAdmin))
                {
                    return(Unauthorized());
                }

                var roles = new List <KeyValuePair <string, string> >();

                var roleNameList = request.AdminPermissionsImpl.IsConsoleAdministrator ? DataProvider.RoleDao.GetRoleNameList() : DataProvider.RoleDao.GetRoleNameListByCreatorUserName(request.AdminName);

                var predefinedRoles = EPredefinedRoleUtils.GetAllPredefinedRoleName();
                foreach (var predefinedRole in predefinedRoles)
                {
                    roles.Add(new KeyValuePair <string, string>(predefinedRole, EPredefinedRoleUtils.GetText(EPredefinedRoleUtils.GetEnumType(predefinedRole))));
                }
                foreach (var roleName in roleNameList)
                {
                    if (!predefinedRoles.Contains(roleName))
                    {
                        roles.Add(new KeyValuePair <string, string>(roleName, roleName));
                    }
                }

                var role             = request.GetQueryString("role");
                var order            = request.GetQueryString("order");
                var lastActivityDate = request.GetQueryInt("lastActivityDate");
                var keyword          = request.GetQueryString("keyword");
                var offset           = request.GetQueryInt("offset");
                var limit            = request.GetQueryInt("limit");

                var isSuperAdmin    = request.AdminPermissions.IsSuperAdmin();
                var creatorUserName = isSuperAdmin ? string.Empty : request.AdminName;
                var count           = DataProvider.AdministratorDao.GetCount(creatorUserName, role, order, lastActivityDate,
                                                                             keyword);
                var administratorInfoList = DataProvider.AdministratorDao.GetAdministrators(creatorUserName, role, order, lastActivityDate, keyword, offset, limit);
                var administrators        = new List <object>();
                foreach (var administratorInfo in administratorInfoList)
                {
                    administrators.Add(new
                    {
                        administratorInfo.Id,
                        administratorInfo.AvatarUrl,
                        administratorInfo.UserName,
                        DisplayName = string.IsNullOrEmpty(administratorInfo.DisplayName)
                            ? administratorInfo.UserName
                            : administratorInfo.DisplayName,
                        administratorInfo.Mobile,
                        administratorInfo.LastActivityDate,
                        administratorInfo.CountOfLogin,
                        administratorInfo.Locked,
                        Roles = AdminManager.GetRoles(administratorInfo.UserName)
                    });
                }

                return(Ok(new
                {
                    Value = administrators,
                    Count = count,
                    Roles = roles,
                    IsSuperAdmin = request.AdminPermissions.IsSuperAdmin(),
                    request.AdminId
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Beispiel #15
0
        private static string GetColumnValue(Hashtable valueHashtable, ETableStyle tableStyle, PublishmentSystemInfo publishmentSystemInfo, ContentInfo contentInfo, TableStyleInfo styleInfo)
        {
            var value = string.Empty;

            if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.AddUserName))
            {
                if (!string.IsNullOrEmpty(contentInfo.AddUserName))
                {
                    var key = ContentAttribute.AddUserName + ":" + contentInfo.AddUserName;
                    value = valueHashtable[key] as string;
                    if (value == null)
                    {
                        value =
                            $@"<a rel=""popover"" class=""popover-hover"" data-content=""{AdminManager.GetFullName(
                                contentInfo.AddUserName)}"" data-original-title=""管理员"">{AdminManager.GetDisplayName(
                                contentInfo.AddUserName, false)}</a>";
                        valueHashtable[key] = value;
                    }
                }
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.LastEditUserName))
            {
                if (!string.IsNullOrEmpty(contentInfo.LastEditUserName))
                {
                    var key = ContentAttribute.LastEditUserName + ":" + contentInfo.LastEditUserName;
                    value = valueHashtable[key] as string;
                    if (value == null)
                    {
                        value =
                            $@"<a rel=""popover"" class=""popover-hover"" data-content=""{AdminManager.GetFullName(
                                contentInfo.LastEditUserName)}"" data-original-title=""管理员"">{AdminManager.GetDisplayName(
                                contentInfo.LastEditUserName, false)}</a>";
                        valueHashtable[key] = value;
                    }
                }
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.CheckUserName))
            {
                var checkUserName = contentInfo.GetExtendedAttribute(ContentAttribute.CheckUserName);
                if (!string.IsNullOrEmpty(checkUserName))
                {
                    var key = ContentAttribute.CheckUserName + ":" + checkUserName;
                    value = valueHashtable[key] as string;
                    if (value == null)
                    {
                        value =
                            $@"<a rel=""popover"" class=""popover-hover"" data-content=""{AdminManager.GetFullName(
                                checkUserName)}"" data-original-title=""管理员"">{AdminManager.GetDisplayName(checkUserName,
                                false)}</a>";

                        valueHashtable[key] = value;
                    }
                }
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.CheckCheckDate))
            {
                var checkDate = contentInfo.GetExtendedAttribute(ContentAttribute.CheckCheckDate);
                if (!string.IsNullOrEmpty(checkDate))
                {
                    value = DateUtils.GetDateAndTimeString(TranslateUtils.ToDateTime(checkDate));
                }
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.CheckReasons))
            {
                value = contentInfo.GetExtendedAttribute(ContentAttribute.CheckReasons);
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.AddDate))
            {
                value = DateUtils.GetDateString(contentInfo.AddDate);
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.LastEditDate))
            {
                value = DateUtils.GetDateString(contentInfo.LastEditDate);
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.SourceId))
            {
                value = SourceManager.GetSourceName(contentInfo.SourceId);
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.Tags))
            {
                value = contentInfo.Tags;
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.ContentGroupNameCollection))
            {
                value = contentInfo.ContentGroupNameCollection;
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.Hits))
            {
                value = contentInfo.Hits.ToString();
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.HitsByDay))
            {
                value = contentInfo.HitsByDay.ToString();
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.HitsByWeek))
            {
                value = contentInfo.HitsByWeek.ToString();
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.HitsByMonth))
            {
                value = contentInfo.HitsByMonth.ToString();
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.LastHitsDate))
            {
                value = DateUtils.GetDateAndTimeString(contentInfo.LastHitsDate);
            }
            else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, ContentAttribute.IsTop))
            {
                value = StringUtils.GetTrueImageHtml(contentInfo.IsTop);
            }
            else
            {
                var isSettting = false;
                if (tableStyle == ETableStyle.BackgroundContent)
                {
                    isSettting = true;
                    if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, BackgroundContentAttribute.Star))
                    {
                        var showPopWinString = ModalContentStarSet.GetOpenWindowString(publishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, contentInfo.Id);
                        value =
                            $@"<a href=""javascript:;"" onclick=""{showPopWinString}"" title=""点击设置评分"">{StarsManager
                                .GetStarString(publishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, contentInfo.Id)}</a>";
                    }
                    else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, BackgroundContentAttribute.Digg))
                    {
                        var    showPopWinString = ModalContentDiggSet.GetOpenWindowString(publishmentSystemInfo.PublishmentSystemId, contentInfo.NodeId, contentInfo.Id);
                        var    nums             = BaiRongDataProvider.DiggDao.GetCount(publishmentSystemInfo.PublishmentSystemId, contentInfo.Id);
                        string display          = $"赞同:{nums[0]} 不赞同:{nums[1]}";
                        value =
                            $@"<a href=""javascript:;"" onclick=""{showPopWinString}"" title=""点击设置Digg数"">{display}</a>";
                    }
                    else if (StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, BackgroundContentAttribute.IsColor) || StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, BackgroundContentAttribute.IsHot) || StringUtils.EqualsIgnoreCase(styleInfo.AttributeName, BackgroundContentAttribute.IsRecommend))
                    {
                        value = StringUtils.GetTrueImageHtml(contentInfo.GetExtendedAttribute(styleInfo.AttributeName));
                    }
                    else
                    {
                        isSettting = false;
                    }
                }

                if (!isSettting)
                {
                    value = InputParserUtility.GetContentByTableStyle(contentInfo.GetExtendedAttribute(styleInfo.AttributeName), publishmentSystemInfo, tableStyle, styleInfo);
                }
            }
            return(value);
        }
Beispiel #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "")
        {
            //IQCareMsgBox.Show("SessionExpired", this);
            //Response.Redirect(strUrl +"/IQCare/frmLogOff.aspx");
            Response.Redirect("~/frmlogin.aspx", true);
        }

        if (!object.Equals(Session["PatientId"], null))
        {
            if (!String.IsNullOrEmpty(Session["PatientId"].ToString()))
            {
                UserControlKNH_Extruder1.Visible = Convert.ToBoolean(Convert.ToUInt32(Session["PatientId"]) != 0);
            }
        }

        if (Request.Url.AbsolutePath.Contains("AdminForms/frmAdmin_ChangePassword.aspx") || Request.Url.AbsolutePath.Contains("AdminForms/frmAdmin_AuditTrail.aspx") ||
            Request.Url.AbsolutePath.Contains("AdminForms/frmConfig_Customfields.aspx"))
        {
            UserControlKNH_Extruder1.Visible = false;
        }

        Page.Header.DataBind();
        lblTitle.Text = "International Quality Care Patient Management and Monitoring System [" + Session["AppLocation"].ToString() + "]";
        string url = Request.RawUrl.ToString();

        Application["PrvFrm"] = url;
        //string pageName = this.Page.ToString();
        System.IO.FileInfo fileinfo = new System.IO.FileInfo(Request.Url.AbsolutePath);
        string             pageName = fileinfo.Name;

        if (Session["PatientID"] != null)
        {
            if (int.Parse(Session["PatientID"].ToString()) > 0)
            {
                //VY added 2014-10-14 for changing level one navigation Menu depending on whether patient has been selected or not
                if (Session["TechnicalAreaId"] != null)
                {
                    MenuItem facilityHome = (levelOneNavigationUserControl1.FindControl("mainMenu") as Menu).FindItem("Facility Home");
                    //facilityHome.Text = "Find/Add Patient";
                    //facilityHome.NavigateUrl = String.Format("~/frmFindAddCustom.aspx?srvNm={0}&mod={1}", Session["TechnicalAreaName"], Session["TechnicalAreaId"]);
                    MenuItem facilityStats = (levelOneNavigationUserControl1.FindControl("mainMenu") as Menu).FindItem("Facility Statistics");
                    //facilityStats.Text = "Select Service";
                    //facilityStats.NavigateUrl = "~/frmFacilityHome.aspx";
                }
                if (pageName.Equals("frmFamilyInformation.aspx"))
                {
                    (levelTwoNavigationUserControl1.FindControl("PanelPatiInfo") as Panel).Visible = false;
                }

                if (pageName.Equals("frmPatient_Home.aspx"))
                {
                    //facilityBanner.Style.Add("display", "none");
                    //patientBanner.Style.Add("display", "inline");
                    //username1.Attributes["class"] = "usernameLevel1"; //Style.Add("display", "inline");
                    //currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
                    //facilityName.Attributes["class"] = "facilityLevel1"; //Style.Add("display", "inline");
                    //userNameLevel2.Style.Add("display", "none");
                    //currentDateLevel2.Style.Add("display", "none");
                    //imageFlipLevel2.Style.Add("display", "none");
                    //facilityLevel2.Style.Add("display", "none");
                    level2Navigation.Style.Add("display", "inline");
                }
                else if (pageName.Equals("frmAddTechnicalArea.aspx"))
                {
                    //facilityBanner.Style.Add("display", "inline");
                    //patientBanner.Style.Add("display", "none");
                    //username1.Attributes["class"] = "usernameLevel1"; //Style.Add("display", "inline");
                    //currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
                    //facilityName.Attributes["class"] = "facilityLevel1"; //Style.Add("display", "inline");
                    ////userNameLevel2.Style.Add("display", "none");
                    ////currentDateLevel2.Style.Add("display", "none");
                    //imageFlipLevel2.Style.Add("display", "none");
                    //facilityLevel2.Style.Add("display", "none");
                    level2Navigation.Style.Add("display", "none");
                }
                else if (pageName.Equals("frmAdmin_DeletePatient.aspx"))
                {
                    //facilityBanner.Style.Add("display", "inline");
                    //patientBanner.Style.Add("display", "none");
                    //username1.Attributes["class"] = "usernameLevel1"; //Style.Add("display", "inline");
                    //currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
                    //facilityName.Attributes["class"] = "facilityLevel1"; //Style.Add("display", "inline");
                    //userNameLevel2.Style.Add("display", "none");
                    //currentDateLevel2.Style.Add("display", "none");
                    //imageFlipLevel2.Style.Add("display", "none");
                    //facilityLevel2.Style.Add("display", "none");
                    level2Navigation.Style.Add("display", "none");
                }
                else if (pageName.Equals("frmPatientCustomRegistration.aspx"))
                {
                    //facilityBanner.Style.Add("display", "none");
                    //patientBanner.Style.Add("display", "inline");
                    //username1.Attributes["class"] = "usernameLevel1"; //Style.Add("display", "inline");
                    //currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
                    //facilityName.Attributes["class"] = "facilityLevel1"; //Style.Add("display", "inline");
                    ////userNameLevel2.Style.Add("display", "none");
                    ////currentDateLevel2.Style.Add("display", "none");
                    //imageFlipLevel2.Style.Add("display", "none");
                    //facilityLevel2.Style.Add("display", "none");
                    level2Navigation.Style.Add("display", "none");
                }
                else
                {
                    //facilityBanner.Style.Add("display", "none");
                    //patientBanner.Style.Add("display", "none");
                    //usernameLevel1.Style.Add("display", "none");
                    //currentdateLevel1.Style.Add("display", "none");
                    //facilityLevel1.Style.Add("display", "none");
                    //username1.Attributes["class"] = "userNameLevel2"; //userNameLevel2.Style.Add("display", "inline");
                    //currentdate1.Attributes["class"] = "currentDateLevel2"; //currentDateLevel2.Style.Add("display", "inline");
                    //imageFlipLevel2.Style.Add("display", "inline");
                    //facilityName.Attributes["class"] = "facilityLevel2"; //facilityLevel2.Style.Add("display", "inline");
                    level2Navigation.Style.Add("display", "inline");
                    level2Navigation.Attributes["class"] = "";
                }
            }
            else
            {
                if (Session["TechnicalAreaId"] == null || Session["TechnicalAreaId"].ToString() != "206" || pageName.Equals("frmFacilityHome.aspx"))
                {
                    //facilityBanner.Style.Add("display", "inline");
                    //patientBanner.Style.Add("display", "none");
                    //username1.Attributes["class"] = "usernameLevel1"; //Style.Add("display", "inline");
                    //currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
                    //facilityName.Attributes["class"] = "facilityLevel1"; //Style.Add("display", "inline");
                    //userNameLevel2.Style.Add("display", "none");
                    //currentDateLevel2.Style.Add("display", "none");
                    //imageFlipLevel2.Style.Add("display", "none");
                    //facilityLevel2.Style.Add("display", "none");
                    level2Navigation.Style.Add("display", "none");
                    //VY added 2014-10-14 for changing level one navigation Menu depending on whether patient has been selected or not
                    MenuItem facilityHome = (levelOneNavigationUserControl1.FindControl("mainMenu") as Menu).FindItem("Facility Home");
                    //facilityHome.Text = "Select Service";
                    //facilityHome.NavigateUrl = "~/frmFacilityHome.aspx";
                    MenuItem facilityStats = (levelOneNavigationUserControl1.FindControl("mainMenu") as Menu).FindItem("Facility Statistics");
                    //facilityStats.Text = "Facility Statistics";
                    //facilityStats.NavigateUrl = "~/frmFacilityStatistics.aspx";
                }
            }
        }
        else
        {
            //facilityBanner.Style.Add("display", "inline");
            //patientBanner.Style.Add("display", "none");
            //username1.Attributes["class"] = "usernameLevel1"; //Style.Add("display", "inline");
            //currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
            //facilityName.Attributes["class"] = "facilityLevel1"; //Style.Add("display", "inline");
            ////userNameLevel2.Style.Add("display", "none");
            ////currentDateLevel2.Style.Add("display", "none");
            //imageFlipLevel2.Style.Add("display", "none");
            //facilityLevel2.Style.Add("display", "none");
            level2Navigation.Style.Add("display", "none");
        }

        if (Session["AppUserName"] != null)
        {
            lblUserName.Text = Session["AppUserName"].ToString();
        }
        if (Session["AppLocation"] != null)
        {
            lblLocation.Text = Session["AppLocation"].ToString();
        }
        IIQCareSystem AdminManager;

        AdminManager = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security");

        if (Session["AppDateFormat"] != "")
        {
            lblDate.Text = AdminManager.SystemDate().ToString(Session["AppDateFormat"].ToString());
        }
        else
        {
            lblDate.Text = AdminManager.SystemDate().ToString("dd-MMM-yyyy");
        }

        lblversion.Text = AuthenticationManager.AppVersion;
        lblrelDate.Text = AuthenticationManager.ReleaseDate;
    }
Beispiel #17
0
        public IHttpActionResult Submit()
        {
            try
            {
                var request = new AuthenticatedRequest();
                var userId  = request.GetQueryInt("userId");
                if (!request.IsAdminLoggin)
                {
                    return(Unauthorized());
                }
                if (request.AdminId != userId &&
                    !request.AdminPermissionsImpl.HasSystemPermissions(ConfigManager.AppPermissions.SettingsAdmin))
                {
                    return(Unauthorized());
                }

                AdministratorInfo adminInfo;
                if (userId > 0)
                {
                    adminInfo = AdminManager.GetAdminInfoByUserId(userId);
                    if (adminInfo == null)
                    {
                        return(NotFound());
                    }
                }
                else
                {
                    adminInfo = new AdministratorInfo();
                }

                var userName    = request.GetPostString("userName");
                var password    = request.GetPostString("password");
                var displayName = request.GetPostString("displayName");
                var avatarUrl   = request.GetPostString("avatarUrl");
                var mobile      = request.GetPostString("mobile");
                var email       = request.GetPostString("email");

                if (adminInfo.Id == 0)
                {
                    adminInfo.UserName        = userName;
                    adminInfo.Password        = password;
                    adminInfo.CreatorUserName = request.AdminName;
                    adminInfo.CreationDate    = DateTime.Now;
                }
                else
                {
                    if (adminInfo.Mobile != mobile && !string.IsNullOrEmpty(mobile) && DataProvider.AdministratorDao.IsMobileExists(mobile))
                    {
                        return(BadRequest("资料修改失败,手机号码已存在"));
                    }

                    if (adminInfo.Email != email && !string.IsNullOrEmpty(email) && DataProvider.AdministratorDao.IsEmailExists(email))
                    {
                        return(BadRequest("资料修改失败,邮箱地址已存在"));
                    }
                }

                adminInfo.DisplayName = displayName;
                adminInfo.AvatarUrl   = avatarUrl;
                adminInfo.Mobile      = mobile;
                adminInfo.Email       = email;

                if (adminInfo.Id == 0)
                {
                    if (!DataProvider.AdministratorDao.Insert(adminInfo, out var errorMessage))
                    {
                        return(BadRequest($"管理员添加失败:{errorMessage}"));
                    }
                    request.AddAdminLog("添加管理员", $"管理员:{adminInfo.UserName}");
                }
                else
                {
                    DataProvider.AdministratorDao.Update(adminInfo);
                    request.AddAdminLog("修改管理员属性", $"管理员:{adminInfo.UserName}");
                }

                return(Ok(new
                {
                    Value = true
                }));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
Beispiel #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!object.Equals(Session["PatientId"], null))
        {
            UserControlKNH_Extruder1.Visible = !Convert.ToBoolean(Convert.ToInt32(Session["PatientId"]) <= 0);
        }

        Page.Header.DataBind();
        if (Session["AppLocation"] == null)
        {
            IQCareMsgBox.Show("SessionExpired", this);
            Response.Redirect(strUrl + "/IQCare/frmLogOff.aspx");
        }


        lblTitle.Text = "International Quality Care Patient Management and Monitoring System [" + Session["AppLocation"].ToString() + "]";
        string url = Request.RawUrl.ToString();

        Application["PrvFrm"] = url;
        //string pageName = this.Page.ToString();
        System.IO.FileInfo fileinfo = new System.IO.FileInfo(Request.Url.AbsolutePath);
        string             pageName = fileinfo.Name;

        if (Session["PatientID"] != null)
        {
            if (Convert.ToInt32(Session["PatientId"]) > 0)
            {
                IKNHMEI KNHMEIManager;
                KNHMEIManager = (IKNHMEI)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BKNHMEI, BusinessProcess.Clinical");
                DataSet theDS = KNHMEIManager.GetTBStatus(Convert.ToInt32(Session["PatientId"]));

                string tbstatus = "";
                if (theDS.Tables[0].Rows.Count > 0)
                {
                    tbstatus = theDS.Tables[0].Rows[0]["TBFindings"].ToString();

                    if (tbstatus == "577")
                    {
                        lblTbStatus.Text  = "Suspected TB";
                        hdnTbStatus.Value = "Suspected TB";
                    }
                    else if (tbstatus == "578")
                    {
                        lblTbStatus.Text  = "TB Confirmed";
                        hdnTbStatus.Value = "TB Confirmed";
                    }
                    else if (tbstatus == "579")
                    {
                        lblTbStatus.Text  = "On Treatment";
                        hdnTbStatus.Value = "On Treatment";
                    }
                    else
                    {
                        lblTbStatus.Text = "No Status Found";
                    }
                }
            }

            if (int.Parse(Session["PatientID"].ToString()) > 0)
            {
                if (pageName.Equals("frmFamilyInformation.aspx"))
                {
                    (levelTwoNavigationUserControl1.FindControl("PanelPatiInfo") as Panel).Visible = false;
                }

                if (pageName.Equals("frmPatient_Home.aspx"))
                {
                    facilityBanner.Style.Add("display", "none");
                    patientBanner.Style.Add("display", "inline");
                    username1.Attributes["class"]    = "usernameLevel1";    //Style.Add("display", "inline");
                    currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
                    facilityName.Attributes["class"] = "facilityLevel1";    //Style.Add("display", "inline");
                    //userNameLevel2.Style.Add("display", "none");
                    //currentDateLevel2.Style.Add("display", "none");
                    imageFlipLevel2.Style.Add("display", "none");
                    //facilityLevel2.Style.Add("display", "none");
                    level2Navigation.Style.Add("display", "inline");
                }
                else if (pageName.Equals("frmAddTechnicalArea.aspx"))
                {
                    facilityBanner.Style.Add("display", "inline");
                    patientBanner.Style.Add("display", "none");
                    username1.Attributes["class"]    = "usernameLevel1";    //Style.Add("display", "inline");
                    currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
                    facilityName.Attributes["class"] = "facilityLevel1";    //Style.Add("display", "inline");
                    //userNameLevel2.Style.Add("display", "none");
                    //currentDateLevel2.Style.Add("display", "none");
                    imageFlipLevel2.Style.Add("display", "none");
                    //facilityLevel2.Style.Add("display", "none");
                    level2Navigation.Style.Add("display", "none");
                }
                else if (pageName.Equals("frmAdmin_DeletePatient.aspx"))
                {
                    facilityBanner.Style.Add("display", "inline");
                    patientBanner.Style.Add("display", "none");
                    username1.Attributes["class"]    = "usernameLevel1";    //Style.Add("display", "inline");
                    currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
                    facilityName.Attributes["class"] = "facilityLevel1";    //Style.Add("display", "inline");
                    //userNameLevel2.Style.Add("display", "none");
                    //currentDateLevel2.Style.Add("display", "none");
                    imageFlipLevel2.Style.Add("display", "none");
                    //facilityLevel2.Style.Add("display", "none");
                    level2Navigation.Style.Add("display", "none");
                }
                else if (pageName.Equals("frmPatientCustomRegistration.aspx"))
                {
                    facilityBanner.Style.Add("display", "none");
                    patientBanner.Style.Add("display", "inline");
                    username1.Attributes["class"]    = "usernameLevel1";    //Style.Add("display", "inline");
                    currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
                    facilityName.Attributes["class"] = "facilityLevel1";    //Style.Add("display", "inline");
                    //userNameLevel2.Style.Add("display", "none");
                    //currentDateLevel2.Style.Add("display", "none");
                    imageFlipLevel2.Style.Add("display", "none");
                    //facilityLevel2.Style.Add("display", "none");
                    level2Navigation.Style.Add("display", "none");
                }
                else
                {
                    facilityBanner.Style.Add("display", "none");
                    patientBanner.Style.Add("display", "none");
                    //usernameLevel1.Style.Add("display", "none");
                    //currentdateLevel1.Style.Add("display", "none");
                    //facilityLevel1.Style.Add("display", "none");
                    username1.Attributes["class"]    = "userNameLevel2";    //userNameLevel2.Style.Add("display", "inline");
                    currentdate1.Attributes["class"] = "currentDateLevel2"; //currentDateLevel2.Style.Add("display", "inline");
                    imageFlipLevel2.Style.Add("display", "inline");
                    facilityName.Attributes["class"] = "facilityLevel2";    //facilityLevel2.Style.Add("display", "inline");
                    level2Navigation.Style.Add("display", "inline");
                    level2Navigation.Attributes["class"] = "";
                }
            }
            else
            {
                facilityBanner.Style.Add("display", "inline");
                patientBanner.Style.Add("display", "none");
                username1.Attributes["class"]    = "usernameLevel1";    //Style.Add("display", "inline");
                currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
                facilityName.Attributes["class"] = "facilityLevel1";    //Style.Add("display", "inline");
                //userNameLevel2.Style.Add("display", "none");
                //currentDateLevel2.Style.Add("display", "none");
                imageFlipLevel2.Style.Add("display", "none");
                //facilityLevel2.Style.Add("display", "none");
                level2Navigation.Style.Add("display", "none");
            }
        }
        else
        {
            facilityBanner.Style.Add("display", "inline");
            patientBanner.Style.Add("display", "none");
            username1.Attributes["class"]    = "usernameLevel1";    //Style.Add("display", "inline");
            currentdate1.Attributes["class"] = "currentdateLevel1"; //Style.Add("display", "inline");
            facilityName.Attributes["class"] = "facilityLevel1";    //Style.Add("display", "inline");
            //userNameLevel2.Style.Add("display", "none");
            //currentDateLevel2.Style.Add("display", "none");
            imageFlipLevel2.Style.Add("display", "none");
            //facilityLevel2.Style.Add("display", "none");
            level2Navigation.Style.Add("display", "none");
        }

        if (Session["AppUserName"] != null)
        {
            lblUserName.Text = Session["AppUserName"].ToString();
        }
        if (Session["AppLocation"] != null)
        {
            lblLocation.Text = Session["AppLocation"].ToString();
        }
        IIQCareSystem AdminManager;

        AdminManager = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security");

        if (Session["AppDateFormat"] != "")
        {
            lblDate.Text = AdminManager.SystemDate().ToString(Session["AppDateFormat"].ToString());
        }
        else
        {
            lblDate.Text = AdminManager.SystemDate().ToString("dd-MMM-yyyy");
        }
        if (Session.Count == 0)
        {
            IQCareMsgBox.Show("SessionExpired", this);
            Response.Redirect("frmLogOff.aspx");
        }
        if (Session["AppUserID"].ToString() == "")
        {
            IQCareMsgBox.Show("SessionExpired", this);
            Response.Redirect("../frmLogOff.aspx");
        }

        lblversion.Text = AuthenticationManager.AppVersion;
        lblrelDate.Text = AuthenticationManager.ReleaseDate;
    }
Beispiel #19
0
 public ActionResult ZamowieniaWszystkie()
 {
     return(View(AdminManager.GetAllOrders()));
 }
Beispiel #20
0
    private void Init_Menu()
    {
        IPatientHome PatientHome = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
        int          ModuleId    = Convert.ToInt32(Session["TechnicalAreaId"]);
        DataSet      theDS       = PatientHome.GetTechnicalAreaandFormName(ModuleId);

        ViewState["AddForms"] = theDS;

        if (Convert.ToInt32(Session["PatientId"]) != 0)
        {
            PatientId = Convert.ToInt32(Session["PatientId"]);
        }

        if (PatientId == 0)
        {
            PatientId = Convert.ToInt32(Session["PatientId"]);
        }

        if (Session["AppUserID"].ToString() == "")
        {
            IQCareMsgBox.Show("SessionExpired", this);
            Response.Redirect("~/frmlogin.aspx", true);
        }

        lblversion.Text = AuthenticationManager.AppVersion;
        lblrelDate.Text = AuthenticationManager.ReleaseDate;

        DataTable dtPatientInfo = (DataTable)Session["PatientInformation"];

        if (dtPatientInfo != null && dtPatientInfo.Rows.Count > 0)
        {
            PMTCTNos = dtPatientInfo.Rows[0]["ANCNumber"].ToString() + dtPatientInfo.Rows[0]["PMTCTNumber"].ToString() + dtPatientInfo.Rows[0]["AdmissionNumber"].ToString() + dtPatientInfo.Rows[0]["OutpatientNumber"].ToString();
            ARTNos   = dtPatientInfo.Rows[0]["PatientEnrollmentId"].ToString();
        }
        ////DataTable theDT1 = (DataTable)Session["AppModule"];
        ////DataView theDV = new DataView(theDT1);

        //################  Master Settings ###################
        string UserID = "";

        if (Session["AppUserID"].ToString() != null)
        {
            UserID = Session["AppUserId"].ToString();
        }
        if (Session["AppUserName"].ToString() != null)
        {
            lblUserName.Text = Session["AppUserName"].ToString();
        }
        if (Session["AppLocation"].ToString() != null)
        {
            lblLocation.Text = Session["AppLocation"].ToString();
        }

        IIQCareSystem AdminManager;

        AdminManager = (IIQCareSystem)ObjectFactory.CreateInstance("BusinessProcess.Security.BIQCareSystem, BusinessProcess.Security");
        if (Session["AppDateFormat"].ToString() != null)
        {
            lblDate.Text = AdminManager.SystemDate().ToString(Session["AppDateFormat"].ToString());
        }

        //######################################################

        string theUrl;

        //////if (lblpntStatus.Text == "0")
        //////{
        if (Session["PtnPrgStatus"] != null)
        {
            DataTable theStatusDT       = (DataTable)Session["PtnPrgStatus"];
            DataTable theCEntedStatusDT = (DataTable)Session["CEndedStatus"];
            string    PatientExitReason = string.Empty;
            string    PMTCTCareEnded    = string.Empty;
            string    CareEnded         = string.Empty;
            if (theCEntedStatusDT.Rows.Count > 0)
            {
                PatientExitReason = Convert.ToString(theCEntedStatusDT.Rows[0]["PatientExitReason"]);
                PMTCTCareEnded    = Convert.ToString(theCEntedStatusDT.Rows[0]["PMTCTCareEnded"]);
                CareEnded         = Convert.ToString(theCEntedStatusDT.Rows[0]["CareEnded"]);
            }


            //if ((theStatusDT.Rows[0]["PMTCTStatus"].ToString() == "PMTCT Care Ended") || (Session["PMTCTPatientStatus"]!= null && Session["PMTCTPatientStatus"].ToString() == "1"))
            if ((Convert.ToString(theStatusDT.Rows[0]["PMTCTStatus"]) == "PMTCT Care Ended") || (PatientExitReason == "93" && PMTCTCareEnded == "1"))
            {
                PtnPMTCTStatus = 1;
                Session["PMTCTPatientStatus"] = 1;
            }
            else
            {
                PtnPMTCTStatus = 0;
                Session["PMTCTPatientStatus"] = 0;
                //LoggedInUser.PatientStatus = 0;
            }
            //if ((theStatusDT.Rows[0]["ART/PalliativeCare"].ToString() == "Care Ended") || (Session["HIVPatientStatus"]!= null && Session["HIVPatientStatus"].ToString() == "1"))
            if ((Convert.ToString(theStatusDT.Rows[0]["ART/PalliativeCare"]) == "Care Ended") || (PatientExitReason == "93" && CareEnded == "1"))
            {
                PtnARTStatus = 1;
                Session["HIVPatientStatus"] = 1;
            }
            else
            {
                PtnARTStatus = 0;
                Session["HIVPatientStatus"] = 0;
            }
        }
        //////}
        //else
        //{
        //    if (Session["PtnPrgStatus"] != null)
        //    {
        //        DataTable theStatusDT = (DataTable)Session["PtnPrgStatus"];
        //        if (theStatusDT.Rows[0]["PMTCTStatus"].ToString() == "PMTCT Care Ended")
        //        {
        //            PtnPMTCTStatus = 1;
        //            Session["PMTCTPatientStatus"] = 1;

        //        }
        //        else
        //        {
        //            PtnPMTCTStatus = 0;
        //            Session["PMTCTPatientStatus"] = 0;

        //        }
        //        if (theStatusDT.Rows[0]["ART/PalliativeCare"].ToString() == "Care Ended")
        //        {
        //            PtnARTStatus = 1;
        //            Session["HIVPatientStatus"] = 1;

        //        }
        //        else
        //        {
        //            PtnARTStatus = 0;
        //            Session["HIVPatientStatus"] = 0;

        //        }
        //    }


        //}

        if (lblpntStatus.Text == "0" && (PtnARTStatus == 0 || PtnPMTCTStatus == 0))
        //if (PtnARTStatus == 0 || PtnPMTCTStatus == 0)
        {
            if (PtnARTStatus == 0)
            {
                //########### Initial Evaluation ############
                //theUrl = string.Format("{0}&sts={1}", "../ClinicalForms/frmClinical_InitialEvaluation.aspx?name=Add", PtnARTStatus);
                theUrl           = string.Format("{0}", "../ClinicalForms/frmClinical_InitialEvaluation.aspx");
                mnuInitEval.HRef = theUrl;
                //########### ART-FollowUp ############
                //string theUrl18 = string.Format("{0}&sts={1}", "../ClinicalForms/frmClinical_ARTFollowup.aspx?name=Add", PtnARTStatus);
                string theUrl18 = string.Format("{0}", "../ClinicalForms/frmClinical_ARTFollowup.aspx");
                mnuFollowupART.HRef = theUrl18;
                //########### Non-ART Follow-Up #########
                string theUrl1 = string.Format("{0}", "../ClinicalForms/frmClinical_NonARTFollowUp.aspx");
                Session.Remove("ExixstDS1");
                mnuNonARTFollowUp.HRef = theUrl1;
                ////########### HIV Care/ART Encounter #########
                //string theUrl2 = string.Format("{0}", "../ClinicalForms/frmClinical_HIVCareARTCardEncounter.aspx");
                //mnuHIVCareARTEncounter.HRef = theUrl2;
                //########### Contact Tracking ############
                //theUrl = string.Format("{0}", "../Scheduler/frmScheduler_ContactCareTracking.aspx?");
                //mnuContactCare1.HRef = theUrl;
                //########### Patient Record ############
                theUrl = string.Format("{0}&sts={1}", "../ClinicalForms/frmClinical_PatientRecordCTC.aspx?name=Add", PtnARTStatus);
                //mnuPatientRecord.HRef = theUrl;
                //########### Adult Pharmacy ############
                //LoggedInUser.Program = "ART";
                //LoggedInUser.PatientPharmacyId = 0;
                theUrl = string.Format("{0}", "../Pharmacy/frmPharmacyForm.aspx?Prog=ART");
                //theUrl = string.Format("{0}", "../Pharmacy/frmPharmacy_Adult.aspx?Prog=ART");
                mnuAdultPharmacy.HRef = theUrl;
                //########### Pediatric Pharmacy ############
                //theUrl = string.Format("{0}", "../Pharmacy/frmPharmacy_Paediatric.aspx?Prog=ART");
                //mnuPaediatricPharmacy.HRef = theUrl;
                ////########### Pharmacy CTC###############
                theUrl = string.Format("{0}", "../Pharmacy/frmPharmacy_CTC.aspx?Prog=ART");
                //mnuPharmacyCTC.HRef = theUrl;
                //########### Laboratory ############
                theUrl = string.Format("{0}sts={1}", "../Laboratory/frmLabOrder.aspx?", PtnARTStatus);
                string theUrlLabOrder = string.Format("{0}&sts={1}", "../Laboratory/frmLabOrderTests.aspx?name=Add", PtnARTStatus);
                mnuLabOrder.HRef     = theUrl;
                mnuOrderLabTest.HRef = theUrlLabOrder;
                mnuOrderLabTest.Attributes.Add("onclick", "window.open('" + theUrlLabOrder + "','','toolbars=no,location=no,directories=no,dependent=yes,top=100,left=30,maximize=no,resize=no,width=1000,height=500,scrollbars=yes');return false;");
                //########### Home Visit ############
                theUrl            = string.Format("{0}", "../Scheduler/frmScheduler_HomeVisit.aspx");
                mnuHomeVisit.HRef = theUrl;
            }

            if (PtnPMTCTStatus == 0)
            {
                //########### Contact Tracking ############
                theUrl = string.Format("{0}Module={1}", "../Scheduler/frmScheduler_ContactCareTracking.aspx?", "PMTCT");
                //mnuContactCarePMTCT.HRef = theUrl;

                //####### Adult Pharmacy PMTCT ##########
                //LoggedInUser.Program = "PMTCT";
                //LoggedInUser.PatientPharmacyId = 0;
                theUrl = string.Format("{0}", "../Pharmacy/frmPharmacyForm.aspx?Prog=PMTCT");
                mnuAdultPharmacyPMTCT.HRef = theUrl;

                //###########Paediatric Pharmacy PMTCT#################
                //theUrl = string.Format("{0}", "../Pharmacy/frmPharmacy_Paediatric.aspx?Prog=PMTCT");
                //mnuPaediatricPharmacyPMTCT.HRef = theUrl;

                //########### Pharmacy PMTCT CTC###############
                theUrl = string.Format("{0}", "../Pharmacy/frmPharmacy_CTC.aspx?Prog=PMTCT");
                //mnuPharmacyPMTCTCTC.HRef = theUrl;

                //########### Laboratory ############
                string theUrlPMTCT         = string.Format("{0}sts={1}", "../Laboratory/frmLabOrder.aspx?", PtnPMTCTStatus);
                string theUrlPMTCTLabOrder = string.Format("{0}sts={1}", "../Laboratory/frmLabOrderTests.aspx?", PtnPMTCTStatus);
                mnuLabOrderPMTCT.HRef     = theUrlPMTCT;
                mnuOrderLabTestPMTCT.HRef = theUrlPMTCTLabOrder;
                mnuOrderLabTestPMTCT.Attributes.Add("onclick", "window.open('" + theUrlPMTCTLabOrder + "','','toolbars=no,location=no,directories=no,dependent=yes,top=100,left=30,maximize=no,resize=no,width=1000,height=500,scrollbars=yes');return false;");
            }
        }

        #region "Common Forms"
        theUrl = string.Format("{0}&mnuClicked={1}&sts={2}", "../AdminForms/frmAdmin_DeletePatient.aspx?name=Add", "DeletePatient", lblpntStatus.Text);
        mnuAdminDeletePatient.HRef = theUrl;

        //######## Meetu 08 Sep 2009 End########//
        //####### Delete Form #############
        theUrl = string.Format("{0}?sts={1}", "../ClinicalForms/frmClinical_DeleteForm.aspx", lblpntStatus.Text);
        mnuClinicalDeleteForm.HRef = theUrl;

        //####### Delete Patient  #############
        //theUrl = string.Format("{0}?mnuClicked={1}&sts={2}", "../frmFindAddPatient.aspx?name=Add", "DeletePatient", lblpntStatus.Text);
        theUrl = string.Format("{0}?mnuClicked={1}&sts={2}&PatientID={3}", "../AdminForms/frmAdmin_DeletePatient.aspx?name=Add", "DeletePatient", lblpntStatus.Text, PatientId.ToString());
        mnuAdminDeletePatient.HRef = theUrl;

        //##### Patient Transfer #######
        //theUrl = string.Format("{0}&PatientId={1}&sts={2}", "../ClinicalForms/frmClinical_Transfer.aspx?name=Add", PatientId.ToString(), lblpntStatus.Text);
        theUrl = string.Format("{0}&sts={1}", "../ClinicalForms/frmClinical_Transfer.aspx?name=Add", lblpntStatus.Text);

        mnuPatientTranfer.HRef = theUrl;

        //########### Existing Forms ############
        theUrl = string.Format("{0}", "../ClinicalForms/frmPatient_History.aspx");
        mnuExistingForms.HRef = theUrl;

        //########### ARV-Pickup Report ############
        theUrl             = string.Format("{0}&SatelliteID={1}&CountryID={2}&PosID={3}&sts={4}", "../Reports/frmReport_PatientARVPickup.aspx?name=Add", Session["AppSatelliteId"], Session["AppCountryId"], Session["AppPosID"], lblpntStatus.Text);
        mnuDrugPickUp.HRef = theUrl;

        //########### PatientProfile ############
        theUrl = string.Format("{0}&ReportName={1}&sts={2}", "../Reports/frmReportViewer.aspx?name=Add", "PatientProfile", lblpntStatus.Text);
        mnuPatientProfile.HRef = theUrl;

        //########### ARV-Pickup Report ############
        theUrl            = string.Format("{0}&SatelliteID={1}&CountryID={2}&PosID={3}&sts={4}", "../Reports/frmReportDebitNote.aspx?name=Add", Session["AppSatelliteId"], Session["AppCountryId"], Session["AppPosID"], lblpntStatus.Text);
        mnuDebitNote.HRef = theUrl;

        ////////########### Patient Blue Cart############
        //////theUrl = string.Format("{0}&PatientId={1}&ReportName={2}&sts={3}", "../Reports/frmPatientBlueCart.aspx?name=Add", PatientId.ToString(), "PatientProfile", lblpntStatus.Text);
        //////mnupatientbluecart.HRef = theUrl;


        //###### PatientHome #############
        ////theUrl = string.Format("{0}?PatientId={1}", "../ClinicalForms/frmPatient_Home.aspx", PatientId.ToString());
        theUrl             = string.Format("{0}", "../ClinicalForms/frmPatient_Home.aspx");
        mnuPatienHome.HRef = theUrl;

        //###### Scheduler #############
        theUrl = string.Format("{0}&LocationId={1}&FormName={2}&sts={3}", "../Scheduler/frmScheduler_AppointmentHistory.aspx?name=Add", Session["AppLocationId"].ToString(), "PatientHome", lblpntStatus.Text);
        mnuScheduleAppointment.HRef = theUrl;

        //####### Additional Forms - Family Information #######
        theUrl = string.Format("{0}", "../ClinicalForms/frmFamilyInformation.aspx?name=Add");
        mnuFamilyInformation.HRef = theUrl;

        //####### Patient Classification #######
        theUrl = string.Format("{0}", "../ClinicalForms/frmClinical_PatientClassificationCTC.aspx?name=Add");
        mnuPatientClassification.HRef = theUrl;

        //####### Follow-up Education #######
        theUrl = string.Format("{0}", "../ClinicalForms/frmFollowUpEducationCTC.aspx?name=Add");
        mnuFollowupEducation.HRef = theUrl;

        //####### Exposed Infant #############
        theUrl = string.Format("{0}", "../ClinicalForms/frmExposedInfantEnrollment.aspx");
        mnuExposedInfant.HRef = theUrl;
        #endregion
        theUrl = string.Format("{0}", "../ClinicalForms/frm_PriorArt_HivCare.aspx");
        mnuPriorARTHIVCare.HRef = theUrl;
        theUrl          = string.Format("{0}", "../ClinicalForms/frmClinical_ARTCare.aspx");
        mnuARTCare.HRef = theUrl;

        //########### HIV Care/ART Encounter #########
        string theUrl2 = string.Format("{0}", "../ClinicalForms/frmClinical_HIVCareARTCardEncounter.aspx");
        mnuHIVCareARTEncounter.HRef = theUrl2;

        //########### Kenya Blue Card #########
        theUrl           = string.Format("{0}", "../ClinicalForms/frmClinical_InitialFollowupVisit.aspx");
        mnuARTVisit.HRef = theUrl;

        theUrl             = string.Format("{0}", "../ClinicalForms/frmClinical_ARVTherapy.aspx");
        mnuARTTherapy.HRef = theUrl;

        //theUrl = string.Format("{0}?PatientId={1}", "../ClinicalForms/frmClinical_ARTHistory.aspx", PatientId.ToString());
        //mnuARTTherapy.HRef = theUrl;

        theUrl             = string.Format("{0}", "../ClinicalForms/frmClinical_ARTHistory.aspx");
        mnuARTHistory.HRef = theUrl;

        //########### Patient Enrollment ############
        //Added - Jayanta Kr. Das - 16-02-07
        DataTable theDT = new DataTable();
        if (PatientId != 0)
        {
            //### Patient Enrolment ######
            string theUrl1 = "";
            if (ARTNos != null && ARTNos == "")
            {
                if (Session["SystemId"].ToString() == "1" && PtnARTStatus == 0)
                {
                    ////theUrl = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_Enrolment.aspx?name=Add", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnARTStatus);
                    theUrl            = string.Format("{0}", "../ClinicalForms/frmClinical_Enrolment.aspx");
                    mnuEnrolment.HRef = theUrl;
                }
                else if (PtnARTStatus == 0)
                {
                    theUrl            = string.Format("{0}&locationid={1}&sts={2}", "../ClinicalForms/frmClinical_PatientRegistrationCTC.aspx?name=Add", Session["AppLocationId"].ToString(), PtnARTStatus);
                    mnuEnrolment.HRef = theUrl;
                }
                if (PtnPMTCTStatus == 0)
                {
                    ////theUrl1 = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_EnrolmentPMTCT.aspx?name=Edit", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnPMTCTStatus);
                    //theUrl1 = string.Format("{0}", "../frmPatientRegistration.aspx"); //JAYANT 25/4/2012
                    theUrl1            = string.Format("{0}", "../frmPatientCustomRegistration.aspx");
                    mnuPMTCTEnrol.HRef = theUrl1;
                }
            }

            else if (PMTCTNos != null && PMTCTNos == "")
            {
                if (PtnPMTCTStatus == 0)
                {
                    ////theUrl1 = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_EnrolmentPMTCT.aspx?name=Add", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnPMTCTStatus);
                    //theUrl1 = string.Format("{0}", "../frmPatientRegistration.aspx");
                    theUrl1            = string.Format("{0}", "../frmPatientCustomRegistration.aspx");
                    mnuPMTCTEnrol.HRef = theUrl1;
                }

                if (Session["SystemId"].ToString() == "1" && PtnARTStatus == 0)
                {
                    theUrl            = string.Format("{0}", "../ClinicalForms/frmClinical_Enrolment.aspx");
                    mnuEnrolment.HRef = theUrl;
                }
                else if (PtnARTStatus == 0)
                {
                    theUrl            = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_PatientRegistrationCTC.aspx?name=Edit", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnARTStatus);
                    mnuEnrolment.HRef = theUrl;
                }
            }
            else
            {
                //if (PtnPMTCTStatus == 0)
                //{
                ////theUrl1 = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_EnrolmentPMTCT.aspx?name=Edit", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnPMTCTStatus);
                //theUrl1 = string.Format("{0}", "../frmPatientRegistration.aspx");
                theUrl1            = string.Format("{0}", "../frmPatientCustomRegistration.aspx");
                mnuPMTCTEnrol.HRef = theUrl1;
                //}

                if (Session["SystemId"].ToString() == "1" && PtnARTStatus == 0)
                {
                    ////theUrl = string.Format("{0}&patientid={1}&locationid={2}&sts={3}", "../ClinicalForms/frmClinical_Enrolment.aspx?name=Edit", PatientId.ToString(), Session["AppLocationId"].ToString(), PtnARTStatus);
                    theUrl            = string.Format("{0}", "../ClinicalForms/frmClinical_Enrolment.aspx");
                    mnuEnrolment.HRef = theUrl;
                }
                else if (PtnARTStatus == 0)
                {
                    theUrl            = string.Format("{0}&locationid={1}&sts={2}", "../ClinicalForms/frmClinical_PatientRegistrationCTC.aspx?name=Edit", Session["AppLocationId"].ToString(), PtnARTStatus);
                    mnuEnrolment.HRef = theUrl;
                }
            }
        }
        //Load_MenuPartial(PatientId, PtnPMTCTStatus.ToString(), Convert.ToInt32(Session["AppCurrency"].ToString()));
    }
Beispiel #21
0
        public async Task <ActionResult> AddStaff(Models.StaffInfoViewModel model)
        {
            //var str = Request.Cookies["userId"].Value;
            var str    = Session["userId"].ToString();
            var userid = Guid.Parse(str);

            try
            {
                string        _path         = Server.MapPath("~/Assets/images/users/");//设定上传的文件路径
                DirectoryInfo directoryInfo = new DirectoryInfo(_path);
                if (!directoryInfo.Exists)
                {
                    directoryInfo.Create();
                }

                HttpPostedFileBase file = Request.Files["ImagePath"];
                //判断是否已经选择上传文件
                if (file != null)
                {
                    string fileType = file.FileName.Split('.')[file.FileName.Split('.').Length - 1];
                    if (fileType != "png" && fileType != "jpg" && fileType != "jpeg")
                    {
                        return(Content("<script language='javascript'>alert('仅支持jpg、png格式的图片,请重新选择!');history.go(-1);</script>"));
                    }
                    else
                    {
                        //图片大小限制为2M
                        if (file.ContentLength > 2 * 1024 * 1024)
                        {
                            return(Content("<script language='javascript'>alert('文件过大!请压缩后上传');history.go(-1);</script>"));
                        }
                        else
                        {
                            string filenName = DateTime.Now.Ticks + file.FileName;
                            string filepath  = _path + filenName;
                            file.SaveAs(filepath);//

                            IAdminManager adminManager = new AdminManager();
                            var           staff        = new LogisticsSystem.DTO.StaffBsicInfoDto()
                            {
                                Name      = model.Name,
                                Tel       = model.Tel,
                                Email     = model.Email,
                                Address   = model.Address,
                                IdCard    = model.IdCard,
                                Position  = model.PositionName,
                                SectionId = await adminManager.GetSectionIdByName(model.SectionName),
                                ImagePath = filenName
                            };
                            var key = ConfigurationManager.AppSettings["EncryptAndDecryptPwdString"].ToString();
                            await adminManager.AddOneStaff(staff, userid, key, model.RoleName);
                        }
                    }
                }
            }
            catch (Exception)
            {
                return(Content("<script language='javascript'>alert('服务器错误,500!');history.go(-1);</script>"));
            }


            return(Content("<script language='javascript'>alert('创建成功!');history.go(-1);</script>"));
        }
Beispiel #22
0
 public ActionResult Index()
 {
     ViewBag.UserName = AdminManager.GetUser().UserName;
     return(View());
 }
Beispiel #23
0
        private static List <Tab> GetTopMenus(SiteInfo siteInfo, bool isSuperAdmin, List <int> siteIdListLatestAccessed, List <int> siteIdListWithPermissions)
        {
            var menus = new List <Tab>();

            if (siteInfo != null && siteIdListWithPermissions.Contains(siteInfo.Id))
            {
                var siteMenus = new List <Tab>();
                if (siteIdListWithPermissions.Count == 1)
                {
                    menus.Add(new Tab
                    {
                        Text     = siteInfo.SiteName,
                        Children = siteMenus.ToArray()
                    });
                }
                else
                {
                    var siteIdList = AdminManager.GetLatestTop10SiteIdList(siteIdListLatestAccessed, siteIdListWithPermissions);
                    foreach (var siteId in siteIdList)
                    {
                        var site = SiteManager.GetSiteInfo(siteId);
                        if (site == null)
                        {
                            continue;
                        }

                        siteMenus.Add(new Tab
                        {
                            Href   = PageUtils.GetMainUrl(site.Id),
                            Target = "_top",
                            Text   = site.SiteName
                        });
                    }
                    siteMenus.Add(new Tab
                    {
                        Href   = ModalSiteSelect.GetRedirectUrl(siteInfo.Id),
                        Target = "_layer",
                        Text   = "全部站点..."
                    });
                    menus.Add(new Tab
                    {
                        Text     = siteInfo.SiteName,
                        Href     = ModalSiteSelect.GetRedirectUrl(siteInfo.Id),
                        Target   = "_layer",
                        Children = siteMenus.ToArray()
                    });
                }

                var linkMenus = new List <Tab>
                {
                    //new Tab {Href = PageUtility.GetSiteUrl(siteInfo, false), Target = "_blank", Text = "访问站点"},
                    //new Tab {Href = ApiRoutePreview.GetSiteUrl(siteInfo.Id), Target = "_blank", Text = "预览站点"}
                };
                //menus.Add(new Tab {Text = "站点链接", Children = linkMenus.ToArray()});                    modify on 2019/1/18
            }

            if (isSuperAdmin)
            {
                foreach (var tab in TabManager.GetTopMenuTabs())
                {
                    var tabs = TabManager.GetTabList(tab.Id, 0);
                    tab.Children = tabs.ToArray();

                    menus.Add(tab);
                }
            }

            return(menus);
        }
Beispiel #24
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsPostBack || !Page.IsValid)
            {
                return;
            }

            if (string.IsNullOrEmpty(_userName))
            {
                var adminInfo = new AdministratorInfo
                {
                    UserName        = TbUserName.Text.Trim(),
                    Password        = TbPassword.Text,
                    CreatorUserName = AuthRequest.AdminName,
                    DisplayName     = TbDisplayName.Text,
                    Email           = TbEmail.Text,
                    Mobile          = TbMobile.Text,
                    DepartmentId    = TranslateUtils.ToInt(DdlDepartmentId.SelectedValue),
                    AreaId          = TranslateUtils.ToInt(DdlAreaId.SelectedValue)
                };

                if (!string.IsNullOrEmpty(DataProvider.AdministratorDao.GetUserNameByEmail(TbEmail.Text)))
                {
                    FailMessage("管理员添加失败,邮箱地址已存在");
                    return;
                }

                if (!string.IsNullOrEmpty(DataProvider.AdministratorDao.GetUserNameByMobile(TbMobile.Text)))
                {
                    FailMessage("管理员添加失败,手机号码已存在");
                    return;
                }

                string errorMessage;
                if (!AdminManager.CreateAdministrator(adminInfo, out errorMessage))
                {
                    FailMessage($"管理员添加失败:{errorMessage}");
                    return;
                }

                AuthRequest.AddAdminLog("添加管理员", $"管理员:{TbUserName.Text.Trim()}");
                SuccessMessage("管理员添加成功!");
                AddWaitAndRedirectScript(PageAdministrator.GetRedirectUrl());
            }
            else
            {
                var adminInfo = DataProvider.AdministratorDao.GetByUserName(_userName);

                if (adminInfo.Email != TbEmail.Text && !string.IsNullOrEmpty(DataProvider.AdministratorDao.GetUserNameByEmail(TbEmail.Text)))
                {
                    FailMessage("管理员设置失败,邮箱地址已存在");
                    return;
                }

                if (adminInfo.Mobile != TbMobile.Text && !string.IsNullOrEmpty(DataProvider.AdministratorDao.GetUserNameByMobile(adminInfo.Mobile)))
                {
                    FailMessage("管理员设置失败,手机号码已存在");
                    return;
                }

                adminInfo.DisplayName  = TbDisplayName.Text;
                adminInfo.Email        = TbEmail.Text;
                adminInfo.Mobile       = TbMobile.Text;
                adminInfo.DepartmentId = TranslateUtils.ToInt(DdlDepartmentId.SelectedValue);
                adminInfo.AreaId       = TranslateUtils.ToInt(DdlAreaId.SelectedValue);

                DataProvider.AdministratorDao.Update(adminInfo);

                AuthRequest.AddAdminLog("修改管理员属性", $"管理员:{TbUserName.Text.Trim()}");
                SuccessMessage("管理员设置成功!");
                AddWaitAndRedirectScript(PageAdministrator.GetRedirectUrl());
            }
        }
Beispiel #25
0
 public void Teardown()
 {
     _manager = null;
 }
Beispiel #26
0
 public IAdministratorInfo GetAdminInfoByUserId(int userId)
 {
     return(AdminManager.GetAdminInfoByUserId(userId));
 }
Beispiel #27
0
 public Services()
 {
     _aManager = new AdminManager();
 }
Beispiel #28
0
 public IAdministratorInfo GetAdminInfoByUserName(string userName)
 {
     return(AdminManager.GetAdminInfoByUserName(userName));
 }
        public static ContentInfo Calculate(int sequence, ContentInfo contentInfo, List <ContentColumn> columns, Dictionary <string, Dictionary <string, Func <IContentContext, string> > > pluginColumns)
        {
            if (contentInfo == null)
            {
                return(null);
            }

            var retVal = new ContentInfo(contentInfo.ToDictionary());

            foreach (var column in columns)
            {
                if (!column.IsCalculate)
                {
                    continue;
                }

                if (StringUtils.EqualsIgnoreCase(column.AttributeName, ContentAttribute.Sequence))
                {
                    retVal.Set(ContentAttribute.Sequence, sequence);
                }
                else if (StringUtils.EqualsIgnoreCase(column.AttributeName, ContentAttribute.AdminId))
                {
                    var value = string.Empty;
                    if (contentInfo.AdminId > 0)
                    {
                        var adminInfo = AdminManager.GetAdminInfoByUserId(contentInfo.AdminId);
                        if (adminInfo != null)
                        {
                            value = string.IsNullOrEmpty(adminInfo.DisplayName) ? adminInfo.UserName : adminInfo.DisplayName;
                        }
                    }
                    retVal.Set(ContentAttribute.AdminId, value);
                }
                else if (StringUtils.EqualsIgnoreCase(column.AttributeName, ContentAttribute.UserId))
                {
                    var value = string.Empty;
                    if (contentInfo.UserId > 0)
                    {
                        var userInfo = UserManager.GetUserInfoByUserId(contentInfo.UserId);
                        if (userInfo != null)
                        {
                            value = string.IsNullOrEmpty(userInfo.DisplayName) ? userInfo.UserName : userInfo.DisplayName;
                        }
                    }
                    retVal.Set(ContentAttribute.UserId, value);
                }
                else if (StringUtils.EqualsIgnoreCase(column.AttributeName, ContentAttribute.SourceId))
                {
                    retVal.Set(ContentAttribute.SourceId, SourceManager.GetSourceName(contentInfo.SourceId));
                }
                else if (StringUtils.EqualsIgnoreCase(column.AttributeName, ContentAttribute.AddUserName))
                {
                    var value = string.Empty;
                    if (!string.IsNullOrEmpty(contentInfo.AddUserName))
                    {
                        var adminInfo = AdminManager.GetAdminInfoByUserName(contentInfo.AddUserName);
                        if (adminInfo != null)
                        {
                            value = string.IsNullOrEmpty(adminInfo.DisplayName) ? adminInfo.UserName : adminInfo.DisplayName;
                        }
                    }
                    retVal.Set(ContentAttribute.AddUserName, value);
                }
                else if (StringUtils.EqualsIgnoreCase(column.AttributeName, ContentAttribute.LastEditUserName))
                {
                    var value = string.Empty;
                    if (!string.IsNullOrEmpty(contentInfo.LastEditUserName))
                    {
                        var adminInfo = AdminManager.GetAdminInfoByUserName(contentInfo.LastEditUserName);
                        if (adminInfo != null)
                        {
                            value = string.IsNullOrEmpty(adminInfo.DisplayName) ? adminInfo.UserName : adminInfo.DisplayName;
                        }
                    }
                    retVal.Set(ContentAttribute.LastEditUserName, value);
                }
            }

            if (pluginColumns != null)
            {
                foreach (var pluginId in pluginColumns.Keys)
                {
                    var contentColumns = pluginColumns[pluginId];
                    if (contentColumns == null || contentColumns.Count == 0)
                    {
                        continue;
                    }

                    foreach (var columnName in contentColumns.Keys)
                    {
                        var attributeName = $"{pluginId}:{columnName}";
                        if (columns.All(x => x.AttributeName != attributeName))
                        {
                            continue;
                        }

                        try
                        {
                            var func  = contentColumns[columnName];
                            var value = func(new ContentContextImpl
                            {
                                SiteId    = contentInfo.SiteId,
                                ChannelId = contentInfo.ChannelId,
                                ContentId = contentInfo.Id
                            });

                            retVal.Set(attributeName, value);
                        }
                        catch (Exception ex)
                        {
                            LogUtils.AddErrorLog(pluginId, ex);
                        }
                    }
                }
            }

            return(retVal);
        }
Beispiel #30
0
 public IAdministratorInfo GetAdminInfoByEmail(string email)
 {
     return(AdminManager.GetAdminInfoByEmail(email));
 }
Beispiel #31
0
        private static void Main()
        {
            Log.Default.Logger = new NLogger();
            Log.Default.Initialize(@"D:\TEMP\LOG\", "TETRINET2_SERVER.LOG");

            IFactory factory = new Factory();
            IPasswordManager passwordManager = new PasswordManager();
            IBanManager banManager = new BanManager(@"D:\TEMP\ban.lst");
            IClientManager clientManager = new ClientManager(50);
            IAdminManager adminManager = new AdminManager(5);
            IGameManager gameManager = new GameManager(10);

            IHost wcfHost = new WCFHost.WCFHost(banManager, clientManager, adminManager, gameManager)
                {
                    Port = 7788
                };

            IServer server = new Server(factory, passwordManager, banManager, clientManager, adminManager, gameManager);

            server.AddHost(wcfHost);

            server.SetVersion(1, 0);
            server.SetAdminPassword("admin1", "123456");

            server.PerformRestartServer += ServerOnPerformRestartServer;

            //
            try
            {
                server.Start();
            }
            catch (Exception ex)
            {
                Log.Default.WriteLine(LogLevels.Error, "Cannot start server. Exception: {0}", ex);
                return;
            }

            bool stopped = false;
            while (!stopped)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo cki = Console.ReadKey(true);
                    switch (cki.Key)
                    {
                        default:
                            DisplayHelp();
                            break;
                        case ConsoleKey.X:
                            server.Stop();
                            stopped = true;
                            break;
                        case ConsoleKey.D:
                            Console.WriteLine("Clients:");
                            foreach (IClient client in clientManager.Clients)
                                Console.WriteLine("{0}) {1} [{2}] {3} {4} {5} {6:HH:mm:ss.fff} {7:HH:mm:ss.fff}", client.Id, client.Name, client.Team, client.State, client.Game == null ? "no in game" : client.Game.Name, client.PieceIndex, client.LastActionFromClient, client.LastActionToClient);
                            Console.WriteLine("Admins:");
                            foreach (IAdmin admin in adminManager.Admins)
                                Console.WriteLine("{0}) {1}", admin.Id, admin.Name);
                            Console.WriteLine("Games:");
                            foreach (IGame game in gameManager.Games)
                                Console.WriteLine("{0}) {1} {2} {3} #players:{4} #spectators:{5}  password:{6} {7:HH:mm:ss}", game.Id, game.Name, game.State, game.Rule, game.PlayerCount, game.SpectatorCount, game.Password, game.CreationTime);
                            break;
                    }
                }
                else
                    System.Threading.Thread.Sleep(100);
            }
        }
Beispiel #32
0
 public IAdministratorInfo GetAdminInfoByMobile(string mobile)
 {
     return(AdminManager.GetAdminInfoByMobile(mobile));
 }
Beispiel #33
0
 public IAdministratorInfo GetAdminInfoByAccount(string account)
 {
     return(AdminManager.GetAdminInfoByAccount(account));
 }
Beispiel #34
0
 /// <summary>
 /// Called by the <see cref="watcher"/> when the admin configuration file changes.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">A <see cref="FileSystemEventArgs"/> object containing the event data.</param>
 private void OnAdminFileChanged(object sender, FileSystemEventArgs e)
 {
     AdminManager.ReloadAdmins();
 }
 /// <summary>
 /// Check settings status
 /// </summary>
 /// <param name="type"></param>
 /// <param name="isValid"></param>
 private void CheckSettingStatus(AdminManager.SettingsType type, bool isValid)
 {
     switch(type)
     {
         case AdminManager.SettingsType.AppSettings:
             isAppSettingsValid = isValid;
             verifyStatus += isValid ? "App settings are valid" : "App settings are not valid";
             break;
         case AdminManager.SettingsType.AdminSettings:
             isAdminSettingsValid = isValid;
             verifyStatus += isValid ? "Admin settings are valid" : "Admin settings are not valid";
             break;
         case AdminManager.SettingsType.VersionSettings:
             isVersionSettingsValid = isValid;
             verifyStatus += isValid ? "Version set to " + instance.AppVersion : "App version not set";
             break;
     }
     verifyStatus += "\n";
     if (!isValid)
         ClearVersions();
 }
Beispiel #36
0
        /// <summary>
        /// Loads the admin users from the Admins.xml file.
        /// </summary>
        private void LoadAdmins()
        {
            if (!File.Exists(ConfigPath))
            {
                this.CreateConfig();
            }

            var xml = new XmlDocument();

            try
            {
                xml.Load(ConfigPath);
            }
            catch (XmlException e)
            {
                this.LogError($"Failed reading admin configuration from {ConfigPath}: {e.Message}");
                return;
            }

            var groups      = new Dictionary <string, GroupInfo>();
            var groupsNodes = xml.GetElementsByTagName("Groups");

            if (groupsNodes.Count > 0)
            {
                foreach (XmlElement node in ((XmlElement)groupsNodes[0]).GetElementsByTagName("Group"))
                {
                    if (!node.HasAttribute("Name"))
                    {
                        continue;
                    }

                    var name = node.GetAttribute("Name");
                    if (groups.ContainsKey(name))
                    {
                        continue;
                    }

                    var immunity = 1;
                    if (node.HasAttribute("Immunity"))
                    {
                        int.TryParse(node.GetAttribute("Immunity"), out immunity);
                    }

                    var flags = string.Empty;
                    if (node.HasAttribute("Flags"))
                    {
                        flags = node.GetAttribute("Flags");
                    }

                    groups.Add(name, new GroupInfo(name, immunity, flags));
                }
            }

            var adminsNodes = xml.GetElementsByTagName("Admins");

            if (adminsNodes.Count > 0)
            {
                foreach (XmlElement node in ((XmlElement)adminsNodes[0]).GetElementsByTagName("Admin"))
                {
                    if (!node.HasAttribute("AuthId"))
                    {
                        continue;
                    }

                    var authId = node.GetAttribute("AuthId");

                    var immunity = 1;
                    if (node.HasAttribute("Immunity"))
                    {
                        int.TryParse(node.GetAttribute("Immunity"), out immunity);
                    }

                    var flags = string.Empty;
                    if (node.HasAttribute("Flags"))
                    {
                        flags = node.GetAttribute("Flags");
                    }

                    if (node.HasAttribute("Groups"))
                    {
                        foreach (var groupName in node.GetAttribute("Groups").Split(','))
                        {
                            if (groups.ContainsKey(groupName))
                            {
                                GroupInfo group = groups[groupName];
                                immunity = Math.Max(immunity, group.Immunity);
                                flags   += group.Flags;
                            }
                        }
                    }

                    AdminManager.AddAdmin(authId, immunity, flags);
                }
            }

            if (this.watcher == null)
            {
                this.watcher = new FileSystemWatcher(Path.GetDirectoryName(ConfigPath), Path.GetFileName(ConfigPath))
                {
                    NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite,
                };
                this.watcher.Changed            += this.OnAdminFileChanged;
                this.watcher.Deleted            += this.OnAdminFileChanged;
                this.watcher.Renamed            += this.OnAdminFileChanged;
                this.watcher.EnableRaisingEvents = true;
            }
        }
 public ContentController(AdminManager adminManager)
 {
     this._adminManager = adminManager;
 }
Beispiel #38
0
 public ActionResult ZamowieniaDoRealizacji()
 {
     return(View(AdminManager.GetOrdersToRealize()));
 }