コード例 #1
0
ファイル: nUser.cs プロジェクト: rivernli/pMKT
 private void set_nUser(string user_id, string domainName)
 {
     domain = "asia";
     if (domainName != "")
         domain = domainName;
     LDAP ldap = new LDAP(@"LDAP://DC=" + domain + ",DC=ad,DC=flextronics,DC=com");
     if (ldap.findUser(user_id, domain))
     {
         _isLdapUser = true;
         _uid = ldap.uid;
         using (SqlDB sqldb = new SqlDB(__conn))
         {
             SqlCommand cmd = new SqlCommand("[sp_GAM_UsersGet]");
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@uid", _uid);
             cmd.Parameters.AddWithValue("@domain", domain);
             DataTable dt = sqldb.getDataTableWithCmd(ref cmd);
             cmd.Dispose();
             if (dt.Rows.Count == 1)
             {
                 DataRow row = dt.Rows[0];
                 isActive = (bool)row["isActive"];
                 isAdmin = (bool)row["isAdmin"];
                 if (row["uGroup"].ToString().ToLower() == "admin")
                     isAdmin = true;
                 managerId = (int)row["managerId"];
                 isSale = (bool)row["isSales"];
                 isReportViewer = (bool)row["isReportViewer"];
                 sysUserId = (int)row["sysUserId"];
                 _isDbUser = true;
             }
         }
         userName = ldap.name;
         emailAddress = ldap.email;
         jobTitle = ldap.title;
         fax = ldap.fax;
         tel = ldap.tel;
         department = ldap.department;
     }
     else
     {
         _uid = "";
         msg = "User not found.";
     }
     ldap.Dispose();
 }