Beispiel #1
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tb_sellerid.Text))
            {
                MyOperation.MessageShow("请填写完整的书主号");
                tb_sellerid.Focus();
                return;
            }
            string sql = string.Format("SELECT s.sellinfoid AS `图书ID`,b.`name` AS `书名`,b.press AS `出版社`,s.price AS `售价`," +
                                       "s.issold AS `是否出售` FROM tt_sellinfo AS s , tt_bookinfo AS b WHERE s.bookid = b.id AND " +
                                       "s.sellerid = '{0}'", tb_sellerid.Text);
            DataTable dt    = dbo.Selectinfo(sql);
            int       count = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if ("0" == dt.Rows[i]["是否出售"].ToString())
                {
                    dt.Rows[i]["是否出售"] = "否";
                }
                else
                {
                    dt.Rows[i]["是否出售"] = "是";
                    count++;
                }
            }
            dataGrid.ItemsSource = dt.DefaultView;
            lb_info.Content      = string.Format("共寄售{0}本,已出售{1}本", dt.Rows.Count.ToString(), count.ToString());
        }
Beispiel #2
0
        private static async Task RawTest(bool hasSessionId, RegisterOptions registerOptions, CallOptions callOptions)
        {
            WampPlayground playground = new WampPlayground();

            CallerCallee dualChannel = await playground.GetCallerCalleeDualChannel();

            IWampChannel calleeChannel = dualChannel.CalleeChannel;
            IWampChannel callerChannel = dualChannel.CallerChannel;

            MyOperation myOperation = new MyOperation();

            await calleeChannel.RealmProxy.RpcCatalog.Register(myOperation, registerOptions);

            MyCallback myCallback = new MyCallback();

            callerChannel.RealmProxy.RpcCatalog.Invoke(myCallback, callOptions, myOperation.Procedure);

            long?expectedCaller = null;

            if (hasSessionId)
            {
                expectedCaller = dualChannel.CallerSessionId;
            }

            if (callOptions.DiscloseMe == false && registerOptions.DiscloseCaller == true)
            {
                Assert.That(myCallback.ErrorUri, Is.EqualTo(WampErrors.DiscloseMeNotAllowed));
            }
            else
            {
                Assert.That(myOperation.Details.Caller, Is.EqualTo(expectedCaller));
            }
        }
        public async Task ProgressiveCallsCalleeProxyProgress()
        {
            WampPlayground playground = new WampPlayground();

            CallerCallee dualChannel = await playground.GetCallerCalleeDualChannel();

            IWampChannel calleeChannel = dualChannel.CalleeChannel;
            IWampChannel callerChannel = dualChannel.CallerChannel;

            MyOperation myOperation = new MyOperation();

            await calleeChannel.RealmProxy.RpcCatalog.Register(myOperation, new RegisterOptions());

            ILongOpService proxy = callerChannel.RealmProxy.Services.GetCalleeProxyPortable <ILongOpService>();

            List <int>       results  = new List <int>();
            MyProgress <int> progress = new MyProgress <int>(i => results.Add(i));

            Task <int> result = proxy.LongOp(10, progress);

            result.Wait();

            CollectionAssert.AreEquivalent(Enumerable.Range(0, 10), results);

            Assert.That(result.Result, Is.EqualTo(10));
        }
        private void SearchSellerinfo()
        {
            if (string.IsNullOrEmpty(this.tb_selleridsearch.Text))
            {
                MyOperation.MessageShow("请输入查询的书主号");
                this.tb_selleridsearch.Focus();
                return;
            }

            string sql = string.Format("SELECT * FROM tt_sellerinfo WHERE sellerid = '{0}'", tb_selleridsearch.Text);

            DataTable dt = dbo.Selectinfo(sql);

            if (dt.Rows.Count != 1)
            {
                sellerid = "";
                MyOperation.MessageShow("查询失败,请检查书主号是否正确");
                this.tb_selleridsearch.Focus();
                return;
            }
            else
            {
                sellerid       = dt.Rows[0]["sellerid"].ToString();
                tb_jiebie.Text = dt.Rows[0]["grade"].ToString();
                tb_mark.Text   = dt.Rows[0]["mark"].ToString();
                tb_name.Text   = dt.Rows[0]["name"].ToString();
                tb_tel.Text    = dt.Rows[0]["phone"].ToString();
            }
        }
Beispiel #5
0
 public MyCondition(IMyVariableStorage <T> storage, MyOperation operation, string leftSideStorage, string rightSideStorage)
 {
     Debug.Assert(storage != null, "Variable storage must not be null.");
     m_storage          = storage;
     m_operation        = operation;
     m_leftSideStorage  = MyStringId.GetOrCompute(leftSideStorage);
     m_rightSideStorage = MyStringId.GetOrCompute(rightSideStorage);
 }
Beispiel #6
0
        public ClassDelegates(Mood moodType, string x)
        {
            name = x;

            if (moodType == Mood.HAPPY)
                chosenGreet = new MyOperation(HappyGreet); // or simply, chosenGreet = HappyGreet;
            else
                chosenGreet = AngryGreet;
        }
Beispiel #7
0
        //书主信息表
        private void button4_Click(object sender, RoutedEventArgs e)
        {
            string sql = "SELECT ts.sellerid AS `书主号`,ts.`name` AS `姓名`,ts.phone AS `手机`," +
                         "ts.grade AS `年级`,ts.mark AS `备注` FROM tt_sellerinfo AS ts";
            DataTable dt = dbo.Selectinfo(sql);

            MyOperation.DebugPrint("导出了全部书主信息");
            ExcelOperation.SendToExcel(dt, "书主信息表");
        }
Beispiel #8
0
 public MyCondition(IMyVariableStorage <T> storage, MyOperation operation, T leftSideValue, T rightSideValue)
 {
     // Debug.Assert(storage != null, "Variable storage must not be null."); // the storage can be null here
     m_storage          = storage;
     m_operation        = operation;
     m_leftSideStorage  = MyStringId.NullOrEmpty;
     m_rightSideStorage = MyStringId.NullOrEmpty;
     m_leftSideValue    = leftSideValue;
     m_rightSideValue   = rightSideValue;
 }
Beispiel #9
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(textBox2.Text))
            {
                MyOperation.MessageShow("请输入要查询的书主ID");
                textBox2.Focus();
                return;
            }

            displayye(textBox2.Text);
        }
Beispiel #10
0
        //导出全部员工信息
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            string sql = "SELECT ts.staffid AS `员工号`,ts.`name` AS `姓名`,ts.email AS `邮箱`,ts.phone AS `手机`," +
                         "ts.role AS `角色`,ts.mark AS `备注` FROM tt_staffinfo AS ts";
            DataTable dt = dbo.Selectinfo(sql);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["角色"] = ("admin" == dt.Rows[i]["角色"].ToString()) ? "管理员" : "员工";
            }
            MyOperation.DebugPrint("导出了全部员工信息");
            ExcelOperation.SendToExcel(dt, "员工信息表");
        }
Beispiel #11
0
        private async Task Register(IWampChannel channel, string procedure, string match, Action <MyOperation, InvocationDetails> action)
        {
            MyOperation operation = new MyOperation(action, procedure);

            Task <IAsyncDisposable> task =
                channel.RealmProxy.RpcCatalog.Register(operation,
                                                       new RegisterOptions()
            {
                Match = match
            });

            await task;
        }
Beispiel #12
0
        private void search_book()
        {
            lbb_author.Content = lbb_ISBN.Content = lbb_name.Content = lbb_press.Content = lbb_price.Content = "";
            if (string.IsNullOrEmpty(tb_isbn.Text))
            {
                MyOperation.MessageShow("请输入图书的ISBN号");
                tb_isbn.Focus();
                return;
            }

            string    sql = string.Format("SELECT * FROM tt_bookinfo WHERE isbn LIKE '%{0}%'", tb_isbn.Text);
            DataTable dt  = dbo.Selectinfo(sql);

            //修改为只看第一个符合ISBN号的图书,这样可以规避ISBN号重复的问题
            if (dt.Rows.Count >= 1)
            {
                bookinfo boi = new bookinfo();
                boi.bookid    = dt.Rows[0]["id"].ToString();
                boi.author    = dt.Rows[0]["author"].ToString();
                boi.isbn      = dt.Rows[0]["isbn"].ToString();
                boi.name      = dt.Rows[0]["name"].ToString();
                boi.press     = dt.Rows[0]["press"].ToString();
                boi.price     = dt.Rows[0]["price"].ToString();
                boi.imgpath   = dt.Rows[0]["imgpath"].ToString();
                tb_price.Text = (MyOperation.string2float(dt.Rows[0]["price"].ToString()) * 0.3).ToString("0.0");
                DisplayBookinfo(boi);
                return;
            }
            //else if (dt.Rows.Count > 1)
            //{
            //    MyOperation.MessageShow("存在2本以上相同ISBN号的图书,请确认ISBN号或者联系系统管理员");
            //    tb_isbn.Focus();
            //    return;
            //}
            else
            {
                string   url  = string.Format("http://api.jige.olege.com/book?q={0}&type=ISBN", tb_isbn.Text);
                string   html = GetHtml(url);
                bookinfo bi;
                if (PraseHtml(html, out bi))
                {
                    bi.bookid = InsertNewBookInfo(bi);
                    if ("" == bi.bookid)
                    {
                        return;
                    }
                    DisplayBookinfo(bi);
                }
            }
        }
Beispiel #13
0
        //可以刷新当前实时余额以及出售数量
        private string get_money2()
        {
            string    sql       = "SELECT date,money FROM tt_fanance ORDER BY date DESC LIMIT 0,1";
            DataTable dt        = dbo.Selectinfo(sql);
            float     count_old = 0;
            string    datetime  = "";

            if (dt.Rows.Count == 1)
            {
                count_old = float.Parse(dt.Rows[0]["money"].ToString());
                datetime  = dt.Rows[0]["date"].ToString();
            }
            else
            {
                datetime = "2000/1/1 00:00:00";
            }
            float count1 = 0;

            //计算该班次出售的数量
            sql = string.Format("SELECT count(*) FROM tt_sellinfo WHERE issold = '1' AND soldtime > '{0}'  GROUP BY NULL", datetime);
            dt  = dbo.Selectinfo(sql);
            if (dt.Rows.Count == 1)
            {
                lb_thiscount.Content = dt.Rows[0][0].ToString();
            }
            else
            {
                lb_thiscount.Content = "数量异常";
            }
            //先计算出售信息
            sql = string.Format("SELECT SUM(price) FROM tt_sellinfo WHERE issold = '1' AND soldtime > '{0}'  GROUP BY NULL", datetime);
            dt  = dbo.Selectinfo(sql);
            if (dt.Rows.Count == 1)
            {
                count1 = float.Parse(dt.Rows[0][0].ToString());
            }

            float count2 = 0;

            //再计算提款信息
            sql = string.Format("SELECT SUM(count) FROM tt_tikuan WHERE date > '{0}'  GROUP BY NULL", datetime);
            dt  = dbo.Selectinfo(sql);
            if (dt.Rows.Count == 1)
            {
                count2 = float.Parse(dt.Rows[0][0].ToString());
            }
            MyOperation.DebugPrint("前日剩余:" + count_old.ToString() + "今日收入:" + count1.ToString() + "今日支出:" + count2.ToString());
            return((count_old + count1 - count2).ToString());
        }
Beispiel #14
0
        private void button7_Click(object sender, RoutedEventArgs e)
        {
            if (null == datePicker5.SelectedDate || null == datePicker6.SelectedDate)
            {
                MyOperation.MessageShow("请选择开始和结束日期");
                return;
            }

            string sql = string.Format("SELECT tt_fanance.money AS `余额`, tt_fanance.date AS `结算时间` FROM tt_fanance " +
                                       "WHERE date > '{0}' AND date < '{1}'", datePicker5.SelectedDate, datePicker6.SelectedDate);
            DataTable dt = dbo.Selectinfo(sql);

            MyOperation.DebugPrint("导出了现金流向信息");
            ExcelOperation.SendToExcel(dt, "现金详情表");
        }
 private void tb_sellidsearch_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.Key == Key.Enter)
         {
             SearchSellinfo();
             e.Handled = true;
         }
     }
     catch (Exception e1)
     {
         MyOperation.DebugPrint(e1.Message);
     }
 }
 private void tb_price_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.Key == Key.Enter)
         {
             ChangePrice();
             e.Handled = true;
         }
     }
     catch (Exception e1)
     {
         MyOperation.DebugPrint(e1.Message);
     }
 }
Beispiel #17
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tb1.Text))
            {
                MyOperation.MessageShow("请输入书主号");
                tb1.Focus();
                return;
            }
            string sql = string.Format("SELECT ts.`name` AS `姓名`,tt.count AS `数额`,tt.date AS `提款时间` " +
                                       "FROM tt_tikuan AS tt ,tt_sellerinfo AS ts WHERE tt.sellerid = ts.sellerid AND ts.sellerid = '{0}'", tb1.Text);
            DataTable dt = dbo.Selectinfo(sql);

            MyOperation.DebugPrint("导出了取现信息:" + tb1.Text);
            ExcelOperation.SendToExcel(dt, string.Format("书主【{0}】取现详情表", tb1.Text));
        }
Beispiel #18
0
 private void tb_isbn_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.Key == Key.Enter)
         {
             search_book();
             e.Handled = true;
         }
     }
     catch (Exception e1)
     {
         MyOperation.MessageShow(e1.Message);
     }
 }
Beispiel #19
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(this.textBox1.Text))
            {
                MyOperation.MessageShow("请输入查询的书主信息");
                this.textBox1.Focus();
                return;
            }

            string sql = string.Format("SELECT * FROM tt_sellerinfo WHERE phone LIKE '%{0}%'", textBox1.Text);

            DataTable dt = dbo.Selectinfo(sql);

            dataGrid.ItemsSource = dt.DefaultView;
        }
Beispiel #20
0
        //按时间导出取现信息
        private void button5_Click(object sender, RoutedEventArgs e)
        {
            if (null == datePicker1.SelectedDate || null == datePicker2.SelectedDate)
            {
                MyOperation.MessageShow("请选择开始和结束日期");
                return;
            }

            string sql = string.Format("SELECT ts.`name` AS `姓名`,tt.count AS `数额`,tt.date AS `提款时间` FROM tt_tikuan AS tt ," +
                                       "tt_sellerinfo AS ts WHERE tt.sellerid = ts.sellerid AND tt.date > '{0}' AND tt.date < '{1}'", datePicker1.SelectedDate, datePicker2.SelectedDate);
            DataTable dt = dbo.Selectinfo(sql);

            MyOperation.DebugPrint("导出了取现信息");
            ExcelOperation.SendToExcel(dt, "取现详情表");
        }
Beispiel #21
0
            public void ThreadProc()
            {
                DBOperation dbo = new DBOperation();
                YouGeWebApi ygw = new YouGeWebApi();

                if (string.IsNullOrEmpty(_book_id))
                {
                    throw new Exception("book_id is null!");
                }
                if (string.IsNullOrEmpty(_price))
                {
                    throw new Exception("price is null!");
                }
                //判断本地是否有相同book_id和price的交易记录,如果有就全部同步成一个mallid,不要再上报给喵校园主库
                string sql = string.Format("SELECT tt_bookinfo.id,tt_sellinfo.mallid FROM tt_bookinfo ,tt_sellinfo WHERE tt_bookinfo.id " +
                                           "= tt_sellinfo.bookid AND tt_bookinfo.gbookid ='{0}' AND ABS(tt_sellinfo.price- {1}) < 1e-5  AND tt_sellinfo.mallid IS NOT NULL",
                                           _book_id, _price);
                DataTable dt = dbo.Selectinfo(sql);

                //如果有,则直接全部更新一次mallid,不用上报给喵校园主库
                if (dt.Rows.Count > 0)
                {
                    sql = string.Format("UPDATE tt_sellinfo SET mallid = '{0}' WHERE bookid = '{1}' AND ABS(price- {2}) < 1e-5",
                                        dt.Rows[0]["mallid"].ToString(), dt.Rows[0]["id"].ToString(), _price);
                    dbo.AddDelUpdate(sql);
                    return;
                }
                //如果没有,则添加到喵校园主库,返回交易ID后,同步到每一条符合条件的交易中
                string sellinfoid;//喵校园交易ID
                IDictionary <string, string> parameters = new Dictionary <string, string>();

                parameters.Add("book_id", _book_id);
                parameters.Add("price", _price);
                parameters.Add("seller_id", Properties.Settings.Default.sellerid);
                if (ygw.InsertNewSellInfo(parameters, out sellinfoid))
                {
                    sql = string.Format("UPDATE tt_sellinfo SET mallid = '{0}' WHERE bookid = '{1}' AND ABS(price- {2}) < 1e-5",
                                        sellinfoid, _local_book_id, _price);
                    dbo.AddDelUpdate(sql);
                    MessageBox.Show("执行完成");
                    return;
                }
                else
                {
                    MyOperation.DebugPrint("Insert Error!", 3);
                    throw new Exception("Insert Error!");
                }
            }
Beispiel #22
0
        private void DisplayBookinfo(bookinfo bi)
        {
            if (null == bi)
            {
                return;
            }
            try
            {
                lbb_bookid.Content = "内部编号:" + bi.bookid;
                lbb_author.Content = "作者:" + bi.author;
                lbb_ISBN.Content   = "ISBN:" + bi.isbn;
                lbb_name.Content   = "书名:" + bi.name;
                lbb_press.Content  = "出版社:" + bi.press;
                lbb_price.Content  = "定价:" + bi.price;
                //====================标准image source添加方法=====================
                // Create source
                BitmapImage myBitmapImage = new BitmapImage();

                // BitmapImage.UriSource must be in a BeginInit/EndInit block
                myBitmapImage.BeginInit();
                myBitmapImage.UriSource = new Uri(@bi.imgpath, UriKind.Absolute);

                // To save significant application memory, set the DecodePixelWidth or
                // DecodePixelHeight of the BitmapImage value of the image source to the desired
                // height or width of the rendered image. If you don't do this, the application will
                // cache the image as though it were rendered as its normal size rather then just
                // the size that is displayed.
                // Note: In order to preserve aspect ratio, set DecodePixelWidth
                // or DecodePixelHeight but not both.
                myBitmapImage.DecodePixelWidth = 250;
                myBitmapImage.EndInit();
                //set image source
                bookimage.Source = myBitmapImage;
                DisplayAll(1);
            }
            catch (UriFormatException e)
            {
                MyOperation.DebugPrint("DisplayBookinfo未能解析URL:" + e.Message, 1);
                bookimage.Source = new BitmapImage(new Uri(@"/images/defaultbookimg.jpg", UriKind.RelativeOrAbsolute));
                DisplayAll(1);
            }
            catch (Exception e)
            {
                MyOperation.DebugPrint("DisplayBookinfo出现catch异常:" + e.Message, 3);
                DisplayAll(2);
                MyOperation.MessageShow("系统异常,请联系管理员处理");
            }
        }
Beispiel #23
0
 private void UserControl_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.Key == Key.F5)
         {
             Display();
             e.Handled = true;
         }
     }
     catch (Exception e1)
     {
         MyOperation.DebugPrint("结账下班界面刷新时出现了异常" + e1.Message);
         MyOperation.MessageShow("结账下班界面刷新时出现了异常" + e1.Message);
     }
 }
Beispiel #24
0
        private void button8_Click(object sender, RoutedEventArgs e)
        {
            if (null == datePicker7.SelectedDate || null == datePicker8.SelectedDate)
            {
                MyOperation.MessageShow("请选择开始和结束日期");
                return;
            }

            string sql = string.Format("SELECT ts.`name` AS `姓名`,tt.time AS `时长`,tt.group AS `班次`,tt.date AS `签到时间`," +
                                       "tt.mark AS `备注` FROM tt_time AS tt ,tt_staffinfo AS ts WHERE ts.staffid = tt.staffid AND tt.date > '{0}' AND " +
                                       "tt.date < '{1}'", datePicker7.SelectedDate, datePicker8.SelectedDate);
            DataTable dt = dbo.Selectinfo(sql);

            MyOperation.DebugPrint("导出了工时信息");
            ExcelOperation.SendToExcel(dt, "工时详情表");
        }
Beispiel #25
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tb_sellerid.Text) || tb_sellerid.Text.Length != 8)
            {
                MyOperation.MessageShow("请填写正确的书主号,长度8位");
                tb_sellerid.Focus();
                return;
            }
            else
            {
                string    sqls = string.Format("SELECT * FROM tt_sellerinfo WHERE sellerid = '{0}'", tb_sellerid.Text);
                DataTable dt   = dbo.Selectinfo(sqls);
                if (dt.Rows.Count > 0)
                {
                    MyOperation.MessageShow("该书主号已经存在");
                    tb_sellerid.Focus();
                    return;
                }
            }

            if (string.IsNullOrEmpty(tb_name.Text))
            {
                MyOperation.MessageShow("请填写完整的姓名");
                tb_name.Focus();
                return;
            }

            if (string.IsNullOrEmpty(tb_phone.Text))
            {
                MyOperation.MessageShow("请填写完整的手机");
                tb_phone.Focus();
                return;
            }

            string sql = string.Format("INSERT INTO tt_sellerinfo (id,sellerid,name,phone,grade,mark) VALUES (null,'{0}','{1}','{2}','{3}','{4}')",
                                       tb_sellerid.Text, tb_name.Text, tb_phone.Text, tb_grade.Text, tb_mark.Text);

            if (dbo.AddDelUpdate(sql) == 1)
            {
                MyOperation.MessageShow("添加成功");
                tb_sellerid.Text = tb_name.Text = tb_phone.Text = tb_mark.Text = tb_grade.Text = "";
            }
            else
            {
                MyOperation.MessageShow("添加失败,请重试");
            }
        }
Beispiel #26
0
        private void ModifyScene(UIApplication uiapp, String text, MyOperation operation)
        {
            uidoc = uiapp.ActiveUIDocument;

            if (uidoc != null)
            {
                using (Transaction trans = new Transaction(uidoc.Document))
                {
                    if (trans.Start(text) == TransactionStatus.Started)
                    {
                        operation(1);

                        trans.Commit();
                    }
                }
            }
        }
Beispiel #27
0
        //出售信息详情表
        private void button6_Click(object sender, RoutedEventArgs e)
        {
            if (null == datePicker3.SelectedDate || null == datePicker4.SelectedDate)
            {
                MyOperation.MessageShow("请选择开始和结束日期");
                return;
            }

            string sql = string.Format("SELECT tb.`name` AS `书名`,tb.press AS `出版社`,ts.sellinfoid AS `图书ID`,ts.price " +
                                       "AS `售价`,tsr.sellerid AS `书主ID`,tsr.`name` AS `书主`,ts.soldtime AS `出售时间` FROM tt_sellinfo AS ts ," +
                                       "tt_bookinfo AS tb ,tt_sellerinfo AS tsr WHERE ts.sellerid = tsr.sellerid AND ts.bookid = tb.id AND ts.soldtime" +
                                       " > '{0}' AND ts.soldtime < '{1}'", datePicker3.SelectedDate, datePicker4.SelectedDate);
            DataTable dt = dbo.Selectinfo(sql);

            MyOperation.DebugPrint("导出了出售信息");
            ExcelOperation.SendToExcel(dt, "出售详情表");
        }
Beispiel #28
0
        public async Task ProgressiveCallsCalleeProxyObservableError()
        {
            WampPlayground playground = new WampPlayground();

            CallerCallee dualChannel = await playground.GetCallerCalleeDualChannel();

            IWampChannel calleeChannel = dualChannel.CalleeChannel;
            IWampChannel callerChannel = dualChannel.CallerChannel;

            MyOperation myOperation = new MyOperation();

            await calleeChannel.RealmProxy.RpcCatalog.Register(myOperation, new RegisterOptions());

            ILongOpObsService proxy = callerChannel.RealmProxy.Services.GetCalleeProxy <ILongOpObsService>();

            Assert.Throws(typeof(WampException), () => proxy.LongOp(9, true).ToEnumerable().Count());
        }
Beispiel #29
0
        public async Task ProgressiveCallsCalleeProxyObservable()
        {
            WampPlayground playground = new WampPlayground();

            CallerCallee dualChannel = await playground.GetCallerCalleeDualChannel();

            IWampChannel calleeChannel = dualChannel.CalleeChannel;
            IWampChannel callerChannel = dualChannel.CallerChannel;

            MyOperation myOperation = new MyOperation();

            await calleeChannel.RealmProxy.RpcCatalog.Register(myOperation, new RegisterOptions());

            ILongOpObsService proxy = callerChannel.RealmProxy.Services.GetCalleeProxy <ILongOpObsService>();

            IEnumerable <int> results = proxy.LongOp(9, false).ToEnumerable(); // it will emit one more than asked

            CollectionAssert.AreEquivalent(Enumerable.Range(0, 10), results);
        }
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tb_name.Text))
            {
                MyOperation.MessageShow("没有输入内容");
                this.tb_name.Focus();
                return;
            }
            string sql = string.Format("UPDATE tt_sellerinfo SET `name` = '{0}' WHERE `sellerid` = '{1}'", tb_name.Text, sellerid);

            if (1 == dbo.AddDelUpdate(sql))
            {
                MyOperation.MessageShow("修改成功!");
            }
            else
            {
                MyOperation.MessageShow("修改失败!");
            }
        }
Beispiel #31
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tb1.Text))
            {
                MyOperation.MessageShow("请输入书主号");
                tb1.Focus();
                return;
            }
            string sql = string.Format("SELECT s.sellinfoid AS `图书ID`,b.`name` AS `书名`,b.press AS `出版社`,s.price AS `售价`," +
                                       "s.issold AS `是否已售` FROM tt_sellinfo AS s , tt_bookinfo AS b WHERE s.bookid = b.id AND " +
                                       "s.sellerid = '{0}'", tb1.Text);
            DataTable dt = dbo.Selectinfo(sql);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["是否已售"] = ("0" == dt.Rows[i]["是否已售"].ToString()) ? "否" : "是";
            }
            MyOperation.DebugPrint("导出了书主信息:" + tb1.Text);
            ExcelOperation.SendToExcel(dt, string.Format("书主【{0}】交易详情表", tb1.Text));
        }
Beispiel #32
0
 private double getResult(double AnumbleA, double AnumbleB, string Aopt, MyOperation Aoper)
 {
     Aoper = OperationFactory.createOperate(Aopt);
     Aoper.NumberA = AnumbleA;
     Aoper.NumberB = AnumbleB;
     return Aoper.GetResult(); ;
 }