public activedirectory(String ad, String val, Boolean LogUser, DataType dt)
        {
            //private string _addomain = @"LDAP://HSI";
            dRequest      = new dRequest();
            dApp          = new List <dApprover>();
            this.ADDomain = ad;

            switch (dt)
            {
            case DataType.Email:
                GetADData("(&(objectCategory=User)(mail=" + val + "))", LogUser, val);
                break;

            case DataType.NTID:
                GetADData("(&(objectCategory=User)(mail=" + GetEmailFromAD(val) + "))", LogUser, val);
                break;
            }


            //if (dt == DataType.Email)

            //else
        }
Exemplo n.º 2
0
        private void UploadFiles(dRequest nu)
        {
            Boolean rtn = false;

            SqlConnection cn = new System.Data.SqlClient.SqlConnection(db);
            SqlCommand    cmd;
            String        filename = String.Empty;
            String        sDir     = String.Empty;

            try
            {
                cn.Open();

                sDir = Server.MapPath("Storage") + @"\" + nu.PIRID + @"\";


                if (Directory.Exists(sDir) == false)
                {
                    Directory.CreateDirectory(sDir);
                }
                else
                {
                    foreach (String f in Directory.GetFiles(sDir))
                    {
                        File.Delete(f);
                    }
                }

                String[] ar = hdFiles.Value.ToString().Split(',');

                foreach (String x in ar)
                {
                    //cmd = new System.Data.SqlClient.SqlCommand("cmr_InsertFile", cn);
                    // cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@cmr_id", nu.CMRID);
                    // cmd.Parameters.AddWithValue("@file_name", x);


                    // byte[] imageBytes = System.IO.File.ReadAllBytes(Path.Combine(Server.MapPath("Storage"), x));
                    //cmd.Parameters.AddWithValue("@file_data", imageBytes);

                    // cmd.ExecuteNonQuery();


                    File.Move(Path.Combine(Server.MapPath("Storage"), x), Path.Combine(sDir, x));

                    //if (File.Exists(filename))
                    //    File.Delete(filename);
                }



                rtn = true;
            }
            catch (SqlException ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Error", "$('#ErrorBody').html(\"" + HttpUtility.HtmlEncode(ex.Message).Replace("\r\n", "") + "\");$('#bsModalError').modal('show');", true);
            }
            catch (IOException ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Error", "$('#ErrorBody').html(\"" + HttpUtility.HtmlEncode(ex.Message).Replace("\r\n", "") + "\");$('#bsModalError').modal('show');", true);
            }
            finally
            {
                if (cn.State == ConnectionState.Open)
                {
                    cn.Close();
                }
            }

            //return rtn;
        }