Ejemplo n.º 1
0
 /// <summary>
 /// 重载判等
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public override bool Equals(object obj)
 {
     if (obj is DeptWardInfo)
     {
         DeptWardInfo dwi = (DeptWardInfo)obj;
         return(dwi.DeptId == DeptId && dwi.DeptName == DeptName &&
                dwi.WardId == WardId && dwi.WardName == WardName);
     }
     return(false);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 设置当前科室病区的代码和名称
 /// </summary>
 /// <param name="newDwi"></param>
 public void SetCurrentDeptWard(DeptWardInfo newDwi)
 {
     if (m_currentDeptWard == newDwi)
     {
         return;
     }
     m_currentDeptWard = newDwi;
     if (CurrentDeptWardChanged != null)
     {
         CurrentDeptWardChanged(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 获得一个DrectSoft.Security.User对象
        /// </summary>
        /// <param name="userId">用户代码</param>
        /// <returns>DrectSoft.Security.User对象</returns>
        public Users GetUser(string userId)
        {
            try
            {
                //****************************Modified By wwj 2011-06-07********************************
                //DataTable dsUser = sql_helper.ExecuteDataTable(string.Format(SelectCZRYK, userId));
                DataTable dsUser = GetUserAccount(userId);
                //**************************************************************************************

                if (dsUser == null || dsUser.Rows.Count < 1)
                {
                    throw new InvalidUserIdException();
                }

                DataRow dataRow = dsUser.Rows[0];
                Users   user    = new Users(dataRow["userid"].ToString().Trim()
                                            , dataRow["username"].ToString().Trim());


                string deptid   = dataRow.IsNull("DeptId") ? string.Empty : dataRow["DeptId"].ToString();
                string warid    = dataRow.IsNull("WardID") ? string.Empty : dataRow["WardID"].ToString();
                string deptname = dataRow.IsNull("DeptName") ? string.Empty : dataRow["DeptName"].ToString();
                string wardname = dataRow.IsNull("WardName") ? string.Empty : dataRow["WardName"].ToString();

                user.SetUserDoctor(dataRow["userid"].ToString().Trim()
                                   , dataRow["username"].ToString().Trim());

                user.SetCurrentDeptWard(deptid, deptname, warid, wardname);
                user.PasswordKey = dataRow["RegDate"].ToString().Trim();
                user.Password    = dataRow["Passwd"].ToString();
                user.SetRoleId(dataRow["JobID"].ToString().Trim());
                user.Status    = dataRow.IsNull("Status") ? 0 : Convert.ToInt32(dataRow["Status"]);
                user.Available = (dataRow["Valid"].ToString().Trim() != "0");
                user.MasterID  = dataRow["MasterID"].ToString().Trim(); //Add By wwj 2011-06-07
                user.RelateDeptWards.Clear();
                // 如果是超级用户,则取所有科室、病区对应关系
                DataTable dtDepts;
                if (Account.IsAdministrator(user.GWCodes))
                {
                    dtDepts = GetAdminCanSelectDepts();
                }
                else
                {
                    dtDepts = GetUserCanSelectDepts(userId);
                }

                if (dtDepts != null)
                {
                    Dictionary <string, string> wardDepts = new Dictionary <string, string>();

                    for (int i = 0; i < dtDepts.Rows.Count; i++)
                    {
                        DataRow      drDepts = dtDepts.Rows[i];
                        DeptWardInfo dwi     = new DeptWardInfo(
                            drDepts["DeptId"].ToString(), drDepts["DeptName"].ToString(),
                            drDepts["WardId"].ToString(), drDepts["WardName"].ToString());
                        user.RelateDeptWards.Add(dwi);
                    }
                }
                return(user);
            }
            catch (SqlException ex)
            {
                throw new InvalidUserIdException(ex.Message);
            }
        }