Пример #1
0
        public void DeleteRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                AssetManagementCategory n = new AssetManagementCategory();
                n.recordId         = index;
                n.name             = "";
                n.deliveryDuration = 0;



                PostRequest <AssetManagementCategory> req = new PostRequest <AssetManagementCategory>();
                req.entity = n;
                PostResponse <AssetManagementCategory> res = _assetManagementService.ChildDelete <AssetManagementCategory>(req);
                if (!res.Success)
                {
                    //Show an error saving...
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(res);
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    Store1.Remove(index);

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }
        public void DeleteRecord(string index)
        {
            try
            {
                //Step 1 Code to delete the object from the database
                AssetManagementOnBoarding s = new AssetManagementOnBoarding();
                s.categoryId = index;
                s.positionId = CurrentPositionId.Text;
                PostRequest <AssetManagementOnBoarding> req = new PostRequest <AssetManagementOnBoarding>();
                req.entity = s;
                PostResponse <AssetManagementOnBoarding> r = _assetManagementService.ChildDelete <AssetManagementOnBoarding>(req);
                if (!r.Success)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    Common.errorMessage(r);;
                    return;
                }
                else
                {
                    //Step 2 :  remove the object from the store
                    OnboardingStore.Reload();

                    //Step 3 : Showing a notification for the user
                    Notification.Show(new NotificationConfig
                    {
                        Title = Resources.Common.Notification,
                        Icon  = Icon.Information,
                        Html  = Resources.Common.RecordDeletedSucc
                    });
                }
            }
            catch (Exception ex)
            {
                //In case of error, showing a message box to the user
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorDeletingRecord).Show();
            }
        }