Exemplo n.º 1
0
        /// <summary>
        /// 添加新用户事件
        /// </summary>
        protected void Submit1_ServerClick(object sender, EventArgs e)
        {
            string userName = Request.Form["username"].Trim();
            string password = Request.Form["newpass"].Trim();

            userAdmin = (SiteUser)Session["admin"];
            string message = string.Empty;

            if (userAdmin != null)
            {
                bool isSuccess = SiteManagement.CreateUser(userName, password, userAdmin.Hospital.ID, 3, ref message);

                if (!isSuccess)
                {
                    if (!string.IsNullOrEmpty(message))
                    {
                        this.Response.Write(BaseSystem.ShowWindow(message));
                    }
                    else
                    {
                        this.Response.Write(BaseSystem.ShowWindow("抱歉,此用户已经存在数据库中!!"));
                    }
                }
                else
                {
                    this.Response.Write(BaseSystem.ShowWindow("新用户添加成功!!"));
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加新管理员事件
        /// </summary>
        protected void Submit1_ServerClick(object sender, EventArgs e)
        {
            string userName = Request.Form["username"].Trim();
            string password = Request.Form["newpass"].Trim();

            int hospitalID = 0;

            bool isSucess = int.TryParse(this.SelectHosptial.SelectedValue, out hospitalID);

            if (isSucess)
            {
                string message   = string.Empty;
                bool   isSuccess = SiteManagement.CreateUser(userName, password, hospitalID, 2, ref message);

                if (!isSuccess)
                {
                    if (!string.IsNullOrEmpty(message))
                    {
                        this.Response.Write(BaseSystem.ShowWindow(message));
                    }
                    else
                    {
                        this.Response.Write(BaseSystem.ShowWindow("抱歉,此用户已经存在数据库中!!"));
                    }
                }
                else
                {
                    this.Response.Write(BaseSystem.ShowWindow("管理员添加成功!!"));
                }
            }
        }