Example #1
0
        public rest AddRest()
        {
            var theRest = new rest();

            this.Items            = ArrayExtensions.ArrayAppend(this.Items, theRest);
            this.ItemsElementName = ArrayExtensions.ArrayAppend(this.ItemsElementName, ItemsChoiceType1.rest);
            return(theRest);
        }
Example #2
0
        public ActionResult Acceptrest(int?id)
        {
            rest a = db.Rests.Find(id);

            a.isCommited = true;
            db.SaveChanges();

            return(View());
        }
Example #3
0
        static string GetRemoteDocument(string address)
        {
            string message = "";
            rest   rc      = new rest();
            string user    = ConfigurationManager.AppSettings["user"].ToString();
            string pwd     = ConfigurationManager.AppSettings["pwd"].ToString();

            byte[] b = rc.getFile(new Uri(address), user, pwd, ref message);
            if (message.Length > 0)
            {
                throw new System.Exception(message);
            }
            return(Encoding.UTF8.GetString(b));
        }
Example #4
0
        private static string getrealprofile(int id)
        {
            string message = "";
            rest   rc      = new rest();
            string user    = ConfigurationManager.AppSettings["user"].ToString();
            string pwd     = ConfigurationManager.AppSettings["pwd"].ToString();
            string address = ConfigurationManager.AppSettings["nav2real"].ToString();

            address = string.Format("{0}{1}", address, id);
            byte[] b = rc.getFile(new Uri(address), user, pwd, ref message);
            if (message.Length > 0)
            {
                throw new System.Exception(message);
            }
            return(Encoding.UTF8.GetString(b));
        }
Example #5
0
        public static Restaurant restToRestaurant(rest rest, Restaurant restaurant)
        {
            StringBuilder address = new StringBuilder();

            if (rest != null)
            {
                restaurant.Name = rest.Name;
                address.Append(rest.s1);
                address.Append(rest.s2);
                address.Append(rest.City);
                address.Append(rest.State);
                address.Append(rest.Country);
                address.Append(rest.Zipcode);
                restaurant.Address = address.ToString();
                restaurant.Phone   = rest.Phone;
                return(restaurant);
            }
            else
            {
                return(null);
            }
        }
Example #6
0
        public ActionResult RestEntry(rest rest)
        {
            var currentuserid = User.Identity.GetUserId();

            return(View());
        }
 public IEnumerable <MyReturnedObject> GetThoseObjects(Delegate ToCallWenDone, rest of parameters)
 {
     //get the data
     //invoke the delegate
 }
Example #8
0
        public static Boolean setConfig(rest.Config config, rest.Operation operation)
        {
            logger.Info("setConfig {...}");
            Boolean rtn = false;
            if (Monitor.TryEnter(SubmitPriceJob.lockObj, 500))
            {
                //if (operation.startTime > SubmitPriceJob.startTime)
                if(operation.updateTime > SubmitPriceJob.lastUpdate)//确保同一个版本(修改)的Operation只被配置并执行一次,避免多次执行
                {
                    SubmitPriceJob.lastUpdate = operation.updateTime;
                    SubmitPriceJob.executeCount = 0;

                    SubmitPriceJob.deltaPrice = ((rest.BidOperation)operation).price;
                    SubmitPriceJob.startTime = operation.startTime;
                    SubmitPriceJob.expireTime = operation.expireTime;

                    logger.DebugFormat("PRICE:{0}", ((rest.BidOperation)operation).price);
                    logger.DebugFormat("startTime:{0}", operation.startTime);
                    logger.DebugFormat("expireTime:{0}", operation.expireTime);

                    Bid bid = Newtonsoft.Json.JsonConvert.DeserializeObject<Bid>(operation.content);
                    SubmitPriceJob.operation = bid;
                    rtn = true;
                }
                Monitor.Exit(SubmitPriceJob.lockObj);
            }
            else
            {
                logger.Error("obtain SubmitPriceJob.lockObj timeout on setConfig(...)");
            }
            return rtn;
        }
Example #9
0
        private void receiveOperation(rest.Operation operation)
        {
            try
            {
                //ShowInfoJob showInfo = new ShowInfoJob("MESSAGE!");
                //System.Threading.ThreadStart myThreadDelegate = new System.Threading.ThreadStart(showInfo.Execute);
                //System.Threading.Thread myThread = new System.Threading.Thread(myThreadDelegate);
                //myThread.Start();
            }
            catch
            {
            }

            if (null != operation)
            {
                rest.BidOperation bidOps = (rest.BidOperation)operation;
                Bid bid = Newtonsoft.Json.JsonConvert.DeserializeObject<Bid>(operation.content);
                this.positionDialog.bid = bid;
                this.label3.Text = String.Format("配置:+{5} @[{4}], 价格[{0},{1}], 校验码[{2},{3}]", bid.give.price.x, bid.give.price.y, bid.submit.captcha[0].x, bid.submit.captcha[0].y, operation.startTime, bidOps.price);
            }
        }