コード例 #1
0
        public Control TourFindControl(object item)
        {
            Entities.Tour tour =
                (Entities.Tour)item;

            return(FindInClients(tour));
        }
コード例 #2
0
        internal bool GetByTour(Entities.Tour tour)
        {
            bool res = false;

            try
            {
                this.query.Parameters.Clear();
                this.query.Parameters.Add(new SqlParameter("@TourId", tour.Id));

                res = this.query.ExecuteReader("TourPaymentsGetByTourId", MapPaymentToObject, tour);
            }
            catch (Exception ex)
            {
                try
                {
                    DomainModel.Application.Status.Update(
                        StatusController.Abstract.StatusTypes.Error,
                        "",
                        ex.Message);
                }
                catch { }
            }

            return(res);
        }
コード例 #3
0
ファイル: TourGroups.cs プロジェクト: HamedMousavi/BreweryTax
        public bool Update(Entities.Tour tour, Entities.TourGroup group)
        {
            bool res = false;

            try
            {
                this.query.Parameters.Clear();

                this.query.Parameters.Add(new SqlParameter("@SignupTypeId", group.SignUpType.Id));
                this.query.Parameters.Add(new SqlParameter("@StateTypeId", group.Status.Id));
                this.query.Parameters.Add(new SqlParameter("@GroupId", group.Id));
                this.query.Parameters.Add(new SqlParameter("@TourId", tour.Id));

                int affected;
                res = this.query.ExecuteUpdateProc("TourGroupstUpdateById", out affected);
            }
            catch (Exception ex)
            {
                try
                {
                    DomainModel.Application.Status.Update(
                        StatusController.Abstract.StatusTypes.Error,
                        "",
                        ex.Message);
                }
                catch { }
            }

            return(res);
        }
コード例 #4
0
        internal bool Update(Entities.Tour tour)
        {
            bool res = false;

            try
            {
                this.query.Parameters.Clear();

                this.query.Parameters.Add(new SqlParameter("@TourTime", Utils.GetDbTime(tour.Time.Value)));
                this.query.Parameters.Add(new SqlParameter("@Comments", tour.Comments));
                this.query.Parameters.Add(new SqlParameter("@TourId", tour.Id));


                int affected;
                res = this.query.ExecuteUpdateProc("ToursUpdateById", out affected);
            }
            catch (Exception ex)
            {
                try
                {
                    DomainModel.Application.Status.Update(
                        StatusController.Abstract.StatusTypes.Error,
                        "",
                        ex.Message);
                }
                catch { }
            }

            return(res);
        }
コード例 #5
0
        public static void Load(Entities.Tour tour)
        {
            try
            {
                // Load group info
                groups.GetByTour(tour);

                // load group members
                foreach (Entities.TourGroup group in tour.Groups)
                {
                    group.BaseTour = tour;

                    DomainModel.TourGroupMembers.Load(group);

                    DomainModel.TourGroupEmployees.Load(group);

                    DomainModel.TourGroupServices.Load(group);
                }
            }
            catch (Exception ex)
            {
                try
                {
                    DomainModel.Application.Status.Update(
                        StatusController.Abstract.StatusTypes.Error,
                        "",
                        ex.Message);
                }
                catch { }
            }
        }
コード例 #6
0
        internal static bool Save(Entities.Tour tour)
        {
            bool res = true;

            /*
             * foreach (Entities.TourPayment pay in tour.Payments)
             * {
             *  if (pay.IsDirty)
             *  {
             *      if (pay.Id < 0)
             *      {
             *          if (!(res = repo.Insert(tour, pay))) break;
             *      }
             *      else
             *      {
             *          if (!(res = repo.Update(tour, pay))) break;
             *      }
             *  }
             * }
             *
             * foreach (Entities.TourPayment pay in tour.DeletedPayments)
             * {
             *  if (!(res = repo.Delete(tour, pay))) break;
             * }
             */
            return(res);
        }
コード例 #7
0
ファイル: Tours.cs プロジェクト: HamedMousavi/BreweryTax
 internal static void Edit(Entities.Tour tour)
 {
     using (FrmTourEditor frmTourEditor = new FrmTourEditor(tour))
     {
         frmTourEditor.ShowDialog();
     }
 }
コード例 #8
0
        internal bool Delete(Entities.Tour tour, Entities.TourPayment pay)
        {
            bool res = false;

            try
            {
                this.query.Parameters.Clear();
                this.query.Parameters.Add(new SqlParameter("@PaymentId", pay.Id));


                int affected;
                res = this.query.ExecuteUpdateProc("TourPaymentDeleteById", out affected);
            }
            catch (Exception ex)
            {
                try
                {
                    DomainModel.Application.Status.Update(
                        StatusController.Abstract.StatusTypes.Error,
                        "",
                        ex.Message);
                }
                catch { }
            }

            return(res);
        }
コード例 #9
0
        public static bool Save(Entities.Tour tour)
        {
            bool res = true;

            foreach (Entities.TourGroup group in tour.Groups)
            {
                if (group.IsDirty)
                {
                    if (group.Id < 0)
                    {
                        if (!(res = groups.Insert(tour, group)))
                        {
                            break;
                        }
                    }
                    else
                    {
                        if (!(res = groups.Update(tour, group)))
                        {
                            break;
                        }
                    }
                }
            }

            return(res);
        }
コード例 #10
0
 private void BindControls(Entities.Tour tour)
 {
     //this.ctrlDetail.Tour = tour;
     this.ctrlServices.Tour = tour;
     //this.ctrlContacts.Tour = tour;
     //this.ctrlEmployees.Tour = tour;
 }
コード例 #11
0
 internal static void AddNew(Entities.Tour tour, Entities.TourGroup group, Entities.GeneralType serviceType)
 {
     using (FrmGroupServiceEditor frm = new
                                        FrmGroupServiceEditor(tour, group, serviceType))
     {
         frm.ShowDialog();
     }
 }
コード例 #12
0
 internal static void Edit(Entities.Tour tour, Entities.TourGroup group, Entities.Abstract.ITourService service)
 {
     using (FrmGroupServiceEditor frm = new FrmGroupServiceEditor(
                tour, group, (Entities.TourServiceBase)service))
     {
         frm.ShowDialog();
     }
 }
コード例 #13
0
 public FrmTourEditor(Entities.Tour editTour)
     : this()
 {
     this.editTour = editTour;
     if (editTour != null)
     {
         this.editTour.CopyTo(this.tour);
     }
 }
コード例 #14
0
        public FrmGroupServiceEditor(Entities.Tour tour, Entities.TourGroup group, Entities.TourServiceBase service)
        {
            this.editService = service;

            CreateService(tour, group);
            service.CopyTo(this.service);

            Init();
        }
コード例 #15
0
        public FrmGroupServiceEditor(Entities.Tour tour, Entities.TourGroup group, Entities.GeneralType serviceType)
        {
            this.group = group;

            CreateService(tour, group);
            this.service.Detail.ServiceType = serviceType;

            Init();
        }
コード例 #16
0
ファイル: Tours.cs プロジェクト: HamedMousavi/BreweryTax
        internal static bool DeleteTour(Entities.Tour tour)
        {
            if (Controllers.MessageBox.ConfirmDelete())
            {
                return(DomainModel.Tours.Delete(tour));
            }

            return(false);
        }
コード例 #17
0
        public TourControl(Entities.Tour tour)
            : base()
        {
            InitializeComponent();

            SetupControls();

            BindControls(tour);
        }
コード例 #18
0
        private void CreateService(Entities.Tour tour, Entities.TourGroup group)
        {
            this.service = new Entities.TourServiceBase(
                DomainModel.TourCostGroups.GetAll());

            this.service.PaymentStrategy = new
                                           DomainModel.PaymentStrategies.NormalStrategy(
                new Entities.PaymentStrategyInfo(
                    tour,
                    group,
                    this.service));
        }
コード例 #19
0
        private void BindControls(Entities.Tour tour)
        {
            Detach();
            this.tour = tour;
            Attach();

            this.ctrlManager = new FormControlManager(this.pnlGroups, tour.Groups);
            this.ctrlManager.CreateControl       = CreateTourGroup;
            this.ctrlManager.FindControl         = TourGroupFindControl;
            this.ctrlManager.ListContainsControl = ListContainsTourGroup;

            UpdateData(true);
        }
コード例 #20
0
ファイル: TourGroups.cs プロジェクト: HamedMousavi/BreweryTax
        protected void MapGroupToObject(SqlDataReader reader, object userData)
        {
            Entities.TourGroup group = new Entities.TourGroup();

            group.Id         = Utils.GetSafeInt32(reader, "GroupId");
            group.SignUpType = DomainModel.SignUpTypes.GetById(
                Utils.GetSafeInt32(reader, "SignupTypeId"));
            group.Status = DomainModel.TourStates.GetById(
                Utils.GetSafeInt32(reader, "StateTypeId"));
            group.IsDirty = false;

            Entities.Tour tour = (Entities.Tour)userData;
            tour.Groups.Add(group);
        }
コード例 #21
0
ファイル: TourCosts.cs プロジェクト: HamedMousavi/BreweryTax
        protected void MapCostToObject(SqlDataReader reader, object userData)
        {
            Entities.TourCostDetail cost = new Entities.TourCostDetail();

            cost.Id                = Utils.GetSafeInt32(reader, "CostId");
            cost.SignUpCount       = Utils.GetSafeInt32(reader, "SignUpCount");
            cost.ParticipantsCount = Utils.GetSafeInt32(reader, "ParticipantCount");
            cost.CostGroup         = DomainModel.TourCostGroups.GetById(
                Utils.GetSafeInt32(reader, "CostGroupId"));
            cost.IsDirty = false;

            Entities.Tour tour = (Entities.Tour)userData;
            //tour.CostDetails.Add(cost);
        }
コード例 #22
0
ファイル: Tours.cs プロジェクト: HamedMousavi/BreweryTax
        internal static Entities.TourGroup AddGroup(Entities.Tour tour)
        {
            Entities.TourGroup group = new Entities.TourGroup();
            group.Status     = DomainModel.TourStates.GetByIndex(0);
            group.SignUpType = DomainModel.SignUpTypes.GetByIndex(0);
            tour.Groups.Add(group);

            if (!DomainModel.TourGroups.Save(tour))
            {
                tour.Groups.Remove(group);
                return(null);
            }

            return(group);
        }
コード例 #23
0
        protected void MapPaymentToObject(SqlDataReader reader, object userData)
        {
            Entities.TourPayment payment = new Entities.TourPayment();

            payment.Id   = Utils.GetSafeInt32(reader, "PaymentId");
            payment.Type = DomainModel.PaymentTypes.GetById(
                Utils.GetSafeInt32(reader, "PaymentTypeId"));
            payment.Amount.Value    = Utils.GetSafeDecimal(reader, "AmountValue");
            payment.Amount.Currency = DomainModel.Currencies.GetById(
                Utils.GetSafeInt32(reader, "AmountUnitId"));
            payment.IsDirty = false;

            Entities.Tour tour = (Entities.Tour)userData;
            //tour.Payments.Add(payment);
        }
コード例 #24
0
        private TourControl FindInClients(Entities.Tour tour)
        {
            foreach (UserControl ctrl in this.flpTours.Controls)
            {
                TourControl grpCtrl = ctrl as TourControl;
                if (grpCtrl != null)
                {
                    if (grpCtrl.Tour == tour)
                    {
                        return(grpCtrl);
                    }
                }
            }

            return(null);
        }
コード例 #25
0
        protected void MapTourToObject(SqlDataReader reader, object userData)
        {
            Entities.TourCollection tours = (Entities.TourCollection)userData;
            Entities.Tour           tour  = new Entities.Tour();

            tour.Id         = Utils.GetSafeInt32(reader, "TourId");
            tour.Time.Value = Utils.GetSafeDateTime(reader, "TourTime", DateTime.Now);
            tour.Comments   = Utils.GetSafeString(reader, "Comments");

            if (tour.Time != null)
            {
                tour.Time.IsDirty = false;
            }
            tour.IsDirty = false;

            tours.Add(tour);
        }
コード例 #26
0
ファイル: TourCosts.cs プロジェクト: HamedMousavi/BreweryTax
 internal static void Load(Entities.Tour tour)
 {
     try
     {
         repo.GetByTour(tour);
     }
     catch (Exception ex)
     {
         try
         {
             DomainModel.Application.Status.Update(
                 StatusController.Abstract.StatusTypes.Error,
                 "",
                 ex.Message);
         }
         catch { }
     }
 }
コード例 #27
0
        private async Task <IActionResult> AddSpecificTour <T>(T tour)
        {
            if (tour == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(UnprocessableEntity(new CustomizedValidationResult(ModelState)));
            }

            Entities.Tour tourEntity = null;

            try
            {
                tourEntity = Mapper.Map <Entities.Tour>(tour);
            }
            catch (Exception ex)
            {
                var e = ex.ToString();
            }

            if (tourEntity.ManagerId == null || tourEntity.ManagerId == Guid.Empty)
            {
                if (!Guid.TryParse(_userInfoService.UserId, out Guid userId))
                {
                    return(BadRequest());
                }

                tourEntity.ManagerId = userId;
            }

            await _tourManagementRepository.AddTour(tourEntity);

            if (await _tourManagementRepository.SaveAsync())
            {
                return(CreatedAtRoute("GetTour", new { tourId = tourEntity.TourId }, Mapper.Map <Dtos.Tour>(tourEntity)));
            }
            else
            {
                throw new Exception("The creation of the tour failed");
            }
        }
コード例 #28
0
ファイル: TourCosts.cs プロジェクト: HamedMousavi/BreweryTax
        internal bool Update(Entities.Tour tour, Entities.TourCostDetail cost)
        {
            bool res = false;

            try
            {
                if (cost.Id < 0)
                {
                    DomainModel.Application.Status.Update(
                        StatusTypes.Warning,
                        "stat_wrn_db_id_not_exists");
                    return(true);
                }

                this.query.Parameters.Clear();

                this.query.Parameters.Add(new SqlParameter("@SignUpCount", cost.SignUpCount));
                this.query.Parameters.Add(new SqlParameter("@ParticipantCount", cost.ParticipantsCount));
                this.query.Parameters.Add(new SqlParameter("@CostGroupId", cost.CostGroup.Id));
                this.query.Parameters.Add(new SqlParameter("@CostId", cost.Id));
                this.query.Parameters.Add(new SqlParameter("@TourId", tour.Id));


                int affected;
                res = this.query.ExecuteUpdateProc("TourCostUpdateById", out affected);
            }
            catch (Exception ex)
            {
                try
                {
                    DomainModel.Application.Status.Update(
                        StatusController.Abstract.StatusTypes.Error,
                        "",
                        ex.Message);
                }
                catch { }
            }

            return(res);
        }
コード例 #29
0
        internal bool Update(Entities.Tour tour, Entities.TourPayment pay)
        {
            bool res = false;

            try
            {
                if (pay.Id < 0)
                {
                    DomainModel.Application.Status.Update(
                        StatusTypes.Warning,
                        "stat_wrn_db_id_not_exists");
                    return(true);
                }

                this.query.Parameters.Clear();

                this.query.Parameters.Add(new SqlParameter("@PaymentTypeId", pay.Type.Id));
                this.query.Parameters.Add(new SqlParameter("@AmountValue", pay.Amount.Value));
                this.query.Parameters.Add(new SqlParameter("@AmountUnitId", pay.Amount.Currency.Id));
                this.query.Parameters.Add(new SqlParameter("@PaymentId", pay.Id));
                this.query.Parameters.Add(new SqlParameter("@TourId", tour.Id));


                int affected;
                res = this.query.ExecuteUpdateProc("TourPaymentUpdateById", out affected);
            }
            catch (Exception ex)
            {
                try
                {
                    DomainModel.Application.Status.Update(
                        StatusController.Abstract.StatusTypes.Error,
                        "",
                        ex.Message);
                }
                catch { }
            }

            return(res);
        }
コード例 #30
0
ファイル: TourCosts.cs プロジェクト: HamedMousavi/BreweryTax
        public static bool Save(Entities.Tour tour)
        {
            bool res = true;

            /*
             * foreach (Entities.TourCostDetail cost in tour.CostDetails)
             * {
             *  if (cost.IsDirty)
             *  {
             *      if (cost.Id < 0)
             *      {
             *          if (!(res = repo.Insert(tour, cost))) break;
             *      }
             *      else
             *      {
             *          if (!(res = repo.Update(tour, cost))) break;
             *      }
             *  }
             * }*/

            return(res);
        }