public void ChangeRequesterTraveller(Guid txID, TADocumentTraveller taDocumentTraveller)
        {
            TADocumentDataSet taDocumentDS = (TADocumentDataSet)TransactionService.GetDS(txID);

            TADocumentDataSet.TADocumentTravellerRow taDocumentTravellerRow = taDocumentDS.TADocumentTraveller.FindByTravellerID(taDocumentTraveller.TravellerID);

            taDocumentTravellerRow.BeginEdit();

            taDocumentTravellerRow.TADocumentID    = taDocumentTraveller.TADocumentID.TADocumentID;
            taDocumentTravellerRow.UserID          = taDocumentTraveller.UserID.Userid;
            taDocumentTravellerRow.EmployeeNameEng = taDocumentTraveller.EmployeeNameEng;
            taDocumentTravellerRow.AirLineMember   = taDocumentTraveller.AirLineMember;

            if (taDocumentTraveller.CostCenterID != null)
            {
                taDocumentTravellerRow.CostCenterID = taDocumentTraveller.CostCenterID.CostCenterID;
            }

            if (taDocumentTraveller.Account != null)
            {
                taDocumentTravellerRow.AccountID = taDocumentTraveller.Account.AccountID;
            }

            if (taDocumentTraveller.IOID != null)
            {
                taDocumentTravellerRow.IOID = taDocumentTraveller.IOID.IOID;
            }

            taDocumentTravellerRow.UpdBy   = UserAccount.UserID;
            taDocumentTravellerRow.UpdDate = DateTime.Now;
            taDocumentTravellerRow.UpdPgm  = UserAccount.CurrentProgramCode;

            taDocumentTravellerRow.EndEdit();
        }
        public DataTable DeleteTADocumentTravellerTransaction(Guid txID, int travellerID)
        {
            TADocumentDataSet taDocumentDS = (TADocumentDataSet)TransactionService.GetDS(txID);

            TADocumentDataSet.TADocumentTravellerRow taDocumentTravellerRow = taDocumentDS.TADocumentTraveller.FindByTravellerID(travellerID);
            taDocumentTravellerRow.Delete();

            return(taDocumentDS.TADocumentTraveller);
        }
        public void PrepareDataToDataset(TADocumentDataSet taDocumentDS, long taDocumentID)
        {
            IList <TADocumentTraveller> taDocumentTravellerList = ScgeAccountingQueryProvider.TADocumentTravellerQuery.FindTADocumentTravellerByTADocumentID(taDocumentID);

            TADocumentDataSet.TADocumentRow taDocumentRow = taDocumentDS.TADocument.FindByTADocumentID(taDocumentID);

            foreach (TADocumentTraveller taDocumentTraveller in taDocumentTravellerList.OrderBy(t => t.TravellerID))
            {
                TADocumentDataSet.TADocumentTravellerRow taDocumentTravellerRow = taDocumentDS.TADocumentTraveller.NewTADocumentTravellerRow();

                taDocumentTravellerRow.TravellerID = taDocumentTraveller.TravellerID;

                if (taDocumentTraveller.TADocumentID != null)
                {
                    taDocumentTravellerRow.TADocumentID = taDocumentTraveller.TADocumentID.TADocumentID;
                }
                if (taDocumentTraveller.UserID != null)
                {
                    taDocumentTravellerRow.UserID = taDocumentTraveller.UserID.Userid;
                }
                if (taDocumentTraveller.EmployeeNameEng != null)
                {
                    taDocumentTravellerRow.EmployeeNameEng = taDocumentTraveller.EmployeeNameEng;
                }
                if (taDocumentTraveller.AirLineMember != null)
                {
                    taDocumentTravellerRow.AirLineMember = taDocumentTraveller.AirLineMember;
                }
                if (taDocumentTraveller.CostCenterID != null)
                {
                    taDocumentTravellerRow.CostCenterID = taDocumentTraveller.CostCenterID.CostCenterID;
                }
                if (taDocumentTraveller.Account != null)
                {
                    taDocumentTravellerRow.AccountID = taDocumentTraveller.Account.AccountID;
                }

                if (taDocumentTraveller.IOID != null)
                {
                    taDocumentTravellerRow.IOID = taDocumentTraveller.IOID.IOID;
                }

                taDocumentTravellerRow.Active  = taDocumentTraveller.Active;
                taDocumentTravellerRow.CreBy   = taDocumentTraveller.CreBy;
                taDocumentTravellerRow.CreDate = taDocumentTraveller.CreDate;
                taDocumentTravellerRow.UpdBy   = taDocumentTraveller.UpdBy;
                taDocumentTravellerRow.UpdDate = taDocumentTraveller.UpdDate;
                taDocumentTravellerRow.UpdPgm  = taDocumentTraveller.UpdPgm;

                // Add document initiator to datatable taDocumentDS.
                taDocumentDS.TADocumentTraveller.AddTADocumentTravellerRow(taDocumentTravellerRow);
            }
        }
Пример #4
0
 public TADocumentTraveller(TADocumentDataSet.TADocumentTravellerRow taDocumentTravellerRow)
 {
     //this.travellerID = taDocumentTravellerRow.TravellerID;
     //this.taDocumentID = new TADocument(taDocumentTravellerRow.TADocumentID);
     //this.userID = new SS.SU.DTO.SuUser(taDocumentTravellerRow.UserID);
     //this.employeeNameEng = taDocumentTravellerRow.EmployeeNameEng;
     //this.airLineMember = taDocumentTravellerRow.AirLineMember;
     //this.Active = taDocumentTravellerRow.Active;
     //this.CreBy = taDocumentTravellerRow.CreBy;
     //this.CreDate = taDocumentTravellerRow.CreDate;
     //this.UpdBy = taDocumentTravellerRow.UpdBy;
     //this.UpdDate = taDocumentTravellerRow.UpdDate;
     //this.UpdPgm = taDocumentTravellerRow.UpdPgm;
 }
        public int AddTADocumentTravellerTransaction(Guid txID, TADocumentTraveller taDocumentTraveller)
        {
            TADocumentDataSet taDocumentDS = (TADocumentDataSet)TransactionService.GetDS(txID);

            TADocumentDataSet.TADocumentTravellerRow taDocumentTravellerRow = taDocumentDS.TADocumentTraveller.NewTADocumentTravellerRow();

            taDocumentTravellerRow.TADocumentID    = taDocumentTraveller.TADocumentID.TADocumentID;
            taDocumentTravellerRow.UserID          = taDocumentTraveller.UserID.Userid;
            taDocumentTravellerRow.EmployeeNameEng = taDocumentTraveller.EmployeeNameEng;
            taDocumentTravellerRow.AirLineMember   = taDocumentTraveller.AirLineMember;
            taDocumentTravellerRow.Active          = taDocumentTraveller.Active;
            taDocumentTravellerRow.CreBy           = UserAccount.UserID;
            taDocumentTravellerRow.CreDate         = DateTime.Now;
            taDocumentTravellerRow.UpdBy           = UserAccount.UserID;
            taDocumentTravellerRow.UpdDate         = DateTime.Now;
            taDocumentTravellerRow.UpdPgm          = UserAccount.CurrentProgramCode;

            taDocumentDS.TADocumentTraveller.AddTADocumentTravellerRow(taDocumentTravellerRow);
            return(taDocumentTravellerRow.TravellerID);
        }
        public void UpdateTADocumentTravellerTransaction(Guid txID, TADocumentTraveller taDocumentTraveller)
        {
            Spring.Validation.ValidationErrors errors = new Spring.Validation.ValidationErrors();

            TADocumentDataSet taDocumentDS = (TADocumentDataSet)TransactionService.GetDS(txID);

            TADocumentDataSet.TADocumentTravellerRow taDocumentTravellerRow = taDocumentDS.TADocumentTraveller.FindByTravellerID(taDocumentTraveller.TravellerID);
            TADocumentDataSet.TADocumentRow          taDocumentRow          = taDocumentDS.TADocument.FindByTADocumentID(taDocumentTraveller.TADocumentID.TADocumentID);

            taDocumentTravellerRow.BeginEdit();

            if (taDocumentTraveller.TADocumentID != null)
            {
                taDocumentTravellerRow.TADocumentID = taDocumentTraveller.TADocumentID.TADocumentID;
            }

            if (taDocumentTraveller.UserID == null)
            {
                errors.AddError("Provider.Error", new Spring.Validation.ErrorMessage("UserIDIsRequired"));
            }
            else
            {
                taDocumentTravellerRow.UserID = taDocumentTraveller.UserID.Userid;
            }

            if (string.IsNullOrEmpty(taDocumentTraveller.EmployeeNameEng))
            {
                errors.AddError("Provider.Error", new Spring.Validation.ErrorMessage("FullNameEngIsRequired"));
            }
            else
            {
                taDocumentTravellerRow.EmployeeNameEng = taDocumentTraveller.EmployeeNameEng;
            }

            if (!errors.IsEmpty)
            {
                throw new ServiceValidationException(errors);
            }

            taDocumentTravellerRow.AirLineMember = taDocumentTraveller.AirLineMember;

            taDocumentTravellerRow.Active = taDocumentTraveller.Active;

            if (taDocumentRow.Ticketing.Trim().ToUpper().Equals("T") && (!string.IsNullOrEmpty(taDocumentRow.Ticketing)))
            {
                if (taDocumentTraveller.CostCenterID == null || taDocumentTraveller.CostCenterID.CostCenterID <= 0)
                {
                    errors.AddError("Provider.Error", new Spring.Validation.ErrorMessage("CostCenterIsRequired", new object[] { taDocumentTraveller.UserName, " " }));
                }
                else
                {
                    taDocumentTravellerRow.CostCenterID = taDocumentTraveller.CostCenterID.CostCenterID;
                }

                if (taDocumentTraveller.IOID == null || taDocumentTraveller.IOID.IOID <= 0)
                {
                    taDocumentTravellerRow.IOID = 0;
                }
                else
                {
                    taDocumentTravellerRow.IOID = taDocumentTraveller.IOID.IOID;
                }

                if (taDocumentTraveller.Account == null || taDocumentTraveller.Account.AccountID <= 0)
                {
                    errors.AddError("Provider.Error", new Spring.Validation.ErrorMessage("ExpenseGroupIsRequired", new object[] { taDocumentTraveller.UserName, " " }));
                }
                else
                {
                    taDocumentTravellerRow.AccountID = taDocumentTraveller.Account.AccountID;
                }
            }
            else
            {
                taDocumentTravellerRow.CostCenterID = 0;
                taDocumentTravellerRow.AccountID    = 0;
                taDocumentTravellerRow.IOID         = 0;
            }

            if (!errors.IsEmpty)
            {
                throw new ServiceValidationException(errors);
            }

            taDocumentTravellerRow.CreBy   = UserAccount.UserID;
            taDocumentTravellerRow.CreDate = DateTime.Now;
            taDocumentTravellerRow.UpdBy   = UserAccount.UserID;
            taDocumentTravellerRow.UpdDate = DateTime.Now;
            taDocumentTravellerRow.UpdPgm  = UserAccount.CurrentProgramCode;

            taDocumentTravellerRow.EndEdit();
        }