Example #1
0
        public static List <ActionEventModel> GetDataSyncActionEventDiaryDetails()
        {
            try {
                string strEventDiaryDetails = SQLiteDatabase.Instance.GetDataSyncActionDetails() [0].Data.ToDecrypt();
                DataSyncActionDetailsModel dataSyncActionDetailsModel = JsonConvert.DeserializeObject <DataSyncActionDetailsModel> (strEventDiaryDetails);

                List <ActionEventModel> listActionEventDiary = null;
                listActionEventDiary = (from ActionEventDairy in dataSyncActionDetailsModel.ActionEventDiaryDetails
                                        where ActionEventDairy.EventID.ToString() == GlobalVariables.RemarkID
                                        select ActionEventDairy).ToList();

                foreach (ActionEventUpdate actionEventUpdate in SQLiteDatabase.Instance.DataSyncGetActionEvent(GlobalVariables.RemarkID))
                {
                    int EventId = actionEventUpdate.EventID;

                    ActionEventModel AEU = listActionEventDiary.Where(item => item.EventID == EventId).ToList() [0];

                    AEU.Status           = actionEventUpdate.Status.ToString();
                    AEU.CommencementDate = actionEventUpdate.CommencementDt;
                    AEU.CommenceComment  = actionEventUpdate.CommencementRemark;
                    AEU.ClosureDate      = actionEventUpdate.ClosureDt;
                    AEU.ClosureComment   = actionEventUpdate.ClosureRemark;
                }

                return(listActionEventDiary);
            } catch {
                return(null);
            }
        }
Example #2
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) {
            }
        }