private void OnListLoaded(Model.List list)
        {
            // Load the actual data context!
            List = list;

            if (_list != null && _list.ListItems != null)
            {
                foreach (var item in _list.ListItems)
                {
                    if (item.Id == _listItemId)
                    {
                        Item = item;

                        if (item.Tip != null && item.Tip.TipId != null)
                        {
                            Listed = DataManager.Current.Load <Model.TipListedLists>(item.Tip.TipId, OnListedLoaded, OnListedFailed);
                        }
                        else
                        {
                            Listed = null;
                        }

                        break;
                    }
                }
            }

            UpdateAppBar();
        }
示例#2
0
 /// <summary>
 /// 終了処理
 /// </summary>
 public void Dispose()
 {
     if (_Model != null)
     {
         _Model.Dispose();
         _Model = null;
     }
 }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            string id;
            if (NavigationContext.QueryString.TryGetValue("id", out id))
            {
                _id = id;
                _list = DataManager.Current.Load<Model.List>(
                    new Model.ListLoadContext(id),
                    OnListLoaded,
                    OnListLoadFailed);
                DataContext = _list;
            }
        }
示例#4
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            string id;

            if (NavigationContext.QueryString.TryGetValue("id", out id))
            {
                _id   = id;
                _list = DataManager.Current.Load <Model.List>(
                    new Model.ListLoadContext(id),
                    OnListLoaded,
                    OnListLoadFailed);
                DataContext = _list;
            }
        }
        public static BaseHelper ComboDepartment(Model.List data)
        {
            var retVal      = new BaseHelper();
            var objJSONPage = new Output.Combo();

            try
            {
                var entityPage = Combo.ComboDepartmentName(data, objJSONPage);
                if (objJSONPage.ResultCode == 1)
                {
                    retVal.SQLElapsed += entityPage.SQLElapsed;
                    retVal.SQLInfo($"sp : {entityPage.SQLDetail}, elapsed : {entityPage.SQLElapsed}");

                    retVal.IsError = (entityPage.ResultCode == 1) ? false : true;
                }
                else
                {
                    objJSONPage.ResultCode   = objJSONPage.ResultCode;
                    objJSONPage.ErrorMessage = objJSONPage.ErrorMessage;
                }
            }
            catch (Exception ex)
            {
                retVal.Exception = ex;

                if (ex is System.Data.SqlClient.SqlException sqlEx)
                {
                    retVal.SQLInfo($"sp:{sqlEx.Procedure}, line:{sqlEx.LineNumber}, detail:{data.SqlDetail}");
                    retVal.SQLException = true;

                    objJSONPage.ResultCode   = 69998;
                    objJSONPage.ErrorMessage = "SQL Exception";
                }
                else
                {
                    objJSONPage.ResultCode   = 69999;
                    objJSONPage.ErrorMessage = "Unknown Error";
                }
            }
            finally
            {
                retVal.SerializeObject <Output.Combo>(objJSONPage);
            }

            return(retVal);
        }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string deskno = txtDeskNo.Text;

            if (currentDeskno == deskno)
            {
                MessageBox.Show("已经开单,请勿重复开单");
            }
            currentDeskno = deskno;

            // this.txtDeskNo.Text = deskno;
            int    num    = Convert.ToInt32(txtNum.Text);
            string remark = txtRemark.Text;

            // decimal price = Convert.ToDecimal(this.txtPrice.Text);
            // string status = this.cboStatus.Text;
            Model.List list = new Model.List();
            list.deskno   = deskno;
            currentDeskno = deskno;
            list.num      = num;
            list.remark   = remark;
            // menu.price = price;
            int us = new ListManager().insertList(list);

            if (us > 0)
            {
                // MessageBox.Show("1");
                // Menu_Load(null, null);
                // MenuMain menuMain = new MenuMain();
                // MenuMain_Load
                // MenuMain_Load(null, null);
            }

            int result = new ListManager().updatedesk(deskno);

            if (result > 0)
            {
                MessageBox.Show("开单成功");
            }
            Close();
            Dispose();
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            string id;

            if (NavigationContext.QueryString.TryGetValue("id", out id))
            {
                _listItemId = id;

                if (NavigationContext.QueryString.TryGetValue("list", out id))
                {
                    _listId = id;

                    _itemType = "listitem";

                    // won't IPNC since it's a direct field set. is that OK?
                    _list = DataManager.Current.Load <Model.List>(
                        new Model.ListLoadContext(_listId),
                        OnListLoaded,
                        OnListLoadFailed);
                }
                else
                {
                    string tipId;
                    if (NavigationContext.QueryString.TryGetValue("tipId", out tipId))
                    {
                        _itemType = "tip";
                        var tip = DataManager.Current.Load <Model.DetailedTip>(
                            new LoadContext(tipId),
                            OnTipLoaded,
                            OnTipLoadFailed);
                    }
                }

                DataContext = this;
            }
        }
示例#8
0
        public static BasicEntity ComboDataBook(Model.List data, Output.ComboDataBook obj)
        {
            var retVal = new BasicEntity();

            data.SqlDetail = retVal.SQLCommandBuilder("spComboDataBook");

            using (SqlDataReader reader = retVal.ExecReader())
            {
                while (reader.Read())
                {
                    obj.ResultCode    = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0);
                    obj.ErrorMessage  = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1);
                    retVal.ResultCode = obj.ResultCode;
                }

                if (retVal.ResultCode == 1)
                {
                    reader.NextResult();
                    while (reader.Read())
                    {
                        var item = new Output.ComboDataBookData();

                        item.ID       = (reader.IsDBNull(0)) ? 0 : reader.GetInt32(0);
                        item.Title    = (reader.IsDBNull(1)) ? string.Empty : reader.GetString(1);
                        item.Price    = (reader.IsDBNull(2)) ? string.Empty : reader.GetString(2);
                        item.Borrowed = (reader.IsDBNull(3)) ? string.Empty : reader.GetString(3);

                        obj.Content.Data.Add(item);
                    }
                }

                reader.Close();
            }

            retVal.Close();

            return(retVal);
        }
示例#9
0
 /// <summary>
 /// 一覧表示.ViewModel
 /// </summary>
 public List()
 {
     _Model = new Model.List();
 }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            string id;
            if (NavigationContext.QueryString.TryGetValue("id", out id))
            {
                _listItemId = id;

                if (NavigationContext.QueryString.TryGetValue("list", out id))
                {
                    _listId = id;

                    _itemType = "listitem";

                    // won't IPNC since it's a direct field set. is that OK?
                    _list = DataManager.Current.Load<Model.List>(
                        new Model.ListLoadContext(_listId),
                        OnListLoaded,
                        OnListLoadFailed);
                }
                else
                {
                    string tipId;
                    if (NavigationContext.QueryString.TryGetValue("tipId", out tipId))
                    {
                        _itemType = "tip";
                        var tip = DataManager.Current.Load<Model.DetailedTip>(
                            new LoadContext(tipId),
                            OnTipLoaded,
                            OnTipLoadFailed);
                    }
                }

                DataContext = this;
            }
        }
示例#11
0
 private void OnListLoaded(Model.List list)
 {
     UpdateAppBar();
 }
        public Model.List Get(int listId)
        {
            Model.List list = null;
            var sql = @"
                SELECT ListId, ListName, OrderId 
                FROM cf.List 
                WHERE ListId = @ListId 
                    AND FamilyId = @FamilyId 
                ORDER BY OrderId";

            using (var conn = GetConnection())
            {
                conn.Open();

                using (var cmd = new SqlCommand(sql, conn))
                {
                    cmd.Parameters.AddWithValue("@ListId", listId);
                    cmd.Parameters.AddWithValue("@FamilyId", _familyId);
                    using (var rdr = cmd.ExecuteReader())
                    {
                        while (rdr.Read())
                        {
                            list = new Model.List
                            {
                                ListId = (int)rdr["ListId"],
                                ListName = (string)rdr["ListName"],
                                OrderId = (int)rdr["OrderId"],
                                Items = new List<Model.ListItem>()
                            };
                        }
                    }
                }

                using (var cmd = new SqlCommand("SELECT ListItemId, ListId, ItemName, OrderId, Checked, RecipeId FROM cf.ListItem WHERE ListId = @ListId ORDER BY OrderId", conn))
                {
                    cmd.Parameters.AddWithValue("@ListId", listId);

                    using (var rdr = cmd.ExecuteReader())
                    {
                        while (rdr.Read())
                        {
                            list.Items.Add(new Model.ListItem
                            {
                                ListItemId = (int)rdr["ListItemId"],
                                ListId = (int)rdr["ListId"],
                                ItemName = (string)rdr["ItemName"],
                                OrderId = (int)rdr["OrderId"],
                                Checked = (bool)rdr["Checked"],
                                RecipeId = (int)rdr["RecipeId"],
                            });
                        }
                    }
                }

                conn.Close();
            }

            return list;
        }