public override void Start()
 {
     try
     { 
         if (base.m_ItemsSelecteds.Count > 0)
         {
             using (ISession Sesion = m_SessionFactory.OpenSession())
             {
                 Collection ObjectsFlow = new Collection();
                 foreach (String ID in base.m_ItemsSelecteds)
                 {
                     Parent Entity = (Parent)Sesion.Get(base.m_EntidadSF.NombreClase, ID);
                     Entity.NewInstance = false;
                     ObjectsFlow.Add(Entity);
                 }
                 base.m_ObjectFlow = ObjectsFlow;
                 base.m_ResultProcess = EnumResult.SUCESS;
             }
         }
     }
     catch (Exception ex)
     {
         base.m_ResultProcess = EnumResult.ERROR;
         SoftException.Control(ex);
     }
     base.Start();
 }
        public void AddAfterNoKey()
        {
            Collection c;

            c = new Collection ();

            c.Add (typeof (int), null, null, 0);
            c.Add (typeof (double), null, null, 1);
            c.Add (typeof (string), null, null, 1);
            c.Add (typeof (object), null, null, 3);

            Assert.AreEqual (4, c.Count, "#AANK01");
            Assert.AreEqual (typeof (object), c[4], "#AANK02");
            Assert.AreEqual (typeof (int), c[1], "#AANK03");
            Assert.AreEqual (typeof (string), c[2], "#AANK04");
        }
        public void AddAfterKey()
        {
            Collection c;

            c = new Collection ();

            c.Add ("Baseball", "Base", null, 0);
            c.Add ("Football", "Foot", null, 1);
            c.Add ("Basketball", "Basket", null, 1);
            c.Add ("Volleyball", "Volley", null, 2);

            Assert.AreEqual (4, c.Count, "#AAK01");
            Assert.AreEqual ("Baseball", c[1], "#AAK02");
            Assert.AreEqual ("Football", c[4], "#AAK03");
            Assert.AreEqual ("Basketball", c["Basket"], "#AAK04");
            Assert.AreEqual ("Volleyball", c["Volley"], "#AAK05");
        }
Exemple #4
0
        public Line_Kit Add(string Kit_Item, string Kit_Item_Desc, float Kit_Item_Qty, float Kit_Item_Base, float Kit_Item_Fraction, float Kit_Item_Allocate, string Kit_Item_Serial, K_Charges K_Charges, string sKey)
        {
            Line_Kit returnValue = default(Line_Kit);

            //create a new object
            Line_Kit objNewMember = default(Line_Kit);

            objNewMember = new Line_Kit();


            //set the properties passed into the method
            objNewMember.K_Charges = K_Charges;

            objNewMember.Kit_Item          = Kit_Item;
            objNewMember.Kit_Item_Desc     = System.Convert.ToString((Information.IsDBNull(Kit_Item_Desc)) ? "" : Kit_Item_Desc);
            objNewMember.Kit_Item_Base     = Kit_Item_Base;
            objNewMember.Kit_Item_Fraction = Kit_Item_Fraction;
            objNewMember.Kit_Item_Allocate = Kit_Item_Allocate;
            objNewMember.Kit_Item_Serial   = System.Convert.ToString((Information.IsDBNull(Kit_Item_Serial)) ? "" : Kit_Item_Serial);
            objNewMember.Kit_Item_Qty      = Kit_Item_Qty;

            if (sKey.Length == 0)
            {
                mCol.Add(objNewMember, null, null, null);
            }
            else
            {
                mCol.Add(objNewMember, sKey, null, null);
            }


            //return the object created
            returnValue  = objNewMember;
            objNewMember = null;


            return(returnValue);
        }
        public static void fncDividirpermisos(string xstrPermisos)
        {
            gcolPermisos.Clear();
            string[] strParte1 = xstrPermisos.Split(';');
            //string[] strParte2=new string[];
            int intIndex;

            //strParte1 = xstrPermisos.Split(';');
            for (intIndex = 0; intIndex <= strParte1.GetUpperBound(0) - 1; intIndex++)
            {
                string[] strParte2 = strParte1[intIndex].Split(',');
                gcolPermisos.Add(strParte2[1], strParte2[0]);
            }
        }
Exemple #6
0
        public static Collection GetUserGroups(string _persalnumber)
        {
            string usr             = FTPUser.GetMasterUser();
            string pwd             = FTPUser.GetMasterPwd();
            string get_ldap_string = FTPUser.GetAppOUContext();
            string ldapstring      = "LDAP://" + FTPUser.GetIPaddressString() + "/CN=FTP_ACCESS," + get_ldap_string;

            DirectoryEntry dsDirectoryEntry = new DirectoryEntry(ldapstring, usr, pwd);

            int    bytCounter = 0;
            string strGroups  = null;

            Microsoft.VisualBasic.Collection UserGroups = new Microsoft.VisualBasic.Collection();
            StringBuilder     sbUserGroups = new StringBuilder();
            DirectorySearcher dsSearcher   = new DirectorySearcher(dsDirectoryEntry);

            dsSearcher.PropertiesToLoad.Add("memberOf");

            try
            {
                SearchResult dsResult = dsSearcher.FindOne();
                if (dsResult == null)
                {
                    return(null);
                }
                for (bytCounter = 0; bytCounter <= (dsResult.Properties["memberOf"].Count - 1); bytCounter++)
                {
                    strGroups = dsResult.Properties["memberOf"][0].ToString();
                    UserGroups.Add(strGroups);
                }
            }
            catch (Exception)
            {
            }
            return(UserGroups);
        }
        public void GetEnumerator()
        {
            Collection c;
            IEnumerator e;
            object[] o = new object[4] {typeof(int),
                                           typeof(double), typeof(string), typeof(object)};
            int i = 0;

            c = new Collection ();

            c.Add (typeof (int), null, null, null);
            c.Add (typeof (double), null, null, null);
            c.Add (typeof (string), null, null, null);
            c.Add (typeof (object), null, null, null);

            e = c.GetEnumerator ();

            Assert.IsNotNull (e, "#GE01");

            while (e.MoveNext ())
            {
                Assert.AreEqual (o[i], e.Current, "#GE02." + i.ToString ());
                i++;
            }

            e.Reset ();
            e.MoveNext ();

            Assert.AreEqual (o[0], e.Current, "#GE03");
        }
        public void Dirty_Read()
        {
            Collection col = new Collection();

            string s = "abc";

            col.Add(s,null,null,null);
            col.Add(s,null,null,null);
            col.Add(s,null,null,null);
            col.Add(s,null,null,null);

            object o = col["abc"];
        }
        public void Count_1()
        {
            Collection col = new Collection();

            Assert.AreEqual(0,col.Count);

            col.Add("a",null,null,null);
            Assert.AreEqual(1,col.Count);

            col.Add("b",null,null,null);
            Assert.AreEqual(2,col.Count);

            col.Add("c",null,null,null);
            Assert.AreEqual(3,col.Count);

            col.Add("d",null,null,null);
            Assert.AreEqual(4,col.Count);

            col.Remove(1);
            col.Remove(1);

            Assert.AreEqual(2,col.Count);

            col.Remove(1);
            col.Remove(1);

            Assert.AreEqual(0,col.Count);
        }
        public void Add_Key_1()
        {
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";
            string s3 = "c";

            col.Add(s2,"key2",null,null);
            col.Add(s1,"key3",null,null);
            col.Add(s3,"key1",null,null);

            Assert.AreEqual(3,col.Count);
            Assert.AreEqual(s2,col[1]);
            Assert.AreEqual(s1,col[2]);
            Assert.AreEqual(s3,col[3]);

            Assert.AreEqual(s1,col["key3"]);
            Assert.AreEqual(s2,col["key2"]);
            Assert.AreEqual(s3,col["key1"]);
        }
        public void Add_Before_3()
        {
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";
            string s3 = "c";
            string s4 = "d";

            col.Add(s1,"key4",null,null);
            col.Add(s2,"key3",1,null);
            col.Add(s4,null,"key3",null);
            col.Add(s3,null,1,null);

            Assert.AreEqual(4,col.Count);
            Assert.AreEqual(s3,col[1]);
            Assert.AreEqual(s4,col[2]);
            Assert.AreEqual(s2,col[3]);
            Assert.AreEqual(s1,col[4]);
        }
Exemple #12
0
        /// <summary>
        /// Sorts the collection.
        /// </summary>
        /// <param name="col">The col.</param>
        /// <param name="psSortPropertyName">Name of the ps sort property.</param>
        /// <param name="pbAscending">if set to <c>true</c> [pb ascending].</param>
        /// <param name="psKeyPropertyName">Name of the ps key property.</param>
        private void SortCollection(Microsoft.VisualBasic.Collection col, string psSortPropertyName, bool pbAscending, string psKeyPropertyName = "")
        {
            object obj            = null;
            int    i              = 0;
            int    j              = 0;
            int    iMinMaxIndex   = 0;
            object vMinMax        = null;
            object vValue         = null;
            bool   bSortCondition = false;
            bool   bUseKey        = false;
            string sKey           = null;

            bUseKey = (!string.IsNullOrEmpty(psKeyPropertyName));

//INSTANT C# NOTE: The ending condition of VB 'For' loops is tested only on entry to the loop. Instant C# has created a temporary variable in order to use the initial value of col.Count for every iteration:
            int tempVar = col.Count;

            for (i = 1; i < tempVar; i++)
            {
                obj          = col[i];
                vMinMax      = Interaction.CallByName(obj, psSortPropertyName, Microsoft.VisualBasic.Constants.vbGet);
                iMinMaxIndex = i;

                for (j = i + 1; j <= col.Count; j++)
                {
                    obj    = col[j];
                    vValue = Interaction.CallByName(obj, psSortPropertyName, Microsoft.VisualBasic.Constants.vbGet);

                    if (pbAscending)
                    {
                        bSortCondition = (Convert.ToSingle(vValue) < Convert.ToSingle(vMinMax));
                    }
                    else
                    {
                        bSortCondition = (Convert.ToSingle(vValue) > Convert.ToSingle(vMinMax));
                    }

                    if (bSortCondition)
                    {
                        vMinMax      = vValue;
                        iMinMaxIndex = j;
                    }

                    obj = null;
                }

                if (iMinMaxIndex != i)
                {
                    obj = col[iMinMaxIndex];

                    col.Remove(iMinMaxIndex);
                    if (bUseKey)
                    {
                        sKey = Convert.ToString(Interaction.CallByName(obj, psKeyPropertyName, Microsoft.VisualBasic.Constants.vbGet));
                        col.Add(obj, sKey, i, null);
                    }
                    else
                    {
                        col.Add(obj, null, i, null);
                    }

                    obj = null;
                }

                obj = null;
            }
        }
        public void Add_2()
        {
            Collection col = new Collection();

            Byte o1 = 1;
            short o2 = 1;
            int o3 = 1;
            long o4 = 1000;
            Single o5 = 1.1F;
            Double o6 = 2.2;
            Decimal o7 = 1000;
            String o8 = "abc";
            Object o9 = null;
            bool o10 = true;
            Char o11 = 'c';
            DateTime o12 = DateTime.Parse("5/31/1993");

            col.Add(o1,null,null,null);
            col.Add(o2,null,null,null);
            col.Add(o3,null,null,null);
            col.Add(o4,null,null,null);
            col.Add(o5,null,null,null);
            col.Add(o6,null,null,null);
            col.Add(o7,null,null,null);
            col.Add(o8,null,null,null);
            col.Add(o9,null,null,null);
            col.Add(o10,null,null,null);
            col.Add(o11,null,null,null);
            col.Add(o12,null,null,null);

            Assert.AreEqual(12,col.Count);
            Assert.AreEqual(o1,col[1]);
            Assert.AreEqual(o2,col[2]);
            Assert.AreEqual(o3,col[3]);
            Assert.AreEqual(o4,col[4]);
            Assert.AreEqual(o5,col[5]);
            Assert.AreEqual(o6,col[6]);
            Assert.AreEqual(o7,col[7]);
            Assert.AreEqual(o8,col[8]);
            Assert.AreEqual(o9,col[9]);
            Assert.AreEqual(o10,col[10]);
            Assert.AreEqual(o11,col[11]);
            Assert.AreEqual(o12,col[12]);
        }
        public void Index_9()
        {
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";

            col.Add(s1,"key1",null,null);
            col.Add(s2,"key2",null,null);

            System.Collections.IList il = (System.Collections.IList)col;

            il[0] = "q";
            il[1] = "r";

            object o = il[1];
        }
Exemple #15
0
    public static void Create_Snapshot()
    {
        object authenticate = null;
        object mvarsError   = null;
        object memberOF     = null;
        object mstr         = null;
        object f            = null;
        //oCont)
        string appstr        = null;
        string govstr        = null;
        string strc          = null;
        string strDepartment = null;

        ActiveDs.IADsUser         oUser      = default(ActiveDs.IADsUser);
        ActiveDs.IADsContainer    oContainer = default(ActiveDs.IADsContainer);
        ActiveDs.IADsOpenDSObject dso        = default(ActiveDs.IADsOpenDSObject);
        string xas  = null;
        string appl = null;

        string[] a         = null;
        string[] temparray = null;
        string   tempstr   = null;

        string[] aGovernment    = null;
        object   entry          = null;
        int      temporaryDate2 = 0;
        int      date2          = 0;
        int      i       = 0;
        int      y       = 0;
        int      mcount  = 0;
        object   mmax    = null;
        string   strApps = null;
        string   strGovt = null;
        int      UCount  = 0;

        Microsoft.VisualBasic.Collection colGovernment   = new Microsoft.VisualBasic.Collection();
        Microsoft.VisualBasic.Collection colApplications = new Microsoft.VisualBasic.Collection();
        string        memberOFS = "";
        SqlConnection cnVIP_EXP = new SqlConnection();

        cnVIP_EXP.ConnectionString = My.Settings.VIP_EXPANDEDConnectionString;

        SqlConnection cnADS2 = new SqlConnection();
        SqlConnection cnADS  = new SqlConnection();

        cnADS.ConnectionString  = My.Settings.AdsConnectionString;
        cnADS2.ConnectionString = My.Settings.AdsConnectionString;

        SqlCommand cmdADS2 = new SqlCommand("AD_SNAPSHOT_ALL_INSERT", cnADS);
        SqlCommand cmdADS3 = new SqlCommand("AD_SNAPSHOT_ALL_DELETE_ALL", cnADS);
        SqlCommand cmdADS4 = new SqlCommand("GetPROVDescription", cnADS2);
        SqlCommand cmdADS5 = new SqlCommand("GetSNAMEDept", cnADS2);

        cmdADS2.CommandType = CommandType.StoredProcedure;
        cmdADS3.CommandType = CommandType.StoredProcedure;
        cmdADS4.CommandType = CommandType.StoredProcedure;
        cmdADS5.CommandType = CommandType.StoredProcedure;

        SqlParameter pUCount          = new SqlParameter("@UCount", SqlDbType.BigInt);
        SqlParameter pPersalnr        = new SqlParameter("@PersalNr", SqlDbType.VarChar, 8);
        SqlParameter pAccountNr       = new SqlParameter("@AccountNr", SqlDbType.VarChar, 9);
        SqlParameter pNatProv         = new SqlParameter("@NatProv ", SqlDbType.VarChar, 20);
        SqlParameter pVote            = new SqlParameter("@Vote", SqlDbType.VarChar, 55);
        SqlParameter pDeptCode        = new SqlParameter("@DeptCode", SqlDbType.VarChar, 9);
        SqlParameter pEMail           = new SqlParameter("@EMail", SqlDbType.VarChar, 150);
        SqlParameter pCell            = new SqlParameter("@Cell", SqlDbType.VarChar, 20);
        SqlParameter pPhone           = new SqlParameter("@Phone", SqlDbType.VarChar, 20);
        SqlParameter pFirstName       = new SqlParameter("@FirstName", SqlDbType.VarChar, 20);
        SqlParameter pLastname        = new SqlParameter("@Lastname", SqlDbType.VarChar, 40);
        SqlParameter pApplMember      = new SqlParameter("@ApplMember", SqlDbType.VarChar, 500);
        SqlParameter pDeptMember      = new SqlParameter("@DeptMember", SqlDbType.VarChar, 4000);
        SqlParameter pDepartment      = new SqlParameter("@Department", SqlDbType.VarChar, 10);
        SqlParameter pAccountDisabled = new SqlParameter("@AccountDisabled", SqlDbType.SmallInt);
        SqlParameter pLOGIS           = new SqlParameter("@LOGIS", SqlDbType.SmallInt);
        SqlParameter pHR         = new SqlParameter("@HR", SqlDbType.SmallInt);
        SqlParameter pFINANCIALS = new SqlParameter("@FINANCIALS", SqlDbType.SmallInt);
        SqlParameter pGFS        = new SqlParameter("@GFS", SqlDbType.SmallInt);
        SqlParameter pDPSA       = new SqlParameter("@DPSA", SqlDbType.SmallInt);
        SqlParameter pSNAME      = new SqlParameter("@SNAME", SqlDbType.VarChar, 9);

        ClsCrypto enc = new ClsCrypto();

        dso        = Interaction.GetObject("LDAP:");
        oContainer = dso.OpenDSObject("LDAP://" + My.Settings.IP_ADDRESS_PRD + "/" + My.Settings.AD_USERS_PRD, My.Settings.ADSMasterUsername_PRD, enc.Dekodeer128(My.Settings.ADSMasterPassword_PRD.ToString), 0);
        cnADS.Open();
        cmdADS3.ExecuteNonQuery();

        foreach (oUser in oContainer)
        {
            UCount       += 1;
            pUCount.Value = UCount;
            mcount        = mcount + 1;
            switch (Strings.LCase(oUser.Class))
            {
            case "user":

                if ((Strings.Trim(oUser.SAMaccountname) != null))
                {
                    frmMain.tsADPosition.Text = oUser.samaccountname;
                    pSNAME.Value = oUser.Department.ToLower.ToString.Trim + "";
                    cmdADS5.Parameters.Add(pSNAME);
                    cnADS2.Open();
                    pVote.Value = cmdADS5.ExecuteScalar().ToString() + "";
                    cnADS2.Close();
                    cmdADS5.Parameters.Remove(pSNAME);

                    // ERROR: Not supported in C#: OnErrorStatement

                    pAccountNr.Value = oUser.SAMaccountname.ToString.Trim + "";
                    cmdADS4.Parameters.Add(pSNAME);
                    cnADS2.Open();
                    pNatProv.Value = cmdADS4.ExecuteScalar().ToString() + "";
                    cnADS2.Close();
                    cmdADS4.Parameters.Remove(pSNAME);

                    pDeptCode.Value = pSNAME.Value + "";

                    if (Information.IsDBNull(Strings.Trim(oUser.EmailAddress)))
                    {
                        pEMail.Value = "No Email";
                    }
                    else
                    {
                        pEMail.Value = oUser.EmailAddress.ToLower.Trim + "";
                    }

                    if (Information.IsDBNull(Convert.ToString(oUser.TelephoneMobile)) | (oUser.TelephoneMobile == null))
                    {
                        pCell.Value = "No Mobile";
                    }
                    else
                    {
                        pCell.Value = Strings.Replace(Strings.Replace(Convert.ToString(oUser.TelephoneMobile), "(", ""), ")", "");
                    }

                    if (Information.IsDBNull(Convert.ToString(oUser.TelephoneNumber)))
                    {
                        pPhone.Value = "No TelephoneNumber";
                    }
                    else
                    {
                        pPhone.Value = Strings.Replace(Strings.Replace(oUser.TelephoneNumber.ToString, "(", ""), ")", "") + "";
                    }

                    if (Information.IsDBNull(oUser.FirstName))
                    {
                        pFirstName.Value = "No Firstname";
                    }
                    else
                    {
                        pFirstName.Value = oUser.FirstName.Trim + "";
                    }

                    if (Information.IsDBNull(oUser.LastName))
                    {
                        pLastname.Value = "No LastName";
                    }
                    else
                    {
                        pLastname.Value = oUser.LastName.Trim + "";
                    }

                    memberOF = oUser.GetEx("MemberOf");

                    if (Err().Number == -2147463155)
                    {
                        colApplications.Add("INVALID USER");
                        colGovernment.Add("INVALID USER");
                        pLOGIS.Value      = 0;
                        pDPSA.Value       = 0;
                        pGFS.Value        = 0;
                        pHR.Value         = 0;
                        pFINANCIALS.Value = 0;
                    }
                    else
                    {
                        // Start with the new structure.
                        memberOFS = "";

                        foreach (object entry_loopVariable in memberOF)
                        {
                            entry = entry_loopVariable;
                            //Clear collections

                            if ((Strings.InStr(1, Strings.UCase(entry), "GOVERNMENT") > 0 | Strings.InStr(1, Strings.UCase(entry), "VUL TS USERS") > 0 | Strings.InStr(1, Strings.UCase(entry), "APPLICATION") > 0) & Strings.InStr(1, Strings.UCase(entry), "CN=") > 0)
                            {
                                entry = Strings.Replace(Strings.Replace(entry, "OU=", ""), "CN=", "");

                                temparray = Strings.Split(entry, ",");
                                tempstr   = Strings.Replace(temparray[0], "_ACCESS_ALL", "");
                                tempstr   = Strings.Replace(tempstr, "_ALL_ACCESS", "");
                                tempstr   = Strings.Replace(tempstr, "_SEC32", "");

                                if (Strings.InStr(1, Strings.UCase(entry), "GOVERNMENT") > 0)
                                {
                                    colGovernment.Add(tempstr);
                                }
                                else if (Strings.InStr(1, Strings.UCase(entry), "APPLICATION") > 0 | Strings.InStr(1, Strings.UCase(entry), "VUL TS USERS") > 0)
                                {
                                    memberOFS = memberOFS + " " + tempstr + "";
                                    colApplications.Add(tempstr);
                                }
                            }
                        }

                        pLOGIS.Value      = (Strings.InStr(1, memberOFS, "LOGIS.") > 0 ? 1 : 0);
                        pDPSA.Value       = (Strings.InStr(1, memberOFS, "DPSA.") > 0 ? 1 : 0);
                        pGFS.Value        = (Strings.InStr(1, memberOFS, "GFS.") > 0 ? 1 : 0);
                        pHR.Value         = (Strings.InStr(1, memberOFS, "HR.") > 0 ? 1 : 0);
                        pFINANCIALS.Value = (Strings.InStr(1, memberOFS, "FINANCIALS.") > 0 ? 1 : 0);
                    }

                    strApps = "";
                    for (y = 1; y <= colApplications.Count(); y++)
                    {
                        if (Strings.Len(strApps) == 0)
                        {
                            strApps = colApplications[y];
                        }
                        else
                        {
                            strApps = strApps + "," + colApplications[y] + "";
                        }
                    }

                    if (Strings.Len(Strings.Trim(strApps)) == 0)
                    {
                        strApps = "INVALID USER";
                    }
                    pApplMember.Value = strApps;

                    strGovt = "";
                    for (y = 1; y <= colGovernment.Count(); y++)
                    {
                        if (Strings.Len(strGovt) == 0)
                        {
                            strGovt = colGovernment[y];
                        }
                        else
                        {
                            strGovt = strGovt + "," + colGovernment[y] + "";
                        }
                    }
                    pDeptMember.Value = strGovt;
                    strDepartment     = "";
                    strDepartment     = oUser.Department + "";
                    if (Strings.Len(Strings.Trim(strDepartment)) == 0)
                    {
                        pDepartment.Value = "No Department";
                    }
                    else
                    {
                        pDepartment.Value = oUser.Department + "";
                    }
                    if ((Convert.ToString(oUser.AccountDisabled)).ToUpper().Trim() == "TRUE")
                    {
                        pAccountDisabled.Value = 1;
                    }
                    else
                    {
                        pAccountDisabled.Value = 0;
                    }
                    //pAccountDisabled.Value = CStr(oUser.AccountDisabled)

                    cmdADS2.Parameters.Add(pAccountNr);
                    cmdADS2.Parameters.Add(pNatProv);
                    cmdADS2.Parameters.Add(pVote);
                    cmdADS2.Parameters.Add(pDeptCode);
                    cmdADS2.Parameters.Add(pEMail);
                    cmdADS2.Parameters.Add(pCell);
                    cmdADS2.Parameters.Add(pPhone);
                    cmdADS2.Parameters.Add(pFirstName);
                    cmdADS2.Parameters.Add(pLastname);
                    cmdADS2.Parameters.Add(pApplMember);
                    cmdADS2.Parameters.Add(pDeptMember);
                    cmdADS2.Parameters.Add(pDepartment);
                    cmdADS2.Parameters.Add(pAccountDisabled);
                    cmdADS2.Parameters.Add(pLOGIS);
                    cmdADS2.Parameters.Add(pHR);
                    cmdADS2.Parameters.Add(pFINANCIALS);
                    cmdADS2.Parameters.Add(pGFS);
                    cmdADS2.Parameters.Add(pDPSA);
                    cmdADS2.Parameters.Add(pUCount);
                    //cmdADS2.Parameters.Add(pAccCreated)
                    //cmdADS2.Parameters.Add(pAccModified)


                    //**************************

                    cmdADS2.ExecuteNonQuery();

                    //**************************
                    cmdADS2.Parameters.Remove(pAccountNr);
                    cmdADS2.Parameters.Remove(pNatProv);
                    cmdADS2.Parameters.Remove(pVote);
                    cmdADS2.Parameters.Remove(pDeptCode);
                    cmdADS2.Parameters.Remove(pEMail);
                    cmdADS2.Parameters.Remove(pCell);
                    cmdADS2.Parameters.Remove(pPhone);
                    cmdADS2.Parameters.Remove(pFirstName);
                    cmdADS2.Parameters.Remove(pLastname);
                    cmdADS2.Parameters.Remove(pApplMember);
                    cmdADS2.Parameters.Remove(pDeptMember);
                    cmdADS2.Parameters.Remove(pDepartment);
                    cmdADS2.Parameters.Remove(pAccountDisabled);
                    cmdADS2.Parameters.Remove(pLOGIS);
                    cmdADS2.Parameters.Remove(pHR);
                    cmdADS2.Parameters.Remove(pFINANCIALS);
                    cmdADS2.Parameters.Remove(pGFS);
                    cmdADS2.Parameters.Remove(pDPSA);

                    colGovernment.Clear();
                    colApplications.Clear();
                }

                break;
            }

            Err().Clear();
        }

        frmMain.tsADPosition.Text = "";
CloseMe:

        goto cleanup;
err_handler:

        mvarsError = "{ADS4.authenticate} authenticate: (" + Err().Number + ") " + Err().Description;
        Err().Clear();
        authenticate = false;
cleanup:

        oUser           = null;
        memberOF        = null;
        oContainer      = null;
        oUser           = null;
        dso             = null;
        colGovernment   = null;
        colApplications = null;
        cnADS.Close();
        cnADS = null;
    }
        public void GetEnumerator_10()
        {
            Collection col = new Collection();

            Byte o1 = 1;
            short o2 = 1;
            int o3 = 1;
            long o4 = 1000;

            col.Add(o1,null,null,null);
            col.Add(o2,null,null,null);
            col.Add(o3,null,null,null);

            IEnumerator en = col.GetEnumerator();

            col.Add(o4,null,1,null);

            en.MoveNext();

            Assert.AreEqual(o4,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o1,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o2,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o3,en.Current);
            Assert.IsFalse(en.MoveNext());
            Assert.AreEqual(null,en.Current);

            col.Add(o4,null,null,null);

            Assert.AreEqual(null,en.Current);
            Assert.IsFalse(en.MoveNext());
        }
        public void AddBeforeKey()
        {
            Collection c;

            c = new Collection ();

            c.Add ("Baseball", "Base", null, null);
            c.Add ("Football", "Foot", 1, null);
            c.Add ("Basketball", "Basket", 1, null);
            c.Add ("Volleyball", "Volley", 3, null);

            Assert.AreEqual (4, c.Count, "#ABK01");
            Assert.AreEqual ("Basketball", c[1], "#ABK02");
            Assert.AreEqual ("Baseball", c[4], "#ABK03");
            Assert.AreEqual ("Volleyball", c["Volley"], "#ABK04");
            Assert.AreEqual ("Football", c["Foot"], "#ABK05");
        }
        public void RemoveKey()
        {
            Collection c;

            c = new Collection ();

            c.Add ("Baseball", "Base", null, null);
            c.Add ("Football", "Foot", null, null);
            c.Add ("Basketball", "Basket", null, null);
            c.Add ("Volleyball", "Volley", null, null);

            Assert.AreEqual (4, c.Count, "#RK01");

            c.Remove ("Foot");

            Assert.AreEqual (3, c.Count, "#RK02");
            Assert.AreEqual ("Basketball", c["Basket"], "#RK03");

            // Collection class is 1-based
            Assert.AreEqual ("Volleyball", c[3], "#RK04");

            c.Remove ("Base");

            Assert.AreEqual (2, c.Count, "#RK05");
            Assert.AreEqual ("Basketball", c[1], "#RK06");
            Assert.AreEqual ("Volleyball", c["Volley"], "#RK07");

            c.Remove (2);

            Assert.AreEqual (1, c.Count, "#RK08");
            Assert.AreEqual ("Basketball", c[1], "#RK09");
            Assert.AreEqual ("Basketball", c["Basket"], "#RK10");

            c.Remove (1);

            Assert.AreEqual (0, c.Count, "#RK11");
        }
        public void Add_After_1()
        {
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";
            string s3 = "c";
            string s4 = "d";

            col.Add(s1,null,null,null);
            col.Add(s2,null,null,1);
            col.Add(s3,null,null,2);
            col.Add(s4,null,null,1);

            Assert.AreEqual(4,col.Count);
            Assert.AreEqual(s1,col[1]);
            Assert.AreEqual(s4,col[2]);
            Assert.AreEqual(s2,col[3]);
            Assert.AreEqual(s3,col[4]);
        }
        public void RemoveNoKey()
        {
            Collection c;

            c = new Collection ();

            c.Add (typeof (int), null, null, null);
            c.Add (typeof (double), null, null, null);
            c.Add (typeof (string), null, null, null);
            c.Add (typeof (object), null, null, null);

            Assert.AreEqual (4, c.Count, "#RNK01");

            c.Remove (3);

            Assert.AreEqual (3, c.Count, "#RNK02");

            // Collection class is 1-based
            Assert.AreEqual (typeof (object), c[3], "#RNK03");

            c.Remove (1);

            Assert.AreEqual (2, c.Count, "#RNK04");
            Assert.AreEqual (typeof (double), c[1], "#RNK05");
            Assert.AreEqual (typeof (object), c[2], "#RNK06");

            c.Remove (2);

            Assert.AreEqual (1, c.Count, "#RNK07");
            Assert.AreEqual (typeof (double), c[1], "#RNK08");

            c.Remove (1);

            Assert.AreEqual (0, c.Count, "#RNK09");
        }
        public void Add_Before_4()
        {
            // Specified argument was out of the range of valid values.
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";

            col.Add(s1,"key1",null,null);
            col.Add(s2,"key2",2,null);

            Assert.AreEqual(2,col.Count);
            Assert.AreEqual(s1,col[1]);
            Assert.AreEqual(s2,col[2]);
        }
        public void Remove_1()
        {
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";
            string s3 = "c";

            col.Add(s2,null,null,null);
            col.Add(s1,null,null,null);
            col.Add(s3,null,null,null);
            col.Add(s2 + s1,null,null,null);
            col.Add(s1 + s1,null,null,null);
            col.Add(s3 + s1,null,null,null);

            col.Remove(1);

            Assert.AreEqual(5,col.Count);
            Assert.AreEqual("a",col[1]);
            Assert.AreEqual("c",col[2]);
            Assert.AreEqual("ba",col[3]);
            Assert.AreEqual("aa",col[4]);
            Assert.AreEqual("ca",col[5]);

            col.Remove(3);

            Assert.AreEqual(4,col.Count);
            Assert.AreEqual("a",col[1]);
            Assert.AreEqual("c",col[2]);
            Assert.AreEqual("aa",col[3]);
            Assert.AreEqual("ca",col[4]);

            col.Remove(4);

            Assert.AreEqual(3,col.Count);
            Assert.AreEqual("a",col[1]);
            Assert.AreEqual("c",col[2]);
            Assert.AreEqual("aa",col[3]);

            col.Remove(2);

            Assert.AreEqual(2,col.Count);
            Assert.AreEqual("a",col[1]);
            Assert.AreEqual("aa",col[2]);

            col.Remove(1);

            Assert.AreEqual(1,col.Count);
            Assert.AreEqual("aa",col[1]);

            col.Remove(1);

            Assert.AreEqual(0,col.Count);
        }
        public void Add_Key_2()
        {
            // Add failed. Duplicate key value supplied.
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";

            col.Add(s2,"key",null,null);
            col.Add(s1,"key",null,null);
        }
        public void Remove_2()
        {
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";
            string s3 = "c";

            col.Add(s2,"keya",null,null);
            col.Add(s1,"keyb",null,null);
            col.Add(s3,"keyc",null,null);
            col.Add(s2 + s1,"keyd",null,null);
            col.Add(s1 + s1,"keye",null,null);
            col.Add(s3 + s1,"keyf",null,null);

            col.Remove("keya");

            Assert.AreEqual(5,col.Count);
            Assert.AreEqual("a",col[1]);
            Assert.AreEqual("c",col[2]);
            Assert.AreEqual("ba",col[3]);
            Assert.AreEqual("aa",col[4]);
            Assert.AreEqual("ca",col[5]);

            col.Remove("keyd");

            Assert.AreEqual(4,col.Count);
            Assert.AreEqual("a",col[1]);
            Assert.AreEqual("c",col[2]);
            Assert.AreEqual("aa",col[3]);
            Assert.AreEqual("ca",col[4]);

            col.Remove("keyf");

            Assert.AreEqual(3,col.Count);
            Assert.AreEqual("a",col[1]);
            Assert.AreEqual("c",col[2]);
            Assert.AreEqual("aa",col[3]);

            col.Remove("keyc");

            Assert.AreEqual(2,col.Count);
            Assert.AreEqual("a",col[1]);
            Assert.AreEqual("aa",col[2]);

            col.Remove("keyb");

            Assert.AreEqual(1,col.Count);
            Assert.AreEqual("aa",col[1]);

            col.Remove("keye");

            Assert.AreEqual(0,col.Count);
        }
        public void Remove_5()
        {
            // Collection index must be in the range 1 to the size of the collection.
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";
            string s3 = "c";

            col.Add(s2,"keya",null,null);
            col.Add(s1,"keyb",null,null);
            col.Add(s3,"keyc",null,null);

            col.Remove(4);
        }
        public void Remove_6()
        {
            // Argument 'Key' is not a valid value.
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";
            string s3 = "c";

            col.Add(s2,"keya",null,null);
            col.Add(s1,"keyb",null,null);
            col.Add(s3,"keyc",null,null);

            col.Remove("keyd");
        }
        public void Exception()
        {
            Collection c = new Collection ();

            try
            {
                // nothing in Collection yet
                object o = c[0];
                Assert.Fail ("#E02");
            }
            catch (IndexOutOfRangeException)
            {
            }

            c.Add ("Baseball", "Base", null, null);
            c.Add ("Football", "Foot", null, null);
            c.Add ("Basketball", "Basket", null, null);
            c.Add ("Volleyball", "Volley", null, null);

            try
            {
                // only 4 elements
                object o = c[5];
                Assert.Fail ("#E04");
            }
            catch (IndexOutOfRangeException)
            {
            }

            try
            {
                // Collection class is 1-based
                object o = c[0];
                Assert.Fail ("#E06");
            }
            catch (IndexOutOfRangeException)
            {
            }

            try
            {
                // no member with Key == "Kick"
                object o = c["Kick"];
                Assert.Fail ("#E08");
            }
            catch (ArgumentException)
            {
                // FIXME
                // VB Language Reference says IndexOutOfRangeException
                // here, but MS throws ArgumentException
            }

            try
            {
                // Even though Indexer is an object, really it's a string
                object o = c[typeof (int)];
                Assert.Fail ("#E10");
            }
            catch (ArgumentException)
            {
            }

            try
            {
                // can't specify both Before and After
                c.Add ("Kickball", "Kick", "Volley", "Foot");
                Assert.Fail ("#E12");
            }
            catch (ArgumentException)
            {
            }

            try
            {
                // Key "Foot" already exists
                c.Add ("Kickball", "Foot", null, null);
                Assert.Fail ("#E14");
            }
            catch (ArgumentException)
            {
            }

            try
            {
                // Even though Before is object, it's really a string
                c.Add ("Dodgeball", "Dodge", typeof (int), null);
                Assert.Fail ("#E16");
            }
            catch (InvalidCastException)
            {
            }

            try
            {
                // Even though After is object, it's really a string
                c.Add ("Wallyball", "Wally", null, typeof (int));
                Assert.Fail ("#E18");
            }
            catch (InvalidCastException)
            {
            }

            try
            {
                // have to pass a legitimate value to remove
                c.Remove (null);
                Assert.Fail ("#E20");
            }
            catch (ArgumentNullException)
            {
            }

            try
            {
                // no Key "Golf" exists
                c.Remove ("Golf");
                Assert.Fail ("#E22");
            }
            catch (ArgumentException)
            {
            }

            try
            {
                // no Index 10 exists
                c.Remove (10);
                Assert.Fail ("#E24");
            }
            catch (IndexOutOfRangeException)
            {
            }

            try
            {
                IEnumerator e = c.GetEnumerator ();

                // Must MoveNext before Current
                object item = e.Current;
                Assert.IsNull (item, "#E25");
            }
            catch (IndexOutOfRangeException)
            {
                Assert.Fail ("#E27");
            }

            try
            {
                IEnumerator e = c.GetEnumerator ();
                e.MoveNext ();

                c.Add ("Paintball", "Paint", null, null);

                // Can't MoveNext if Collection has been modified
                e.MoveNext ();

                // FIXME
                // On-line help says this should throw an error. MS doesn't.
            }
            catch (Exception)
            {
                Assert.Fail ("#E28");
            }

            try
            {
                IEnumerator e = c.GetEnumerator ();
                e.MoveNext ();

                c.Add ("Racketball", "Racket", null, null);

                // Can't Reset if Collection has been modified
                e.Reset ();

                // FIXME
                // On-line help says this should throw an error. MS doesn't.
            }
            catch (InvalidOperationException)
            {
                Assert.Fail ("#E30");
            }
        }
        public void Remove_7()
        {
            // Key cannot be null
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";
            string s3 = "c";

            col.Add(s2,"keya",null,null);
            col.Add(s1,"keyb",null,null);
            col.Add(s3,"keyc",null,null);

            col.Remove(null);
        }
        public void Foreach()
        {
            Collection c;
            object[] o = new object[4] {typeof(int),
                                           typeof(double), typeof(string), typeof(object)};
            int i = 0;

            c = new Collection ();

            c.Add (typeof (int), null, null, null);
            c.Add (typeof (double), null, null, null);
            c.Add (typeof (string), null, null, null);
            c.Add (typeof (object), null, null, null);

            foreach (object item in c)
            {
                Assert.AreEqual (o[i], item, "#fe01." + i.ToString ());
                i++;
            }
        }
        public void Add_3()
        {
            // 'Before' and 'After' arguments cannot be combined.
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";
            string s3 = "c";
            string s4 = "d";

            col.Add(s1,"key1",null,null);
            col.Add(s2,"key2",null,null);
            col.Add(s3,"key3",null,null);
            col.Add(s4,"key4",3,2);
        }
        public void GetEnumerator_1()
        {
            Collection col = new Collection();

            Byte o1 = 1;
            short o2 = 1;
            int o3 = 1;
            long o4 = 1000;
            Single o5 = 1.1F;
            Double o6 = 2.2;
            Decimal o7 = 1000;
            String o8 = "abc";
            Object o9 = null;
            bool o10 = true;
            Char o11 = 'c';
            DateTime o12 = DateTime.Parse("5/31/1993");

            col.Add(o1,null,null,null);
            col.Add(o2,null,null,null);
            col.Add(o3,null,null,null);
            col.Add(o4,null,null,null);
            col.Add(o5,null,null,null);
            col.Add(o6,null,null,null);
            col.Add(o7,null,null,null);
            col.Add(o8,null,null,null);
            col.Add(o9,null,null,null);
            col.Add(o10,null,null,null);
            col.Add(o11,null,null,null);
            col.Add(o12,null,null,null);

            IEnumerator en = col.GetEnumerator();

            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o1,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o2,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o3,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o4,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o5,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o6,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o7,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o8,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o9,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o10,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o11,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o12,en.Current);
            Assert.IsFalse(en.MoveNext());
            Assert.AreEqual(null,en.Current);
        }
        public void Add_7()
        {
            // Specified argument was out of the range of valid values.
            Collection col = new Collection();

            string s1 = "a";
            string s2 = "b";

            col.Add(s1,"key1",null,null);
            col.Add(s2,"key2",null,-1);
        }
        public void GetEnumerator_11()
        {
            Collection col = new Collection();

            Byte o1 = 1;
            short o2 = 1;
            int o3 = 1;

            col.Add(o1,null,null,null);
            col.Add(o2,null,null,null);
            col.Add(o3,null,null,null);

            IEnumerator en = col.GetEnumerator();

            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(o1,en.Current);

            col.Remove(1);

            object o = en.Current;
            Assert.AreEqual (o1, o, "#01");
        }
        public void Add_8()
        {
            Collection col = new Collection();

            Object o1 = null;
            Object o2 = null;
            Object o3 = null;
            Object o4 = null;

            col.Add(o1,null,null,null);
            col.Add(o2,null,null,null);
            col.Add(o3,null,null,null);
            col.Add(o4,null,null,null);

            Assert.AreEqual(4,col.Count);
            Assert.AreEqual(o1,col[1]);
            Assert.AreEqual(o2,col[2]);
            Assert.AreEqual(o3,col[3]);
            Assert.AreEqual(o4,col[4]);
        }
        public void GetEnumerator_13()
        {
            Collection col = new Collection();

            string s1 = "e";
            string s2 = "g";
            string s3 = "a";
            string s4 = "f";
            string s5 = "q";

            col.Add(s1,null,null,null);
            col.Add(s2,null,null,null);

            IEnumerator en = col.GetEnumerator();

            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(s1,en.Current);
            Assert.IsTrue(en.MoveNext());
            Assert.AreEqual(s2,en.Current);
            Assert.IsFalse(en.MoveNext());
            Assert.AreEqual(null,en.Current);

            col.Add(s3,null,null,null);

            Assert.AreEqual(null,en.Current);

            col.Add(s4,null,null,null);
            col.Add(s5,null,null,null);

            Assert.IsFalse(en.MoveNext());
        }
Exemple #36
0
        /// <summary>
        /// Handles the MouseDown event of the ColorBlender control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        private void ColorBlender_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (e.Y > TopMargin + BarHeight - 10 && e.Y < TopMargin + BarHeight + 20 && e.X > 5 && e.X < this.Width - 5)
            {
                //Check if the cursor is over a MiddlePointer
                int mOver = IsMouseOverPointer(e.X, e.Y);
                if (mOver > -1)
                {
                    if (!(CurrPointer == mOver))
                    {
                        CurrPointer = mOver;
                        ClearCurrPointer();
                        ((cblPointer)(cblPointer)MiddlePointers[CurrPointer]).pIsCurr = true;
                        UpdateRGBnuds(((cblPointer)(cblPointer)MiddlePointers[CurrPointer]).pColor);
                        lblPos.Text = ((cblPointer)MiddlePointers[CurrPointer]).PosToStrong;
                    }

                    if (e.Button == System.Windows.Forms.MouseButtons.Left)
                    {
                        MouseMoving = true;
                    }
                    else if (e.Button == System.Windows.Forms.MouseButtons.Right)
                    {
                        MiddlePointers.Remove(CurrPointer);
                        lblPos.Text = "";
                    }
                }
                else
                {
                    //Check if the cursor is over a Start or End Pointer
                    if (IsMouseOverStartPointer(e.X, e.Y))
                    {
                        ClearCurrPointer();
                        CurrPointer          = -1;
                        StartPointer.pIsCurr = true;
                        UpdateRGBnuds(StartPointer.pColor);
                        lblPos.Text = StartPointer.PosToStrong;
                    }
                    else if (IsMouseOverEndPointer(e.X, e.Y))
                    {
                        ClearCurrPointer();
                        CurrPointer        = -1;
                        EndPointer.pIsCurr = true;
                        UpdateRGBnuds(EndPointer.pColor);
                        lblPos.Text = EndPointer.PosToStrong;
                    }
                    else
                    {
                        //If the cursor is not over a cblPointer then Add One
                        if (e.Button == System.Windows.Forms.MouseButtons.Left)
                        {
                            ClearCurrPointer();
                            MiddlePointers.Add(new cblPointer(Convert.ToSingle(((e.X - 10) / (double)(this.Width - 20))), Color.FromArgb(tbarAlpha.Value, Convert.ToInt32(nudRed.Value), Convert.ToInt32(nudGreen.Value), Convert.ToInt32(nudBlue.Value)), true), null, null, null);
                            SortCollection(MiddlePointers, "pPos", true);
                            CurrPointer = FindCurr();
                            lblPos.Text = ((cblPointer)MiddlePointers[CurrPointer]).PosToStrong;
                            this.Invalidate();
                            MouseMoving = true;
                        }
                    }
                }
            }
        }