protected override void EditarConceptoAction()
        {
            if (Datos_Concepto.Current == null)
            {
                return;
            }

            BudgetLine cf = (BudgetLine)Datos_Concepto.Current;

            _cliente = Datos_Cliente.Current as ClienteInfo;

            if (cf.OidExpediente == 0)
            {
                BudgetLineEditForm form = new BudgetLineEditForm(ETipoProducto.Libres, _entity, _serie, _cliente, cf, this);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    _entity.CalculaTotal();
                    RefreshConceptos();
                }
            }
            else
            {
                BudgetLineEditForm form = new BudgetLineEditForm(ETipoProducto.Libres, _entity, _serie, _cliente, cf, this);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    _entity.CalculaTotal();
                    RefreshConceptos();
                }
            }
        }
        public BudgetLineEditForm(ETipoProducto productType, Budget budget, SerieInfo serie, ClienteInfo client, BudgetLine line, Form parent)
            : base(productType, budget, serie, client, parent)
        {
            InitializeComponent();

            _entity = line;

            RefreshMainData();
        }
예제 #3
0
        protected override void RefreshMainData()
        {
            _entity            = BudgetLine.NewChild(_budget);
            _entity.PImpuestos = _serie.PImpuesto;

            Datos.DataSource = _entity;
            PgMng.Grow();

            base.RefreshMainData();
        }
        protected override void SelectImpuestoLineaAction()
        {
            if (Datos_Concepto.Current == null)
            {
                return;
            }

            BudgetLine item = Datos_Concepto.Current as BudgetLine;

            ImpuestoSelectForm form = new ImpuestoSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ImpuestoInfo source = (ImpuestoInfo)form.Selected;

                item.OidImpuesto = source.Oid;
                item.PImpuestos  = source.Porcentaje;

                _entity.CalculaTotal();
            }
        }
        protected override void SelectExpedienteLineaAction()
        {
            if (Datos_Concepto.Current == null)
            {
                return;
            }

            BudgetLine item = Datos_Concepto.Current as BudgetLine;

            ExpedienteSelectForm form = new ExpedienteSelectForm(this);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ExpedientInfo source = (ExpedientInfo)form.Selected;

                item.OidExpediente = source.Oid;
                item.Expediente    = source.Codigo;

                //AddCacheItem(source);
            }
        }
예제 #6
0
파일: Lines.cs 프로젝트: valeriob/MyBudget
 public string CategoryNameFor(BudgetLine line)
 {
     return Categories.Where(r => r.Id == line.Category).Select(s => s.Name).First();
 }
예제 #7
0
파일: Lines.cs 프로젝트: valeriob/MyBudget
 public string CategoryNameFor(BudgetLine line)
 {
     return(Categories.Where(r => r.Id == line.Category).Select(s => s.Name).First());
 }
예제 #8
0
        public static void Initialize(CCDPlannerDBContext context)
        {
            //context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            if (true)
            {
                Project project1 = new Project()
                {
                    ProjectId = Guid.NewGuid(),
                    Name      = "Griesser",
                    Sponsor   = "Griesser Sales",
                    Budget    = "100.000",
                    StartDate = DateTime.Now
                };

                Project project2 = new Project()
                {
                    ProjectId = Guid.NewGuid(),
                    Name      = "Valooze",
                    Sponsor   = "Valooze Sales",
                    Budget    = "200.000",
                    StartDate = DateTime.Now
                };

                Project project3 = new Project()
                {
                    ProjectId = Guid.NewGuid(),
                    Name      = "DoojZ",
                    Sponsor   = "DoojZ Sales",
                    Budget    = "1.000.000",
                    StartDate = DateTime.Now
                };

                BudgetCategory bc1 = new BudgetCategory()
                {
                    BudgetCategoryId = Guid.NewGuid(),
                    Description      = "Infrastructure"
                };

                BudgetCategory bc11 = new BudgetCategory()
                {
                    BudgetCategoryId = Guid.NewGuid(),
                    Description      = "Rent",
                    ParentCategoryId = bc1.BudgetCategoryId
                };

                BudgetCategory bc12 = new BudgetCategory()
                {
                    BudgetCategoryId = Guid.NewGuid(),
                    Description      = "Phone",
                    ParentCategoryId = bc1.BudgetCategoryId
                };

                BudgetCategory bc121 = new BudgetCategory()
                {
                    BudgetCategoryId = Guid.NewGuid(),
                    Description      = "Business Phone",
                    ParentCategoryId = bc12.BudgetCategoryId
                };

                BudgetCategory bc122 = new BudgetCategory()
                {
                    BudgetCategoryId = Guid.NewGuid(),
                    Description      = "Private Phone",
                    ParentCategoryId = bc12.BudgetCategoryId
                };

                BudgetCategory bc1221 = new BudgetCategory()
                {
                    BudgetCategoryId = Guid.NewGuid(),
                    Description      = "Private Phone Euro",
                    ParentCategoryId = bc122.BudgetCategoryId
                };

                BudgetCategory bc1222 = new BudgetCategory()
                {
                    BudgetCategoryId = Guid.NewGuid(),
                    Description      = "Private Phone Dollars",
                    ParentCategoryId = bc122.BudgetCategoryId
                };

                BudgetCategory bc2 = new BudgetCategory()
                {
                    BudgetCategoryId = Guid.NewGuid(),
                    Description      = "Activites"
                };

                BudgetCategory bc21 = new BudgetCategory()
                {
                    BudgetCategoryId = Guid.NewGuid(),
                    Description      = "Seminar",
                    ParentCategoryId = bc2.BudgetCategoryId
                };

                BudgetCategory bc22 = new BudgetCategory()
                {
                    BudgetCategoryId = Guid.NewGuid(),
                    Description      = "Online Show",
                    ParentCategoryId = bc2.BudgetCategoryId
                };


                ProjectBudgetCategory pbc1 = context.ProjectBudgetCategories.Where(pbc => pbc.BudgetCategory.Description == "Business Phone").FirstOrDefault();


                //context.Add(pbc1);
                //context.Add(new ProjectBudgetCategory { Project = project1, BudgetCategory = bc11 });
                //context.Add(new ProjectBudgetCategory { Project = project1, BudgetCategory = bc12 });
                //context.Add(new ProjectBudgetCategory { Project = project1, BudgetCategory = bc2 });
                //context.Add(new ProjectBudgetCategory { Project = project1, BudgetCategory = bc21 });
                //context.Add(new ProjectBudgetCategory { Project = project1, BudgetCategory = bc22 });
                //context.Add(new ProjectBudgetCategory { Project = project1, BudgetCategory = bc121 });
                //context.Add(new ProjectBudgetCategory { Project = project1, BudgetCategory = bc122 });
                //context.Add(new ProjectBudgetCategory { Project = project1, BudgetCategory = bc1221 });
                //context.Add(new ProjectBudgetCategory { Project = project1, BudgetCategory = bc1222 });

                //context.Add(new ProjectBudgetCategory { Project = project2, BudgetCategory = bc1 });
                //context.Add(new ProjectBudgetCategory { Project = project2, BudgetCategory = bc11 });
                //context.Add(new ProjectBudgetCategory { Project = project2, BudgetCategory = bc12 });
                //context.Add(new ProjectBudgetCategory { Project = project2, BudgetCategory = bc2 });
                //context.Add(new ProjectBudgetCategory { Project = project2, BudgetCategory = bc21 });
                //context.Add(new ProjectBudgetCategory { Project = project2, BudgetCategory = bc22 });
                //context.Add(new ProjectBudgetCategory { Project = project2, BudgetCategory = bc121 });
                //context.Add(new ProjectBudgetCategory { Project = project2, BudgetCategory = bc122 });

                //context.Add(new ProjectBudgetCategory { Project = project3, BudgetCategory = bc1 });
                //context.Add(new ProjectBudgetCategory { Project = project3, BudgetCategory = bc11 });
                //context.Add(new ProjectBudgetCategory { Project = project3, BudgetCategory = bc12 });
                //context.Add(new ProjectBudgetCategory { Project = project3, BudgetCategory = bc2 });
                //context.Add(new ProjectBudgetCategory { Project = project3, BudgetCategory = bc121 });
                //context.Add(new ProjectBudgetCategory { Project = project3, BudgetCategory = bc122 });



                BudgetLine bl1 = new BudgetLine()
                {
                    Descriptioin          = "Phone costs for Edin Dujso",
                    Unit                  = "Month",
                    NumberOfUnits         = 12,
                    CostPerUnit           = 50,
                    TotalCost             = "600",
                    ProjectBudgetCategory = pbc1
                };

                context.Add(bl1);

                context.SaveChanges();
            }
        }
        public bool Post([FromBody] BudgetDTO data)
        {
            if (data != null)
            {
                Budget budget = Budget.NewBudget();
                if (data.BudgetID > 0)
                {
                    budget = Budget.GetByBudgetID(data.BudgetID);
                }
                else
                {
                    budget.CreatedOn = DateTime.Now;
                    budget.CreatedBy = CurrentUserID;
                }

                data.CopyDTO(budget);
                if (budget.IsNew)
                {
                    budget.IsActive = true;
                }
                else
                {
                    if (budget.IsDirty)
                    {
                        budget.UpdatedOn = DateTime.Now;
                        budget.UpdatedBy = CurrentUserID;
                    }
                }

                foreach (BudgetLineDTO dataBudgetLine in data.BudgetLines)
                {
                    BudgetLine budgetLine =
                        budget.BudgetLines.FirstOrDefault(x => x.BudgetLineID == dataBudgetLine.BudgetLineID);
                    if (budgetLine == null)
                    {
                        budgetLine           = BudgetLine.NewBudgetLine();
                        budgetLine.CreatedOn = DateTime.Now;
                        budgetLine.CreatedBy = CurrentUserID;
                        budget.BudgetLines.Add(budgetLine);
                    }

                    dataBudgetLine.CopyDTO(budgetLine);
                    if (budgetLine.IsNew)
                    {
                        budgetLine.IsActive = true;
                    }
                    else
                    {
                        if (budgetLine.IsDirty)
                        {
                            budgetLine.UpdatedOn = DateTime.Now;
                            budgetLine.UpdatedBy = CurrentUserID;
                        }
                    }
                }

                budget.Save();
                return(true);
            }


            return(false);
        }