Пример #1
0
        public async Task LoadLoanDetails()
        {
            ActivityIndicator = true;
            try {
                if (GlobalVariables.IsOffline)
                {
                    PLoanDetailsList = new ObservableCollection <LoanDetailsModel> (DataSync.GetDataSyncLoanDetails(GlobalVariables.CustomerEntityID, GlobalVariables.AccountEntityID));
                }
                else
                {
                    var result = await APIRequest.Instance.GetLoanDetailsAPI(new LoanDetailsRequestModel {
                        CustomerEntityID = GlobalVariables.CustomerEntityID,
                        AccountEntityID  = GlobalVariables.AccountEntityID
                    });

                    if (result != null)
                    {
                        var loanDetailsRequestModel = JsonConvert.DeserializeObject <LoanDetailsResponseModel> (result);
                        PLoanDetailsList = new ObservableCollection <LoanDetailsModel> (loanDetailsRequestModel.LoanDetails);
                    }
                    else
                    {
                        GlobalVariables.DisplayMessage = "Record not found";
                        MessagingCenter.Send <VMLoanDetails> (this, Strings.Display_Message);
                    }
                }
            } catch {
                GlobalVariables.DisplayMessage = "Error";
                MessagingCenter.Send <VMLoanDetails> (this, Strings.Display_Message);
            }
            ActivityIndicator = false;
        }
Пример #2
0
        public async Task SaveCustomer()
        {
            if (PSelectedCustomer != null)
            {
                CustomerDetailsResponseModel customerDetailsResponseModel = null;
                if (GlobalVariables.IsOffline)
                {
                    customerDetailsResponseModel = DataSync.GetDataSyncCustomerDetails(PSelectedCustomer.CustomerEntityID);
                }
                else
                {
                    string result = await APIRequest.Instance.GetCustomerDetailsList(new CustomerDetailsRequestModel {
                        CustomerEntityID = PSelectedCustomer.CustomerEntityID
                    });

                    if (result != null)
                    {
                        customerDetailsResponseModel = JsonConvert.DeserializeObject <CustomerDetailsResponseModel> (result);
                    }
                }

                if (customerDetailsResponseModel != null)
                {
                    try {
                        if (SQLiteDatabase.Instance.InsertCustomerDetails(customerDetailsResponseModel))
                        {
                            GlobalVariables.CustomerEntityID = PSelectedCustomer.CustomerEntityID;
                            GlobalVariables.CustomerID       = PSelectedCustomer.CustomerID;
                            GlobalVariables.CustomerName     = PSelectedCustomer.CustomerName;


                            MessagingCenter.Send <VMCustomerList> (this, Strings.CustomerList_Success);
                        }
                    } catch (Exception ex) {
                        GlobalVariables.DisplayMessage = "Error";
                        MessagingCenter.Send <VMCustomerList> (this, Strings.Display_Message);
                    }
                }
            }
            else
            {
                GlobalVariables.DisplayMessage = "Please Select Customer";
                MessagingCenter.Send <VMCustomerList> (this, Strings.Display_Message);
            }
        }
Пример #3
0
        public async Task LoadActionDiary()
        {
            ActionEventModel AEM = null;

            try {
                if (GlobalVariables.IsOffline)
                {
                    List <ActionEventModel> listActionEventDiary = DataSync.GetDataSyncActionEventDiaryDetails();
                    if (listActionEventDiary != null)
                    {
                        AEM = listActionEventDiary [0];
                    }
                }
                else
                {
                    var result = await APIRequest.Instance.GetActionEventDiaryDetailsAPI();

                    if (result != null)
                    {
                        ActionEventDiaryResponseModel responseModelList = JsonConvert.DeserializeObject <ActionEventDiaryResponseModel> (result);
                        AEM = responseModelList.ActionEventDiaryDetails [0];
                    }
                }

                if (AEM != null)
                {
                    EventID         = AEM.EventID;
                    PAssignedAction = AEM.WhatIsToBeDone;
                    String Status = AEM.Status;
                    CommencementComment = AEM.CommenceComment;
                    ClosureComment      = AEM.ClosureComment;

                    StatusMaster = new List <EventStatusModel> ();
                    if (AEM.Status == "20")
                    {
                        StatusMaster.Add(new EventStatusModel()
                        {
                            StatusKey = 20, StatusValue = "Allotted"
                        });
                        StatusMaster.Add(new EventStatusModel()
                        {
                            StatusKey = 30, StatusValue = "In Process"
                        });
                        //						StatusMaster.Add(new EventStatusModel(){StatusKey = 30,StatusValue = "Done" });
                    }
                    else if (AEM.Status == "30")
                    {
                        StatusMaster.Add(new EventStatusModel()
                        {
                            StatusKey = 30, StatusValue = "In Process"
                        });
                        StatusMaster.Add(new EventStatusModel()
                        {
                            StatusKey = 10, StatusValue = "Done"
                        });
                        IsCommecementDateEnalble     = true;
                        IsEnalbleCommencementComment = true;
                    }
                    else if (AEM.Status == "10")
                    {
                        StatusMaster.Add(new EventStatusModel()
                        {
                            StatusKey = 10, StatusValue = "Done"
                        });
                    }


                    if (!string.IsNullOrEmpty(AEM.CommencementDate))
                    {
                        PCommecementDate = Convert.ToDateTime(AEM.CommencementDate);
                    }
                    if (!string.IsNullOrEmpty(AEM.ClosureDate))
                    {
                        PClosureDate = Convert.ToDateTime(AEM.ClosureDate);
                    }
                }
            } catch (Exception ex) {
            }
        }
Пример #4
0
        public async Task LoadActionEventDiaryList()
        {
            //			ActivityIndicator = true;
            try {
                if (GlobalVariables.IsOffline)
                {
                    PRemarkDetailsList = new ObservableCollection <ActionEventDiaryListModel> (DataSync.GetDataSyncActionEventDiaryList(GlobalVariables.CustomerEntityID, GlobalVariables.AccountEntityID));
                }
                else
                {
                    var result = await APIRequest.Instance.GetActionEventDiaryListAPI(new ActionEventDiaryListRequestModel {
                        CustomerEntityID = GlobalVariables.CustomerEntityID,
                        AccountEntityID  = GlobalVariables.AccountEntityID
                    });

                    if (result != null)
                    {
                        //result = result.ToDecrypt ();
                        var actionEventDiaryDetailsResponseModel = JsonConvert.DeserializeObject <ActionEventDiaryListResponseModel> (result);
                        //MessagingCenter.Send<VMAddInventory> (this, Strings.LOAD_SUCCESS);
                        PRemarkDetailsList = new  ObservableCollection <ActionEventDiaryListModel> (actionEventDiaryDetailsResponseModel.GetActionEventDiaryList);

                        //MessagingCenter.Send<VMAddInventory> (this, Strings.InventoryDetails_SUCCESS);
                    }
                    //			ActivityIndicator = false;
                }
            } catch (Exception ex) {
            }
        }