public rptOrderDetail()
        {
            InitializeComponent();
            StoreInfor infor = inforDAO.getObject();

            lbName.Text    = infor.name;
            lbAddress.Text = infor.address;
            lbPhone.Text   = infor.phoneNumber;
            lbWeb.Text     = infor.website;
        }
        public static async Task <StoreInfor> GetStoreInforByItemIdAndBranchAsync(IRestDataMapper mapper, long itemId, int branchId)
        {
            StoreInfor reds = new StoreInfor();

            if (mapper == null)
            {
                return(reds);
            }
            string url = $"item/api/v1/itemstores/{itemId}/{branchId}";

            reds = await mapper.GetDataAsync <StoreInfor>(url);

            return(reds);
        }
        public static async Task <StoreInfor> UpdateStoreInforAsync(IRestDataMapper mapper, StoreInfor data)
        {
            StoreInfor reds = new StoreInfor();

            if (mapper == null)
            {
                return(reds);
            }
            string url = $"item/api/v1/itemstores/{data.id}";

            reds = await mapper.PutDataAsync(url, data);

            return(reds);
        }
 public static StoreInfor CreateNewStore(this StoreInfor s)
 {
     s = new StoreInfor()
     {
         id                = 0,
         cost              = 0.00m,
         wholesalePrice    = 0.00m,
         retailPrice       = 0.00m,
         availableQuantity = 0.00m,
         reorderLevel      = 0.00m,
         discount          = 0.00m,
     };
     return(s);
 }
        private async void UpdateCustomer()
        {
            IRestDataMapper mapper = containerExtension.Resolve <IRestDataMapper>();

            if (SelectedItem != null)
            {
                if (SelectedItem.id > 0)
                {
                    if (SelectedItem.unitOfMeasurement.id != SelectedUom.id)
                    {
                        SelectedItem.unitOfMeasurement = SelectedUom;
                    }

                    Item i = await ItemRestService.UpdateItemAsync(mapper, SelectedItem);

                    if (i.id > 0)
                    {
                        StoreInfor s = await ItemRestService.UpdateStoreInforAsync(mapper, ItemStore);

                        if (s.id > 0)
                        {
                            _ = ShowMessageDialg("Item Update", "Item Updated Successfully", MsgDialogType.infor);
                            RizeSyncEvent();
                            Initialize();
                        }
                        else
                        {
                            _ = ShowMessageDialg("Item Update", "Can't Update Item Store", MsgDialogType.error);
                            return;
                        }
                    }
                    else
                    {
                        _ = ShowMessageDialg("Item Update", "Can't Save Item", MsgDialogType.error);
                        return;
                    }
                }
                else
                {
                    _ = ShowMessageDialg("Item Update", "Please Select Item Before Update", MsgDialogType.warrning);
                    return;
                }
            }
            else
            {
                _ = ShowMessageDialg("Item Update", "Please Select Item Before Update", MsgDialogType.warrning);
                return;
            }
        }
        private async void SaveCustomer()
        {
            IRestDataMapper mapper = containerExtension.Resolve <IRestDataMapper>();

            if (SelectedItemGroup == null || SelectedItemSubGroup == null || SelectedUom == null)
            {
                _ = ShowMessageDialg("New Item Creation", "Can't Save Item Select Group and Sub Group", MsgDialogType.error);
                return;
            }
            SelectedItem.barcode           = SelectedItem.code;
            SelectedItem.itemGroup         = SelectedItemGroup;
            SelectedItem.itemSubGroup      = SelectedItemSubGroup;
            SelectedItem.unitOfMeasurement = SelectedUom;
            if (SelectedItem.IsValiedItem())
            {
                Item i = await ItemRestService.CreateItemAsync(mapper, SelectedItem);

                if (i.id > 0)
                {
                    ItemStore.branch = loggedUser.LoggedUser.branch;
                    ItemStore.item   = i;
                    StoreInfor s = await ItemRestService.CreateStoreInforAsync(mapper, ItemStore);

                    if (s.id > 0)
                    {
                        _ = ShowMessageDialg("New Item Creation", "Item Created Successfully", MsgDialogType.infor);
                        RizeSyncEvent();
                        Initialize();
                    }
                    else
                    {
                        _ = ShowMessageDialg("New Item Creation", "Can't Save Item Store", MsgDialogType.error);
                        return;
                    }
                }
                else
                {
                    _ = ShowMessageDialg("New Item Creation", "Can't Save Item", MsgDialogType.error);
                    return;
                }
            }
            else
            {
                _ = ShowMessageDialg("New Item Creation", "Invalid Item Details or Already Exist Item", MsgDialogType.warrning);
                return;
            }
        }
        private void Save_Clicked(object sender, EventArgs e)
        {
            string message = CheckInfor();

            if (message != "")
            {
                DisplayAlert("Error", message, "OK");
                return;
            }
            StoreInfor newInfor = new StoreInfor
            {
                StoreName        = NameEntry.Text,
                StoreDescription = DescEntry.Text
            };

            //(App.Current.MainPage.Navigation.NavigationStack.ElementAt(0).BindingContext as StoreSetttingViewModel).ChangeInfor(newInfor);
            (TabbarStoreManager.GetInstance().Children.ElementAt(4).BindingContext as StoreSetttingViewModel).ChangeInfor(newInfor);

            App.Current.MainPage.Navigation.PopAsync();
        }
Example #8
0
 public void ChangeInfor(StoreInfor newInfor)
 {
     myStore.StoreName        = newInfor.StoreName;
     myStore.StoreDescription = newInfor.StoreDescription;
 }