コード例 #1
0
        /// <summary>
        /// Gets the file information for delivery asynchronous.
        /// </summary>
        /// <returns></returns>
        public async Task <FileInfoDeliveryModel> GetFileInfosDelivery(string FileNumber, string MobileNumber)
        {
            FileInfoDeliveryModel fileInfoDel = new FileInfoDeliveryModel();

            try
            {
                using (var client = new RestClient(new Uri("https://api-tray.intragest.info/api/")))
                {
                    client.Authenticator = new HttpBasicAuthenticator("astek.tracker", "3B]U/2Z8w7fDce=(");
                    var request = new RestRequest("PackingGetFileInfosDelivery", Method.GET);
                    request.AddQueryParameter("file_number", FileNumber);
                    request.AddQueryParameter("mobile_number", MobileNumber);
                    var result = await client.Execute <FileInfoDeliveryModel>(request).ConfigureAwait(false);

                    fileInfoDel = result.Data;
                }
            }
            catch (Exception e)
            {
                var da = new DatabaseAccessAsync();
                da.InsertException(new PackingCygestExceptionModel
                {
                    Message    = e.Message,
                    StackTrace = e.StackTrace,
                    TimeSpan   = DateTime.Today.ToString(System.Globalization.CultureInfo.CurrentCulture),
                    MethodName = e.Source
                });
            }

            return(fileInfoDel);
        }
コード例 #2
0
        /// <summary>
        /// Inserts the file information delete.
        /// </summary>
        /// <param name="fileInfo">The file information.</param>
        public void InsertFileInfoDel(FileInfoDeliveryModel fileInfo)
        {
            SQLiteConnection _con = OpenConnect();

            _con.CreateTable <FileInfoDeliveryModel>();
            _con.InsertOrReplace(fileInfo);
            CloseConenct(_con);
        }
コード例 #3
0
 /// <summary>
 /// SetValueByBinding field UI with value from paramater of constructor .
 /// </summary>
 /// <param name="fileInfo">The file information.</param>
 private void SetValueByBinding(FileInfoDeliveryModel fileInfo)
 {
     LblFileNumber      = fileInfo.File_number;
     LblClientNumber    = fileInfo.Client_number;
     Volume             = fileInfo.Volume;
     LoadingCountry     = fileInfo.Country_loading;
     DestinationCountry = fileInfo.Country_delivery;
     SetTransportImage(fileInfo);
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DelSynchroViewModel"/> class.
 /// </summary>
 /// <param name="pageService">The page service.</param>
 /// <param name="infomodel">The infomodel.</param>
 public DelSynchroViewModel(IPageService pageService, FileInfoDeliveryModel infomodel)
 {
     HandleTranslation(_appViewModel.DefaultedCultureInfo);
     PageService      = pageService;
     InfoModel        = infomodel;
     _dbAccess        = new DatabaseAccessAsync();
     _db              = new DatabaseAccess();
     Back             = new Command(GoBack);
     ProgressValue    = 0;
     LoadingText      = LoadingTextWait;
     LoadingIndicator = true;
     PerfomCall();
 }
コード例 #5
0
 public DelItemViewModel(IPageService pageService, FileInfoDeliveryModel fileInfo, ItemDeliveredModel deliveryItem)
 {
     HandleTranslation(_appViewModel.DefaultedCultureInfo);
     PageService    = pageService;
     _delivery      = deliveryItem;
     _fileInfo      = fileInfo;
     _db            = new DatabaseAccess();
     _photoPathList = new List <string>();
     SetValueByBinding(deliveryItem);
     SaveItemAndGoBackToDeliveryControl = new Command(SaveItemAndGoBack);
     Back      = new Command(GoBack);
     TakePhoto = new Command(TakeAndSavePhoto);
     GetPhotoPathFromDbForDelivery(_delivery.Barecode);
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DelFinalSummaryViewModel"/> class.
 /// </summary>
 /// <param name="pageService">The page service.</param>
 /// <param name="info">The information.</param>
 /// <param name="end">The end.</param>
 /// <param name="isSuccess">if set to <c>true</c> [is success].</param>
 public DelFinalSummaryViewModel(IPageService pageService, FileInfoDeliveryModel info, DeliveryEndControls end, bool isSuccess)
 {
     HandleTranslation(_appViewModel.DefaultedCultureInfo);
     LanguageSelected = _appViewModel.DefaultedCultureInfo;
     PageService      = pageService;
     InfoModel        = info;
     _delEndControl   = end;
     _isSucess        = isSuccess;
     _db = new DatabaseAccess();
     GetDeliverySummaryDetail(end);
     GetDeliveryItem(InfoModel.File_number);
     GoToSignature = new Command(GoToSignaturePage);
     Back          = new Command(BackToControlAsync);
 }
コード例 #7
0
 /// <summary>
 /// Sets the transport image.
 /// </summary>
 /// <param name="fileInfoModel">The file information model.</param>
 private void SetTransportImage(FileInfoDeliveryModel fileInfoModel)
 {
     if (fileInfoModel.Transportation == Constants.Air)
     {
         MyImagePath = "resource://PackingCygest.Image.plane.svg";
     }
     else if (fileInfoModel.Transportation == Constants.Road)
     {
         MyImagePath = "resource://PackingCygest.Image.truck.svg";
     }
     else
     {
         MyImagePath = "resource://PackingCygest.Image.boat.svg";
     }
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DelControlViewModel"/> class.
 /// </summary>
 /// <param name="pageService">The page service.</param>
 /// <param name="fileInfo">The file information.</param>
 public DelControlViewModel(IPageService pageService, FileInfoDeliveryModel fileInfo)
 {
     _databaseAccess = new DatabaseAccess();
     HandleTranslation(_appViewModel.DefaultedCultureInfo);
     LanguageSelected = _appViewModel.DefaultedCultureInfo;
     PageService      = pageService;
     SetValueByBinding(fileInfo);
     _fileInfo = fileInfo;
     ScanBtn   = new Command(ScanBarcode);
     GetDeliveryItem(_fileInfo.File_number);
     GetCountOfRubric(_fileInfo.File_number);
     GoToSynchronation = new Command(Synchronation);
     Back = new Command(GoBack);
     BarCodeScannerViewModel = new BarCodeScannerViewModel();
 }
コード例 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhotoAndCommentPage"/> class.
 /// </summary>
 public PhotoAndCommentPage(FileInfoDeliveryModel fileInfo, ItemDeliveredModel cartonModel)
 {
     InitializeComponent();
     _itemModel = cartonModel;
     CallLabel(true, false);
     Appear         = true;
     BindingContext = new PhotoAndCommentViewModel(new PageService(), fileInfo, cartonModel, "delivery");
     if (!string.IsNullOrEmpty(_itemModel.comments_Delivery))
     {
         MyEditor.Text = _itemModel.comments_Delivery;
     }
     else
     {
         MyEditor.Text = "";
     }
     Appear = false;
 }
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PhotoAndCommentViewModel"/> class.
 /// </summary>
 /// <param name="pageService">The page service.</param>
 /// <param name="fileInfo">The file information.</param>
 /// <param name="deliveryItem">The delivery item.</param>
 /// <param name="status">The status.</param>
 public PhotoAndCommentViewModel(IPageService pageService, FileInfoDeliveryModel fileInfo, ItemDeliveredModel deliveryItem, string status)
 {
     /**
      * Get Image quality from database at initial stage to set compression ratio
      *
      */
     CrossMedia.Current.Initialize();
     HandleTranslation(_appViewModel.DefaultedCultureInfo);
     PageService    = pageService;
     _fileInfo      = fileInfo;
     _status        = status;
     _db            = new DatabaseAccess();
     _photoPathList = new List <string>();
     _delivery      = deliveryItem;
     GetPhotoPathFromDb(_status, _delivery.Barecode);
     GetPhotoQualityFromDb();
     DetermineValues();
     AddPhoto           = new Command(TakePhoto);
     SaveLoadingDetails = new Command(CallSaveLoadingAsync);
     SaveAndGoBack      = new Command(SaveImageAndGoBack);
     TakePhoto();
 }
コード例 #11
0
using System;
using Acr.XamForms.SignaturePad;
using PackingCygest.ViewModel;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using PackingCygest.Interface;
using PackingCygest.Model;
using PackingCygest.Utils;
using System.Threading.Tasks;


namespace PackingCygest.View
{
    /// <summary>
    /// Class Signature
    /// </summary>
    /// <seealso cref="Xamarin.Forms.ContentPage" />
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class Signature : ContentPage
    {
        private string _status;
        private string _blankSignature = "";
        public FileInfoModel InfoModel { get; }
        public FileInfoDeliveryModel InfoModelDel { get; }
        public string LblOk { get; private set; }
        public string LblError { get; private set; }
        public string LblSignatureSaveSuccessful { get; private set; }
        public string LblInvalidSignature { get; private set; }
        public string LblSuccess { get; private set; }
        public string SignatureClearMsg { get; private set; }

        private readonly ApplicationViewModel _appViewModel = new ApplicationViewModel();

        /// <summary>
        /// Initializes a new instance of the <see cref="Signature"/> class.
        /// </summary>
        public Signature(FileInfoModel info, string status)
        {
            InitializeComponent();
            BindingContext = new SignatureViewModel(new PageService(), info);
            InfoModel = info;
            _status = status;
            HandleTranslation(_appViewModel.DefaultedCultureInfo);
            OnAppearing();
            SignatureView.ClearPath = !SignatureView.ClearPath;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Signature" /> class.
        /// </summary>
        /// <param name="info">The information.</param>
        /// <param name="status">The status.</param>
        public Signature(FileInfoDeliveryModel info, string status)
        {
            InitializeComponent();
            BindingContext = new SignatureViewModel(new PageService(), info);
            InfoModelDel = info;
            _status = status;
            HandleTranslation(_appViewModel.DefaultedCultureInfo);

            OnAppearing();

        }

        /// <summary>
        /// Handles the translation.
        /// </summary>
        /// <param name="cultureInfo">The culture information.</param>
        public void HandleTranslation(string cultureInfo)
        {
            LblOk = Localize.GetString("lblOK", cultureInfo);
            LblError = Localize.GetString("lblError", cultureInfo);
            LblSignatureSaveSuccessful = Localize.GetString("LblSignatureSaveSuccessful", cultureInfo);
            LblInvalidSignature = Localize.GetString("LblInvalidSignature", cultureInfo);
            LblSuccess = Localize.GetString("LblSuccess", cultureInfo);
            SignatureClearMsg = Localize.GetString("MsgSignatureClear", cultureInfo);

        }

        /// <summary>
        /// Handles the OnClicked event of the BtnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void BtnSave_OnClicked(object sender, EventArgs e)
        {
            var imgPath = DependencyService.Get<ISignService>().Sign();
            if (_status.Equals("Loading"))
            {
                var vm = new SignatureViewModel(new PageService(), InfoModel);
                SignatureView.SavedImagePath = imgPath;

                string imageBase64 = DependencyService.Get<IFileMgr>().GetBase64ImageString(imgPath);

                if (Device.RuntimePlatform == Device.Android)
                {
                    if (imageBase64.Equals(_blankSignature))
                    {
                        DisplayAlert(LblError, LblInvalidSignature, LblOk);
                        SignatureView.ClearPath = !SignatureView.ClearPath;
                    }
                    else
                    {
                        vm.SaveImagePath(imgPath, _status);
                        DisplayAlert(LblSuccess, LblSignatureSaveSuccessful, LblOk);
                        Navigation.PushAsync(new View.CompletedPage(_status));
                    }
                }

                if (Device.RuntimePlatform == Device.iOS)
                {
                    if (imageBase64.Equals(_blankSignature))
                    {
                        DisplayAlert(LblError, LblInvalidSignature, LblOk);
                    }
                    else
                    {
                        vm.SaveImagePath(imgPath, _status);
                        DisplayAlert(LblSuccess, LblSignatureSaveSuccessful, LblOk);
                        Navigation.PushAsync(new View.CompletedPage(_status));
                    }
                }

            }
            else
            {
                var vm = new SignatureViewModel(new PageService(), InfoModelDel);
                SignatureView.SavedImagePath = imgPath;

                string imageBase64 = DependencyService.Get<IFileMgr>().GetBase64ImageString(imgPath);

                if (Device.RuntimePlatform == Device.Android)
                {
                    if (imageBase64.Equals(_blankSignature))
                    {
                        DisplayAlert(LblError, LblInvalidSignature, LblOk);
                        SignatureView.ClearPath = !SignatureView.ClearPath;
                    }
                    else
                    {
                        vm.SaveImagePath(imgPath, _status);
                        DisplayAlert(LblSuccess, LblSignatureSaveSuccessful, LblOk);
                        Navigation.PushAsync(new View.CompletedPage(_status));
                    }
                }

                if (Device.RuntimePlatform == Device.iOS)
                {
                    if (imageBase64.Equals(_blankSignature))
                    {
                        DisplayAlert(LblError, LblInvalidSignature, LblOk);
                    }
                    else
                    {
                        vm.SaveImagePath(imgPath, _status);
                        DisplayAlert(LblSuccess, LblSignatureSaveSuccessful, LblOk);
                        Navigation.PushAsync(new View.CompletedPage(_status));
                    }
                }
            }
        }

        /// <summary>
        /// Handles the Click event of the btnClear control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnClear_Click(object sender, EventArgs e)
        {
            SignatureView.ClearPath = !SignatureView.ClearPath;
            DisplayAlert(LblSuccess, SignatureClearMsg, LblOk);
        }


        /// <summary>
        /// Gets blank signature image on page appearing
        /// </summary>
        protected override async void OnAppearing()
        {
            
            await Task.Delay(1000);
            if (_status.Equals("Loading"))
            {
           
               
                var imgPath = DependencyService.Get<ISignService>().Sign();
                var vm = new SignatureViewModel(new PageService(), InfoModel);
                SignatureView.SavedImagePath = imgPath;
                _blankSignature = DependencyService.Get<IFileMgr>().GetBase64ImageString(imgPath);
                SignatureView.ClearPath = !SignatureView.ClearPath;
                base.OnAppearing();
            }
            else
            {
                var imgPath = DependencyService.Get<ISignService>().Sign();
                var vm = new SignatureViewModel(new PageService(), InfoModelDel);
                SignatureView.SavedImagePath = imgPath;
                _blankSignature = DependencyService.Get<IFileMgr>().GetBase64ImageString(imgPath);
                SignatureView.ClearPath = !SignatureView.ClearPath;
                base.OnAppearing();
            }           
            
        }
    }
}

コード例 #12
0
ファイル: DelItem.xaml.cs プロジェクト: ksoman/Packing_CYGEST
 /// <summary>
 /// Initializes a new instance of the <see cref="DelItem"/> class.
 /// </summary>
 /// <param name="fileInfo">The file information.</param>
 /// <param name="itemDelModel">The item delete model.</param>
 public DelItem(FileInfoDeliveryModel fileInfo, ItemDeliveredModel itemDelModel)
 {
     InitializeComponent();
     BindingContext = new DelItemViewModel(new PageService(), fileInfo, itemDelModel);
 }
コード例 #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DelFinalSummary"/> class.
 /// </summary>
 public DelFinalSummary(FileInfoDeliveryModel info, DeliveryEndControls end, bool success)
 {
     InitializeComponent();
     BindingContext = new DelFinalSummaryViewModel(new PageService(), info, end, success);
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Synchro"/> class.
 /// </summary>
 /// <param name="delivery">The delivery.</param>
 public Synchro(FileInfoDeliveryModel infomodel)
 {
     InitializeComponent();
     BindingContext = new DelSynchroViewModel(new PageService(), infomodel);
 }
コード例 #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DelControls"/> class.
        /// </summary>
        public DelControls(FileInfoDeliveryModel fileInfo)
        {
            InitializeComponent();

            BindingContext = new DelControlViewModel(new PageService(), fileInfo);
        }