void allClear() { købeliste.Items.Clear(); Sum.Content = ""; aSum.Content = ""; SumPris.Clear(); Usernamebox.Clear(); Password.Clear(); VareNR.Text = ""; aPassword.Clear(); Penge.Text = ""; Manual_Price.Clear(); GiftCard.Clear(); vareListe.Items.Clear(); CSide(); }
private void InitGiftCard() { GiftCard.Clear(); DataTable GiftCards = GiftCardModel.advanceSearchGiftCardByMultiCondition(this._txtKeySearch, paging.StringLimit, this._txtSortBy); if (GiftCards.Rows.Count == 0 && paging.CurrentPage > 1) { paging.CurrentPage = paging.CurrentPage - 1; GiftCards = GiftCardModel.advanceSearchGiftCardByMultiCondition(this._txtKeySearch, paging.StringLimit, this._txtSortBy); ShowCurPage = paging.CurrentPage; } if (GiftCards.Rows.Count > 0) { var i = 1; foreach (DataRow dr in GiftCards.Rows) { DateTime dt = UnixTimeToDateTime(Convert.ToInt32(dr["CreateDate"])); DateTime _expreTime = UnixTimeToDateTime(Convert.ToInt32(dr["ExpirationDate"].ToString())); string _giftCardImg = GiftCardModel.GiftCardImgPath + dr["Barcode"].ToString() + ".png"; string _deliverDate = string.Empty; if (Convert.ToInt32(dr["DeliveredDate"].ToString()) > 0) { DateTime _isDelivered = UnixTimeToDateTime(Convert.ToInt32(dr["DeliveredDate"].ToString())); _deliverDate = _isDelivered.ToString(StaticClass.GeneralClass.dateFromatSettings[StaticClass.GeneralClass.app_settings["dateFormat"]].ToString() + _orderTime); } GiftCard.Add(new GiftCardModel { No = i, GiftCardID = Convert.ToInt32(dr["GiftCardID"].ToString()), Barcode = dr["Barcode"].ToString(), Serial = dr["Serial"].ToString(), CreateDate = dt.ToString(StaticClass.GeneralClass.dateFromatSettings[StaticClass.GeneralClass.app_settings["dateFormat"]].ToString() + _orderTime), ExpirationDate = _expreTime.ToString(StaticClass.GeneralClass.dateFromatSettings[StaticClass.GeneralClass.app_settings["dateFormat"]].ToString() + _orderTime), CustomerIDUse = Convert.ToInt32(dr["CustomerIDUse"].ToString()), Amount = Convert.ToDouble(dr["Amount"].ToString()), Balance = Convert.ToDouble(dr["Balance"].ToString()), IsChecked = false, CustomerName = string.IsNullOrEmpty(dr["FullName"].ToString())?"None": dr["FullName"].ToString(), DeliveredDate = _deliverDate }); i++; } } if (GiftCards.Rows.Count == 0 || (paging.CurrentPage == 1 && paging.MaxPage == 1)) { ShowNextPage = false; ShowLastPage = false; ShowFirstPage = false; ShowPrevPage = false; IsPaging = "Hidden"; /*if (GiftCards.Rows.Count == 0) * { * ModernDialog md = new ModernDialog(); * md.CloseButton.FindResource("close").ToString(); * md.Content = App.Current.FindResource("cannot_found_data").ToString(); * md.Title = App.Current.FindResource("notification").ToString(); * md.ShowDialog(); * }*/ } else if (paging.CurrentPage == paging.MaxPage) { ShowNextPage = false; ShowLastPage = false; ShowFirstPage = true; ShowPrevPage = true; } else if (paging.MaxPage > 1) { IsPaging = "Visible"; ShowNextPage = true; ShowLastPage = true; } IsCheckAll = false; }
private void onPagingClick(string _param) { if (_param == PageOptions.First.ToString()) { paging.CurrentPage = 1; ShowNextPage = true; ShowLastPage = true; ShowFirstPage = false; ShowPrevPage = false; } else if (_param == PageOptions.Last.ToString()) { paging.CurrentPage = paging.MaxPage; ShowNextPage = false; ShowLastPage = false; ShowFirstPage = true; ShowPrevPage = true; } else if (_param == PageOptions.Previous.ToString()) { if (paging.CurrentPage == 1) { ShowNextPage = true; ShowLastPage = true; ShowFirstPage = false; ShowPrevPage = false; } else { paging.CurrentPage--; ShowNextPage = true; ShowLastPage = true; ShowFirstPage = true; ShowPrevPage = true; } } else if (_param == PageOptions.Next.ToString()) { if (paging.CurrentPage == paging.MaxPage) { ShowNextPage = false; ShowLastPage = false; ShowFirstPage = true; ShowPrevPage = true; } else { paging.CurrentPage++; ShowNextPage = true; ShowLastPage = true; ShowFirstPage = true; ShowPrevPage = true; } } ShowCurPage = paging.CurrentPage; GiftCard.Clear(); DataTable GiftCards = GiftCardModel.advanceSearchGiftCardByMultiCondition(this._txtKeySearch, paging.StringLimit, this._txtSortBy); if (GiftCards.Rows.Count > 0) { var i = 1; foreach (DataRow dr in GiftCards.Rows) { DateTime dt = UnixTimeToDateTime(Convert.ToInt32(dr["CreateDate"])); DateTime _expreTime = UnixTimeToDateTime(Convert.ToInt32(dr["ExpirationDate"].ToString())); string _delivered = string.Empty; if (Convert.ToInt32(dr["DeliveredDate"]) > 0) { DateTime _timeDeliver = UnixTimeToDateTime(Convert.ToInt32(dr["DeliveredDate"].ToString())); _delivered = _timeDeliver.ToString(_orderDate); } string _customName = string.IsNullOrEmpty(dr["FullName"].ToString())? "None": dr["FullName"].ToString(); GiftCard.Add(new GiftCardModel { No = i, GiftCardID = Convert.ToInt32(dr["GiftCardID"].ToString()), Barcode = dr["Barcode"].ToString(), Serial = dr["Serial"].ToString(), CreateDate = dt.ToString(_orderDate), ExpirationDate = _expreTime.ToString(_orderDate), CustomerIDUse = Convert.ToInt32(dr["CustomerIDUse"].ToString()), Amount = Convert.ToDouble(dr["Amount"].ToString()), Balance = Convert.ToDouble(dr["Balance"].ToString()), IsChecked = false, CustomerName = _customName, DeliveredDate = _delivered }); i++; } } IsCheckAll = false; }