public void MSCPSWS_S01_TC09_EntityTypes_ValidProviderNames()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            bool isEntityTypesSuccess = false;

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                ArrayOfString providerNames = new ArrayOfString();
                providerNames.Add(provider.ProviderName);

                // Call EntityTypes method to get entity types with valid providerNames in the request.
                ArrayOfString responseOfEntityTypesResult = CPSWSAdapter.EntityTypes(providerNames);
                Site.Assert.IsNotNull(responseOfEntityTypesResult, "If the providerNames is a valid providerNames, the protocol server MUST use the current available claims providers.");

                // Call GetEntityTypesResultBySutAdapter method to get entity types with valid providerNames in the request.
                ArrayOfString getEntityTypesResultBySutAdapter = GetEntityTypesResultBySutAdapter(providerNames);
                Site.Assert.IsTrue(this.VerificationSutResultsAndProResults(responseOfEntityTypesResult, getEntityTypesResultBySutAdapter), "The entity types returned by the protocol and script should be equal.");
                isEntityTypesSuccess = true;
            }

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isEntityTypesSuccess,
                178,
                @"[In EntityTypes] The protocol server MUST retrieve picker entity types from claims providers that meet both of the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.");
        }
        public void MSCPSWS_S04_TC08_Resolve_NullResolveInput()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.User;

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            bool caughtException = false;

            try
            {
                // Call Resolve multiple method with resolveInput parameter sets to null.
                CPSWSAdapter.Resolve(providerNames, principalType, null);
            }
            catch (FaultException faultException)
            {
                caughtException = true;

                // If the server returns an ArgumentNullException<""value""> message, then the following requirement can be captured.
                Site.CaptureRequirementIfIsTrue(
                    this.VerifyArgumentNullException(faultException, "value"),
                    616,
                    @"[In Resolve] If this [resolveInput] is NULL, the protocol server MUST return an ArgumentNullException<""value""> message.");
            }
            finally
            {
                this.Site.Assert.IsTrue(caughtException, "If resolveInput is NULL, the protocol server should return an ArgumentNullException<value> message.");
            }
        }
        public void MSCPSWS_S04_TC02_ResolveClaim_Valid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames         = new ArrayOfString();
            SPPrincipalType principalType         = SPPrincipalType.SecurityGroup;
            SPClaim         resolveInput          = GenerateSPClaimResolveInput_Valid();
            bool            isResolveClaimSuccess = false;

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                if (provider.Children.Length != 0)
                {
                    providerNames.Add(provider.ProviderName);
                }

                // Call Resolve claim method to resolve an SPClaim to picker entities using a list of claims providers.
                PickerEntity[] responseOfResolveClaimResult = CPSWSAdapter.ResolveClaim(providerNames, principalType, resolveInput);
                Site.Assert.IsNotNull(responseOfResolveClaimResult, "The resolve claim result should not be null.");
                isResolveClaimSuccess = true;
            }

            // If the claims providers listed in the provider names in the input message is resolved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isResolveClaimSuccess,
                303,
                @"[In ResolveClaim] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
        public void MSCPSWS_S01_TC02_ClaimTypes_AllValidProviderNames()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                providerNames.Add(provider.ProviderName);
            }

            // Call ClaimTypes method to get claim types with all of valid providerNames in the request.
            ArrayOfString responseOfClaimTypesResult = CPSWSAdapter.ClaimTypes(providerNames);
            Site.Assert.IsNotNull(responseOfClaimTypesResult, "If the providerNames is all of valid providerNames, the protocol server MUST use all the available claims providers.");

            bool isNotDuplicate = VierfyRemoveDuplicate(responseOfClaimTypesResult);
           
            Site.CaptureRequirementIfIsTrue(
                isNotDuplicate,
                146001,
                @"[In ClaimTypes] The protocol server will remove the duplicated claim types from the known basic claim types and the claim providers’ claim types.");

            // Call GetClaimTypesResultBySutAdapter method to get claim types with all of valid providerNames in the request.
            ArrayOfString getClaimTypesResultBySutAdapter = GetClaimTypesResultBySutAdapter(providerNames);
            Site.Assert.IsTrue(this.VerificationSutResultsAndProResults(responseOfClaimTypesResult, getClaimTypesResultBySutAdapter), "The claim types returned by the protocol and script should be equal.");

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirement(
                144,
                @"[In ClaimTypes] The protocol server MUST retrieve all known basic claim types. In addition, the protocol server MUST retrieve claim types from claims providers that meet both of the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claim providers are listed in the provider names in the input message.");
        }
        public void MSCPSWS_S02_TC06_GetHierarchyAll_AllOfProviderNames()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.User;

            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            // Call GetHierarchyAll method to get a list of claims provider hierarchy trees with all of valid providerNames in the request.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
            Site.Assert.IsNotNull(responseOfGetHierarchyAllResult, "If the providerNames is all of valid providerNames, the protocol server MUST use all the available claims providers.");

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                responseOfGetHierarchyAllResult.Length == providerNames.Count,
                219,
                @"[In GetHierarchyAll] The protocol server MUST retrieve claims provider hierarchy trees from claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support hierarchy.");

            Site.CaptureRequirementIfIsTrue(
                responseOfGetHierarchyAllResult.Length == providerNames.Count,
                239,
                @"[In GetHierarchyAllResponse]The protocol server MUST return one claims provider hierarchy tree for each claims provider that match the criteria specified in the input message.");
        }
Ejemplo n.º 6
0
        private void SSJ_Alarm()
        {
            ArrayOfString ssjAlert = new ArrayOfString();

            ssjAlert.Add(stk.Read_Index[Stacker.Read_Index_SSJ_1_Alarm_Code]);
            ssjAlert.Add(stk.Read_Index[Stacker.Read_Index_SSJ_2_Alarm_Code]);
            ssjAlert.Add(stk.Read_Index[Stacker.Read_Index_SSJ_3_Alarm_Code]);
            while (true)
            {
                var reader = srv.OPC_Read(ssjAlert);
                if (reader[0].ToString() != "0")
                {
                    lb_SSJ1_Alert.Text      = TranslateSSJAlertCode(int.Parse(reader[0].ToString()));
                    lb_SSJ1_Alert.ForeColor = Color.Red;
                }
                else
                {
                    lb_SSJ1_Alert.Text      = "正常";
                    lb_SSJ1_Alert.ForeColor = Color.Lime;
                }
                if (reader[1].ToString() != "0")
                {
                    lb_SSJ2_Alert.Text      = TranslateSSJAlertCode(int.Parse(reader[1].ToString()));
                    lb_SSJ2_Alert.ForeColor = Color.Red;
                }
                else
                {
                    lb_SSJ2_Alert.Text      = "正常";
                    lb_SSJ2_Alert.ForeColor = Color.Lime;
                }
                if (reader[2].ToString() != "0")
                {
                    lb_SSJ3_Alert.Text      = TranslateSSJAlertCode(int.Parse(reader[2].ToString()));
                    lb_SSJ3_Alert.ForeColor = Color.Red;
                }
                else
                {
                    lb_SSJ3_Alert.Text      = "正常";
                    lb_SSJ3_Alert.ForeColor = Color.Lime;
                }
                wait(1000);
            }
        }
Ejemplo n.º 7
0
        private static ArrayOfString getmobarry(string[] mob)
        {
            ArrayOfString refof = new ArrayOfString();

            for (int i = 0; i < mob.Length; i++)
            {
                refof.Add(mob[i]);
            }
            return(refof);
        }
Ejemplo n.º 8
0
        private ArrayOfString convertArrayToArrayOfString(string[] strings)
        {
            //todo: decent array to ArrayOfStrings conversion
            var arrayOfString = new ArrayOfString();

            foreach (var s in strings)
            {
                arrayOfString.Add(s);
            }
            return(arrayOfString);
        }
Ejemplo n.º 9
0
        public static async Task <string> SendSmsAsync(string to, string content)
        {
            var reciver = new ArrayOfString();
            var status  = new ArrayOfbyte();
            var smsId   = new ArrayOfLong();

            reciver.Add(to);

            var sendResult = await new SendSoapClient().SendSmsAsync(_username, _password, reciver, _senderId, content, false, null, smsId, status);

            return($"{sendResult.Body.recId[0]}:{sendResult.Body.SendSmsResult}:{sendResult.Body.status[0]}");
        }
Ejemplo n.º 10
0
        /// <summary>
        /// A method used to do a depth first traverse in a given Provider Hierarchy tree to
        /// gather provider names and save them in the list of providerNames.
        /// </summary>
        /// <param name="node">A parameter represents a provider hierarchy node.</param>
        /// <param name="providerNames">A parameter represents a list of provider names.</param>
        public void DepthFirstTraverse(SPProviderHierarchyNode node, ref ArrayOfString providerNames)
        {
            providerNames.Add(node.ProviderName);
            if (node.IsLeaf == true)
            {
                return;
            }

            foreach (SPProviderHierarchyNode c in node.Children)
            {
                this.DepthFirstTraverse(c, ref providerNames);
            }
        }
        public void MSCPSWS_S04_TC04_ResolveMultipleStrings_SomeValid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.User;
            ArrayOfString   resolveInput  = new ArrayOfString();

            resolveInput.Add(Common.GetConfigurationPropertyValue("OwnerLogin", this.Site));
            resolveInput.Add(this.GenerateInvalidUser());

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            // Call Resolve multiple method to resolve 2 users to picker entities, one valid and another invalid.
            PickerEntity[] responseOfResolveMultipleResult = CPSWSAdapter.ResolveMultiple(providerNames, principalType, resolveInput);
            Site.Assert.IsNotNull(responseOfResolveMultipleResult, "The resolve multiple result should not be null.");

            // If the resolve multiple result contains 2 picker entities, that is to say, one picker entity in the response corresponding to one user in the request, then the following requirement can be captured.
            Site.CaptureRequirementIfAreEqual <int>(
                responseOfResolveMultipleResult.Length,
                2,
                345,
                @"[In ResolveMultipleResponse] The list [ResolveMultipleResult] MUST contain one and only one picker entity per string in the input.");

            Site.CaptureRequirementIfAreEqual <int>(
                responseOfResolveMultipleResult.Length,
                2,
                325,
                @"[In ResolveMultiple] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
Ejemplo n.º 12
0
        private void readTask()
        {
            CheckForIllegalCrossThreadCalls = false;
            string        fromPai, fromLie, fromCeng, toPai, toLie, toCeng, taskId, newTask;
            ArrayOfString items = new ArrayOfString();

            items.Add(LOCALSERVER + StackerWrite + "W42"); //frompai 0
            items.Add(LOCALSERVER + StackerWrite + "W38"); //fromlie 1
            items.Add(LOCALSERVER + StackerWrite + "W40"); //fromceng 2
            items.Add(LOCALSERVER + StackerWrite + "W48"); //topai 3
            items.Add(LOCALSERVER + StackerWrite + "W44"); //tolie 4
            items.Add(LOCALSERVER + StackerWrite + "W46"); //toceng 5
            items.Add(LOCALSERVER + StackerWrite + "W50"); //taskid 6
            items.Add(LOCALSERVER + StackerWrite + "W52"); //newtask 7
            while (true)
            {
                wait(1000);
                try
                {
                    using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
                    {
                        ArrayOfAnyType rsts = srv.OPC_Read(items);
                        if (rsts[7].ToString() == "1")
                        {
                            lbfromPai.Text   = rsts[0].ToString();
                            lbFromLie.Text   = rsts[1].ToString();
                            lbFromCeng.Text  = rsts[2].ToString();
                            lbToPai.Text     = rsts[3].ToString();
                            lbToLie.Text     = rsts[4].ToString();
                            lbToCeng.Text    = rsts[5].ToString();
                            lbTaskId.Text    = "任务号:" + rsts[6].ToString();
                            IsNewTask        = "是";
                            lbIsNewTask.Text = "是否下发:" + "是";
                        }
                        else
                        {
                            lbIsNewTask.Text = "是否下发:" + "否";
                            IsNewTask        = "否";
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// A method used to get claim types by SUT control adapter.
        /// </summary>
        /// <param name="claimProviderNames">A parameter represents a group of provider name.</param>
        /// <returns>A return value represents a list of claim types</returns>
        public ArrayOfString GetClaimTypesResultBySutAdapter(ArrayOfString claimProviderNames)
        {
            ArrayOfString claimTypesResultBySut           = new ArrayOfString();
            string        inputClaimProviderNames         = InputClaimProviderNames(claimProviderNames);
            string        getClaimTypesInSPProviderScript = SutControlAdapter.GetClaimTypesInSPProvider(inputClaimProviderNames);

            if (getClaimTypesInSPProviderScript != null && getClaimTypesInSPProviderScript != string.Empty)
            {
                foreach (string claimType in getClaimTypesInSPProviderScript.Split(','))
                {
                    claimTypesResultBySut.Add(claimType);
                }
            }

            return(claimTypesResultBySut);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 读取一个数据块的值
        /// </summary>
        /// <param name="ItemName"></param>
        /// <returns></returns>
        public object ReadValuePoint(string ItemName)
        {
            ArrayOfString ItemNames = new ArrayOfString();

            ItemNames.Add(ItemName);
            try
            {
                using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
                {
                    return(srv.OPC_Read(ItemNames)[0]);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Ejemplo n.º 15
0
        public bool bSendOTPSMS(SMSViewModel oSMSViewModel)
        {
            try
            {
                ArrayOfString arrPhoneNos = new ArrayOfString();
                arrPhoneNos.Add("968" + oSMSViewModel.Recipient.ToString());
                SMSService.BulkSMSSoapClient client = new BulkSMSSoapClient();
                int nResult = client.PushMessage(CommonHelper.sGetConfigKeyValue(ConstantNames.SMSServiceUserName), CommonHelper.sGetConfigKeyValue(ConstantNames.SMSServicPassword),
                                                 oSMSViewModel.Message, oSMSViewModel.Language, DateTime.Now, arrPhoneNos, 1);

                return(nResult == 1);
            }
            catch (Exception ex)
            {
                Elmah.ErrorLog.GetDefault(HttpContext.Current).Log(new Elmah.Error(ex));
                return(false);
            }
        }
        public void MSCPSWS_S01_TC03_ClaimTypes_ValidProviderName()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                ArrayOfString providerNames = new ArrayOfString();
                providerNames.Add(provider.ProviderName);

                // Call ClaimTypes method to get claim types with valid providerNames in the request.
                ArrayOfString responseOfClaimTypesResult = CPSWSAdapter.ClaimTypes(providerNames);
                Site.Assert.IsNotNull(responseOfClaimTypesResult, "If the providerNames is a valid providerNames, the protocol server MUST use the current available claims providers.");

                // Call GetClaimTypesResultBySutAdapter method to get claim types with valid providerNames in the request.
                ArrayOfString getClaimTypesResultBySutAdapter = GetClaimTypesResultBySutAdapter(providerNames);
                Site.Assert.IsTrue(this.VerificationSutResultsAndProResults(responseOfClaimTypesResult, getClaimTypesResultBySutAdapter), "The claim types returned by the protocol and script should be equal.");
            }
        }
        public void MSCPSWS_S02_TC07_GetHierarchyAll_ValidInputParameters()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            SPPrincipalType principalType = SPPrincipalType.User;

            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                ArrayOfString providerNames = new ArrayOfString();
                providerNames.Add(provider.ProviderName);

                // Call GetHierarchyAll method to get a list of claims provider hierarchy trees with a valid providerNames in the request.
                SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
                Site.Assert.IsNotNull(responseOfGetHierarchyAllResult, "If the provider names are valid, the protocol server will return the hierarchy trees that match the claims providers.");
            }
        }
Ejemplo n.º 18
0
        private ArrayOfString GetMethods()
        {
            ArrayOfString arr = new ArrayOfString();

            if (CheckBoxEQW.Checked)
            {
                arr.Add("EQW");
            }
            if (CheckBoxSAX.Checked)
            {
                arr.Add("SAX");
            }
            if (CheckBoxTD4CCos.Checked)
            {
                arr.Add("TD4C_Cos");
            }
            if (CheckBoxTD4CDEnt.Checked)
            {
                arr.Add("TD4C_DEnt");
            }
            if (CheckBoxTD4CDiffSum.Checked)
            {
                arr.Add("TD4C_DiffSum");
            }
            if (CheckBoxTD4CDiffSumMax.Checked)
            {
                arr.Add("TD4C_DiffSumMax");
            }
            if (CheckBoxTD4CEnt.Checked)
            {
                arr.Add("TD4C_Ent");
            }
            if (CheckBoxTD4CKL.Checked)
            {
                arr.Add("TD4C_KL");
            }

            return(arr);
        }
Ejemplo n.º 19
0
        private void exportFeaturesToXML()
        {
            ArrayOfString checkedItems = new ArrayOfString();

            if (saveXMLFileDialog.ShowDialog() != DialogResult.Cancel)
            {
                using (ISWebService.SWebServiceSoapClient client = new ISWebService.SWebServiceSoapClient())
                {
                    foreach (var item in featuresList.CheckedItems)
                    {
                        checkedItems.Add(item.ToString());
                    }


                    client.ExportToXML(checkedItems, saveXMLFileDialog.FileName);

                    MessageBox.Show("Exported to " + saveXMLFileDialog.FileName);
                }
            }
        }
        public void MSCPSWS_S04_TC06_ResolveMultipleClaim_SomeValid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.SecurityGroup;

            SPClaim[] resolveInput = new SPClaim[2];

            resolveInput[0] = this.GenerateSPClaimResolveInput_Valid();
            resolveInput[1] = this.GenerateSPClaimResolveInput_Invalid();

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                if (provider.Children.Length != 0)
                {
                    providerNames.Add(provider.ProviderName);
                }
            }

            // Call Resolve multiple claim method to resolve 2 claims to picker entities using a list of claims providers.
            PickerEntity[] responseOfResolveMultipleClaimResult = CPSWSAdapter.ResolveMultipleClaim(providerNames, principalType, resolveInput);
            Site.Assert.IsNotNull(responseOfResolveMultipleClaimResult, "The resolve multiple claim result should not be null.");

            // If the resolve multiple result contains 2 picker entities, that is to say, one picker entity in the response corresponding to one user in the request, then the following requirement can be captured.
            Site.CaptureRequirementIfAreEqual <int>(
                responseOfResolveMultipleClaimResult.Length,
                2,
                369,
                @"[In ResolveMultipleClaimResponse] ResolveMultipleClaimResult: The list MUST contain one and only one picker entity per one claim in the input.");

            Site.CaptureRequirementIfAreEqual <int>(
                responseOfResolveMultipleClaimResult.Length,
                2,
                350,
                @"[In ResolveMultipleClaim] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
Ejemplo n.º 21
0
 public static void SendSMS(String to, String username, String password, String message, String from, String op)
 {
     try
     {
         if (op.ToUpper().Equals("RELAX"))
         {
             ArrayOfString senders = new ArrayOfString();
             senders.Add(from);
             ArrayOfString recv = new ArrayOfString();
             recv.Add(ClearifyCellNumber(to));
             ArrayOfString body = new ArrayOfString();
             body.Add(message);
             var s = smsClient.SendSMS(username, password, senders, recv, body, null, null, null);
             foreach (var ss in s)
             {
                 Console.WriteLine("MSG:" + ss);
             }
         }
         else if (op.ToUpper().Equals("FARAPAYAMAK"))
         {
             try
             {
                 FarapayamakSend.ArrayOfString recv = new FarapayamakSend.ArrayOfString();
                 recv.Add(ClearifyCellNumber(to));
                 FarapayamakSend.SendSoapClient fpSendSMS = new FarapayamakSend.SendSoapClient();
                 fpSendSMS.SendSimpleSMS(username, password, recv, from, message, false);
             }
             catch (Exception ex)
             {
                 Console.WriteLine("Err:" + ex.Message);
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error  : " + ex.Message);
         smsClient = new v2SoapClient();
     }
 }
        public void MSCPSWS_S04_TC01_ResolveString()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.SecurityGroup;
            string resolveInput = string.Empty;
            bool isResolveSuccess = false;

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                if (provider.EntityData.Length != 0)
                {
                    providerNames.Add(provider.ProviderName);

                    foreach (PickerEntity entityData in provider.EntityData)
                    {
                        resolveInput = entityData.DisplayText;

                        // Call Resolve method to resolve an input string to picker entities using a list of claims providers.
                        PickerEntity[] responseOfResolveResult = CPSWSAdapter.Resolve(providerNames, principalType, resolveInput);                     
                        Site.Assert.IsNotNull(responseOfResolveResult, "Resolve result should not null.");
                        isResolveSuccess = true;
                    }
                }
            }

            // If the claims providers listed in the provider names in the input message is resolved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isResolveSuccess,
                280,
                @"[In Resolve] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
        public void MSCPSWS_S04_TC01_ResolveString()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames    = new ArrayOfString();
            SPPrincipalType principalType    = SPPrincipalType.SecurityGroup;
            string          resolveInput     = string.Empty;
            bool            isResolveSuccess = false;

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                if (provider.EntityData.Length != 0)
                {
                    providerNames.Add(provider.ProviderName);

                    foreach (PickerEntity entityData in provider.EntityData)
                    {
                        resolveInput = entityData.DisplayText;

                        // Call Resolve method to resolve an input string to picker entities using a list of claims providers.
                        PickerEntity[] responseOfResolveResult = CPSWSAdapter.Resolve(providerNames, principalType, resolveInput);
                        Site.Assert.IsNotNull(responseOfResolveResult, "Resolve result should not null.");
                        isResolveSuccess = true;
                    }
                }
            }

            // If the claims providers listed in the provider names in the input message is resolved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isResolveSuccess,
                280,
                @"[In Resolve] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
Ejemplo n.º 24
0
        public void MSCPSWS_S01_TC02_ClaimTypes_AllValidProviderNames()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                providerNames.Add(provider.ProviderName);
            }

            // Call ClaimTypes method to get claim types with all of valid providerNames in the request.
            ArrayOfString responseOfClaimTypesResult = CPSWSAdapter.ClaimTypes(providerNames);

            Site.Assert.IsNotNull(responseOfClaimTypesResult, "If the providerNames is all of valid providerNames, the protocol server MUST use all the available claims providers.");

            bool isNotDuplicate = VierfyRemoveDuplicate(responseOfClaimTypesResult);

            Site.CaptureRequirementIfIsTrue(
                isNotDuplicate,
                146001,
                @"[In ClaimTypes] The protocol server will remove the duplicated claim types from the known basic claim types and the claim providers’ claim types.");

            // Call GetClaimTypesResultBySutAdapter method to get claim types with all of valid providerNames in the request.
            ArrayOfString getClaimTypesResultBySutAdapter = GetClaimTypesResultBySutAdapter(providerNames);

            Site.Assert.IsTrue(this.VerificationSutResultsAndProResults(responseOfClaimTypesResult, getClaimTypesResultBySutAdapter), "The claim types returned by the protocol and script should be equal.");

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirement(
                144,
                @"[In ClaimTypes] The protocol server MUST retrieve all known basic claim types. In addition, the protocol server MUST retrieve claim types from claims providers that meet both of the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claim providers are listed in the provider names in the input message.");
        }
        public void MSCPSWS_S02_TC09_GetHierarchyAll_InvalidNumberOfLevels()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames  = new ArrayOfString();
            SPPrincipalType principalType  = SPPrincipalType.SharePointGroup;
            int             numberOfLevels = 0;

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            bool caughtException = false;

            try
            {
                // Call GetHierarchyAll method with numberOfLevels parameter sets to invalid.
                CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
            }
            catch (FaultException faultException)
            {
                caughtException = true;

                // If the server returns an ArgumentNullException<""numberOfLevels""> message, then the following requirement can be captured.
                Site.CaptureRequirementIfIsTrue(
                    this.VerifyArgumentOutOfRangeException(faultException, "numberOfLevels"),
                    591,
                    @"[In GetHierarchyAll] The protocol server MUST return an ArgumentOutOfRangeException<""numberOfLevels""> message if the value of this element [numberOfLevels] is less than 1.");
            }
            finally
            {
                this.Site.Assert.IsTrue(caughtException, "The protocol server should return ArgumentOutOfRangeException<numberOfLevels> message if the value of this element [numberOfLevels] is less than 1.");
            }
        }
        /******************************************************************************************************************************************
         * Nombre: EnviarWebRequest
         * Propósito: Crear una conexión remota y enviar un http request con todas las variables POST necesarias. Se genera una factura.
         * Output: Sin necesidad de especificación (bien puede manejarse como un sub).
         ******************************************************************************************************************************************/
        public string EnviarWebRequest(Cliente Cliente, Venta Venta, List<ProductoVenta> Productos, Sucursal Sucursal)
        {
            if (Cliente == null || Venta == null || Productos.Count < 1 || Sucursal == null)
                return "* Error en los argumentos de la funcion";

            //Instancia del Web Service para la conexion remota
            ConexionRemota32SoapClient conexionRemota = new ConexionRemota32SoapClient();

            /* Crear la información que llevará incluida la factura
             * Establecer TODOS los datos requeridos por Facturar en Línea, que deberán ser incluidos en el POST.
             * Nota: Checar archivo API de Excel que contiene la descripción y requerimiento de cada campo.
             * Crear la información que llevará el WS
             * Sección de Variables para la autenticación del usuario remoto.
             */

            #region Datos del Emisor

            //Creamos el arreglo del usuario remoto
            ArrayOfString datosUsuario = new ArrayOfString();
            //Establecer el nombre de usuario (RFC) (REQUERIDO). Posicion 0
            datosUsuario.Add(Sucursal.RFC);
            //Nombre de la cuenta (SUCURSAL). Posicion 1
            datosUsuario.Add(Sucursal.Cuenta);
            //Password. Posicion 2
            datosUsuario.Add(Sucursal.Password);

            #endregion

            #region Datos del cliente
            /*****************************************************************************************
            * Sección de Arreglo para identificar y actualizar los datos del Cliente o Receptor.
            *****************************************************************************************/

            //Creamos el arreglo que contendra los datos del cliente o receptor
            ArrayOfString datosReceptor = new ArrayOfString();

            //Nombre del cliente REQUERIDO. Posicion 0
            datosReceptor.Add(Cliente.NombreCliente);
            //Nombre del contacto principal OPCIONAL. Posicion 1
            datosReceptor.Add(Cliente.Contacto);
            //Telefono del contacto principal OPCIONAL. Posicion 2
            datosReceptor.Add(Cliente.Telefono);
            //Email del contacto OPCIONAL. Posicion 3
            datosReceptor.Add(Cliente.Email);
            //RFC del cliente REQUERIDO. Posicion 4
            datosReceptor.Add(Cliente.RfcReceptor);
            //Razon Social REQUERIDO. Posicion 5
            datosReceptor.Add(Cliente.NombreReceptor);
            // Calle de dirección Requerido. Posicion 6
            datosReceptor.Add(Cliente.CalleReceptor);
            // Numero Exterior REQUERIDO. Posicion 7
            datosReceptor.Add(Cliente.NoExteriorReceptor);
            //Numero Interior OPCIONAL. Posicion 8
            datosReceptor.Add(Cliente.NoInteriorReceptor);
            //Colonia REQUERIDO. Posicion 9.
            datosReceptor.Add(Cliente.ColoniaReceptor);
            //Localidad OPCIONAL. Posicion 10.
            datosReceptor.Add(Cliente.LocalidadReceptor);
            //Referencia OPCIONAL. Posicion 11.
            datosReceptor.Add(Cliente.ReferenciaReceptor);
            //Municipio REQUERIDO. Posicion 12
            datosReceptor.Add(Cliente.MunicipioReceptor);
            //Estado REQUERIDO. Posicion 13
            datosReceptor.Add(Cliente.EstadoReceptor);
            //Pais Requerido. Posicion 14
            datosReceptor.Add(Cliente.PaisReceptor);
            //Codigo Postal REQUERIDO. Posicion 15
            datosReceptor.Add(Cliente.CodigoPostalReceptor);

            #endregion

            #region Informacion del CFDI
            /*********************************************************
            ' Sección de Variables de información general del CFDI.
            ' *********************************************************/

            //Arreglo del comprobante general
            ArrayOfString datosCFDI = new ArrayOfString();

            //Establecer la clave de CFD a emitir, "FAC" para factura (REQUERIDO). Posicion 0
            datosCFDI.Add("FAC");
            //Establecer la forma de pago (REQUERIDO). Posicion 1
            datosCFDI.Add("Pago en una sola exhibición");
            //Pago en parcialidades. (OPCIONAL). Posicion 2
            datosCFDI.Add("");
            //Condiciones de pago. (OPCIONAL). Posicion 3
            datosCFDI.Add("");
            //Metodo de pago. (Opcional). Posicion 4
            datosCFDI.Add("");
            //Descuento Usado (Opcional). Posicion 5
            datosCFDI.Add("0.00");
            //Porcentaje de descuento (Opcional). Posicion 6
            datosCFDI.Add("0.00");
            //Motivo del descuento (Opcional). Posicion 7
            datosCFDI.Add("");
            //Establecer el tipo de moneda (Requerido). Posicion 8
            datosCFDI.Add("MXN");
            //Tipo de cambio(Opcional). Posicion 9
            datosCFDI.Add("");
            //Fecha de tipo de cambio (Opcional). Posicion 10
            datosCFDI.Add("");
            //Impuestos Retenidos (Requerido). Posicion 11
            datosCFDI.Add("0.000000");
            //Impuestos Trasladados (Requerido). Posicion 12
            datosCFDI.Add(Venta.TotalImpuestosTrasladados.ToString());
            //Establecer el subtotal (REQUERIDO). Posicion 13
            datosCFDI.Add(Venta.Subtotal.ToString());
            //Establecer el total (REQUERIDO). Posicion 14
            datosCFDI.Add(Venta.Total.ToString());
            //Establecer el importe con letra del total (REQUERIDO). Posicion 15
            datosCFDI.Add(Venta.ImporteLetra);

            //Nuevos Campos SAT 3.2
            // Lugar de expedicion (Requerido)
            datosCFDI.Add("Puebla");
            //(17) NumCuentaPago (OPCIONAL)
            datosCFDI.Add("");
            //(18) FolioFiscalOrig (OPCIONAL)
            datosCFDI.Add("");
            //(19) SerieFolioFiscalOrig (OPCIONAL)
            datosCFDI.Add("");
            //(20) FechaFolioFiscalOrig (OPCIONAL)
            datosCFDI.Add("");
            //(21) MontoFolioFiscalOrig (OPCIONAL)
            datosCFDI.Add("");

            #endregion

            #region Etiquetas
            /*************************************************************************************
            / Sección de Variables para el uso de información comercial de la empresa emisora.
            /*************************************************************************************/
            //Arreglo para enviar los datos de la empresa emisora (FEL)
            ArrayOfString datosEtiquetas = new ArrayOfString();
            //Establecer el nombre de la etiqueta personalizada (Opcional).
            //secuencia |nombre|valor|

            //Etiqueta para el portal web
            datosEtiquetas.Add("|Portal Web|www.segurigases.com|");
            //Etiqueta Correo electronico
            datosEtiquetas.Add("|Email|[email protected]|");

            #endregion

            #region Conceptos
            /*****************************************************************************
            ' Sección de Variables para la información y descripción de los conceptos.
            ' *****************************************************************************/
            //arreglo para la referencia de los conceptos
            ArrayOfString datosConceptos = new ArrayOfString();

            int noProd = Productos.Count();
            //Por cada producto dentro de la venta creamos un concepto nuevo
            foreach(ProductoVenta item in Productos)
            {
                string cantidad = item.Count.ToString();
                string descripcion = item.Producto.Nombre;
                string valor = item.PrecioVenta.ToString();
                string importe = (item.PrecioVenta * item.Count).ToString();
                string unidad = item.Producto.Unidad.Nombre;
                string clave = item.Producto.Clave;

                //Secuencia: |cantidad|unidad|noIdentificacion|descripcion|valorUnitario|importe|
                datosConceptos.Add("|" + cantidad + "|" + unidad + "|" + clave + "|" + descripcion + "|" + valor + "|" + importe + "|");
            }
            #endregion

            #region Informacion Aduanera

            /*
             * Sección de variables para la información aduanera correspondiente a cada concepto usado en el CFDI.
             * IMPORTANTE: El tamaño del vector de aduanera debe coincidir respectivamente con el de conceptos, ya que es 1 a 1.
             * Secuencia: |numero|fecha|aduana|
             * Por el momento Segurigases no cuenta con informacion aduanera por lo tanto no se enviara un arreglo con las posiciones vacias
             */

            //Creacion del arreglo para la informacion aduanera
            ArrayOfString datosInfoAduanera = new ArrayOfString();

            foreach (var item in Productos)
                datosInfoAduanera.Add(null);

            #endregion

            #region Impuestos Retenidos

            /*
             * Sección de variables para la información de todos los impuestos retenidos utilizados en el CFDI.
             * Secuencia: |NombreImpuesto|impuesto|importe|
             * SeguriGases no retiene impuestos por lo tanto no haremos nada aqui
             */

            //Arreglo para referenciar los impuestos retenidos
            ArrayOfString datosRetenidos = new ArrayOfString();

            #endregion

            #region Impuestos Retenidos Locales

            /*
             * Sección de variables para la información de todos los impuestos retenidos locales utilizados en el CFDI.
             * Secuencia: |NombreImpuesto|impuesto|tasa|importe|
             * SeguriGases no retiene impuestos, por lo tanto nos se hara nada
             */

            //Arreglo de Retenidos Locales
            ArrayOfString datosRetenidosLocales = new ArrayOfString();

            #endregion

            #region Impuestos trasladados

            /*
             * Sección de variables para la información de todos los impuestos trasladados utilizados en el CFDI.
             * Secuencia: |NombreImpuesto|impuesto|tasa|importe|
             */

            //Arreglo para referenciar los impuestos trasladados
            ArrayOfString datosTrasladados = new ArrayOfString();

            //Establecer el nombre arbitrario del impuesto trasladado (Opcional).
            string nombreTraslado1 = "IVA (IVA 16%)";
            //Establecer el tipo de impuesto trasladado (Opcional).
            string impuestoTraslado1 = "IVA";
            //Establecer la tasa de impuesto trasladado (Opcional).
            string tasa1 = "16.00";
            //Establecer el importe del impuesto trasladado (Opcional).
            string importeTraslado1 = Venta.TotalImpuestosTrasladados.ToString();

            string cadenaTraslados = "|" + nombreTraslado1 + "|" + impuestoTraslado1 + "|" + tasa1 + "|" + importeTraslado1 + "|";

            datosTrasladados.Add(cadenaTraslados);

            #endregion

            #region Impuestos Trasladados Locales

            /*
             * Sección de variables para la información de todos los impuestos trasladados locales utilizados en el CFDI.
             * Secuencia:|NombreImpuesto|impuesto|tasa|importe|
             */

            //Arreglo de traslados locales
            ArrayOfString datosTrasladosLocales = new ArrayOfString();
            datosTrasladosLocales.Add(cadenaTraslados);

            #endregion

            #region Consumision del servicio

            //Respuesta del servicio
            ArrayOfString respuestaWS = new ArrayOfString();

            //Consumimos el servicio
            respuestaWS = conexionRemota.GenerarCFDIv32(datosUsuario,
                                                        datosReceptor,
                                                        datosCFDI,
                                                        datosEtiquetas,
                                                        datosConceptos,
                                                        datosInfoAduanera,
                                                        datosRetenidos,
                                                        datosTrasladados,
                                                        datosRetenidosLocales,
                                                        datosTrasladosLocales);

            string folio = "";
            //Verificar si la respuesta fue o no exitosa
            if (!respuestaWS[0].Equals("True"))
            {
                //No Fue exitosa, debemos cancelar la venta aqui, pero por el momento solo reportaremos el error en el log
                string ruta = @"C:\Facturas\respuesta" + DateTime.Now + ".txt";
                // Se usa una clase externa que simplemente guarda un contenido en un archivo de texto.

                //System.IO.File.WriteAllText(ruta, respuestaWS);
            }
            else
            {
                //Si fe exitosa, entonces guardaremos el Xml del CDF en la computadora
                XmlDocument cfdXML = new XmlDocument();
                //El contenido XML se encuentra en la posicion 3 del arreglo
                cfdXML.LoadXml(respuestaWS[3]);
                folio = cfdXML.GetElementById("folio").ToString();
                //Leemos el folio
                //TODO: Parsear el XML para buscar el folio
                //Guardamos el XML
                //TODO: cfdXML.Save(@"C:\CFDXML\
            }
            #endregion

            return folio;
        }
Ejemplo n.º 27
0
 protected void Bt_Modify_Click(object sender, EventArgs e)
 {
     if (RCB_Identity.CheckedItems.Count == 0)
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('身份选择不能为空!');", true);
         return;
     }
     RadTreeView regionTreeView = RadDropDownTree1.Controls[0] as RadTreeView;
     if (regionTreeView.SelectedNodes.Count == 0)
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('区域选择不能为空!');", true);
         return;
     }
     if (RTB_Name.Text.Trim().Equals(""))
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('用户姓名不能为空!');", true);
         return;
     }
     Model.Log logModel = new Model.Log();
     logModel.OperationItem = "修改终端用户";
     logModel.OperationTime = DateTime.Now;
     logModel.Operator = user.UserInfo.UserID;
     logModel.Memo = "";
     Model.EndUser euModel = eu.GetModel(AutoID);
     if (euModel == null)
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('抱歉!该用户已不存在!');", true);
         return;
     }
     euModel.EndUserName = RTB_Name.Text;
     euModel.SimCardNo = RTB_SIM.Text;
     euModel.LastModifyTime = DateTime.Now;
     euModel.IsValid = RCB_Enable.SelectedValue=="1" ? true : false;
     StringBuilder sb = new StringBuilder();
     foreach (RadComboBoxItem rcbi in RCB_Identity.CheckedItems)
     {
         sb.Append("|"+rcbi.Value + "|");
     }
     sb.Append("|" + regionTreeView.SelectedValue + "|");
     string identityStr = sb.ToString();
     logModel.OperationDetail = "姓名:" + RTB_Name.Text + "SIM:" + RTB_SIM.Text + "身份&区域:" + identityStr;
     euModel.Identities = identityStr;
     bool isUpdate = false;
     try
     {
         using (MongoDBServiceSoapClient mg = new MongoDBServiceSoapClient())
         {
             MongoDBService.EndUser dc = new MongoDBService.EndUser();
             dc.AutoID = euModel.AutoID.ToString();
             dc.EnduserName = euModel.EndUserName;
             string[] identityArr = euModel.Identities.Split('|');
             ArrayOfString aof = new ArrayOfString();
             foreach (string id in identityArr)
             {
                 if (id.Equals(""))
                 {
                     continue;
                 }
                 aof.Add(id);
             }
             dc.Identities = aof;
             dc.IsValid = euModel.IsValid;
             dc.LastModifyTime = euModel.LastModifyTime;
             dc.SimCardNo = euModel.SimCardNo;
             string rtStr = "";
             if (mg.UpdateEnduser(dc, out rtStr))
             {
                 isUpdate = eu.Update(euModel);
             }
         }
     }
     catch (Exception ex)
     {
         logModel.Memo += ex.Message;
     }
     finally
     {
         if (euModel != null)
         {
             log.Add(logModel);
             if (isUpdate)
             {
                 RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('恭喜!用户修改成功!');", true);
             }
             else
             {
                 RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('抱歉!用户修改失败!');", true);
             }
         }
         else
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('抱歉!用户修改失败,已不存在该用户!');", true);
         }
     }
 }
Ejemplo n.º 28
0
        // Загрузка 1 игры в список
        void Load1Game(ListViewItem lvi, System.Data.SqlServerCe.SqlCeDataReader sqlReader)
        {
            bool update = (lvi != null); //обновить существующий lvi или добавить новый?

            // Комментарий
            String str = "";
            if (!sqlReader.IsDBNull(sqlReader.GetOrdinal("Comment")))
            {
                str = sqlReader.GetString(sqlReader.GetOrdinal("Comment")).Trim();
            }
            if (update)
                lvi.Text = str;
            else
                lvi = m_listview_Games.Items.Add(new ListViewItem(str));

            // Дата
            str = "";
            if (!sqlReader.IsDBNull(sqlReader.GetOrdinal("StartDate")))
            {
                DateTime dt = sqlReader.GetDateTime(sqlReader.GetOrdinal("StartDate"));
                str = dt.ToString("dd.MM.yyyy HH") + "ч";
            }
            if (update)
                lvi.SubItems[1].Text = str;
            else
                lvi.SubItems.Add(str);

            // id (тэг)
            if (!update)
            {
                lvi.Tag = sqlReader.GetInt32(sqlReader.GetOrdinal("id"));
            }

            // Тип
            GameType t = (GameType)sqlReader.GetByte(sqlReader.GetOrdinal("Type"));
            if (!update)
            {
                switch (t)
                {
                    case GameType.Robber:
                        lvi.SubItems.Add("Робб");
                        break;
                    case GameType.Sport:
                        lvi.SubItems.Add("Спорт");
                        break;
                    case GameType.Compensat:
                        lvi.SubItems.Add("Комп");
                        break;
                    case GameType.SimpleIMP:
                        lvi.SubItems.Add("IMP");
                        break;
                }
            }

            // Строка опций:
            if (!update)
            {
                ArrayOfString arrOptions = new ArrayOfString();
                if (!sqlReader.IsDBNull(sqlReader.GetOrdinal("DealsInMatch")))
                    arrOptions.Add(sqlReader.GetByte(sqlReader.GetOrdinal("DealsInMatch")).ToString() + "x");
                if (!sqlReader.IsDBNull(sqlReader.GetOrdinal("GameOptions")))
                {
                    byte GOptions = sqlReader.GetByte(sqlReader.GetOrdinal("GameOptions"));
                    if (t == GameType.Robber)
                    {
                        bool BonusForOners = ((GOptions & 1) > 0);
                        bool BonusForWholeRobber = ((GOptions & 2) > 0);
                        arrOptions.Add(BonusForWholeRobber ? "за робб" : "за гейм");
                        if (BonusForOners)
                            arrOptions.Add("за онеры");
                    }
                    if (t == GameType.Compensat)
                    {
                        BridgeGameScoring.TypeOfCompensation CompType = (BridgeGameScoring.TypeOfCompensation)(GOptions & 3); //2 bits
                        bool TenCardsIsTwoFits = ((GOptions & 4) > 0); //3rd bit
                        bool LessCompFor2Fits23PC = ((GOptions & 8) > 0); //4th bit
                        switch (CompType)
                        {
                            case BridgeGameScoring.TypeOfCompensation.Chicago:
                                arrOptions.Add("чикаг");
                                break;
                            case BridgeGameScoring.TypeOfCompensation.Europe:
                                arrOptions.Add("европ");
                                if (TenCardsIsTwoFits)
                                    arrOptions.Add("10 за 2");
                                if (LessCompFor2Fits23PC)
                                    arrOptions.Add("< 23-2");
                                break;
                            case BridgeGameScoring.TypeOfCompensation.Milton_York:
                                arrOptions.Add("М-У");
                                break;
                            case BridgeGameScoring.TypeOfCompensation.Moscow:
                                arrOptions.Add("моск");
                                break;
                        }
                    }
                }

                str = "";
                if (arrOptions.Count != 0)
                {
                    for (int j = 0; j < arrOptions.Count; j++)
                    {
                        if (j > 0)
                            str += ", ";
                        str += arrOptions[j];
                    }
                }
                lvi.SubItems.Add(str);
            }

            // Место
            str = "";
            if (!sqlReader.IsDBNull(sqlReader.GetOrdinal("Place")))
            {
                str = sqlReader.GetString(sqlReader.GetOrdinal("Place")).Trim();
            }
            if(update)
                lvi.SubItems[4].Text = str;
            else
                lvi.SubItems.Add(str);

            // Игроки
            str = "";
            str += "N: ";
            if (!sqlReader.IsDBNull(sqlReader.GetOrdinal("N")))
            {
                str += sqlReader.GetString(sqlReader.GetOrdinal("N")).Trim();
            }
            str += ", S: ";
            if (!sqlReader.IsDBNull(sqlReader.GetOrdinal("S")))
            {
                str += sqlReader.GetString(sqlReader.GetOrdinal("S")).Trim();
            }
            str += ", E: ";
            if (!sqlReader.IsDBNull(sqlReader.GetOrdinal("E")))
            {
                str += sqlReader.GetString(sqlReader.GetOrdinal("E")).Trim();
            }
            str += ", W: ";
            if (!sqlReader.IsDBNull(sqlReader.GetOrdinal("W")))
            {
                str += sqlReader.GetString(sqlReader.GetOrdinal("W")).Trim();
            }
            if (update)
                lvi.SubItems[5].Text = str;
            else
                lvi.SubItems.Add(str);
        }
        public void MSCPSWS_S04_TC04_ResolveMultipleStrings_SomeValid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.User;
            ArrayOfString resolveInput = new ArrayOfString();
            resolveInput.Add(Common.GetConfigurationPropertyValue("OwnerLogin", this.Site));
            resolveInput.Add(this.GenerateInvalidUser());

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            // Call Resolve multiple method to resolve 2 users to picker entities, one valid and another invalid.
            PickerEntity[] responseOfResolveMultipleResult = CPSWSAdapter.ResolveMultiple(providerNames, principalType, resolveInput);
            Site.Assert.IsNotNull(responseOfResolveMultipleResult, "The resolve multiple result should not be null.");

            // If the resolve multiple result contains 2 picker entities, that is to say, one picker entity in the response corresponding to one user in the request, then the following requirement can be captured.
            Site.CaptureRequirementIfAreEqual<int>(
                responseOfResolveMultipleResult.Length,
                2,
                345,
                @"[In ResolveMultipleResponse] The list [ResolveMultipleResult] MUST contain one and only one picker entity per string in the input.");

            Site.CaptureRequirementIfAreEqual<int>(
                responseOfResolveMultipleResult.Length,
                2,
                325,
                @"[In ResolveMultiple] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
        public void MSCPSWS_S02_TC09_GetHierarchyAll_InvalidNumberOfLevels()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.SharePointGroup;
            int numberOfLevels = 0;

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            bool caughtException = false; 
            try
            {
                // Call GetHierarchyAll method with numberOfLevels parameter sets to invalid.
                CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
            }
            catch (FaultException faultException)
            {
                caughtException = true; 

                // If the server returns an ArgumentNullException<""numberOfLevels""> message, then the following requirement can be captured.
                Site.CaptureRequirementIfIsTrue(
                    this.VerifyArgumentOutOfRangeException(faultException, "numberOfLevels"),
                    591,
                    @"[In GetHierarchyAll] The protocol server MUST return an ArgumentOutOfRangeException<""numberOfLevels""> message if the value of this element [numberOfLevels] is less than 1.");
            }
            finally
            {
                this.Site.Assert.IsTrue(caughtException, "The protocol server should return ArgumentOutOfRangeException<numberOfLevels> message if the value of this element [numberOfLevels] is less than 1.");
            }
        }
        public void MSCPSWS_S01_TC09_EntityTypes_ValidProviderNames()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            bool isEntityTypesSuccess = false;

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                ArrayOfString providerNames = new ArrayOfString();
                providerNames.Add(provider.ProviderName);

                // Call EntityTypes method to get entity types with valid providerNames in the request.
                ArrayOfString responseOfEntityTypesResult = CPSWSAdapter.EntityTypes(providerNames);
                Site.Assert.IsNotNull(responseOfEntityTypesResult, "If the providerNames is a valid providerNames, the protocol server MUST use the current available claims providers.");
                
                // Call GetEntityTypesResultBySutAdapter method to get entity types with valid providerNames in the request.
                ArrayOfString getEntityTypesResultBySutAdapter = GetEntityTypesResultBySutAdapter(providerNames);
                Site.Assert.IsTrue(this.VerificationSutResultsAndProResults(responseOfEntityTypesResult, getEntityTypesResultBySutAdapter), "The entity types returned by the protocol and script should be equal.");
                isEntityTypesSuccess = true;
            }

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isEntityTypesSuccess,
                178,
                @"[In EntityTypes] The protocol server MUST retrieve picker entity types from claims providers that meet both of the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.");
        }
        public void MSCPSWS_S04_TC02_ResolveClaim_Valid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.SecurityGroup;
            SPClaim resolveInput = GenerateSPClaimResolveInput_Valid();
            bool isResolveClaimSuccess = false;

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                if (provider.Children.Length != 0)
                {
                    providerNames.Add(provider.ProviderName);                    
                }

                // Call Resolve claim method to resolve an SPClaim to picker entities using a list of claims providers.
                PickerEntity[] responseOfResolveClaimResult = CPSWSAdapter.ResolveClaim(providerNames, principalType, resolveInput);
                Site.Assert.IsNotNull(responseOfResolveClaimResult, "The resolve claim result should not be null.");
                isResolveClaimSuccess = true;               
            }

            // If the claims providers listed in the provider names in the input message is resolved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isResolveClaimSuccess,
                303,
                @"[In ResolveClaim] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
        public void MSCPSWS_S02_TC06_GetHierarchyAll_AllOfProviderNames()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.User;

            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            // Call GetHierarchyAll method to get a list of claims provider hierarchy trees with all of valid providerNames in the request.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
            Site.Assert.IsNotNull(responseOfGetHierarchyAllResult, "If the providerNames is all of valid providerNames, the protocol server MUST use all the available claims providers.");
            
            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                responseOfGetHierarchyAllResult.Length == providerNames.Count,
                219,
                @"[In GetHierarchyAll] The protocol server MUST retrieve claims provider hierarchy trees from claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support hierarchy.");

            Site.CaptureRequirementIfIsTrue(
                responseOfGetHierarchyAllResult.Length == providerNames.Count,
                239,
                @"[In GetHierarchyAllResponse]The protocol server MUST return one claims provider hierarchy tree for each claims provider that match the criteria specified in the input message.");
        }
Ejemplo n.º 34
0
        protected void RGrid_EndUserList_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "Del")
            {
                string AutoID = Convert.ToString(e.CommandArgument);
                bool isDelete = false;
                Model.Log logModel = new Model.Log();
                logModel.OperationItem = "删除终端用户";
                logModel.Operator = user.UserInfo.UserID;
                logModel.OperationTime = DateTime.Now;
                Model.EndUser euModel = eu.GetModel(long.Parse(AutoID));
                try
                {
                    if (euModel != null)
                    {
                        logModel.OperationDetail = "用户姓名:" + euModel.EndUserName + " - STB号:" + euModel.SimCardNo + " - 身份:" + euModel.Identities;

                        using (MongoDBServiceSoapClient mg = new MongoDBServiceSoapClient())
                        {
                            string rtStr = "";
                            bool isDeleteMg = true;
                            if (mg.SelectEnduserBySimCardNo(euModel.SimCardNo, out rtStr) != null)
                            {
                                isDeleteMg = false;
                                isDeleteMg = mg.DeleteEnduser(euModel.SimCardNo, out rtStr);
                            }
                            if (isDeleteMg)
                            {
                                isDelete = eu.Delete(long.Parse(AutoID));
                            }

                            logModel.Memo += rtStr;
                        }
                    }
                }
                catch (Exception ex)
                {
                    logModel.Memo = "异常:" + ex.Message;
                }
                finally
                {
                    if (euModel != null)
                    {
                        log.Add(logModel);
                        if (isDelete)
                        {
                            List<Model.EndUser> endUserList = (List<Model.EndUser>)ViewState["EndUserList"];
                            endUserList.RemoveAll(rt => rt.AutoID == long.Parse(AutoID));
                            RGrid_EndUserList.DataSource = endUserList;
                            RGrid_EndUserList.Rebind();
                            RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc1", "OpenAlert('恭喜用户删除成功。');", true);
                        }
                        else
                        {
                            RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc2", "OpenAlert('抱歉!用户删除失败。');", true);
                        }
                    }
                    else
                    {
                        List<Model.EndUser> endUserList = (List<Model.EndUser>)ViewState["EndUserList"];
                        endUserList.RemoveAll(rt => rt.AutoID == long.Parse(AutoID));
                        RGrid_EndUserList.DataSource = endUserList;
                        RGrid_EndUserList.DataBind();
                        ViewState["EndUserList"] = endUserList;
                        RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc2", "OpenAlert('抱歉!用户删除失败。该用户已不存在!!');", true);
                    }
                }
            }
            if (e.CommandName == "Sync")
            {
                string AutoID = Convert.ToString(e.CommandArgument);
                bool isSyncMg = false;
                Model.Log logModel = new Model.Log();
                logModel.OperationItem = "同步终端用户";
                logModel.Operator = user.UserInfo.UserID;
                logModel.OperationTime = DateTime.Now;
                Model.EndUser euModel = eu.GetModel(long.Parse(AutoID));
                try
                {
                    if (euModel != null)
                    {
                        logModel.OperationDetail = "用户姓名:" + euModel.EndUserName + " - STB号:" + euModel.SimCardNo + " - 身份:" + euModel.Identities;
                        MongoDBService.EndUser dc = new MongoDBService.EndUser();
                        {
                            dc.AutoID = euModel.AutoID.ToString();
                            dc.EnduserName = euModel.EndUserName;
                            string[] identityArr = euModel.Identities.Split('|');
                            ArrayOfString aof = new ArrayOfString();
                            foreach (string id in identityArr)
                            {
                                if (id.Equals(""))
                                {
                                    continue;
                                }
                                aof.Add(id);
                            }
                            dc.Identities = aof;
                            dc.IsValid = euModel.IsValid;
                            dc.LastModifyTime = euModel.LastModifyTime;
                            dc.SimCardNo = euModel.SimCardNo;
                            using (MongoDBServiceSoapClient mg = new MongoDBServiceSoapClient())
                            {
                                string rtStr = "";
                                if (mg.SelectEnduserBySimCardNo(euModel.SimCardNo, out rtStr) != null)
                                {
                                    isSyncMg = mg.UpdateEnduser(dc, out rtStr);
                                }
                                else
                                {
                                    isSyncMg = mg.InsertEnduser(dc, out rtStr);
                                }
                                logModel.Memo += rtStr;

                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    logModel.Memo = "异常:" + ex.Message;
                }
                finally
                {
                    if (euModel != null)
                    {
                        log.Add(logModel);
                        if (isSyncMg)
                        {
                            RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc1", "OpenAlert('恭喜用户同步成功。');", true);
                        }
                        else
                        {
                            RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc2", "OpenAlert('抱歉!用户同步失败。');", true);
                        }
                    }
                    else
                    {
                        RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc2", "OpenAlert('抱歉!用户同步失败。该用户本地已不存在!!');", true);
                    }
                }
            }
        }
Ejemplo n.º 35
0
        public List <Product> GetAllProduct(string csvPath, QT.Entities.Company company, DatafeedConfig datafeedConfig, Action <string> eventLog = null)
        {
            List <Product> lstPt       = new List <Product>();
            CultureInfo    cultureInfo = (datafeedConfig.CurrencyFormat == CurrencyFormat.Vietnamese) ? CultureInfo.GetCultureInfo("vi-VN") : CultureInfo.GetCultureInfo("en-US");
            var            csv         = new Wss.Lib.CsvHelper.CsvFile(csvPath, new Action <string>((string str) =>
            {
                _log.ErrorFormat("Can't parser csv line: {0}", str);
            }));

            while (csv.Read())
            {
                try
                {
                    var tmpProduct = new Product
                    {
                        Domain   = company.Domain,
                        IDCongTy = company.ID,
                        Status   = Common.ProductStatus.Available,
                        Instock  = Common.GetProductInstockFormStatus(Common.ProductStatus.Available)
                    };
                    string        strTemp         = "";
                    long          discountedPrice = 0;
                    long          originPrice     = 0;
                    List <string> lstCat          = new ArrayOfString();

                    if (csv.TryGetField(datafeedConfig.ProductNameNode, ref strTemp))
                    {
                        tmpProduct.Name = strTemp;
                    }

                    if (csv.TryGetField(datafeedConfig.UrlNode, ref strTemp))
                    {
                        tmpProduct.DetailUrl = strTemp;
                        tmpProduct.ID        = Wss.Lib.Utilities.UtilIdProduct.GenId(tmpProduct.DetailUrl, datafeedConfig.RegexConfigUrl);
                    }

                    if (csv.TryGetField(datafeedConfig.SkuNode, ref strTemp))
                    {
                        tmpProduct.MerchantSku = strTemp;
                    }

                    if (csv.TryGetField(datafeedConfig.BrandNode, ref strTemp))
                    {
                        tmpProduct.Manufacture = strTemp;
                    }
                    tmpProduct.HashName = Common.GetHashNameProduct(company.Domain, tmpProduct.Name.Trim());

                    if (csv.TryGetField(datafeedConfig.DiscountedPriceNode, ref strTemp))
                    {
                        discountedPrice = (int)Decimal.Parse(Regex.Replace(strTemp.ToLower().Trim(), strNotMeanPrice, ""), cultureInfo);
                    }

                    if (csv.TryGetField(datafeedConfig.PriceNode, ref strTemp))
                    {
                        originPrice = (int)Decimal.Parse(Regex.Replace(strTemp.ToLower().Trim(), strNotMeanPrice, ""), cultureInfo);
                    }

                    #region {xuligia}

                    if (discountedPrice > 0)
                    {
                        if (originPrice > discountedPrice)
                        {
                            tmpProduct.Price       = (int)discountedPrice;
                            tmpProduct.OriginPrice = (int)originPrice;
                            //tmpProduct.IsDeal = true;
                        }
                        else
                        {
                            tmpProduct.Price = tmpProduct.OriginPrice = (int)discountedPrice;
                            //tmpProduct.IsDeal = false;
                        }
                    }
                    //
                    else if (originPrice > 0)
                    {
                        int discountPrice = 0;
                        //DiscountPrice (số tiền giảm)
                        try
                        {
                            if (csv.TryGetField(datafeedConfig.DiscountNode, ref strTemp))
                            {
                                discountPrice = (int)Decimal.Parse(Regex.Replace(strTemp.ToLower().Trim(), strNotMeanPrice, ""), cultureInfo);
                            }
                        }
                        catch (Exception)
                        {
                        }
                        if (discountPrice > 0)
                        {
                            tmpProduct.Price       = (int)originPrice - (int)discountPrice;
                            tmpProduct.OriginPrice = (int)originPrice;
                            //tmpProduct.IsDeal = true;
                        }
                        else
                        {
                            tmpProduct.Price = tmpProduct.OriginPrice = (int)originPrice;
                            //tmpProduct.IsDeal = false;
                        }
                    }

                    #endregion

                    if (csv.TryGetField(datafeedConfig.Category1Node, ref strTemp))
                    {
                        lstCat.Add(strTemp);
                    }

                    if (csv.TryGetField(datafeedConfig.Category2Node, ref strTemp))
                    {
                        lstCat.Add(strTemp);
                    }
                    tmpProduct.Categories   = lstCat;
                    tmpProduct.IDCategories = Common.GetIDClassification(Common.ConvertToString(tmpProduct.Categories, " -> "));

                    if (csv.TryGetField(datafeedConfig.PictureUrl1Node, ref strTemp))
                    {
                        tmpProduct.ImageUrls = new ArrayOfString()
                        {
                            strTemp
                        };
                    }

                    tmpProduct.VATStatus = 1;


                    eventLog(string.Format("NumbItem: {0} CheckInfoProduct: {1}", lstPt.Count, CheckWarnInfo(tmpProduct)));
                    lstPt.Add(tmpProduct);
                }
                catch (Exception ex)
                {
                    _log.Error(ex);
                    throw ex;
                }
            }
            return(lstPt);
        }
Ejemplo n.º 36
0
        //同步
        protected void Button1_Click(object sender, EventArgs e)
        {
            int selectCount = RGrid_EndUserList.SelectedItems.Count;
            if (selectCount == 0)
            {
                RadScriptManager.RegisterStartupScript(Page, GetType(), "c3", "OpenAlert('抱歉!您未选择任何项!!');", true);
                return;
            }
            Model.Log logModel = new Model.Log();
            logModel.OperationItem = "批量同步终端用户";
            logModel.Operator = user.UserInfo.UserID;
            logModel.OperationTime = DateTime.Now;
            int totCount = selectCount;
            StringBuilder notExist = new StringBuilder("");
            bool isSyncMgUp = false;
            bool isSyncMgIn = false;
            try
            {
                StringBuilder sb = new StringBuilder("【");
                StringBuilder sbU = new StringBuilder("【");
                StringBuilder sbI = new StringBuilder("【");
                List<MongoDBService.EndUser> euUpList = new List<MongoDBService.EndUser>();
                List<MongoDBService.EndUser> euInList = new List<MongoDBService.EndUser>();
                using (MongoDBServiceSoapClient mg = new MongoDBServiceSoapClient())
                {
                    foreach (GridDataItem item in RGrid_EndUserList.MasterTableView.Items)
                    {
                        if ((item["CheckboxSelectColumn"].Controls[0] as CheckBox).Checked)
                        {
                            String autoid = item["AutoID"].Text;
                            sb.Append(autoid + " ");
                            if (!eu.Exists(long.Parse(autoid)))
                            {
                                continue;
                            }
                            Model.EndUser euModel = eu.GetModel(long.Parse(autoid));
                            MongoDBService.EndUser dc = new MongoDBService.EndUser();
                            dc.AutoID = euModel.AutoID.ToString();
                            dc.EnduserName = euModel.EndUserName;
                            string[] identityArr = euModel.Identities.Split('|');
                            ArrayOfString aof = new ArrayOfString();
                            foreach (string id in identityArr)
                            {
                                if (id.Equals(""))
                                {
                                    continue;
                                }
                                aof.Add(id);
                            }
                            dc.Identities = aof;
                            dc.IsValid = euModel.IsValid;
                            dc.LastModifyTime = euModel.LastModifyTime;
                            dc.SimCardNo = euModel.SimCardNo;
                            string rtStrx = "";
                            if (mg.SelectEnduserBySimCardNo(euModel.SimCardNo, out rtStrx) != null)
                            {
                                sbU.Append(autoid + " ");
                                euUpList.Add(dc);
                            }
                            else
                            {
                                sbI.Append(autoid + " ");
                                euInList.Add(dc);
                            }
                        }
                    }

                    string info0 = "";
                    string info1 = "";
                    isSyncMgUp = true;
                    if (euUpList.Count > 0)
                    {
                        string rtStr = "";
                        isSyncMgUp = false;
                        isSyncMgUp = mg.UpdateEndusers(euUpList.ToArray(), out rtStr);
                        if (isSyncMgUp)
                        {
                            info0 = "同步成功(更新)列表[" + euUpList.Count + "]:" + sbU.ToString();
                        }
                        else
                        {
                            info0 = "同步成功(更新)列表[" + euUpList.Count + "]:无";
                        }
                        logModel.Memo += "同步更新返回:" + rtStr;
                    }
                    isSyncMgIn = true;
                    if (euInList.Count > 0)
                    {
                        string rtStr = "";
                        isSyncMgIn = false;
                        isSyncMgIn = mg.InsertEndusers(euInList.ToArray(), out rtStr);
                        if (isSyncMgIn)
                        {
                            info0 = "同步成功(新增)列表[" + euUpList.Count + "]:" + sbU.ToString();
                        }
                        else
                        {
                            info0 = "同步成功(新增)列表[" + euUpList.Count + "]:无";
                        }
                        logModel.Memo += "同步新增返回:" + rtStr; ;
                    }
                    sb.Append("】");
                    sbU.Append("】");
                    sbI.Append("】");
                    logModel.OperationDetail = "同步请求列表[" + totCount + "]:" + sb.ToString() + info0 + info1;
                }
            }
            catch (Exception ex)
            {
                logModel.Memo = "异常:" + ex.Message;
            }
            finally
            {
                if (isSyncMgUp && isSyncMgIn)
                {
                    logModel.Memo = "成功";
                    log.Add(logModel);
                    RadScriptManager.RegisterStartupScript(Page, GetType(), "c2", "OpenAlert('恭喜!同步成功!');", true);
                }
                else
                {
                    logModel.Memo += "失败";
                    log.Add(logModel);
                    RadScriptManager.RegisterStartupScript(Page, GetType(), "c3", "OpenAlert('抱歉!同步未完全成功!');", true);
                }
            }
        }
Ejemplo n.º 37
0
        void LOAD_GAME_SETTINGS___4_SimpleIMP()
        {
            isRobber = false;
            isSplit = false;
            canbeNoContract = true;

            //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            DB_Deals_TableName = "Deals_Sport";
            DB_Deals_ColumnsNames.Add(1, "CardsDistribution");
            DB_Deals_ColumnsNames.Add(3, "Pair");
            DB_Deals_ColumnsNames.Add(4, "Contract");
            DB_Deals_ColumnsNames.Add(5, "Result");

            columnsDataClasses = new ArrayOfTypes();
            columnsDataClasses.Add(typeof(IntData));
            columnsDataClasses.Add(typeof(CardsDistribution));
            columnsDataClasses.Add(typeof(ZoneSwitcher));
            columnsDataClasses.Add(typeof(PairSwitcher));
            columnsDataClasses.Add(typeof(Contract));
            columnsDataClasses.Add(typeof(Result));
            columnsDataClasses.Add(typeof(SimpleScore));
            columnsDataClasses.Add(typeof(SimpleScore));
            columnsDataClasses.Add(typeof(QuarterSwitcher));

            ID_NAMES.Add(0, "NO");
            ID_NAMES.Add(1, "DISTRIBUTION");
            ID_NAMES.Add(2, "ZONE");
            ID_NAMES.Add(3, "PAIR");
            ID_NAMES.Add(4, "CONTRACT");
            ID_NAMES.Add(5, "RESULT");
            ID_NAMES.Add(6, "SCORE");
            ID_NAMES.Add(7, "IMP");
            ID_NAMES.Add(8, "DEALER");

            REFLECT_Functions.Add(3, new FuncInfo[] { new FuncInfo("NoPairIfNoContract", new string[] { "PAIR", "CONTRACT" }) });
            REFLECT_Depends.Add(3, new int[] { 3, 4 });
            REFLECT_Functions.Add(0, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "NO", "MDEAL_NO" }) });
            REFLECT_Constructors.Add(0, new string[] { "true" });
            REFLECT_Depends.Add(0, new int[] { -1 });
            REFLECT_Functions.Add(2, new FuncInfo[] { new FuncInfo("DefineSportZone", new string[] { "ZONE", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", GameSettings_3Sports_ZoneSwims.ToString() }) });
            REFLECT_Depends.Add(2, new int[] { -1 });
            REFLECT_Functions.Add(5, new FuncInfo[] { new FuncInfo("CorrectResultAccordingToContract", new string[] { "RESULT", "CONTRACT", "0" }) });
            REFLECT_Depends.Add(5, new int[] { 4 });
            REFLECT_Constructors.Add(5, new string[] { "CONTRACT" });
            REFLECT_Functions.Add(6, new FuncInfo[] { new FuncInfo("SportScore", new string[] { "SCORE", "PAIR", "ZONE", "CONTRACT", "RESULT" }) });
            REFLECT_Depends.Add(6, new int[] { 2, 3, 4, 5 });
            REFLECT_Functions.Add(7, new FuncInfo[] { new FuncInfo("ConvertToIMPs", new string[] { "IMP", "SCORE" }) });
            REFLECT_Depends.Add(7, new int[] { 6 });
            REFLECT_Functions.Add(8, new FuncInfo[] { new FuncInfo("DefineSportDealer", new string[] { "DEALER", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", "FIRST_DEALER", GameSettings_3Sports_ZoneSwims.ToString() }) });
            REFLECT_Depends.Add(8, new int[] { -1 });
            //new for match:
            REFLECT_Functions.Add((int)CONST.MATCH_TOTAL_SCORE, new FuncInfo[] { new FuncInfo("SetMatchScore", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO", "7" }), new FuncInfo("TotalScore_MatchMode", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO__REAL" }) });
            REFLECT_Depends.Add((int)CONST.MATCH_TOTAL_SCORE, new int[] { 7 });
            REFLECT_InsideFunctionsList.Add("SetMatchScore");
            REFLECT_InsideFunctionsList.Add("TotalScore_MatchMode");

            NotNecessaryValues.Add(new int[] { 1 });
            ContractColumns.Add(new int[] { 4 });
            NotNecessaryValues_NOCONTRACT.Add(new ArrayOfInt());
            NotNecessaryValues_NOCONTRACT[0].Add(new int[] { 3 });

            columnsControlsClasses = new ArrayOfTypes();
            columnsControlsClasses.Add(typeof(DealInfoControl));
            columnsControlsClasses.Add(typeof(ShowTextControl_Center));
            columnsControlsClasses.Add(typeof(ShowTextControl));
            columnsControlsClasses.Add(typeof(SwitcherControl_Orange_Center));
            columnsControlsClasses.Add(typeof(ContractSelectControl));
            columnsControlsClasses.Add(typeof(ResultSelectControl));
            columnsControlsClasses.Add(typeof(ShowSimpleScore));
            columnsControlsClasses.Add(typeof(ShowSimpleScore));

            arrHeadersNames = new ArrayOfString();
            arrHeadersNames.Add("#");
            arrHeadersNames.Add("Сда-\nющий");
            arrHeadersNames.Add("Зона");
            arrHeadersNames.Add("Па\nра");
            arrHeadersNames.Add("Контракт");
            arrHeadersNames.Add("Рез-т");
            arrHeadersNames.Add("Очки");
            arrHeadersNames.Add("IMP");

            arrHeadersNames_FULL = new ArrayOfString();
            arrHeadersNames_FULL.Add("#");
            arrHeadersNames_FULL.Add("Сдающий");
            arrHeadersNames_FULL.Add("Зона");
            arrHeadersNames_FULL.Add("Пара");
            arrHeadersNames_FULL.Add("Контракт");
            arrHeadersNames_FULL.Add("Рез-т");
            arrHeadersNames_FULL.Add("Очки");
            arrHeadersNames_FULL.Add("IMP");

            arrHeadersWidths = new ArrayOfInt();
            arrHeadersWidths.Add(new int[] { 22+8, 42+3, 55+14, 28+14, 71+14, 47+14, 47+14, 30+14 });

            CoVa_Dependences = new ArrayOfArrayOfInt();
            for (int i = 0; i < arrHeadersNames.Count; i++)
                CoVa_Dependences.Add(new ArrayOfInt());
            CoVa_Dependences[0].Add(new int[] { 0, 1 });
            CoVa_Dependences[1].Add(8);
            CoVa_Dependences[2].Add(2);
            CoVa_Dependences[3].Add(3);
            CoVa_Dependences[4].Add(4);
            CoVa_Dependences[5].Add(5);
            CoVa_Dependences[6].Add(new int[] { 6 });  //относительно заданной пары
            CoVa_Dependences[7].Add(new int[] { 7 });  //относительно заданной пары
        }
Ejemplo n.º 38
0
        void LOAD_GAME_SETTINGS___3_Compensat()
        {
            isRobber = false;
            isSplit = false;
            canbeNoContract = true;

            // ОПЦИИ
            GameSettings_Comp_Type = (BridgeGameScoring.TypeOfCompensation)(GameSettings_Options & 3); //2 bits
            GameSettings_Comp_10CardsIs2Fits = ((GameSettings_Options & 4) > 0); //3rd bit
            GameSettings_Comp_LessCompFor2Fits23PC = ((GameSettings_Options & 8) > 0); //4th bit

            // Скрыть ли сдающего в меню?
            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
                hide_dealer_in_menu = true;
            else
                hide_dealer_in_menu = false;

            //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            DB_Deals_TableName = "Deals_Sport";
            DB_Deals_ColumnsNames.Add(1, "CardsDistribution");
            DB_Deals_ColumnsNames.Add(3, "Pair");
            DB_Deals_ColumnsNames.Add(4, "Contract");
            DB_Deals_ColumnsNames.Add(5, "Result");
            DB_Deals_ColumnsNames.Add(7, "Figures");
            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
            {
                DB_Deals_ColumnsNames.Add(12, "Fits");
                DB_Deals_ColumnsNames.Add(13, "StrongestPair");
            }

            columnsDataClasses = new ArrayOfTypes();
            columnsDataClasses.Add(typeof(IntData));
            columnsDataClasses.Add(typeof(CardsDistribution));
            columnsDataClasses.Add(typeof(ZoneSwitcher));
            columnsDataClasses.Add(typeof(PairSwitcher));
            columnsDataClasses.Add(typeof(Contract));
            columnsDataClasses.Add(typeof(Result));
            columnsDataClasses.Add(typeof(SimpleScore));
            columnsDataClasses.Add(typeof(IntData));
            columnsDataClasses.Add(typeof(SimpleScore));
            columnsDataClasses.Add(typeof(SimpleScore));
            columnsDataClasses.Add(typeof(SimpleScore));
            columnsDataClasses.Add(typeof(QuarterSwitcher));
            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
            {
                columnsDataClasses.Add(typeof(FitsSwitcher));
                columnsDataClasses.Add(typeof(BoolData));
            }

            ID_NAMES.Add(0, "NO");
            ID_NAMES.Add(1, "DISTRIBUTION");
            ID_NAMES.Add(2, "ZONE");
            ID_NAMES.Add(3, "PAIR");
            ID_NAMES.Add(4, "CONTRACT");
            ID_NAMES.Add(5, "RESULT");
            ID_NAMES.Add(6, "SCORE");
            ID_NAMES.Add(7, "FIG");
            ID_NAMES.Add(8, "COMPENS");
            ID_NAMES.Add(9, "DIFF");
            ID_NAMES.Add(10, "IMP");
            ID_NAMES.Add(11, "DEALER");
            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
            {
                ID_NAMES.Add(12, "FITS");
                ID_NAMES.Add(13, "STRONGEST");
            }

            REFLECT_Functions.Add(3, new FuncInfo[] { new FuncInfo("NoPairIfNoContract", new string[] { "PAIR", "CONTRACT" }) });
            REFLECT_Depends.Add(3, new int[] { 3, 4 });
            REFLECT_Functions.Add(0, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "NO", "MDEAL_NO" }) });
            REFLECT_Constructors.Add(0, new string[] { "true" });
            REFLECT_Depends.Add(0, new int[] { -1 });
            REFLECT_Functions.Add(2, new FuncInfo[] { new FuncInfo("DefineSportZone", new string[] { "ZONE", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", GameSettings_3Sports_ZoneSwims.ToString() }) });
            REFLECT_Depends.Add(2, new int[] { -1 });
            REFLECT_Functions.Add(5, new FuncInfo[] { new FuncInfo("CorrectResultAccordingToContract", new string[] { "RESULT", "CONTRACT", "0" }) });
            REFLECT_Depends.Add(5, new int[] { 4 });
            REFLECT_Constructors.Add(5, new string[] { "CONTRACT" });
            REFLECT_Functions.Add(6, new FuncInfo[] { new FuncInfo("SportScore", new string[] { "SCORE", "PAIR", "ZONE", "CONTRACT", "RESULT" }) });
            REFLECT_Depends.Add(6, new int[] { 2, 3, 4, 5 });

            //fig
            REFLECT_Functions.Add(7, new FuncInfo[] { new FuncInfo("FiguresPoints", new string[] { "FIG", "DISTRIBUTION", "TRUE", /*not use*/ "PAIR" }) });
            REFLECT_Depends.Add(7, new int[] { 7, 1 });
            REFLECT_Constructors.Add(7, new string[] { "true", "0", "true", "40" });

            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
            {
                // strongest
                REFLECT_Functions.Add(13, new FuncInfo[] { new FuncInfo("WhoIsStrongest20", new string[] { "STRONGEST", "FIG", "DISTRIBUTION", "LOADING_FROM_DB" }) });
                REFLECT_Depends.Add(13, new int[] { 1, 7 });

                //fits
                REFLECT_Functions.Add(12, new FuncInfo[] { new FuncInfo("FitsPoints", new string[] { "FITS", "DISTRIBUTION", (GameSettings_Comp_10CardsIs2Fits ? "TRUE" : "FALSE") }) });
                REFLECT_Depends.Add(12, new int[] { 12, 1 });
            }

            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
            {
                //comp with fits
                REFLECT_Functions.Add(8, new FuncInfo[] { new FuncInfo("GetCompensation_WithFits", new string[] { "COMPENS", "DISTRIBUTION", "FIG", "ZONE", "TRUE", /*not use*/"PAIR", /* ||||| */ "FITS", "STRONGEST", (GameSettings_Comp_10CardsIs2Fits ? "TRUE" : "FALSE"), (GameSettings_Comp_LessCompFor2Fits23PC ? "TRUE" : "FALSE") }) });
                REFLECT_Depends.Add(8, new int[] { 7, 2, 1, 12, 13 });
            }
            else
            {
                //comp
                REFLECT_Functions.Add(8, new FuncInfo[] { new FuncInfo("GetCompensation", new string[] { "COMPENS", "DISTRIBUTION", "FIG", "ZONE", "TRUE", /*not use*/"PAIR", ((int)GameSettings_Comp_Type).ToString() }) });
                REFLECT_Depends.Add(8, new int[] { 7, 2, 1 });
            }
            REFLECT_Functions.Add(9, new FuncInfo[] { new FuncInfo("ScoreSumm", new string[] { "DIFF", "SCORE", "COMPENS" }) });
            REFLECT_Depends.Add(9, new int[] { 6, 8 });
            REFLECT_Functions.Add(10, new FuncInfo[] { new FuncInfo("ConvertToIMPs", new string[] { "IMP", "DIFF" }) });
            REFLECT_Depends.Add(10, new int[] { 9 });
            REFLECT_Functions.Add(11, new FuncInfo[] { new FuncInfo("DefineSportDealer", new string[] { "DEALER", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", "FIRST_DEALER", GameSettings_3Sports_ZoneSwims.ToString() }) });
            REFLECT_Depends.Add(11, new int[] { -1 });

            //new for match:
            REFLECT_Functions.Add((int)CONST.MATCH_TOTAL_SCORE, new FuncInfo[] { new FuncInfo("SetMatchScore", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO", "10" }), new FuncInfo("TotalScore_MatchMode", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO__REAL" }) });
            REFLECT_Depends.Add((int)CONST.MATCH_TOTAL_SCORE, new int[] { 10 });
            REFLECT_InsideFunctionsList.Add("SetMatchScore");
            REFLECT_InsideFunctionsList.Add("TotalScore_MatchMode");

            NotNecessaryValues.Add(new int[] { 1 });
            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
            {
                NotNecessaryValues.Add(new int[] { 13 }); //!!!!!!!!!!! указать сильную сторону все-таки обязательно, если фигур=20 !!!!!!!!!!!!
            }
            ContractColumns.Add(new int[] { 4 });
            NotNecessaryValues_NOCONTRACT.Add(new ArrayOfInt());
            NotNecessaryValues_NOCONTRACT[0].Add(new int[] { 3 });

            columnsControlsClasses = new ArrayOfTypes();
            columnsControlsClasses.Add(typeof(DealInfoControl));
            if (!hide_dealer_in_menu)
            {
                columnsControlsClasses.Add(typeof(ShowTextControl_Center)); //1...
            }
            columnsControlsClasses.Add(typeof(ShowTextControl));
            columnsControlsClasses.Add(typeof(SwitcherControl_Orange));
            columnsControlsClasses.Add(typeof(ContractSelectControl));
            columnsControlsClasses.Add(typeof(ResultSelectControl));
            columnsControlsClasses.Add(typeof(ShowSimpleScore));
            columnsControlsClasses.Add(typeof(TextBoxInTable)); //6
            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
            {
                columnsControlsClasses.Add(typeof(SwitcherControl_Orange)); //7
            }
            columnsControlsClasses.Add(typeof(ShowSimpleScore)); //7-8
            columnsControlsClasses.Add(typeof(ShowSimpleScore)); //8-9
            columnsControlsClasses.Add(typeof(ShowSimpleScore)); //9-10

            arrHeadersNames = new ArrayOfString();
            arrHeadersNames.Add("#");
            if (!hide_dealer_in_menu)
            {
                arrHeadersNames.Add("Сда\nющ.");
            }
            arrHeadersNames.Add("Зона");
            arrHeadersNames.Add("Па\nра");
            arrHeadersNames.Add("Контракт");
            arrHeadersNames.Add("Рез-т");
            arrHeadersNames.Add("Очки");
            arrHeadersNames.Add("Фи\nгур"); //6
            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
            {
                arrHeadersNames.Add("Фи\nты"); //7
            }
            arrHeadersNames.Add("Комп."); //7-8
            arrHeadersNames.Add("Раз-\nница"); //8-9
            arrHeadersNames.Add("IMP"); //9-10

            arrHeadersNames_FULL = new ArrayOfString();
            arrHeadersNames_FULL.Add("#");
            if (!hide_dealer_in_menu)
            {
                arrHeadersNames_FULL.Add("Сдающий");
            }
            arrHeadersNames_FULL.Add("Зона");
            arrHeadersNames_FULL.Add("Пара");
            arrHeadersNames_FULL.Add("Контракт");
            arrHeadersNames_FULL.Add("Рез-т");
            arrHeadersNames_FULL.Add("Очки");
            arrHeadersNames_FULL.Add("Фигуры (NS)"); //6
            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
            {
                arrHeadersNames_FULL.Add("Фиты"); //7
            }
            arrHeadersNames_FULL.Add("Компенсация"); //7-8
            arrHeadersNames_FULL.Add("Разница"); //8-9
            arrHeadersNames_FULL.Add("IMP"); //9-10

            arrHeadersWidths = new ArrayOfInt();
            arrHeadersWidths.Add(22);
            if (!hide_dealer_in_menu)
            {
                arrHeadersWidths.Add(33);
            }
            arrHeadersWidths.Add(new int[] { 51, 26, 69, 45, 45, 26 });
            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
                arrHeadersWidths.Add(25);
            arrHeadersWidths.Add(new int[] { 45, 45, 28 });

            int hidden_dealer_offset = (!hide_dealer_in_menu) ? 1 : 0; //сдвиг индексов на 1 (после #), если сдающего все-таки показывать
            CoVa_Dependences = new ArrayOfArrayOfInt();
            for (int i = 0; i < arrHeadersNames.Count; i++)
                CoVa_Dependences.Add(new ArrayOfInt());
            if (hide_dealer_in_menu)
            {
                CoVa_Dependences[0].Add(new int[] { 0, 1, 11 });
            }
            else
            {
                CoVa_Dependences[0].Add(new int[] { 0, 1 });
                CoVa_Dependences[1].Add(11);
            }
            CoVa_Dependences[1 + hidden_dealer_offset].Add(2);
            CoVa_Dependences[2 + hidden_dealer_offset].Add(3);
            CoVa_Dependences[3 + hidden_dealer_offset].Add(4);
            CoVa_Dependences[4 + hidden_dealer_offset].Add(5);
            CoVa_Dependences[5 + hidden_dealer_offset].Add(new int[] { 6 });  //относительно static
            CoVa_Dependences[6 + hidden_dealer_offset].Add(7);
            if (GameSettings_Comp_Type == BridgeGameScoring.TypeOfCompensation.Europe)
            {
                CoVa_Dependences[7 + hidden_dealer_offset].Add(new int[] { 12 });  // относительно СИЛЬНОЙ пары, так что ПОХУЙ //
                CoVa_Dependences[8 + hidden_dealer_offset].Add(new int[] { 8 });  //относительно static
                CoVa_Dependences[9 + hidden_dealer_offset].Add(new int[] { 9 });  //относительно static
                CoVa_Dependences[10 + hidden_dealer_offset].Add(new int[] { 10 });  //относительно static
            }
            else
            {
                CoVa_Dependences[7 + hidden_dealer_offset].Add(new int[] { 8 });  //относительно static
                CoVa_Dependences[8 + hidden_dealer_offset].Add(new int[] { 9 });  //относительно static
                CoVa_Dependences[9 + hidden_dealer_offset].Add(new int[] { 10 });  //относительно static
            }
        }
Ejemplo n.º 39
0
        public void ResolveUserInfo(List<UserInfo> users)
        {
            var logins = new ArrayOfString();

            foreach (UserInfo user in users)
            {
                logins.Add(user.AccountName != ""
                    ? user.AccountName
                    : user.DisplayName);
            }

            _peopleService.ResolvePrincipalsAsync(logins,
                    SPPrincipalType.User, true);

        }
        public void MSCPSWS_S04_TC06_ResolveMultipleClaim_SomeValid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.SecurityGroup;
            SPClaim[] resolveInput = new SPClaim[2];

            resolveInput[0] = this.GenerateSPClaimResolveInput_Valid();
            resolveInput[1] = this.GenerateSPClaimResolveInput_Invalid();

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                if (provider.Children.Length != 0)
                {
                    providerNames.Add(provider.ProviderName);                             
                }
            }

            // Call Resolve multiple claim method to resolve 2 claims to picker entities using a list of claims providers.
            PickerEntity[] responseOfResolveMultipleClaimResult = CPSWSAdapter.ResolveMultipleClaim(providerNames, principalType, resolveInput);
            Site.Assert.IsNotNull(responseOfResolveMultipleClaimResult, "The resolve multiple claim result should not be null.");

            // If the resolve multiple result contains 2 picker entities, that is to say, one picker entity in the response corresponding to one user in the request, then the following requirement can be captured.
            Site.CaptureRequirementIfAreEqual<int>(
                responseOfResolveMultipleClaimResult.Length,
                2,
                369,
                @"[In ResolveMultipleClaimResponse] ResolveMultipleClaimResult: The list MUST contain one and only one picker entity per one claim in the input.");

            Site.CaptureRequirementIfAreEqual<int>(
                responseOfResolveMultipleClaimResult.Length,
                2,
                350,
                @"[In ResolveMultipleClaim] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
Ejemplo n.º 41
0
        //建立表
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            ShapeFileRecord record1 = shapeFileReader.Records[0];
            Graphic         g1      = record1.ToGraphic();

            if (g1 != null)
            {
                FeatureSet fs1 = new FeatureSet();
                fs1.Features.Add(g1);
                string     json1    = fs1.ToJson();
                JsonObject jsonObj1 = JsonObject.Parse(json1) as JsonObject;
                if (jsonObj1.ContainsKey("features"))
                {
                    JsonValue jsonFea1 = jsonObj1["features"];
                    if (jsonFea1 is JsonArray)
                    {
                        if (jsonFea1[0].ContainsKey("attributes"))
                        {
                            JsonValue     jsonAtt1 = jsonFea1[0]["attributes"];
                            JsonObject    jsonAO1  = jsonAtt1 as JsonObject;
                            ArrayOfString Names    = new ArrayOfString();
                            ArrayOfString Types    = new ArrayOfString();
                            //获取名
                            foreach (string name in jsonAO1.Keys)
                            {
                                Names.Add(name);
                                names += "," + name;
                            }
                            Names.Add("Json");
                            names += ",Json";
                            //获取属性类型
                            foreach (JsonValue item in jsonAO1.Values)
                            {
                                switch (item.JsonType)
                                {
                                case JsonType.String:
                                    Types.Add((typeof(String)).ToString());
                                    break;

                                case JsonType.Number:
                                    Types.Add((typeof(Double)).ToString());
                                    break;

                                case JsonType.Boolean:
                                    Types.Add((typeof(Boolean)).ToString());
                                    break;

                                case JsonType.Array:
                                    Types.Add((typeof(Array)).ToString());
                                    break;

                                case JsonType.Object:
                                    Types.Add((typeof(Object)).ToString());
                                    break;

                                default: MessageBox.Show("未识别类型");
                                    break;
                                }
                            }
                            Types.Add("Json");
                            MyWebService1SoapClient MyClient1 = new MyWebService1SoapClient();
                            MyClient1.DynamicAccessCompleted += new EventHandler <System.ComponentModel.AsyncCompletedEventArgs>(MyClient1_DynamicAccessCompleted);
                            MyClient1.DynamicAccessAsync(textBox1.Text + ".mdb", textBox2.Text, Names, Types);
                        }
                    }
                }
            }
        }
Ejemplo n.º 42
0
        public static void ResultAsync(string account, string url, string verb, string rawData = "", PostCallBack callBack = null)
        {
            if (!EnumHelper.TryParseStr(verb, out HttpVerb httpVerb))
            {
                Log.ErrorFormat("请求服务器异常:{0},Verb:{1}", url, verb);
                callBack?.Invoke("", new Exception("Verb Error:" + verb));
            }
            if (!rawData.IsNullOrEmpty())
            {
                try
                {
                    if (httpVerb == HttpVerb.GET)
                    {
                        var requestBody = JObject.Parse(rawData);
                        if (requestBody.Count == 1 && requestBody.GetValue("id") != null)
                        {
                            url += "/" + requestBody["id"];
                            requestBody.Remove("id");
                            rawData = requestBody.HasValues ? requestBody.ToJSON() : "";
                        }
                        else
                        {
                            var dts = new ArrayOfString();
                            foreach (var variable in requestBody)
                            {
                                dts.Add($"{variable.Key}={variable.Value}");
                            }
                            if (dts.Count > 0)
                            {
                                url += "?" + dts.Join("&");
                            }
                        }
                    }
                    else
                    {
                        var requestBody = JObject.Parse(rawData);
                        if (requestBody.GetValue("id") != null)
                        {
                            url += "/" + requestBody["id"];
                            requestBody.Remove("id");
                            rawData = requestBody.HasValues ? requestBody.ToJSON() : "";
                        }
                    }
                }
                catch (Exception)
                {
                    // ignored
                }
            }
            var httpClient = new HttpClient(url, account)
            {
                Verb = httpVerb, RawData = rawData
            };

            httpClient.AsyncGetString((ss, e) =>
            {
                if (e == null)
                {
                    callBack?.Invoke(ss, null);
                }
                else
                {
                    ss = "fail";
                    callBack?.Invoke(ss, e);
                    Log.Error($"请求服务器异常:{url},Verb:{verb},{e}");
                }
            });
        }
        public void MSCPSWS_S02_TC07_GetHierarchyAll_ValidInputParameters()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            SPPrincipalType principalType = SPPrincipalType.User;
          
            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                ArrayOfString providerNames = new ArrayOfString();
                providerNames.Add(provider.ProviderName);

                // Call GetHierarchyAll method to get a list of claims provider hierarchy trees with a valid providerNames in the request.
                SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
                Site.Assert.IsNotNull(responseOfGetHierarchyAllResult, "If the provider names are valid, the protocol server will return the hierarchy trees that match the claims providers.");
            }
        }
Ejemplo n.º 44
0
        public static string Result(string account, string url, string verb, string rawData = "")
        {
            try
            {
                if (!EnumHelper.TryParseStr(verb, out HttpVerb httpVerb))
                {
                    Log.Error($"请求服务器异常:{url},Verb:{verb}");
                    return("fail");
                }

                if (!rawData.IsNullOrEmpty())
                {
                    try
                    {
                        if (httpVerb == HttpVerb.GET)
                        {
                            var requestBody = JObject.Parse(rawData);
                            if (requestBody.Count == 1 && requestBody.GetValue("id") != null)
                            {
                                url += "/" + requestBody["id"];
                                requestBody.Remove("id");
                                rawData = requestBody.HasValues ? requestBody.ToJSON() : "";
                            }
                            else
                            {
                                var dts = new ArrayOfString();
                                foreach (var variable in requestBody)
                                {
                                    dts.Add($"{variable.Key}={variable.Value}");
                                }
                                if (dts.Count > 0)
                                {
                                    url += "?" + dts.Join("&");
                                }
                            }
                        }
                        else
                        {
                            var requestBody = JObject.Parse(rawData);
                            if (requestBody.GetValue("id") != null)
                            {
                                url += "/" + requestBody["id"];
                                requestBody.Remove("id");
                                rawData = requestBody.HasValues ? requestBody.ToJSON() : "";
                            }
                        }
                    }
                    catch (Exception)
                    {
                        // ignored
                    }
                }
                var httpClient = new HttpClient(url, account)
                {
                    Verb = httpVerb
                };
                httpClient.RawData = rawData;
                var result = httpClient.GetString();

                return(result);
            }
            catch (Exception e)
            {
                Log.Error($"请求服务器异常:{url},Verb:{verb},{e}");
                return("fail");
            }
        }
        public void MSCPSWS_S01_TC03_ClaimTypes_ValidProviderName()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                ArrayOfString providerNames = new ArrayOfString();
                providerNames.Add(provider.ProviderName);

                // Call ClaimTypes method to get claim types with valid providerNames in the request.
                ArrayOfString responseOfClaimTypesResult = CPSWSAdapter.ClaimTypes(providerNames);
                Site.Assert.IsNotNull(responseOfClaimTypesResult, "If the providerNames is a valid providerNames, the protocol server MUST use the current available claims providers.");

                // Call GetClaimTypesResultBySutAdapter method to get claim types with valid providerNames in the request.
                ArrayOfString getClaimTypesResultBySutAdapter = GetClaimTypesResultBySutAdapter(providerNames);
                Site.Assert.IsTrue(this.VerificationSutResultsAndProResults(responseOfClaimTypesResult, getClaimTypesResultBySutAdapter), "The claim types returned by the protocol and script should be equal.");
            }
        }
        public void MSCPSWS_S04_TC05_ResolveMultiple_NullResolveInput()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.User;          

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            bool caughtException = false;
            try
            {
                // Call Resolve multiple method with resolveInput parameter sets to null.
                CPSWSAdapter.ResolveMultiple(providerNames, principalType, null);
            }
            catch (FaultException faultException)
            {
                caughtException = true;

                // If the server returns an ArgumentNullException<""resolveInput""> message, then the following requirement can be captured.
                Site.CaptureRequirementIfIsTrue(
                    this.VerifyArgumentNullException(faultException, "resolveInput"),
                    626,
                    @"[In ResolveMultiple] If this [resolveInput] is NULL, the protocol server MUST return an ArgumentNullException<""resolveInput""> message.");
            }
            finally
            {
                this.Site.Assert.IsTrue(caughtException, "If resolveInput is NULL, the protocol server should return an ArgumentNullException<resolveInput> message.");
            }
        }
Ejemplo n.º 47
0
        void LOAD_GAME_SETTINGS___1_Robber()
        {
            isRobber = true;
            isSplit = false;
            canbeNoContract = true;

            // ОПЦИИ
            GameSettings_Rob_BonusForOners = ((GameSettings_Options & 1) > 0);
            GameSettings_Rob_BonusForWholeRobber = ((GameSettings_Options & 2) > 0);

            //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            DB_Deals_TableName = "Deals_Rob";
            DB_Deals_ColumnsNames.Add(6, "CardsDistribution");
            DB_Deals_ColumnsNames.Add(1, "Pair");
            DB_Deals_ColumnsNames.Add(2, "Contract");
            DB_Deals_ColumnsNames.Add(3, "Result");
            if (GameSettings_Rob_BonusForOners)
                DB_Deals_ColumnsNames.Add(8, "Oners");

            columnsDataClasses = new ArrayOfTypes();
            columnsDataClasses.Add(typeof(ZoneSwitcher));
            columnsDataClasses.Add(typeof(PairSwitcher));
            columnsDataClasses.Add(typeof(Contract));
            columnsDataClasses.Add(typeof(Result));
            columnsDataClasses.Add(typeof(SimpleScore));
            columnsDataClasses.Add(typeof(IntData));
            columnsDataClasses.Add(typeof(CardsDistribution));
            columnsDataClasses.Add(typeof(QuarterSwitcher));
            if (GameSettings_Rob_BonusForOners)
                columnsDataClasses.Add(typeof(OnersSwitcher));

            ID_NAMES.Add(0, "ZONE");
            ID_NAMES.Add(1, "PAIR");
            ID_NAMES.Add(2, "CONTRACT");
            ID_NAMES.Add(3, "RESULT");
            ID_NAMES.Add(4, "RDEAL_LIGHTSCORE");
            ID_NAMES.Add(5, "NO");
            ID_NAMES.Add(6, "DISTRIBUTION");
            ID_NAMES.Add(7, "DEALER");
            if (GameSettings_Rob_BonusForOners)
                ID_NAMES.Add(8, "ONERS");

            REFLECT_Functions.Add(0, new FuncInfo[] { new FuncInfo("DefineRobberZone", new string[] { "ZONE", "ROBBER", "RDEAL_NO" }) });
            REFLECT_Depends.Add(0, new int[] { -1 });
            REFLECT_Functions.Add(1, new FuncInfo[] { new FuncInfo("NoPairIfNoContract", new string[] { "PAIR", "CONTRACT" }) });
            REFLECT_Depends.Add(1, new int[] { 1, 2 });
            REFLECT_Functions.Add(3, new FuncInfo[] { new FuncInfo("CorrectResultAccordingToContract", new string[] { "RESULT", "CONTRACT", "0" }) });
            REFLECT_Depends.Add(3, new int[] { 2 });
            REFLECT_Constructors.Add(3, new string[] { "CONTRACT" });
            if (GameSettings_Rob_BonusForOners)
            {
                REFLECT_Functions.Add((int)CONST.RDEAL_FULLSCORE, new FuncInfo[] { new FuncInfo("RobberScore", new string[] { "RDEAL_FULLSCORE", "PAIR", "ZONE", "CONTRACT", "RESULT", (GameSettings_Rob_BonusForWholeRobber ? "TRUE" : "FALSE"), "ROBBER", "RDEAL_NO", "ONERS" }) });
                REFLECT_Depends.Add((int)CONST.RDEAL_FULLSCORE, new int[] { 0, 1, 2, 3, 8 });
            }
            else
            {
                REFLECT_Functions.Add((int)CONST.RDEAL_FULLSCORE, new FuncInfo[] { new FuncInfo("RobberScore", new string[] { "RDEAL_FULLSCORE", "PAIR", "ZONE", "CONTRACT", "RESULT", (GameSettings_Rob_BonusForWholeRobber ? "TRUE" : "FALSE"), "ROBBER", "RDEAL_NO" }) });
                REFLECT_Depends.Add((int)CONST.RDEAL_FULLSCORE, new int[] { 0, 1, 2, 3 });
            }
            REFLECT_Functions.Add(4, new FuncInfo[] { new FuncInfo("RobberScoreLight", new string[] { "RDEAL_LIGHTSCORE", "RDEAL_FULLSCORE" }) });
            REFLECT_Depends.Add(4, new int[] { (int)CONST.RDEAL_FULLSCORE });
            REFLECT_Functions.Add(5, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "NO", "RDEAL_NO" }) });
            REFLECT_Constructors.Add(5, new string[] { "true" });
            REFLECT_Depends.Add(5, new int[] { -1 });
            REFLECT_Functions.Add((int)CONST.ROBBER, new FuncInfo[] { new FuncInfo("CleanUnnecessaryRDealsInRobber", new string[] { "ROBBER", "ROBBER_FIRSTLINE" }), new FuncInfo("InvalidateRobber", new string[] { "ROBBER" }) });
            REFLECT_Depends.Add((int)CONST.ROBBER, new int[] { (int)CONST.RDEAL_FULLSCORE });
            REFLECT_Recounts.Add((int)CONST.ROBBER, new int[] { 0, (int)CONST.RDEAL_FULLSCORE });
            REFLECT_Functions.Add((int)CONST.ROBBER_TOTAL_SCORE, new FuncInfo[] { new FuncInfo("SetRobberScore", new string[] { "ROBBER", "ROBBER_TOTAL_SCORE" }), new FuncInfo("TotalScore_RobberMode", new string[] { "ROBBER_TOTAL_SCORE", "ROBBER_NO__REAL" }) });
            REFLECT_Depends.Add((int)CONST.ROBBER_TOTAL_SCORE, new int[] { (int)CONST.ROBBER });
            REFLECT_InsideFunctionsList.Add("CleanUnnecessaryRDealsInRobber");
            REFLECT_InsideFunctionsList.Add("InvalidateRobber");
            REFLECT_InsideFunctionsList.Add("TotalScore_RobberMode");
            REFLECT_Functions.Add(7, new FuncInfo[] { new FuncInfo("DefineRobberDealer", new string[] { "DEALER", "LINE_NO__REAL", "ROBBER_NO__REAL", "RDEAL_NO", "FIRST_DEALER" }) });
            REFLECT_Depends.Add(7, new int[] { -1 });

            if (GameSettings_Rob_BonusForOners)
            {
                REFLECT_Functions.Add(8, new FuncInfo[] { new FuncInfo("GetOners", new string[] { "ONERS", "CONTRACT", "DISTRIBUTION" }) });
                REFLECT_Depends.Add(8, new int[] { 8, 2, 6 });
            }

            NotNecessaryValues.Add(6);
            ContractColumns.Add(new int[] { 2 });
            NotNecessaryValues_NOCONTRACT.Add(new ArrayOfInt());
            NotNecessaryValues_NOCONTRACT[0].Add(new int[] { 1 });
            if (GameSettings_Rob_BonusForOners)
                NotNecessaryValues_NOCONTRACT[0].Add(new int[] { 8 });

            columnsControlsClasses = new ArrayOfTypes();
            columnsControlsClasses.Add(typeof(DealInfoControl));
            columnsControlsClasses.Add(typeof(ShowTextControl_Center));
            columnsControlsClasses.Add(typeof(ShowTextControl));
            columnsControlsClasses.Add(typeof(SwitcherControl_Orange_Center));
            columnsControlsClasses.Add(typeof(ContractSelectControl));
            if (GameSettings_Rob_BonusForOners)
                columnsControlsClasses.Add(typeof(SwitcherControl_Orange));
            columnsControlsClasses.Add(typeof(ResultSelectControl));
            columnsControlsClasses.Add(typeof(ShowSimpleScore));

            arrHeadersNames = new ArrayOfString();
            arrHeadersNames.Add("#");
            arrHeadersNames.Add("Сда\nющ.");
            arrHeadersNames.Add("Зона");
            arrHeadersNames.Add("Па\nра");
            arrHeadersNames.Add("Контракт");
            if (GameSettings_Rob_BonusForOners)
                arrHeadersNames.Add("Онеры");
            arrHeadersNames.Add("Рез-т");
            arrHeadersNames.Add("Очки");

            arrHeadersNames_FULL = new ArrayOfString();
            arrHeadersNames_FULL.Add("#");
            arrHeadersNames_FULL.Add("Сдающий");
            arrHeadersNames_FULL.Add("Зона");
            arrHeadersNames_FULL.Add("Пара");
            arrHeadersNames_FULL.Add("Контракт");
            if (GameSettings_Rob_BonusForOners)
                arrHeadersNames_FULL.Add("Онеры");
            arrHeadersNames_FULL.Add("Рез-т");
            arrHeadersNames_FULL.Add("Очки");

            arrHeadersWidths = new ArrayOfInt();
            if (GameSettings_Rob_BonusForOners)
            {
                arrHeadersWidths.Add(new int[] { 22, 33, 51, 26, 69, /*oners*/51, 45, 45 });
            }
            else
            {
                arrHeadersWidths.Add(new int[] { 22+8, 33, 51+9, 26+9, 69+8, 45+9, 45+9 });
            }

            CoVa_Dependences = new ArrayOfArrayOfInt();
            for (int i = 0; i < arrHeadersNames.Count; i++)
                CoVa_Dependences.Add(new ArrayOfInt());
            CoVa_Dependences[0].Add(new int[] { 5, 6 });
            CoVa_Dependences[1].Add(7);
            CoVa_Dependences[2].Add(0);
            CoVa_Dependences[3].Add(1);
            CoVa_Dependences[4].Add(2);
            if (GameSettings_Rob_BonusForOners)
            {
                CoVa_Dependences[5].Add(8);
                CoVa_Dependences[6].Add(3);
                CoVa_Dependences[7].Add(new int[] { 4 }); //относительно static
            }
            else
            {
                CoVa_Dependences[5].Add(3);
                CoVa_Dependences[6].Add(new int[] { 4 }); //относительно static
            }
        }
Ejemplo n.º 48
0
        /// <summary>
        /// A method used to do a depth first traverse in a given Provider Hierarchy tree to 
        /// gather provider names and save them in the list of providerNames.
        /// </summary>
        /// <param name="node">A parameter represents a provider hierarchy node.</param>
        /// <param name="providerNames">A parameter represents a list of provider names.</param>
        public void DepthFirstTraverse(SPProviderHierarchyNode node, ref ArrayOfString providerNames)
        {
            providerNames.Add(node.ProviderName);
            if (node.IsLeaf == true)
            {
                return;
            }

            foreach (SPProviderHierarchyNode c in node.Children)
            {
                this.DepthFirstTraverse(c, ref providerNames);
            }
        }
Ejemplo n.º 49
0
        /// <summary>
        /// A method used to get claim types by SUT control adapter.
        /// </summary>
        /// <param name="claimProviderNames">A parameter represents a group of provider name.</param>
        /// <returns>A return value represents a list of claim types</returns> 
        public ArrayOfString GetClaimTypesResultBySutAdapter(ArrayOfString claimProviderNames)
        {
            ArrayOfString claimTypesResultBySut = new ArrayOfString();
            string inputClaimProviderNames = InputClaimProviderNames(claimProviderNames);
            string getClaimTypesInSPProviderScript = SutControlAdapter.GetClaimTypesInSPProvider(inputClaimProviderNames);
            if (getClaimTypesInSPProviderScript != null && getClaimTypesInSPProviderScript != string.Empty)
            {
                foreach (string claimType in getClaimTypesInSPProviderScript.Split(','))
                {
                    claimTypesResultBySut.Add(claimType);
                }
            }

            return claimTypesResultBySut;
        }
Ejemplo n.º 50
0
        void LOAD_GAME_SETTINGS___2_Sport()
        {
            isRobber = false;
            isSplit = true;
            canbeNoContract = true;

            //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! DB !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            DB_Deals_TableName = "Deals_Double";
            DB_Deals_ColumnsNames.Add(1, "CardsDistribution");
            DB_Deals_ColumnsNames.Add(5, "Pair1");
            DB_Deals_ColumnsNames.Add(6, "Contract1");
            DB_Deals_ColumnsNames.Add(7, "Result1");
            DB_Deals_ColumnsNames.Add(9, "Pair2");
            DB_Deals_ColumnsNames.Add(10, "Contract2");
            DB_Deals_ColumnsNames.Add(11, "Result2");

            columnsDataClasses = new ArrayOfTypes();

            columnsDataClasses.Add(typeof(IntData));
            columnsDataClasses.Add(typeof(CardsDistribution));
            columnsDataClasses.Add(typeof(IntData));
            columnsDataClasses.Add(typeof(IntData));
            columnsDataClasses.Add(typeof(ZoneSwitcher));
            columnsDataClasses.Add(typeof(PairSwitcher));
            columnsDataClasses.Add(typeof(Contract));
            columnsDataClasses.Add(typeof(Result));
            columnsDataClasses.Add(typeof(SimpleScore));
            columnsDataClasses.Add(typeof(PairSwitcher));
            columnsDataClasses.Add(typeof(Contract));
            columnsDataClasses.Add(typeof(Result));
            columnsDataClasses.Add(typeof(SimpleScore));
            columnsDataClasses.Add(typeof(SimpleScore));
            columnsDataClasses.Add(typeof(SimpleScore));
            columnsDataClasses.Add(typeof(QuarterSwitcher));

            SUBDEALS = new ArrayOfArrayOfInt();
            SUBDEALS.Add(new ArrayOfInt());
            SUBDEALS[0].Add(new int[] { 2, 5, 6, 7, 8 });
            SUBDEALS.Add(new ArrayOfInt());
            SUBDEALS[1].Add(new int[] { 3, 9, 10, 11, 12 });

            ID_NAMES.Add(0, "NO");
            ID_NAMES.Add(1, "DISTRIBUTION");
            ID_NAMES.Add(2, "SUBNO1");
            ID_NAMES.Add(3, "SUBNO2");
            ID_NAMES.Add(4, "ZONE");
            ID_NAMES.Add(5, "PAIR1");
            ID_NAMES.Add(6, "CONTRACT1");
            ID_NAMES.Add(7, "RESULT1");
            ID_NAMES.Add(8, "SCORE1");
            ID_NAMES.Add(9, "PAIR2");
            ID_NAMES.Add(10, "CONTRACT2");
            ID_NAMES.Add(11, "RESULT2");
            ID_NAMES.Add(12, "SCORE2");
            ID_NAMES.Add(13, "DIFF");
            ID_NAMES.Add(14, "IMP");
            ID_NAMES.Add(15, "DEALER");

            REFLECT_Functions.Add(5, new FuncInfo[] { new FuncInfo("NoPairIfNoContract", new string[] { "PAIR1", "CONTRACT1" }) });
            REFLECT_Depends.Add(5, new int[] { 5, 6 });
            REFLECT_Functions.Add(9, new FuncInfo[] { new FuncInfo("NoPairIfNoContract", new string[] { "PAIR2", "CONTRACT2" }) });
            REFLECT_Depends.Add(9, new int[] { 9, 10 });
            REFLECT_Functions.Add(0, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "NO", "MDEAL_NO" }) });
            REFLECT_Constructors.Add(0, new string[] { "true" });
            REFLECT_Depends.Add(0, new int[] { -1 });
            REFLECT_Functions.Add(2, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "SUBNO1", "0" }) });
            REFLECT_Constructors.Add(2, new string[] { "true" });
            REFLECT_Depends.Add(2, new int[] { -1 });
            REFLECT_Functions.Add(3, new FuncInfo[] { new FuncInfo("IntData_Equal", new string[] { "SUBNO2", "1" }) });
            REFLECT_Constructors.Add(3, new string[] { "true" });
            REFLECT_Depends.Add(3, new int[] { -2 });
            REFLECT_Functions.Add(4, new FuncInfo[] { new FuncInfo("DefineSportZone", new string[] { "ZONE", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", GameSettings_3Sports_ZoneSwims.ToString() }) });
            REFLECT_Depends.Add(4, new int[] { -1 });
            REFLECT_Functions.Add(7, new FuncInfo[] { new FuncInfo("CorrectResultAccordingToContract", new string[] { "RESULT1", "CONTRACT1", "0" }) });
            REFLECT_Depends.Add(7, new int[] { 6 });
            REFLECT_Constructors.Add(7, new string[] { "CONTRACT1" });
            REFLECT_Functions.Add(8, new FuncInfo[] { new FuncInfo("SportScore", new string[] { "SCORE1", "PAIR1", "ZONE", "CONTRACT1", "RESULT1" }) });
            REFLECT_Depends.Add(8, new int[] { 4, 5, 6, 7 });
            REFLECT_Functions.Add(11, new FuncInfo[] { new FuncInfo("CorrectResultAccordingToContract", new string[] { "RESULT2", "CONTRACT2", "0" }) });
            REFLECT_Depends.Add(11, new int[] { 10 });
            REFLECT_Constructors.Add(11, new string[] { "CONTRACT2" });
            REFLECT_Functions.Add(12, new FuncInfo[] { new FuncInfo("SportScoreInvert", new string[] { "SCORE2", "PAIR2", "ZONE", "CONTRACT2", "RESULT2" }) });
            REFLECT_Depends.Add(12, new int[] { 4, 9, 10, 11 });
            REFLECT_Functions.Add(13, new FuncInfo[] { new FuncInfo("ScoreSumm", new string[] { "DIFF", "SCORE1", "SCORE2" }) });
            REFLECT_Depends.Add(13, new int[] { 8, 12 });
            REFLECT_Functions.Add(14, new FuncInfo[] { new FuncInfo("ConvertToIMPs", new string[] { "IMP", "DIFF" }) });
            REFLECT_Depends.Add(14, new int[] { 13 });
            REFLECT_Functions.Add(15, new FuncInfo[] { new FuncInfo("DefineSportDealer", new string[] { "DEALER", "LINE_NO__REAL", "MATCH_NO__REAL", "MDEAL_NO", "FIRST_DEALER", GameSettings_3Sports_ZoneSwims.ToString() }) });
            REFLECT_Depends.Add(15, new int[] { -1 });

            //new for match:
            REFLECT_Functions.Add((int)CONST.MATCH_TOTAL_SCORE, new FuncInfo[] { new FuncInfo("SetMatchScore", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO", "14" }), new FuncInfo("TotalScore_MatchMode", new string[] { "MATCH_TOTAL_SCORE", "MATCH_NO__REAL" }) });
            REFLECT_Depends.Add((int)CONST.MATCH_TOTAL_SCORE, new int[] { 14 });
            REFLECT_InsideFunctionsList.Add("SetMatchScore");
            REFLECT_InsideFunctionsList.Add("TotalScore_MatchMode");

            NotNecessaryValues.Add(new int[] { 1, 13, 14 });
            ContractColumns.Add(new int[] { 6, 10 });
            NotNecessaryValues_NOCONTRACT.Add(new ArrayOfInt());
            NotNecessaryValues_NOCONTRACT.Add(new ArrayOfInt());
            NotNecessaryValues_NOCONTRACT[0].Add(new int[] { 5 });
            NotNecessaryValues_NOCONTRACT[1].Add(new int[] { 9 });

            columnsControlsClasses = new ArrayOfTypes();
            columnsControlsClasses.Add(typeof(DealInfoControl_split));
            columnsControlsClasses.Add(typeof(ShowTextControl_Center));
            columnsControlsClasses.Add(typeof(ShowTextControl_Center));
            columnsControlsClasses.Add(typeof(ShowTextControl));
            columnsControlsClasses.Add(typeof(SwitcherControl_Orange_Center));
            columnsControlsClasses.Add(typeof(ContractSelectControl));
            columnsControlsClasses.Add(typeof(ResultSelectControl));
            columnsControlsClasses.Add(typeof(ShowSimpleScore));
            columnsControlsClasses.Add(typeof(ShowSimpleScore));
            columnsControlsClasses.Add(typeof(ShowSimpleScore));

            arrHeadersNames = new ArrayOfString();
            arrHeadersNames.Add("#");
            arrHeadersNames.Add("Ст\nол");
            arrHeadersNames.Add("Сда\nющ.");
            arrHeadersNames.Add("Зона");
            arrHeadersNames.Add("Па\nра");
            arrHeadersNames.Add("Контракт");
            arrHeadersNames.Add("Рез-т");
            arrHeadersNames.Add("Очки");
            arrHeadersNames.Add("Раз-\nница");
            arrHeadersNames.Add("IMP");

            arrHeadersNames_FULL = new ArrayOfString();
            arrHeadersNames_FULL.Add("#");
            arrHeadersNames_FULL.Add("Стол");
            arrHeadersNames_FULL.Add("Сдающий");
            arrHeadersNames_FULL.Add("Зона");
            arrHeadersNames_FULL.Add("Пара");
            arrHeadersNames_FULL.Add("Контракт");
            arrHeadersNames_FULL.Add("Рез-т");
            arrHeadersNames_FULL.Add("Очки");
            arrHeadersNames_FULL.Add("Разница");
            arrHeadersNames_FULL.Add("IMP");

            // Какие контролы разделены?
            SUBDEALS_CONTROLS_ISSPLIT = new ArrayList();
            SUBDEALS_CONTROLS_ISSPLIT.Add(false);
            SUBDEALS_CONTROLS_ISSPLIT.Add(true);
            SUBDEALS_CONTROLS_ISSPLIT.Add(false);
            SUBDEALS_CONTROLS_ISSPLIT.Add(false);
            SUBDEALS_CONTROLS_ISSPLIT.Add(true);
            SUBDEALS_CONTROLS_ISSPLIT.Add(true);
            SUBDEALS_CONTROLS_ISSPLIT.Add(true);
            SUBDEALS_CONTROLS_ISSPLIT.Add(true);
            SUBDEALS_CONTROLS_ISSPLIT.Add(false);
            SUBDEALS_CONTROLS_ISSPLIT.Add(false);

            arrHeadersWidths = new ArrayOfInt();
            arrHeadersWidths.Add(new int[] { 22+4, 22, 33, 51+7, 26+7, 69+6, 45+6, 45+7, 45+7, 28+6 });

            CoVa_Dependences = new ArrayOfArrayOfInt();
            for (int i = 0; i < arrHeadersNames.Count; i++)
                CoVa_Dependences.Add(new ArrayOfInt());
            CoVa_Dependences[0].Add(new int[] { 0, 1 });
            CoVa_Dependences[2].Add(15);
            CoVa_Dependences[3].Add(4);
            CoVa_Dependences[8].Add(new int[] { 13 });  //относительно static
            CoVa_Dependences[9].Add(new int[] { 14 });  //относительно static

            CoVa_Dependences_SPLIT = new ArrayOfArrayOfInt();
            for (int i = 0; i < arrHeadersNames.Count; i++)
                CoVa_Dependences_SPLIT.Add(new ArrayOfInt());
            CoVa_Dependences_SPLIT[1].Add(new int[] { 2, 3 });
            CoVa_Dependences_SPLIT[4].Add(new int[] { 5, 9 });
            CoVa_Dependences_SPLIT[5].Add(new int[] { 6, 10 });
            CoVa_Dependences_SPLIT[6].Add(new int[] { 7, 11 });
            CoVa_Dependences_SPLIT[7].Add(new int[] { 8, 12 });   //относительно static (было 5,9,8,12)
        }
Ejemplo n.º 51
0
 protected void SubmitBtn_Click(object sender, EventArgs e)
 {
     if (RCB_Identity.CheckedItems.Count == 0)
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('身份选择不能为空!');", true);
         return;
     }
     RadTreeView regionTreeView = RadDropDownTree1.Controls[0] as RadTreeView;
     if (regionTreeView.SelectedNodes.Count==0)
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('区域选择不能为空!');", true);
         return;
     }
     if (RTB_Name.Text.Trim().Equals(""))
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('用户姓名不能为空!');", true);
         return;
     }
     if (RTB_SIM.Text.Trim().Equals(""))
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('STB号不能为空!');", true);
         return;
     }
     Model.Log logModel = new Model.Log();
     logModel.OperationItem = "添加终端用户";
     logModel.OperationTime = DateTime.Now;
     logModel.Operator = user.UserInfo.UserID;
     logModel.Memo = "";
     Model.EndUser euModel = new Model.EndUser();
     euModel.EndUserName = RTB_Name.Text;
     euModel.SimCardNo = RTB_SIM.Text;
     euModel.LastModifyTime = DateTime.Now;
     euModel.IsValid = true;
     StringBuilder sb = new StringBuilder();
     foreach (RadComboBoxItem rcbi in RCB_Identity.CheckedItems)
     {
         sb.Append("|"+rcbi.Value + "|");
     }
     sb.Append("|" + regionTreeView.SelectedValue + "|");
     string identityStr = sb.ToString();
     logModel.OperationDetail = "姓名:"+RTB_Name.Text+"SIM:"+RTB_SIM.Text+"身份&区域:"+identityStr;
     euModel.Identities = identityStr;
     long autoid = 0;
     try
     {
         autoid = eu.Add(euModel);
         if (autoid > 0)
         {
             using (MongoDBServiceSoapClient mg = new MongoDBServiceSoapClient())
             {
                 MongoDBService.EndUser dc = new MongoDBService.EndUser();
                 bool IsAddMg = true;
                 string rtStr = "";
                 if (mg.SelectEnduserBySimCardNo(euModel.SimCardNo, out rtStr) == null)
                 {
                     IsAddMg = false;
                     dc.AutoID = autoid.ToString();
                     dc.EnduserName = euModel.EndUserName;
                     string[] identityArr = euModel.Identities.Split('|');
                     ArrayOfString aof = new ArrayOfString();
                     foreach (string id in identityArr)
                     {
                         if (id.Trim().Equals(""))
                         {
                             continue;
                         }
                         aof.Add(id);
                     }
                     dc.Identities = aof;
                     dc.IsValid = true;
                     dc.LastModifyTime = euModel.LastModifyTime;
                     dc.SimCardNo = euModel.SimCardNo;
                     IsAddMg = mg.InsertEnduser(dc, out rtStr);
                 }
                 if (!IsAddMg)
                 {
                     eu.Delete(autoid);
                     autoid = 0;
                 }
                 logModel.Memo += rtStr;
             }
         }
     }
     catch (Exception ex)
     {
         autoid = 0;
         logModel.Memo += ex.Message;
     }
     finally
     {
         log.Add(logModel);
         if (autoid > 0)
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('恭喜!用户添加成功!');", true);
         }
         else
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('抱歉!用户添加失败!');", true);
         }
     }
 }
Ejemplo n.º 52
0
        private void SRMRun()
        {
            CheckForIllegalCrossThreadCalls = false;
            ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient();
            ArrayOfString          tmp = new ArrayOfString();

            tmp.Add(LOCALSERVER + StackerRead + "D10");
            int YLocation = Int32.Parse(srv.OPC_Read(tmp)[0].ToString());//堆垛机水平距离

            while (true)
            {
                srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 0);//空闲
                if (IsNewTask == "是")
                {
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.2", false); //任务完成
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X0.3", false); //取货完毕
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.3", false); //载货台有货
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.4", true);  //货叉原点
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X0.4", false); //放货完毕

                    lsBRunning.Items.Add(DateTime.Now.ToString() + "堆垛机开始执行任务....");
                    wait(1000);
                    lsBRunning.Items.Add("开始定位准备取货");
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 2);//定位
                    int lenth = int.Parse(lbFromLie.Text) * 100;
                    while (lenth != YLocation)
                    {
                        if (YLocation > lenth)
                        {
                            YLocation--;
                        }
                        else
                        {
                            YLocation++;
                        }
                        srv.OPC_WritePoint(LOCALSERVER + StackerRead + "D10", YLocation);//写入当前水平坐标
                    }
                    wait(300);
                    lsBRunning.Items.Add("定位完毕,开始取货");
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 3);       //取货
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.4", false); //货叉原点

                    wait(300);
                    int zero = 1;
                    if (lbfromPai.Text.Trim() == "2")
                    {
                        zero = -1;
                    }
                    SetFork(zero);

                    wait(300);
                    lsBRunning.Items.Add("取货完毕,开始定位准备放货");
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X0.3", true); //取货完毕
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.3", true); //载货台有货
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.4", true); //货叉原点
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "INT18", 0);   //伸叉位置 1排为正,二排为负
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 2);      //定位
                    lenth = int.Parse(lbToLie.Text) * 100;
                    while (lenth != YLocation)
                    {
                        if (YLocation > lenth)
                        {
                            YLocation--;
                        }
                        else
                        {
                            YLocation++;
                        }
                        srv.OPC_WritePoint(LOCALSERVER + StackerRead + "D10", YLocation);//写入当前水平坐标
                    }
                    wait(500);
                    lsBRunning.Items.Add("定位完毕,开始放货");
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 4);       //放货
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.4", false); //货叉原点
                    wait(800);
                    zero = 1;
                    if (lbToPai.Text.Trim() == "2")
                    {
                        zero = -1;
                    }
                    SetFork(zero);
                    wait(300);
                    lsBRunning.Items.Add("放货完毕,执行完成");
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X0.4", true);  //放货完毕
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.3", false); //载货台有货
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.4", true);  //货叉原点
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "INT18", 0);
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "W8", 0);       //空闲
                    wait(200);
                    srv.OPC_WritePoint(LOCALSERVER + StackerRead + "X1.2", true);  //任务完成
                    srv.OPC_WritePoint(LOCALSERVER + StackerWrite + "W52", 0);     //新任务下达
                    IsNewTask = "否";
                    wait(1000);
                }
            }
        }