コード例 #1
0
ファイル: Proxy.cs プロジェクト: vslab/Energon
 public result Simplex(int cols, int rows, OptimisationDirection direction, bound[] rowbounds, bound[] colbounds, int[] ia, int[] ja, double[] ar, double[] coeff)
 {
     LPProblem p = new LPProblem();
     p.ObjectiveDirection = direction;
     p.AddCols(cols);
     p.AddRows(rows);
     for (int i = 0; i < rowbounds.Length; i++)
     {
         p.SetRowBounds(i + 1, rowbounds[i].BoundType, rowbounds[i].lower, rowbounds[i].upper);
     }
     for (int i = 0; i < colbounds.Length; i++)
     {
         p.SetColBounds(i + 1, colbounds[i].BoundType, colbounds[i].lower, colbounds[i].upper);
     }
     p.LoadMatrix(ia, ja, ar);
     //p.SetMatRow(1, new int[] {0, 1, 2 }, new double[] {0, 1, 1 });
     for (int i = 0; i < coeff.Length; i++)
     {
         p.SetObjCoef(i+1, coeff[i]);
     }
     p.SolveSimplex();
     Console.WriteLine("result = {0}, x1 = {1}, x2 = {2}", p.GetObjectiveValue(), p.GetColPrimal(1), p.GetColPrimal(2));
     //Console.In.ReadLine();
     result r = new result();
     r.ObjResult = p.GetObjectiveValue();
     r.Columns = new double[cols];
     for (int i = 0; i < cols; i++)
     {
         r.Columns[i] = p.GetColPrimal(i + 1);
     }
     return r;
 }
コード例 #2
0
        public void ProcessRequest(HttpContext context)
        {
            int id = Convert.ToInt32(context.Request["id"]);

            mydbEntities1 db = new mydbEntities1();

            user new1 = db.users.Single(u => u.id == id);

            db.DeleteObject(new1);
            db.SaveChanges();

            var p1 = new result();

            if (new1 != null)
            {
                p1.success = true;
                p1.msg = "aaa";

            }
            else
            {
                p1.success = false;
                p1.msg = "Some errors occured.";

            }

            DataContractJsonSerializer json = new DataContractJsonSerializer(p1.GetType());
            json.WriteObject(context.Response.OutputStream, p1);
        }
コード例 #3
0
ファイル: poll.cs プロジェクト: FadiZahhar/tutsplus
    public ArrayList updateVotes(string selected)
    {
        using (SqlConnection dbCon = new SqlConnection("Data Source=desktop-pc\\sqlexpress;Initial Catalog=browsers;Persist Security Info=True;User ID=poll_manager;Password=password"))
        {
            dbCon.Open();

            SqlCommand readCommand = new SqlCommand("SELECT Votes FROM choices WHERE Browser = @browser", dbCon);
            readCommand.Parameters.AddWithValue("@browser", selected);
            SqlCommand readAllCommand = new SqlCommand("SELECT * FROM choices", dbCon);

            int val = (int)readCommand.ExecuteScalar();

            SqlCommand writeCommand = new SqlCommand("UPDATE choices SET Votes = @newVotes WHERE Browser = @browser", dbCon);
            writeCommand.Parameters.AddWithValue("@newVotes", ++val);
            writeCommand.Parameters.AddWithValue("@browser", selected);

            writeCommand.ExecuteNonQuery();

            ArrayList totalVotes = new ArrayList();
            SqlDataReader reader = readAllCommand.ExecuteReader();

            while (reader.Read())
            {
                result result = new result();
                result.browser = reader["Browser"].ToString();
                result.votes = Int32.Parse(reader["Votes"].ToString());
                totalVotes.Add(result);
            }

            dbCon.Close();

            return totalVotes;
        }
    }
コード例 #4
0
ファイル: CaseTranslator.cs プロジェクト: BdGL3/CXPortal
        public static CaseObject AddResult(Stream CaseXML, result res, String Directory = null)
        {
            try
            {
                CaseObject caseObj = null;
                caseObj = Translate(CaseXML, Directory);

                caseObj.ResultsList.Add(res);

                return caseObj;
            }
            catch (Exception exp)
            {
                throw;
            }
        }
コード例 #5
0
ファイル: ResultItem.xaml.cs プロジェクト: BdGL3/CXPortal
        public ResultItem(result res)
        {
            InitializeComponent();
            CultureResources.registerDataProvider(this);
            this.result = res;
            string decision = result.Decision.Replace(" ", "");
            if (!String.IsNullOrEmpty(L3.Cargo.Common.Resources.ResourceManager.GetString(decision)))
            {
                var binding = new Binding(decision);
                binding.Source = CultureResources.getDataProvider();
                BindingOperations.SetBinding(Decision, TextBlock.TextProperty, binding);
            }
            else
            {
                Decision.Text = result.Decision;
            }

            CreateTime.Text = (result.CreateTime == String.Empty) ? result.CreateTime : CultureResources.ConvertDateTimeToStringForDisplay(DateTime.Parse(result.CreateTime, CultureResources.getDefaultDisplayCulture()));
            Comment.Text = result.Comment;

            string reason = result.Reason.Replace(" ", "");
            if (!String.IsNullOrEmpty(L3.Cargo.Common.Resources.ResourceManager.GetString(reason)))
            {
                var binding = new Binding(reason);
                binding.Source = CultureResources.getDataProvider();
                BindingOperations.SetBinding(Reason, TextBlock.TextProperty, binding);
            }
            else
            {
                Reason.Text = result.Reason;
            }

            User.Text = result.User;
            StationType.Text = result.StationType;
            AnalysisTime.Text = result.AnalysisTime;

            CultureResources.getDataProvider().DataChanged += new EventHandler(CultureResources_DataChanged);

            this.Unloaded += new RoutedEventHandler(ResultItem_Unloaded);
        }
コード例 #6
0
    void insert()
    {
        try
        {
            arvindEntities db = new arvindEntities();
            int a;
            a = int.Parse(TextBox1.Text);
            result em = new result();
            em.id = a;
            em.results = DropDownList1.SelectedItem.Text;
            em.Mark = TextBox2.Text;
            em.Attendance = TextBox3.Text;
            db.AddToresults(em);
            db.SaveChanges();
            Response.Write("<script>alert('Record has save')</script>");
            fill();
        }
        catch (Exception e) {
           // Response.Write("<script>alert('same primary key insert''" + e.Message + "')</script>");
            Console.WriteLine("same primary key insert", e.Message);

        }
    }
コード例 #7
0
        public void ProcessRequest(HttpContext context)
        {
            int id =Convert.ToInt32(context.Request["id"]);
            string firstname = context.Request["firstname"];
            string lastname = context.Request["lastname"];
            string phone = context.Request["phone"];
            string email = context.Request["email"];

            mydbEntities1 db = new mydbEntities1();

               user new1 = db.users.Single(u => u.id == id);

            new1.firstname = firstname;
            new1.lastname = lastname;
            new1.phone = phone;
            new1.email = email;

            db.SaveChanges();

            var p1 = new result();

            if (new1 != null)
            {
                p1.success = true;
                p1.msg = "aaa";

            }
            else
            {
                p1.success = false;
                p1.msg = "Some errors occured.";

            }

            DataContractJsonSerializer json = new DataContractJsonSerializer(p1.GetType());
            json.WriteObject(context.Response.OutputStream, p1);
        }
コード例 #8
0
        public void ProcessRequest(HttpContext context)
        {
            string firstname = context.Request.Form["firstname"];
            string lastname = context.Request.Form["lastname"];
            string phone = context.Request.Form["phone"];
            string email = context.Request.Form["email"];

            mydbEntities1 db = new mydbEntities1();

            user p = new user();
            p.firstname = firstname;
            p.lastname = lastname;
            p.phone = phone;
            p.email = email;

            db.AddTousers(p);
            db.SaveChanges();

            var p1 = new result();

            if (p != null)
            {
                p1.success = true;
                p1.msg = "aaa";

            }
            else
            {
                p1.success = false;
                p1.msg = "Some errors occured.";

            }

            DataContractJsonSerializer json = new DataContractJsonSerializer(p1.GetType());
            json.WriteObject(context.Response.OutputStream, p1);
        }
コード例 #9
0
ファイル: CaseTranslator.cs プロジェクト: marzlia/CXPortal
        private static CaseObject Translate1_0(Stream CaseXML)
        {
            CaseObject caseObj = new CaseObject();

            XmlSerializer serializer = new XmlSerializer(typeof(L3.Cargo.Common.Xml.XCase_1_0.XCase));

            L3.Cargo.Common.Xml.XCase_1_0.XCase xcase = (L3.Cargo.Common.Xml.XCase_1_0.XCase)serializer.Deserialize(CaseXML);

            caseObj.CaseId       = xcase.id;
            caseObj.createTime   = xcase.createTime;
            caseObj.LinkedCaseId = xcase.linkedCase;
            caseObj.AbortedBy    = xcase.abortedBy;
            caseObj.CurrentArea  = xcase.currentArea;

            Location location = null;

            Conveyance convey = null;

            Container cont = null;

            caseObj.attachments = new DataAttachments();

            if (xcase.vehicle != null)
            {
                cont        = new Container(String.Empty, String.Empty, String.Empty, String.Empty);
                cont.Id     = xcase.vehicle.registrationNum;
                cont.Weight = xcase.vehicle.weight.ToString();

                if (xcase.vehicle.manifest != null)
                {
                    foreach (L3.Cargo.Common.Xml.XCase_1_0.Manifest manifest in xcase.vehicle.manifest)
                    {
                        DataAttachment attach = new DataAttachment();
                        attach.attachmentType = AttachmentType.Manifest;
                        attach.attachmentId   = manifest.image;
                        attach.User           = String.Empty;
                        attach.CreateTime     = String.Empty;
                        caseObj.attachments.Add(attach);
                    }
                }
            }

            caseObj.scanInfo = new ScanInfo(String.Empty, location, convey, cont);

            caseObj.systemInfo = new SystemInfo(String.Empty, xcase.siteId);

            if (xcase.xRayImage != null)
            {
                foreach (String str in xcase.xRayImage)
                {
                    DataAttachment attach = new DataAttachment();
                    attach.attachmentType = AttachmentType.XRayImage;
                    attach.attachmentId   = str;
                    attach.User           = String.Empty;
                    attach.CreateTime     = String.Empty;
                    caseObj.attachments.Add(attach);
                }
            }

            if (xcase.attachment != null)
            {
                foreach (L3.Cargo.Common.Xml.XCase_1_0.Attachment atch in xcase.attachment)
                {
                    if (atch.File != String.Empty)
                    {
                        DataAttachment attach = new DataAttachment();
                        if (atch.type.ToLower() == "unknown" || atch.type == String.Empty)
                        {
                            attach.attachmentType = AttachmentType.Unknown;
                        }
                        else
                        {
                            attach.attachmentType = (AttachmentType)Enum.Parse(typeof(AttachmentType), atch.type);
                        }

                        attach.attachmentId = atch.File;
                        attach.User         = String.Empty;
                        attach.CreateTime   = String.Empty;
                        caseObj.attachments.Add(attach);
                    }
                }
            }

            if (xcase.tdsResultFile != null && xcase.tdsResultFile != String.Empty)
            {
                DataAttachment attach = new DataAttachment();
                attach.attachmentType = AttachmentType.TDSResultFile;
                attach.attachmentId   = xcase.tdsResultFile;
                attach.User           = String.Empty;
                attach.CreateTime     = String.Empty;
                caseObj.attachments.Add(attach);
            }

            if (xcase.eventRecord != null)
            {
                caseObj.EventRecords = new List <CaseObject.CaseEventRecord>();

                foreach (L3.Cargo.Common.Xml.XCase_1_0.EventRecord record in xcase.eventRecord)
                {
                    CaseObject.CaseEventRecord eventRecord = new CaseObject.CaseEventRecord(record.createTime, record.description, false);
                    caseObj.EventRecords.Add(eventRecord);
                }
            }

            caseObj.ResultsList = new List <result>();

            if (xcase.awsResult != null)
            {
                String decision;

                switch (xcase.awsResult.decision)
                {
                case L3.Cargo.Common.Xml.XCase_1_0.AWSDecision.AWS_CAUTION:
                    decision = WorkstationDecision.Caution.ToString();
                    break;

                case L3.Cargo.Common.Xml.XCase_1_0.AWSDecision.AWS_CLEAR:
                    decision = WorkstationDecision.Clear.ToString();
                    break;

                case L3.Cargo.Common.Xml.XCase_1_0.AWSDecision.AWS_REJECT:
                    decision = WorkstationDecision.Reject.ToString();
                    break;

                case L3.Cargo.Common.Xml.XCase_1_0.AWSDecision.AWS_UNKNOWN:
                    decision = WorkstationDecision.Unknown.ToString();
                    break;

                default:
                    decision = WorkstationDecision.Unknown.ToString();
                    break;
                }

                result res = new result(decision, xcase.awsResult.reason.ToString(),
                                        String.Empty, xcase.awsResult.awsUserId, xcase.awsResult.comment, "Analyst", String.Empty);

                caseObj.ResultsList.Add(res);
            }

            if (xcase.ewsResult != null)
            {
                String decision;

                switch (xcase.ewsResult.decision)
                {
                case L3.Cargo.Common.Xml.XCase_1_0.EWSDecision.EWS_RELEASE:
                case L3.Cargo.Common.Xml.XCase_1_0.EWSDecision.EWS_CLEAR:
                    decision = WorkstationDecision.Clear.ToString();
                    break;

                case L3.Cargo.Common.Xml.XCase_1_0.EWSDecision.EWS_REJECT:
                    decision = WorkstationDecision.Reject.ToString();
                    break;

                case L3.Cargo.Common.Xml.XCase_1_0.EWSDecision.EWS_UNKNOWN:
                    decision = WorkstationDecision.Unknown.ToString();
                    break;

                default:
                    decision = WorkstationDecision.Unknown.ToString();
                    break;
                }

                result res = new result(decision, String.Empty,
                                        String.Empty, xcase.ewsResult.ewsUserId, xcase.ewsResult.comment, "EWS", String.Empty);

                caseObj.ResultsList.Add(res);
            }

            if (xcase.insResult != null)
            {
                String decision;

                switch (xcase.insResult.decision)
                {
                case L3.Cargo.Common.Xml.XCase_1_0.INSDecision.INS_CLEAR:
                    decision = WorkstationDecision.Clear.ToString();
                    break;

                case L3.Cargo.Common.Xml.XCase_1_0.INSDecision.INS_REJECT:
                    decision = WorkstationDecision.Reject.ToString();
                    break;

                default:
                    decision = WorkstationDecision.Unknown.ToString();
                    break;
                }

                result res = new result(decision, String.Empty,
                                        String.Empty, xcase.insResult.insUserId, xcase.insResult.comment, "Inspector", String.Empty);

                caseObj.ResultsList.Add(res);
            }

            if (xcase.supResult != null)
            {
                String decision;

                switch (xcase.supResult.decision)
                {
                case L3.Cargo.Common.Xml.XCase_1_0.SUPDecision.SUP_CLEAR:
                    decision = WorkstationDecision.Clear.ToString();
                    break;

                case L3.Cargo.Common.Xml.XCase_1_0.SUPDecision.SUP_REJECT:
                    decision = WorkstationDecision.Reject.ToString();
                    break;

                default:
                    decision = WorkstationDecision.Unknown.ToString();
                    break;
                }

                result res = new result(decision, String.Empty,
                                        String.Empty, xcase.supResult.supUserId, xcase.supResult.comment, "Supervisor", String.Empty);

                caseObj.ResultsList.Add(res);
            }

            return(caseObj);
        }
 private static int GetUniqueMedalKey(result result)
 {
     return(int.Parse(result.game.ToString() + result.country.ToString() + [email protected]() + result.medal.Value.ToString()));
 }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            DirectPaymentAPI ws = new DirectPaymentAPI();

            // PAYMENT
            payment.amount             = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("paymentAmount"))).Text;
            payment.mode               = ((DropDownList)(Page.PreviousPage.FindControl("doAuthorization").FindControl("paymentMode"))).Text;
            payment.action             = ((DropDownList)(Page.PreviousPage.FindControl("doAuthorization").FindControl("paymentFonction"))).Text;
            payment.currency           = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("paymentCurrency"))).Text;
            payment.contractNumber     = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("paymentContractNumber"))).Text;
            payment.differedActionDate = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("paymentDifferedActionDate"))).Text; // Format : "dd/mm/yy"

            // ORDER
            order.@ref    = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderRef"))).Text;
            order.origin  = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderOrigin"))).Text;
            order.country = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderCountry"))).Text;
            order.taxes   = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderTaxes"))).Text;

            order.currency = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderCurrency"))).Text;
            if (order.currency == "")
            {
                order.currency = Resources.Resource.ORDER_CURRENCY;
            }

            order.amount = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderAmount"))).Text;
            order.date   = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderDate"))).Text; // format : "dd/mm/yyyy HH24:MM"

            // ORDER DETAILS
            orderDetail1.@ref     = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderDetailRef1"))).Text;
            orderDetail1.price    = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderDetailPrice1"))).Text;
            orderDetail1.quantity = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderDetailQuantity1"))).Text;
            orderDetail1.comment  = ((HtmlTextArea)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderDetailComment1"))).Value;

            orderDetail2.@ref     = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderDetailRef2"))).Text;
            orderDetail2.price    = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderDetailPrice2"))).Text;
            orderDetail2.quantity = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderDetailQuantity2"))).Text;
            orderDetail2.comment  = ((HtmlTextArea)(Page.PreviousPage.FindControl("doAuthorization").FindControl("orderDetailComment2"))).Value;

            order.details = new orderDetail[2];
            order.details.SetValue(orderDetail1, 0);
            order.details.SetValue(orderDetail2, 1);

            // ADDRESS (optional)
            address.name     = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("addressName"))).Text;
            address.street1  = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("addressStreet1"))).Text;
            address.street2  = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("addressStreet2"))).Text;
            address.cityName = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("addressCity"))).Text;
            address.zipCode  = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("addressZipCode"))).Text;
            address.country  = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("addressCountry"))).Text;
            address.phone    = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("addressPhone"))).Text;

            // BUYER (optional)
            buyer.shippingAdress       = address;
            buyer.walletId             = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("buyerWalletId"))).Text;
            buyer.lastName             = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("buyerLastName"))).Text;
            buyer.firstName            = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("buyerFirstName"))).Text;
            buyer.email                = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("buyerEmail"))).Text;
            buyer.accountCreateDate    = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("buyerAccountCreateDate"))).Text; // format : "dd/mm/yy"
            buyer.accountAverageAmount = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("buyerAverageAmount"))).Text;
            buyer.accountOrderCount    = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("buyerOrderCount"))).Text;

            // PRIVATE DATA (optional)
            privateData1.key   = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("privateDataKey1"))).Text;
            privateData1.value = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("privateDataValue1"))).Text;
            privateData2.key   = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("privateDataKey2"))).Text;
            privateData2.value = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("privateDataValue2"))).Text;
            privateData3.key   = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("privateDataKey3"))).Text;
            privateData3.value = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("privateDataValue3"))).Text;

            privateDataList.SetValue(privateData1, 0);
            privateDataList.SetValue(privateData2, 1);
            privateDataList.SetValue(privateData3, 2);

            // CARD INFO
            card.number            = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("cardNumber"))).Text;
            card.type              = ((DropDownList)(Page.PreviousPage.FindControl("doAuthorization").FindControl("cardType"))).Text;
            card.expirationDate    = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("cardExpirationDate"))).Text;
            card.cvx               = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("cardCrypto"))).Text;
            card.ownerBirthdayDate = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("cardOwnerBirthdayDate"))).Text;
            card.password          = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("cardPassword"))).Text;

            //CARD PRESENT
            if (((DropDownList)(Page.PreviousPage.FindControl("doAuthorization").FindControl("cardPresent"))).Text != "")
            {
                card.cardPresent = ((DropDownList)(Page.PreviousPage.FindControl("doAuthorization").FindControl("cardPresent"))).Text;
            }

            // AUTHENTICATION 3D SECURE (optional)
            authentication3DSecure.md    = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("md"))).Text;
            authentication3DSecure.pares = ((TextBox)(Page.PreviousPage.FindControl("doAuthorization").FindControl("pares"))).Text;

            //PROXY
            if (Resources.Resource.PROXY_HOST != "" && Resources.Resource.PROXY_PORT != "")
            {
                ws.Proxy = new System.Net.WebProxy(Resources.Resource.PROXY_HOST, Convert.ToInt32(Resources.Resource.PROXY_PORT));
                if (Resources.Resource.PROXY_USER != "" && Resources.Resource.PROXY_PASSWORD != "")
                {
                    ws.Proxy.Credentials = new NetworkCredential(Resources.Resource.PROXY_USER, Resources.Resource.PROXY_PASSWORD);
                }
            }

            //ws.Proxy = System.Net.WebRequest.DefaultWebProxy;

            if (Resources.Resource.PROD == "true")
            {
                ws.Url = Resources.Resource.ENDPOINT_DIRECT;
            }

            ws.Credentials = new System.Net.NetworkCredential(Resources.Resource.MERCHANT_ID, Resources.Resource.ACCESS_KEY);

            resultat = ws.doAuthorization(payment, card, order, buyer, privateDataList, authentication3DSecure, out transaction, out authorization);
        }
        catch (Exception exc)
        {
            errorMessage = exc.Message;
            errorDetails = exc.ToString();
        }
    }
コード例 #12
0
        public static bool updateungvien(RM0010 value)
        {
            using (DB db = new DB())
            {
                result <object> rel   = new result <object>();
                var             check = db.RM0010.SingleOrDefault(p => p.RM0010_ID == value.RM0010_ID);
                if (check != null)
                {
                    check.maID                     = value.maID;
                    check.HODEM                    = value.HODEM;
                    check.TEN                      = value.TEN;
                    check.NGAYSINH                 = value.NGAYSINH;
                    check.NOISINH                  = value.NOISINH;
                    check.CMTND_SO                 = value.CMTND_SO;
                    check.CMTND_NGAYCAP            = value.CMTND_NGAYCAP;
                    check.CMTND_NOICAP             = value.CMTND_NOICAP;
                    check.GIOITINH                 = value.GIOITINH;
                    check.HONNHAN                  = value.HONNHAN;
                    check.TELEPHONE                = value.TELEPHONE;
                    check.MOBILE                   = value.MOBILE;
                    check.CHIEUCAO                 = value.CHIEUCAO;
                    check.CANNANG                  = value.CANNANG;
                    check.EMAIL                    = value.EMAIL;
                    check.THUONGTRU                = value.THUONGTRU;
                    check.TAMTRU                   = value.TAMTRU;
                    check.RM0001_ID                = value.RM0001_ID;
                    check.RM0001_ID2               = value.RM0001_ID2;
                    check.NGAYCOTHELAM             = value.NGAYCOTHELAM;
                    check.THUNHAPMONGMUON          = value.THUNHAPMONGMUON;
                    check.COTHELAMTHEM             = value.COTHELAMTHEM;
                    check.COTHEDICONGTAC           = value.COTHEDICONGTAC;
                    check.COTHETHAYDOIDIADIEM      = value.COTHETHAYDOIDIADIEM;
                    check.DATUNGTHITUYENMEIKO      = value.DATUNGTHITUYENMEIKO;
                    check.NEUDATUNGTHITUYENMEIKO   = value.NEUDATUNGTHITUYENMEIKO;
                    check.ID_NGUONTHONGTIN         = value.ID_NGUONTHONGTIN;
                    check.DUDINHTUONGLAI           = value.DUDINHTUONGLAI;
                    check.SOTHICH                  = value.SOTHICH;
                    check.KHONGTHICH               = value.KHONGTHICH;
                    check.CACPHAMCHATKYNANG        = value.CACPHAMCHATKYNANG;
                    check.HOTENNGUOITHAN           = value.HOTENNGUOITHAN;
                    check.DIACHINGUOITHAN          = value.DIACHINGUOITHAN;
                    check.MOBILENGUOITHAN          = value.MOBILENGUOITHAN;
                    check.ANHCHANDUNG              = value.ANHCHANDUNG;
                    check.RM0011_ID1               = value.RM0011_ID1;
                    check.RM0011_ID2               = value.RM0011_ID2;
                    check.trangthai                = value.trangthai;
                    check.DUDINHHOCTIEPCHUYENNGANH = value.DUDINHHOCTIEPCHUYENNGANH;
                    check.DUDINHHOCTIEP            = value.DUDINHHOCTIEP;
                    check.bophanid                 = value.bophanid;
                    check.A0028_ID                 = value.A0028_ID;
                    check.ghichu                   = value.ghichu;
                    check.Headhunt                 = value.Headhunt;
                    check.Position                 = value.Position;
                    check.Date                     = value.Date;
                    if (value.sophieu != null)
                    {
                        check.A0028_ID = db.A0028.Where(p => p.sophieu == value.sophieu).Select(p => p.A0028_ID).FirstOrDefault();
                        check.bophanid = db.A0028.Where(p => p.sophieu == value.sophieu).Select(p => p.T098C).FirstOrDefault();
                        //check.RM0001_ID =int.Parse( db.A0028.Where(p => p.sophieu == value.sophieu).Select(p => p.T005C).FirstOrDefault());
                    }
                    if (value.A0028_ID != null)
                    {
                        check.RM0001_ID = int.Parse(db.A0028.Where(p => p.A0028_ID == value.A0028_ID).Select(p => p.T005C).FirstOrDefault());
                    }
                    try
                    {
                        db.SaveChanges();

                        db.RM0081_A.RemoveRange(check.RM0081_A);
                        db.RM0081_B.RemoveRange(check.RM0081_B);
                        db.RM0081_C.RemoveRange(check.RM0081_C);
                        db.RM0081_D.RemoveRange(check.RM0081_D);
                        db.RM0081_E.RemoveRange(check.RM0081_E);
                        db.RM0081_F.RemoveRange(check.RM0081_F);
                        db.RM0080.RemoveRange(check.RM0080);
                        db.SaveChanges();
                        check.RM0080   = value.RM0080;
                        check.RM0081_A = value.RM0081_A;
                        check.RM0081_B = value.RM0081_B;
                        check.RM0081_C = value.RM0081_C;
                        check.RM0081_D = value.RM0081_D;
                        check.RM0081_E = value.RM0081_E;
                        check.RM0081_F = value.RM0081_F;
                        db.SaveChanges();
                        return(true);

                        rel.set("OK", ungvienget.Getallungvien(new ungvienget.filterungvien()
                        {
                            id = value.RM0010_ID
                        }), "Thành công");
                    }
                    catch (Exception l)
                    {
                        return(false);

                        rel.set("ERR", null, "Thất bại:" + l.Message);
                    }
                }
                else
                {
                    return(false);

                    rel.set("NaN", null, "Không tìm thấy dữ liệu.");
                }
                return(false);
                // return rel.ToHttpResponseMessage();
            }
        }
コード例 #13
0
 var(paulis, qubits, result, msg) = _args;
コード例 #14
0
 var(result, failure) = await @this;
コード例 #15
0
 GetClassificationSpansCore(result, context, cancellationToken);
 result = await base.GetUpdatedDocumentAsync(
     result,
     unimplementedMembers.WhereAsArray(m => !m.Item1.Equals(idisposable)),
コード例 #17
0
	private void detach_results(result entity)
	{
		this.SendPropertyChanging();
		entity.survey = null;
	}
コード例 #18
0
 GetClassificationSpansCore(result, context, null);
コード例 #19
0
	private void attach_results(result entity)
	{
		this.SendPropertyChanging();
		entity.survey = this;
	}
コード例 #20
0
 partial void Deleteresult(result instance);
コード例 #21
0
 partial void Updateresult(result instance);
コード例 #22
0
 ResultKind.Constant => CreateConstantRange(result, generator),
コード例 #23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            MassPaymentAPI ws = new MassPaymentAPI();

            /************************************/
            /*          Capture 1               */
            /************************************/

            //TRANSACTION1
            capture1.transactionID = ((TextBox)(Page.PreviousPage.FindControl("doMassCapture").FindControl("transactionID1"))).Text;

            //PAYMENT1
            payment1.amount             = ((TextBox)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentAmount1"))).Text;
            payment1.mode               = ((DropDownList)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentMode1"))).Text;
            payment1.action             = ((DropDownList)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentFonction1"))).Text;
            payment1.currency           = ((TextBox)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentCurrency1"))).Text;
            payment1.contractNumber     = ((TextBox)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentContractNumber1"))).Text;
            payment1.differedActionDate = ((TextBox)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentDifferedActionDate1"))).Text; // Format : "dd/mm/yy"

            capture1.payment = payment1;

            captureAuthorizationList.SetValue(capture1, 0);

            /************************************/
            /*          Capture 2               */
            /************************************/

            //TRANSACTION2
            capture2.transactionID = ((TextBox)(Page.PreviousPage.FindControl("doMassCapture").FindControl("transactionID2"))).Text;

            //PAYMENT2
            payment2.amount             = ((TextBox)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentAmount2"))).Text;
            payment2.mode               = ((DropDownList)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentMode2"))).Text;
            payment2.action             = ((DropDownList)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentFonction2"))).Text;
            payment2.currency           = ((TextBox)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentCurrency2"))).Text;
            payment2.contractNumber     = ((TextBox)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentContractNumber2"))).Text;
            payment2.differedActionDate = ((TextBox)(Page.PreviousPage.FindControl("doMassCapture").FindControl("paymentDifferedActionDate2"))).Text; // Format : "dd/mm/yy"

            capture2.payment = payment2;

            captureAuthorizationList.SetValue(capture2, 1);

            //COMMENT
            string comment = ((HtmlTextArea)(Page.PreviousPage.FindControl("doMassCapture").FindControl("comment"))).Value;

            //PROXY
            if (Resources.Resource.PROXY_HOST != "" && Resources.Resource.PROXY_PORT != "")
            {
                ws.Proxy = new System.Net.WebProxy(Resources.Resource.PROXY_HOST, Convert.ToInt32(Resources.Resource.PROXY_PORT));
                if (Resources.Resource.PROXY_USER != "" && Resources.Resource.PROXY_PASSWORD != "")
                {
                    ws.Proxy.Credentials = new System.Net.NetworkCredential(Resources.Resource.PROXY_USER, Resources.Resource.PROXY_PASSWORD);
                }
            }

            if (Resources.Resource.PROD == "true")
            {
                ws.Url = Resources.Resource.ENDPOINT_MASS;
            }

            ws.Credentials = new System.Net.NetworkCredential(Resources.Resource.MERCHANT_ID, Resources.Resource.ACCESS_KEY);

            resultat = ws.doMassCapture(captureAuthorizationList, comment, out massTraitmentID, out date);
        }
        catch (Exception exc)
        {
            errorMessage = exc.Message;
            errorDetails = exc.ToString();
        }
    }
コード例 #24
0
 partial void Insertresult(result instance);
コード例 #25
0
ファイル: Program.cs プロジェクト: rmaalmeida/NNCG
        public static Resultado ExecutaTeste(List<Dados> grupos, Teste nTeste)
        {
            Resultado resultado = new Resultado(nTeste);

            for (int fold = 0; fold < nTeste.folds; fold++)
            {
                List<List<Vector>> dadosTreino = new List<List<Vector>>();
                List<List<Vector>> dadosTeste = new List<List<Vector>>();

                //DEBUG Console.WriteLine(" - Iniciando fold " + fold.ToString());
                for (int i = 0; i < grupos.Count; i++)
                {
                    dadosTreino.Add(grupos[i].GetKFoldTreino(nTeste.folds, fold));
                    dadosTeste.Add(grupos[i].GetKFoldTeste(nTeste.folds, fold));
                }

                List<BoundingVolume> caixas = new List<BoundingVolume>();

                //Aqui Seleciona o tipo de bounding volume
                for (int i = 0; i < grupos.Count; i++)
                {
                    if (nTeste.BV == 2){
                        caixas.Add(new OBB(dadosTreino[i], Convert.ToInt32 (Math.Pow (2,i)),0));
                    }
                    if (nTeste.BV == 1){
                        //caixas.Add(new AABB(dadosTreino[i], "-" + i.ToString() + "-",0));
                    }
                    if (nTeste.BV == 0){
                        caixas.Add(new Sphere(dadosTreino[i], Convert.ToInt32 (Math.Pow (2,i)),0));
                    }

                }

                TesteColisao teste = new TesteColisao(nTeste);

                teste.RealizaTeste(caixas);

                 Console.WriteLine(" - Iniciando testes");

                result result = new result();
                foreach (BoundingVolume c in caixas)
                {
                    result.profundidadeMaxima = Math.Max(result.profundidadeMaxima, c.MaxProfundidade());
                }

                foreach (PreRedeNeural p in teste.PRN)
                {
                    result.planos += p.planos.Count;
                    result.padroes += p.padDentro.RowCount;
                    result.padroes += p.padFora.RowCount;
                }

                 Console.WriteLine(" - Gerando Redes " + fold.ToString());
                List<Rede> redes = GeraRedesNeurais(teste.PRN, nTeste);

                 Console.WriteLine(" - Pontos de treino " + fold.ToString());
                TestaPontos(caixas, redes, nTeste, out result.treinoCertos, out result.treinoErrados);

                 Console.WriteLine(" - Pontos de teste " + fold.ToString());

                if (dadosTeste.Count == dadosTreino.Count)
                {
                    caixas.Clear();
                    for (int i = 0; i < grupos.Count; i++)
                    {
                        caixas.Add(new BoundingVolume(dadosTeste[i], Convert.ToInt32 (Math.Pow (2,i)),0));
                    }
                    TestaPontos(caixas, redes,nTeste, out result.testeCertos, out result.testeErrados);
                }
                resultado.resultados.Add (result);
            }
            return resultado;
        }
コード例 #26
0
ファイル: EventScript.cs プロジェクト: seanyourchek-dev/repo
    List <resultModifierPreview> previewModifiers = new List <resultModifierPreview>(); // List of values which will be modified with additional informations

    void computeResultPreview(result res)
    {
        previewModifiers.Clear();

        if (res.resultType == resultTypes.simple)
        {
            //If the result is configured as 'simple' just add the value modifiers to list.
            addPreviewValueChanges(res.modifiers);
        }
        else if (res.resultType == resultTypes.conditional)
        {
            //If the result is configured as 'conditional' validate the conditions and
            //execute the depending modifiers.
            if (AreConditinsForResultMet(res.conditions))
            {
                addPreviewValueChanges(res.modifiersTrue);
            }
            else
            {
                addPreviewValueChanges(res.modifiersFalse);
            }
        }
        else if (res.resultType == resultTypes.randomConditions)
        {
            //If the result is configured as 'randomConditions':
            //Value changes are unknown for the preview. Mark them as unknown.
            //Is it possible to preview this correctly? In some circumstances, but I think this is not worth the effort.

            //Add both possibilities, mark them as 'randomIndependent' = false
            addPreviewValueChanges(res.modifiersTrue, false);
            addPreviewValueChanges(res.modifiersFalse, false);
        }
        else if (res.resultType == resultTypes.random)
        {
            //If the result is configured as 'random':
            //Add all possible value changes for the preview to the list, marked as 'randomIndependent' = false
            if (res.randomModifiers.Length != 0)
            {
                for (int i = 0; i < res.randomModifiers.Length; i++)
                {
                    addPreviewValueChanges(res.randomModifiers[i]);
                }
            }
            else
            {
                Debug.LogWarning("Missing random results-list");
            }
        }
        else
        {
            Debug.LogError("Path not reachable?");
        }

        //Now all the possible value changes are known.

        //Attention! There can be still duplicates in the list because of randomization.
        //If this happens, the value script itself will detect the setting of duplicates and then setting the outcome to 'randomIndependant' = true

        //Tell the valueManager to tell the ValueScripts to show these previews.
        valueManager.instance.setPreviews(ref previewModifiers);
    }
コード例 #27
0
ファイル: NumVariator.cs プロジェクト: fzimmermann89/MSF
        public void DoWork()
        {
            Parallel.For (0, betasteps+1,ibeta=>
            {
                double beta = betamin + ibeta * (betamax - betamin) / betasteps;

                //RMS
                NumIterator rmsIterator = new NumIterator(adjmatrix, beta, sigma, delta,pertubation);
                rmsIterator.noise = noise;
                double[] rms = new double[cluster.Length];
                rmsIterator.iterate(pre);
                for (int itime = 0; itime < rec; itime++)
                {
                    rmsIterator.iterate();
                    for (int icluster = 0; icluster < cluster.Length; icluster++)
                    {
                        rms[icluster] += MS(rmsIterator.xt.Last())[icluster];
                    }
                }
                for (int i = 0; i < rms.Length; i++)
                {
                    rms[i] /= rec;
                    rms[i] = Math.Sqrt(rms[i]);
                }

                //Ljapunow
                double[] ljapunow = new double[cluster.Length];
                //synchrone orbits berechnen

                NumIterator smIterator = new NumIterator(adjmatrix, beta, sigma, delta,pertubation);
                smIterator.iterate(pre + rec);

                List<double[]> transDoneSynchManifolds = smIterator.xt.GetRange(pre, rec);

                List<double[]> smts = new List<double[]>();
                for (int i = 0; i < transDoneSynchManifolds.Count; i++)
                {
                    double[] add = new double[cluster.Length];
                    for (int j = 0; j < cluster.Length; j++)
                    {
                        int node0 = cluster[j][0];
                        add[j] = transDoneSynchManifolds[i][node0];
                    }
                    smts.Add(add);
                }

                ljapunow = ljapunow.Add(Double.MinValue);

                for (int m = 0; m < clusterTransform.Length; m++)
                {
                    for (int i = 0; i < clusterTransform[m].Length; i++)
                    {
                        int etanodenum = clusterTransform[m][i];
                        if (etanodenum >= clusterTransform.Length) // unterer Block
                        {
                            Ljapunator punator = new Ljapunator(JMats, BMat, cluster.Length, smts, beta, sigma, delta);
                            punator.etat[0][etanodenum] = pertubation;
                            punator.iterate(rec);
                            ljapunow[m] = Math.Max(punator.ljapunowSum / (double)rec, ljapunow[m]);

                    }
                }
                }

                result ret_result = new result(beta, rms, ljapunow);
                callback(ret_result);

            });
        }
コード例 #28
0
ファイル: FrmPagamento.cs プロジェクト: viczac/plugpag
        private void FrmPagamento_Activated(object sender, EventArgs e)
        {
            try
            {
                unsafe
                {
                    fixed(byte *p = amount)
                    {
                        convertToByte(p, FrmCompras.vlTotal);
                    }
                }

                //circularProgressBar1.Style = ProgressBarStyle.Marquee;
                Application.DoEvents();

                int resp = 0;

                if (FrmCompras.vlTotal != 0)
                {
                    result trsResult = new result();
                    byte[] comport   = Encoding.ASCII.GetBytes(GetPortFromFile());
                    byte[] codvenda  = Encoding.ASCII.GetBytes("Cafe");

                    int    size = Marshal.SizeOf(trsResult);
                    IntPtr ptr  = Marshal.AllocHGlobal(size);
                    Marshal.StructureToPtr(trsResult, ptr, false);

                    byte[] appName = Encoding.ASCII.GetBytes("PagCafe");
                    byte[] version = Encoding.ASCII.GetBytes("0.0.1");
                    SetVersionName(appName, version);

                    switch (FrmCompras.tipoPagamento)
                    {
                    case 0:
                        try
                        {
                            resp = InitBTConnection(comport);

                            resp = CancelTransaction(
                                ptr
                                );
                        }
                        catch (Exception ex) { }

                        break;

                    case 1:
                        try
                        {
                            resp = InitBTConnection(comport);

                            resp = SimplePaymentTransaction(
                                1,
                                1,
                                1,
                                amount,
                                codvenda,
                                ptr
                                );
                        }
                        catch (Exception ex) { }

                        break;

                    case 2:
                        InitBTConnection(comport);
                        resp = SimplePaymentTransaction(
                            2,
                            1,
                            1,
                            amount,
                            codvenda,
                            ptr
                            );
                        break;
                    }

                    trsResult = (result)Marshal.PtrToStructure(ptr, typeof(result));
                    Marshal.FreeHGlobal(ptr);

                    FrmCompras.ConfirmaPagamento = resp;
                }
                else
                {
                    FrmCompras.ConfirmaPagamento = 1;
                }

                //circularProgressBar1.Style = ProgressBarStyle.Blocks;
                Application.DoEvents();
                //circularProgressBar1.Dispose();
                //while (circularProgressBar1.IsDisposed == false) { Application.DoEvents(); }
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex) {  }
        }
コード例 #29
0
        /// <summary>
        /// Create the XML Element
        /// </summary>
        /// <param name="resultElementName">The Name of the XML Element to be created</param>
        /// <param name="row">The DataRow from the DBF file</param>
        /// <param name="resultObject">The result object being added</param>
        /// <param name="elementMappingTable">The DataTable containing the Element Mapping</param>
        private void CreateXMLElement(string resultElementName, DataRow row, result resultObject, DataTable elementMappingTable)
        {
            // Get the DBF Column name from the codes.xml file
            string dataColumnName = this.GetDataColumnName(resultElementName, elementMappingTable);

            // Ensure that such a DBF Column exists
            if (dataColumnName != null && row.Table.Columns.Contains(dataColumnName))
            {
                // Get the content of the DBF column
                string givenString = row[dataColumnName].ToString().Trim();

                // If there is conent, create the XML element, otherwise skip
                if (givenString != string.Empty)
                {
                    PropertyInfo prop = resultObject.GetType().GetProperty(resultElementName, BindingFlags.Public | BindingFlags.Instance);
                    if (prop != null && prop.CanWrite)
                    {
                        if (prop.PropertyType == typeof(string))
                        {
                            prop.SetValue(resultObject, givenString, null);
                        }

                        if (prop.PropertyType == typeof(decimal))
                        {
                            decimal decimalValue;
                            decimal.TryParse(givenString, out decimalValue);
                            prop.SetValue(resultObject, decimalValue, null);
                            PropertyInfo propSpecified = resultObject.GetType().GetProperty(resultElementName + "Specified", BindingFlags.Public | BindingFlags.Instance);
                            if (propSpecified != null && propSpecified.CanWrite && decimalValue != 0)
                            {
                                propSpecified.SetValue(resultObject, true, null);
                            }
                        }

                        if (prop.PropertyType == typeof(SSDCompoundType))
                        {
                            if (givenString.IndexOf("=") > -1)
                            {
                                // If there is a $ separator, there are multiple attributes
                                string[] attributeArray;
                                if (givenString.IndexOf("$") > -1)
                                {
                                    attributeArray = givenString.Split("$".ToCharArray());
                                }
                                else
                                {
                                    attributeArray    = new string[1];
                                    attributeArray[0] = givenString;
                                }

                                List <SSDCompoundTypeValue> values = new List <SSDCompoundTypeValue>();
                                for (int i = 0; i < attributeArray.Length; i++)
                                {
                                    SSDCompoundTypeValue ctv = new SSDCompoundTypeValue();
                                    ctv.name  = attributeArray[i].Split("=".ToCharArray())[0];
                                    ctv.Value = attributeArray[i].Split("=".ToCharArray())[1];
                                    values.Add(ctv);
                                }

                                SSDCompoundType newSSDCompoundType = new SSDCompoundType();
                                newSSDCompoundType.value = values.ToArray();
                                prop.SetValue(resultObject, newSSDCompoundType, null);
                            }
                            else
                            {
                                SSDCompoundType newSSDCompoundType = new SSDCompoundType();
                                newSSDCompoundType.Text    = new string[1];
                                newSSDCompoundType.Text[0] = givenString;
                                prop.SetValue(resultObject, newSSDCompoundType, null);
                            }
                        }

                        if (prop.PropertyType == typeof(SSDRepeatableType))
                        {
                            SSDRepeatableType newSSDRepeatableType = new SSDRepeatableType();
                            //// List<String> rvalues = new List<String>();
                            //// rvalues.Add(givenString);
                            //// newSSDRepeatableType.value = rvalues.ToArray();
                            newSSDRepeatableType.Text    = new string[1];
                            newSSDRepeatableType.Text[0] = givenString;
                            prop.SetValue(resultObject, newSSDRepeatableType, null);
                        }
                    }
                }
            }
        }
 result = await base.GetUpdatedDocumentAsync(
     result,
     unimplementedMembers.WhereAsArray(m => !m.type.Equals(idisposable)),
コード例 #31
0
 await LogErrorAsync(result, context);
コード例 #32
0
ファイル: limit.cs プロジェクト: NickJ1984/planner
        public DateTime checkDate(DateTime Date)
        {
            result rslt = process(date, Date);

            return(rslt.date);
        }
コード例 #33
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            writeFile("enter");
            string code          = "";
            string threedsession = "";

            string[] arr    = new string[100];
            string   openid = "";

            try
            {
                code = HttpContext.Current.Request.QueryString["code"].ToString();
                writeFile("nice");
                writeFile(code);
            }
            catch (Exception ex)
            {
                context.Response.Write(ex.ToString());
            }
            string Appid      = "wx2e67c9b918d371a4";
            string Secret     = "84060efaf50e9fa85a62963a36dbb4b2";
            string grant_type = "authorization_code";

            //向微信服务端 使用登录凭证 code 获取 session_key 和 openid
            string url  = "https://api.weixin.qq.com/sns/jscode2session?appid=" + Appid + "&secret=" + Secret + "&js_code=" + code + "&grant_type=" + grant_type;
            string type = "utf-8";

            writeFile(url);
            GetUsersHelper GetUsersHelper = new GetUsersHelper();
            string         j = GetUsersHelper.GetUrltoHtml(url, type);//获取微信服务器返回字符串


            //将字符串转换为json格式
            JObject jo = (JObject)JsonConvert.DeserializeObject(j);

            writeFile(jo.ToString());

            result res = new result();

            try
            {
                //微信服务器验证成功
                res.openid      = jo["openid"].ToString();
                res.session_key = jo["session_key"].ToString();
                threedsession   = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 16);
                writeFile(res.openid);
                writeFile(res.session_key);
                writeFile(threedsession);

                //测试用
                // string threedsession= "425f364ba60247b5";
                //string openid = "obrIH0QPYFOYAREo9qZwpq69DxbQ";
                //string session_key = "UTokwQsvVFTQ7adPuwG1ow==";


                //Session存储
                // SetSession(threedsession, openid + "|" + session_key);
                // HttpContext.Current.Session["threedsession"] = threedsession;
                SetSession(threedsession, res.openid + "|" + res.session_key);
                if (GetSession(threedsession).ToString() != null)
                {
                    string value = GetSession(threedsession).ToString();
                    writeFile(value);
                    arr    = value.Split('|');
                    openid = arr[0];
                    writeFile(openid);
                    value = arr[1];
                    writeFile(value);
                }
                else
                {
                    writeFile("以Session得openid fail");
                }
                context.Response.Write(threedsession);
            }
            catch (Exception)
            {
                //微信服务器验证失败
                res.errcode = jo["errcode"].ToString();
                res.errmsg  = jo["errmsg"].ToString();
            }
        }
コード例 #34
0
 ReadScores(result, list);
コード例 #35
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            DirectPaymentAPI ws = new DirectPaymentAPI();

            // WALLET ID
            walletId = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("walletId"))).Text;

            payment.amount             = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("paymentAmount"))).Text;
            payment.mode               = ((DropDownList)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("paymentMode"))).Text;
            payment.action             = ((DropDownList)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("paymentFonction"))).Text;
            payment.currency           = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("paymentCurrency"))).Text;
            payment.contractNumber     = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("paymentContractNumber"))).Text;
            payment.differedActionDate = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("paymentDifferedActionDate"))).Text; // Format : "dd/mm/yy"

            // ORDER
            order.@ref    = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderRef"))).Text;
            order.origin  = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderOrigin"))).Text;
            order.country = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderCountry"))).Text;
            order.taxes   = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderTaxes"))).Text;

            order.currency = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderCurrency"))).Text;
            if (order.currency == "")
            {
                order.currency = Resources.Resource.ORDER_CURRENCY;
            }

            order.amount = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderAmount"))).Text;
            order.date   = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderDate"))).Text; // format : "dd/mm/yyyy HH24:MM"

            // ORDER DETAILS
            orderDetail1.@ref     = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderDetailRef1"))).Text;
            orderDetail1.price    = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderDetailPrice1"))).Text;
            orderDetail1.quantity = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderDetailQuantity1"))).Text;
            orderDetail1.comment  = ((HtmlTextArea)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderDetailComment1"))).Value;

            orderDetail2.@ref     = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderDetailRef2"))).Text;
            orderDetail2.price    = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderDetailPrice2"))).Text;
            orderDetail2.quantity = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderDetailQuantity2"))).Text;
            orderDetail2.comment  = ((HtmlTextArea)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("orderDetailComment2"))).Value;

            order.details = new orderDetail[2];
            order.details.SetValue(orderDetail1, 0);
            order.details.SetValue(orderDetail2, 1);

            // PRIVATE DATA (optional)
            privateData1.key   = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("privateDataKey1"))).Text;
            privateData1.value = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("privateDataValue1"))).Text;
            privateData2.key   = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("privateDataKey2"))).Text;
            privateData2.value = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("privateDataValue2"))).Text;
            privateData3.key   = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("privateDataKey3"))).Text;
            privateData3.value = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("privateDataValue3"))).Text;

            privateDataList.SetValue(privateData1, 0);
            privateDataList.SetValue(privateData2, 1);
            privateDataList.SetValue(privateData3, 2);


            // SCHEDULED DATE
            scheduledDate = ((TextBox)(Page.PreviousPage.FindControl("doScheduledWalletPayment").FindControl("scheduledDate"))).Text;

            //PROXY
            if (Resources.Resource.PROXY_HOST != "" && Resources.Resource.PROXY_PORT != "")
            {
                ws.Proxy = new System.Net.WebProxy(Resources.Resource.PROXY_HOST, Convert.ToInt32(Resources.Resource.PROXY_PORT));
                if (Resources.Resource.PROXY_USER != "" && Resources.Resource.PROXY_PASSWORD != "")
                {
                    ws.Proxy.Credentials = new System.Net.NetworkCredential(Resources.Resource.PROXY_USER, Resources.Resource.PROXY_PASSWORD);
                }
            }

            if (Resources.Resource.PROD == "true")
            {
                ws.Url = Resources.Resource.ENDPOINT_DIRECT;
            }

            ws.Credentials = new System.Net.NetworkCredential(Resources.Resource.MERCHANT_ID, Resources.Resource.ACCESS_KEY);

            resultat = ws.doScheduledWalletPayment(payment, order.@ref, order.date, scheduledDate, walletId, order, privateDataList, out paymentRecordId);
        }
        catch (Exception exc)
        {
            errorMessage = exc.Message;
            errorDetails = exc.ToString();
        }
    }
コード例 #36
0
 var(paulis, qubits, result, expectedPr, msg, tol) = _args;
コード例 #37
0
 similarity.similarities[StacktraceKey]          = CalculateStacktraceSimilarity(result, otherResult);
コード例 #38
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            WebPaymentAPI ws = new WebPaymentAPI();

            contractNumber = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("paymentContractNumber"))).Text;

            if (contractNumber.Contains(";"))
            {
                string[] split = contractNumber.Split(new Char[] { ';' });
                selectedCrontractList = split;
                contractNumber        = Resources.Resource.CONTRACT_NUMBER;
            }
            else
            {
                selectedCrontractList.SetValue(contractNumber, 0);
            }

            walletId = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("walletId"))).Text;

            updatePersonalDetails = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("updatePersonalDetails"))).Text;

            updatePaymentDetails = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("updatePaymentDetails"))).Text;

            // PRIVATE DATA (optional)
            privateData1.key   = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("privateDataKey1"))).Text;
            privateData1.value = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("privateDataValue1"))).Text;
            privateData2.key   = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("privateDataKey2"))).Text;
            privateData2.value = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("privateDataValue2"))).Text;
            privateData3.key   = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("privateDataKey3"))).Text;
            privateData3.value = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("privateDataValue3"))).Text;

            privateDataList.SetValue(privateData1, 0);
            privateDataList.SetValue(privateData2, 1);
            privateDataList.SetValue(privateData3, 2);

            // TRANSACTION OPTIONS
            string securityMode = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("securityMode"))).Text;
            if (securityMode == "")
            {
                securityMode = Resources.Resource.SECURITY_MODE;
            }

            string notificationURL = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("notificationURL"))).Text;
            if (notificationURL == "")
            {
                notificationURL = Resources.Resource.NOTIFICATION_URL;
            }

            string returnURL = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("returnURL"))).Text;
            if (returnURL == "")
            {
                returnURL = Resources.Resource.RETURN_URL;
            }

            string cancelURL = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("cancelURL"))).Text;
            if (cancelURL == "")
            {
                cancelURL = Resources.Resource.CANCEL_URL;
            }

            string customPaymentPageCode = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("customPaymentPageCode"))).Text;
            if (customPaymentPageCode == "")
            {
                customPaymentPageCode = Resources.Resource.CUSTOM_PAYMENT_PAGE_CODE;
            }

            string customPaymentTemplateURL = ((TextBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("customPaymentTemplateURL"))).Text;
            if (customPaymentTemplateURL == "")
            {
                customPaymentTemplateURL = Resources.Resource.CUSTOM_PAYMENT_TEMPLATE_URL;
            }

            string languageCode = ((DropDownList)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("languageCode"))).Text;
            if (languageCode == "")
            {
                languageCode = Resources.Resource.LANGUAGE_CODE;
            }


            //PROXY
            if (Resources.Resource.PROXY_HOST != "" && Resources.Resource.PROXY_PORT != "")
            {
                ws.Proxy = new System.Net.WebProxy(Resources.Resource.PROXY_HOST, Convert.ToInt32(Resources.Resource.PROXY_PORT));
                if (Resources.Resource.PROXY_USER != "" && Resources.Resource.PROXY_PASSWORD != "")
                {
                    ws.Proxy.Credentials = new System.Net.NetworkCredential(Resources.Resource.PROXY_USER, Resources.Resource.PROXY_PASSWORD);
                }
            }

            if (Resources.Resource.PROD == "true")
            {
                ws.Url = Resources.Resource.ENDPOINT_WEB;
            }

            ws.Credentials = new System.Net.NetworkCredential(Resources.Resource.MERCHANT_ID, Resources.Resource.ACCESS_KEY);

            resultat = ws.updateWebWallet(contractNumber, walletId, updatePersonalDetails, updatePaymentDetails, languageCode, customPaymentPageCode,
                                          securityMode, returnURL, cancelURL, notificationURL, privateDataList, customPaymentTemplateURL,
                                          out token, out redirectURL);

            debug = ((CheckBox)(Page.PreviousPage.FindControl("updateWebWallet").FindControl("debug"))).Checked;
        }
        catch (Exception exc)
        {
            errorMessage = exc.Message;
            errorDetails = exc.ToString();
        }
    }
コード例 #39
0
 similarity.similarities[LastEventKey]           = CalculateLastEventSimilarity(result, otherResult);
コード例 #40
0
ファイル: AssertProb.cs プロジェクト: sycomix/qsharp-runtime
 var(paulis, qubits, result, expectedProb, msg, tolerance) = _args;
コード例 #41
0
        public ScheduleTeamMatchup(teammatchup tm)
        {
            int numOfTeams = tm.teams.Count;

            this.MatchOrder = tm.matchOrder;

            team team1 = numOfTeams > 0 ? tm.teams.First() : null;
            team team2 = numOfTeams > 1 ? tm.teams.Skip(1).First() : null;

            if (team1 != null)
            {
                this.Team1       = TeamResponse.From(team1);
                this.Team1Points = tm.PointsFor(team1);
                this.Team1Win    = tm.Team1Won();
            }

            if (team2 != null)
            {
                this.Team2       = TeamResponse.From(team2);
                this.Team2Points = tm.PointsFor(team2);
                this.Team2Win    = tm.Team2Won();
            }

            this.IsComplete  = tm.IsComplete();
            this.TeeTimeText = tm.TeeTimeText();
            this.Id          = tm.id;
            this.PlayoffType = tm.playoffType;

            if (this.IsComplete && team1 != null && team2 != null)
            {
                result team1PointsResult = tm.TopPoints(team1);
                //result team2PointsResult = tm.TopPoints(team2);

                this.TopPoints = team1PointsResult != null ?
                                 new MatchSummaryValue
                {
                    Player         = new PlayerWebResponse(team1PointsResult.player),
                    FormattedValue = LeaderBoardFormat.Default.FormatValue(team1PointsResult.points),
                    Value          = (double)team1PointsResult.points
                } : null;


                result topNetScore = tm.TopNetDifference(team1);

                this.TopNetScore = topNetScore != null ?
                                   new MatchSummaryValue
                {
                    Player         = new PlayerWebResponse(topNetScore.player),
                    FormattedValue = LeaderBoardFormat.Net.FormatValue(topNetScore.NetScoreDifference()),
                    Value          = (double)topNetScore.NetScoreDifference()
                } : null;

                //this.Team2TopPoints = team2PointsResult != null ?
                //    new MatchSummaryValue
                //    {
                //        Player = new PlayerWebResponse(team2PointsResult.player),
                //        FormattedValue = LeaderBoardFormat.Default.FormatValue(team2PointsResult.points),
                //        Value = (double)team2PointsResult.points
                //    } : null;
            }
        }
コード例 #42
0
 similarity.similarities[ModulesInStacktraceKey] = CalculateModulesInStacktraceSimilarity(result, otherResult);
コード例 #43
0
ファイル: CaseTranslator.cs プロジェクト: BdGL3/CXPortal
        private static CaseObject Translate1_0(Stream CaseXML)
        {
            CaseObject caseObj = new CaseObject();

            XmlSerializer serializer = new XmlSerializer(typeof(L3.Cargo.Common.Xml.XCase_1_0.XCase));
            L3.Cargo.Common.Xml.XCase_1_0.XCase xcase = (L3.Cargo.Common.Xml.XCase_1_0.XCase)serializer.Deserialize(CaseXML);

            caseObj.CaseId = xcase.id;
            caseObj.createTime = xcase.createTime;
            caseObj.LinkedCaseId = xcase.linkedCase;
            caseObj.AbortedBy = xcase.abortedBy;
            caseObj.CurrentArea = xcase.currentArea;

            Location location = null;

            Conveyance convey = null;

            Container cont = null;

            caseObj.attachments = new DataAttachments();

            if (xcase.vehicle != null)
            {
                cont = new Container(String.Empty, String.Empty, String.Empty, String.Empty);
                cont.Id = xcase.vehicle.registrationNum;
                cont.Weight = xcase.vehicle.weight.ToString();

                if (xcase.vehicle.manifest != null)
                {
                    foreach (L3.Cargo.Common.Xml.XCase_1_0.Manifest manifest in xcase.vehicle.manifest)
                    {
                        DataAttachment attach = new DataAttachment();
                        attach.attachmentType = AttachmentType.Manifest;
                        attach.attachmentId = manifest.image;
                        attach.User = String.Empty;
                        attach.CreateTime = String.Empty;
                        caseObj.attachments.Add(attach);
                    }
                }
            }

            caseObj.scanInfo = new ScanInfo(String.Empty, location, convey, cont);

            caseObj.systemInfo = new SystemInfo(String.Empty, xcase.siteId);

            if (xcase.xRayImage != null)
            {
                foreach (String str in xcase.xRayImage)
                {
                    DataAttachment attach = new DataAttachment();
                    attach.attachmentType = AttachmentType.XRayImage;
                    attach.attachmentId = str;
                    attach.User = String.Empty;
                    attach.CreateTime = String.Empty;
                    caseObj.attachments.Add(attach);
                }
            }

            if (xcase.attachment != null)
            {
                foreach (L3.Cargo.Common.Xml.XCase_1_0.Attachment atch in xcase.attachment)
                {
                    if (atch.File != String.Empty)
                    {
                        DataAttachment attach = new DataAttachment();
                        if (atch.type.ToLower() == "unknown" || atch.type == String.Empty)
                            attach.attachmentType = AttachmentType.Unknown;
                        else
                            attach.attachmentType = (AttachmentType)Enum.Parse(typeof(AttachmentType), atch.type);

                        attach.attachmentId = atch.File;
                        attach.User = String.Empty;
                        attach.CreateTime = String.Empty;
                        caseObj.attachments.Add(attach);
                    }
                }
            }

            if (xcase.tdsResultFile != null && xcase.tdsResultFile != String.Empty)
            {
                DataAttachment attach = new DataAttachment();
                attach.attachmentType = AttachmentType.TDSResultFile;
                attach.attachmentId = xcase.tdsResultFile;
                attach.User = String.Empty;
                attach.CreateTime = String.Empty;
                caseObj.attachments.Add(attach);
            }

            if (xcase.eventRecord != null)
            {
                caseObj.EventRecords = new List<CaseObject.CaseEventRecord>();

                foreach (L3.Cargo.Common.Xml.XCase_1_0.EventRecord record in xcase.eventRecord)
                {
                    CaseObject.CaseEventRecord eventRecord = new CaseObject.CaseEventRecord(record.createTime, record.description, false);
                    caseObj.EventRecords.Add(eventRecord);
                }
            }

            caseObj.ResultsList = new List<result>();

            if (xcase.awsResult != null)
            {
                String decision;

                switch (xcase.awsResult.decision)
                {
                    case L3.Cargo.Common.Xml.XCase_1_0.AWSDecision.AWS_CAUTION:
                        decision = WorkstationDecision.Caution.ToString();
                        break;
                    case L3.Cargo.Common.Xml.XCase_1_0.AWSDecision.AWS_CLEAR:
                        decision = WorkstationDecision.Clear.ToString();
                        break;
                    case L3.Cargo.Common.Xml.XCase_1_0.AWSDecision.AWS_REJECT:
                        decision = WorkstationDecision.Reject.ToString();
                        break;
                    case L3.Cargo.Common.Xml.XCase_1_0.AWSDecision.AWS_UNKNOWN:
                        decision = WorkstationDecision.Unknown.ToString();
                        break;
                    default:
                        decision = WorkstationDecision.Unknown.ToString();
                        break;
                }

                result res = new result(decision, xcase.awsResult.reason.ToString(),
                    String.Empty, xcase.awsResult.awsUserId, xcase.awsResult.comment, "Analyst", String.Empty);

                caseObj.ResultsList.Add(res);
            }

            if (xcase.ewsResult != null)
            {
                String decision;

                switch (xcase.ewsResult.decision)
                {
                    case L3.Cargo.Common.Xml.XCase_1_0.EWSDecision.EWS_RELEASE:
                    case L3.Cargo.Common.Xml.XCase_1_0.EWSDecision.EWS_CLEAR:
                        decision = WorkstationDecision.Clear.ToString();
                        break;
                    case L3.Cargo.Common.Xml.XCase_1_0.EWSDecision.EWS_REJECT:
                        decision = WorkstationDecision.Reject.ToString();
                        break;
                    case L3.Cargo.Common.Xml.XCase_1_0.EWSDecision.EWS_UNKNOWN:
                        decision = WorkstationDecision.Unknown.ToString();
                        break;
                    default:
                        decision = WorkstationDecision.Unknown.ToString();
                        break;
                }

                result res = new result(decision, String.Empty,
                    String.Empty, xcase.ewsResult.ewsUserId, xcase.ewsResult.comment, "EWS", String.Empty);

                caseObj.ResultsList.Add(res);
            }

            if (xcase.insResult != null)
            {
                String decision;

                switch (xcase.insResult.decision)
                {
                    case L3.Cargo.Common.Xml.XCase_1_0.INSDecision.INS_CLEAR:
                        decision = WorkstationDecision.Clear.ToString();
                        break;
                    case L3.Cargo.Common.Xml.XCase_1_0.INSDecision.INS_REJECT:
                        decision = WorkstationDecision.Reject.ToString();
                        break;
                    default:
                        decision = WorkstationDecision.Unknown.ToString();
                        break;
                }

                result res = new result(decision, String.Empty,
                    String.Empty, xcase.insResult.insUserId, xcase.insResult.comment, "Inspector", String.Empty);

                caseObj.ResultsList.Add(res);
            }

            if (xcase.supResult != null)
            {
                String decision;

                switch (xcase.supResult.decision)
                {
                    case L3.Cargo.Common.Xml.XCase_1_0.SUPDecision.SUP_CLEAR:
                        decision = WorkstationDecision.Clear.ToString();
                        break;
                    case L3.Cargo.Common.Xml.XCase_1_0.SUPDecision.SUP_REJECT:
                        decision = WorkstationDecision.Reject.ToString();
                        break;
                    default:
                        decision = WorkstationDecision.Unknown.ToString();
                        break;
                }

                result res = new result(decision, String.Empty,
                    String.Empty, xcase.supResult.supUserId, xcase.supResult.comment, "Supervisor", String.Empty);

                caseObj.ResultsList.Add(res);
            }

            return caseObj;
        }
コード例 #44
0
 similarity.similarities[ExceptionMessageKey]    = CalculateExceptionMessageSimilarity(result, otherResult);
 result = await CodeGenerator.AddMemberDeclarationsAsync(
     result.Project.Solution, classOrStructType, memberDefinitions,
コード例 #46
0
        public static analysis Results(string xmlfile)
        {
            analysis answer = new analysis();

            using (XmlReader reader = XmlReader.Create(xmlfile))
            {
                while (!reader.EOF)
                {
                    if (reader.ReadToFollowing("header"))
                    {
                        var subtree = reader.ReadSubtree();

                        while (subtree.Read())
                        {
                            subtree.MoveToElement();
                            if (subtree.IsStartElement())
                            {
                                try
                                {
                                    switch (subtree.Name.ToLower())
                                    {
                                    case "logfile":
                                        answer.logfile = subtree.ReadString();
                                        break;

                                    case "sizekb":
                                        answer.sizekb = subtree.ReadString();
                                        break;

                                    case "sizelines":
                                        answer.sizelines = subtree.ReadString();
                                        break;

                                    case "duration":
                                        answer.duration = subtree.ReadString();
                                        break;

                                    case "vehicletype":
                                        answer.vehicletype = subtree.ReadString();
                                        break;

                                    case "firmwareversion":
                                        answer.firmwareversion = subtree.ReadString();
                                        break;

                                    case "firmwarehash":
                                        answer.firmwarehash = subtree.ReadString();
                                        break;

                                    case "hardwaretype":
                                        answer.hardwaretype = subtree.ReadString();
                                        break;

                                    case "freemem":
                                        answer.freemem = subtree.ReadString();
                                        break;

                                    case "skippedlines":
                                        answer.skippedlines = subtree.ReadString();
                                        break;
                                    }
                                }
                                catch (Exception ex)
                                {
                                    log.Error(ex);
                                }
                            }
                        }
                    }
                    // params - later
                    if (reader.ReadToFollowing("results"))
                    {
                        var subtree = reader.ReadSubtree();

                        result res = null;

                        while (subtree.Read())
                        {
                            subtree.MoveToElement();
                            if (subtree.IsStartElement())
                            {
                                switch (subtree.Name.ToLower())
                                {
                                case "result":
                                    if (res != null && res.name != "")
                                    {
                                        answer.results.Add(res);
                                    }
                                    res = new result();
                                    break;

                                case "name":
                                    res.name = subtree.ReadString();
                                    break;

                                case "status":
                                    res.status = subtree.ReadString();
                                    break;

                                case "message":
                                    res.message = subtree.ReadString();
                                    break;

                                case "data":
                                    res.data = subtree.ReadString();
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            return(answer);
        }
コード例 #47
0
        public static analysis Results(string xmlfile)
        {
            analysis answer = new analysis();

            using (XmlReader reader = XmlReader.Create(xmlfile))
            {
                while (!reader.EOF)
                {
                    if (reader.ReadToFollowing("header"))
                    {
                        var subtree = reader.ReadSubtree();

                        while (subtree.Read())
                        {
                            subtree.MoveToElement();
                            if (subtree.IsStartElement())
                            {
                                switch (subtree.Name.ToLower())
                                {
                                    case "logfile":
                                        answer.logfile = subtree.ReadString();
                                        break;
                                    case "sizekb":
                                        answer.sizekb = subtree.ReadString();
                                        break;
                                    case "sizelines":
                                        answer.sizelines = subtree.ReadString();
                                        break;
                                    case "duration":
                                        answer.duration = subtree.ReadString();
                                        break;
                                    case "vehicletype":
                                        answer.vehicletype = subtree.ReadString();
                                        break;
                                    case "firmwareversion":
                                        answer.firmwareversion = subtree.ReadString();
                                        break;
                                    case "firmwarehash":
                                        answer.firmwarehash = subtree.ReadString();
                                        break;
                                    case "hardwaretype":
                                        answer.hardwaretype = subtree.ReadString();
                                        break;
                                    case "freemem":
                                        answer.freemem = subtree.ReadString();
                                        break;
                                    case "skippedlines":
                                        answer.skippedlines = subtree.ReadString();
                                        break;
                                }
                            }
                        }
                    }
                    // params - later
                    if (reader.ReadToFollowing("results"))
                    {
                        var subtree = reader.ReadSubtree();

                        result res = null;

                        while (subtree.Read())
                        {
                            subtree.MoveToElement();
                            if (subtree.IsStartElement())
                            {
                                switch (subtree.Name.ToLower())
                                {
                                    case "result":
                                        if (res != null && res.name != "")
                                            answer.results.Add(res);
                                        res = new result();
                                        break;
                                    case "name":
                                        res.name = subtree.ReadString();
                                        break;
                                    case "status":
                                        res.status = subtree.ReadString();
                                        break;
                                    case "message":
                                        res.message = subtree.ReadString();
                                        break;
                                    case "data":
                                        res.data = subtree.ReadString();
                                        break;
                                }
                            }
                        }
                    }
                }
            }

            return answer;
        }
コード例 #48
0
 public KingdeeJsonResultModel()
 {
     Result = new result();
     Result.ResponseStatus = new ResponseStatus();
 }
コード例 #49
0
ファイル: EventScript.cs プロジェクト: seanyourchek-dev/repo
    public static void ComputeResultTypeDependant(result res, bool actualizeFollowUpCard = true)
    {
        switch (res.resultType)
        {
        case resultTypes.simple:
            //If the result is configured as 'simple' just execute the value modifiers.
            executeValueChanges(res.modifiers, actualizeFollowUpCard);
            break;

        case resultTypes.conditional:
            //If the result is configured as 'conditional' validate the conditions and
            //execute the depending modifiers.
            if (AreConditinsForResultMet(res.conditions))
            {
                executeValueChanges(res.modifiersTrue, actualizeFollowUpCard);
            }
            else
            {
                executeValueChanges(res.modifiersFalse, actualizeFollowUpCard);
            }
            break;

        case resultTypes.randomConditions:
            //If the result is configured as 'randomConditions':
            //1. Randomize the borders of predefined value-typ dependencies.
            //2. Validate the new conditions.
            //3. Execute outcome dependent value changes.

            float       rndCResult = 1f;
            ValueScript v          = null;
            foreach (condition c in res.conditions)
            {
                rndCResult = Random.Range(0f, 1f);
                v          = valueManager.instance.getFirstFittingValue(c.value);

                if (v != null)
                {
                    //set the minimum border for the conditon between min and max,
                    //if the real value is over min, the path 'true' is executed
                    c.valueMin = c.valueMin + rndCResult * (c.valueMax - c.valueMin);     // <-This is now really input depending.
                    c.valueMax = 999f;
                }
                else
                {
                    Debug.LogWarning("Missing value type: " + c.value);
                }
            }

            if (AreConditinsForResultMet(res.conditions))
            {
                executeValueChanges(res.modifiersTrue, actualizeFollowUpCard);
            }
            else
            {
                executeValueChanges(res.modifiersFalse, actualizeFollowUpCard);
            }
            break;

        case resultTypes.random:
            //If the result is configured as 'random':
            //Select randomly a modifier-group out of the defined pool and execute the value changes.
            if (res.randomModifiers.Length != 0)
            {
                int rndResult = Random.Range(0, res.randomModifiers.Length);
                executeValueChanges(res.randomModifiers[rndResult], actualizeFollowUpCard);
            }
            else
            {
                Debug.LogWarning("Missing random results-list");
            }
            break;

        default:
            Debug.LogError("Path not reachable?");
            break;
        }
    }
コード例 #50
0
        /// <summary>
        /// ��������
        /// </summary>
        /// <param name="context"></param>
        private static void SaveData(HttpContext context)
        {
            result rlt = new result();
            try
            {
                BLL.ZSSY.OPListForSpecimen bll_OPListForSpecimen = new BLL.ZSSY.OPListForSpecimen();
                Model.ZSSY.OPListForSpecimen model_OPListForSpecimen = new Model.ZSSY.OPListForSpecimen();
                string  ssType = string.Empty,
                        ssName = string.Empty,
                        ssDecription = string.Empty;
                #region ʵ���ำֵ
                if (context.Request["PatientId"] != null)
                    model_OPListForSpecimen.PatientId = context.Request["PatientId"];

                if (context.Request["InpNO"] != null)
                    model_OPListForSpecimen.InpNO = context.Request["InpNO"];

                if (context.Request["VisitId"] != null)
                    model_OPListForSpecimen.VisitId = context.Request["VisitId"];

                if (context.Request["Name"] != null)
                    model_OPListForSpecimen.Name = context.Request["Name"];

                if (context.Request["NamePhonetic"] != null)
                    model_OPListForSpecimen.NamePhonetic = context.Request["NamePhonetic"];

                if (context.Request["Sex"] != null)
                    model_OPListForSpecimen.Sex = context.Request["Sex"];

                if (context.Request["DateOfBirth"] != null)
                    model_OPListForSpecimen.DateOfBirth = context.Request["DateOfBirth"];

                if (context.Request["BirthPlace"] != null)
                    model_OPListForSpecimen.BirthPlace = context.Request["BirthPlace"];

                if (context.Request["Citizenship"] != null)
                    model_OPListForSpecimen.Citizenship = context.Request["Citizenship"];

                if (context.Request["Nation"] != null)
                    model_OPListForSpecimen.Nation = context.Request["Nation"];

                if (context.Request["IDNO"] != null)
                    model_OPListForSpecimen.IDNO = context.Request["IDNO"];

                if (context.Request["Identity"] != null)
                    model_OPListForSpecimen.Identity = context.Request["Identity"];

                if (context.Request["ChargeType"] != null)
                    model_OPListForSpecimen.ChargeType = context.Request["ChargeType"];

                if (context.Request["MailingAddress"] != null)
                    model_OPListForSpecimen.MailingAddress = context.Request["MailingAddress"];

                if (context.Request["ZipCode"] != null)
                    model_OPListForSpecimen.ZipCode = context.Request["ZipCode"];

                if (context.Request["PhoneNumberHome"] != null)
                    model_OPListForSpecimen.PhoneNumberHome = context.Request["PhoneNumberHome"];

                if (context.Request["PhoneNumbeBusiness"] != null)
                    model_OPListForSpecimen.PhoneNumbeBusiness = context.Request["PhoneNumbeBusiness"];

                if (context.Request["NextOfKin"] != null)
                    model_OPListForSpecimen.NextOfKin = context.Request["NextOfKin"];

                if (context.Request["RelationShip"] != null)
                    model_OPListForSpecimen.RelationShip = context.Request["RelationShip"];

                if (context.Request["NextOfKinAddr"] != null)
                    model_OPListForSpecimen.NextOfKinAddr = context.Request["NextOfKinAddr"];

                if (context.Request["NextOfKinZipCode"] != null)
                    model_OPListForSpecimen.NextOfKinZipCode = context.Request["NextOfKinZipCode"];

                if (context.Request["NextOfKinPhome"] != null)
                    model_OPListForSpecimen.NextOfKinPhome = context.Request["NextOfKinPhome"];

                if (context.Request["DeptCode"] != null)
                    model_OPListForSpecimen.DeptCode = context.Request["DeptCode"];

                if (context.Request["BedNO"] != null)
                    model_OPListForSpecimen.BedNO = context.Request["BedNO"];

                if (context.Request["AdmissionDateTime"] != null)
                    model_OPListForSpecimen.AdmissionDateTime = context.Request["AdmissionDateTime"];

                if (context.Request["DoctorInCharge"] != null)
                    model_OPListForSpecimen.DoctorInCharge = context.Request["DoctorInCharge"];

                if (context.Request["ScheduleId"] != null)
                    model_OPListForSpecimen.ScheduleId = context.Request["ScheduleId"];

                if (context.Request["DiagBeforeOperation"] != null)
                    model_OPListForSpecimen.DiagBeforeOperation = context.Request["DiagBeforeOperation"];

                if (context.Request["ScheduledDateTime"] != null)
                    model_OPListForSpecimen.ScheduledDateTime = context.Request["ScheduledDateTime"];

                if (context.Request["KeepSpecimenSign"] != null)
                    model_OPListForSpecimen.KeepSpecimenSign = context.Request["KeepSpecimenSign"];

                if (context.Request["OperatingRoom"] != null)
                    model_OPListForSpecimen.OperatingRoom = context.Request["OperatingRoom"];

                if (context.Request["Surgeon"] != null)
                    model_OPListForSpecimen.Surgeon = context.Request["Surgeon"];

                if (context.Request["InPatPreillness"] != null)
                    model_OPListForSpecimen.InPatPreillness = context.Request["InPatPreillness"];

                if (context.Request["InPatPastillness"] != null)
                    model_OPListForSpecimen.InPatPastillness = context.Request["InPatPastillness"];

                if (context.Request["InPatFamillness"] != null)
                    model_OPListForSpecimen.InPatFamillness = context.Request["InPatFamillness"];

                if (context.Request["LabInfo"] != null)
                    model_OPListForSpecimen.LabInfo = context.Request["LabInfo"];
                if (context.Request["DateOfAge"] != null)
                    model_OPListForSpecimen.DateOfAge = context.Request["DateOfAge"];
                #endregion
                //����ת��
                if (context.Request["ssType"] != null)
                    ssType = context.Request["ssType"];
                if (context.Request["pId"] != null)
                    ssName = context.Request["pId"];
                if (context.Request["ssType"] != null)
                    ssDecription = context.Request["ssType"] + "����";
                //����ƥ��
               BLL.ImpSampleSource imp = new BLL.ImpSampleSource();
               string result = imp.Import(model_OPListForSpecimen, ssType, ssName, ssDecription);
               context.Response.Write(result);
                //�����ύ
                //�������

            }
            catch (Exception exception)
            {
                rlt.success = false;
                rlt.msg = exception.Message;
            }
            //context.Response.Write(JSONHelper.Convert2Json(rlt));
        }
コード例 #51
0
ファイル: Round.cs プロジェクト: GaProgMan/RockPaperScissors
 /// <summary>
 /// Used to calculate the result of the current round - storing
 /// it in the local restul variable
 /// </summary>
 private void generateResult()
 {
     // Default value - not caught by the switch or if statements
      // as there are too many possible instances
      this._result = result.Draw;
      switch (_userMove)
      {
     case moves.Rock:
        if (_cpuMove == moves.Scissors || _cpuMove == moves.Lizard)
           this._result = result.Win;
        else if (_cpuMove == moves.Spock || _cpuMove == moves.Paper)
           this._result = result.Loss;
        break;
     case moves.Paper:
        if (_cpuMove == moves.Rock || _cpuMove == moves.Spock)
           this._result = result.Win;
        else if (_cpuMove == moves.Lizard || _cpuMove == moves.Scissors)
           this._result = result.Loss;
        break;
     case moves.Scissors:
        if (_cpuMove == moves.Paper || _cpuMove == moves.Lizard)
           this._result = result.Win;
        else if (_cpuMove == moves.Spock || _cpuMove == moves.Rock)
           this._result = result.Loss;
        break;
     case moves.Lizard:
        if (_cpuMove == moves.Paper || _cpuMove == moves.Spock)
           this._result = result.Win;
        else if (_cpuMove == moves.Scissors || _cpuMove == moves.Rock)
           this._result = result.Loss;
        break; ;
     case moves.Spock:
        if (_cpuMove == moves.Scissors || _cpuMove == moves.Rock)
           this._result = result.Win;
        else if (_cpuMove == moves.Paper || _cpuMove == moves.Lizard)
           this._result = result.Loss;
        break;
     default:
        this._result = result.Draw;
        break;
      }
 }