示例#1
0
        private void toolBar_btnEdit_Click(object sender)
        {
            project_event_template project_event_template = template_designerDataGrid.SelectedValue as project_event_template;

            project_event_template.IsSelected = true;
            project_event_template.State      = EntityState.Modified;
        }
示例#2
0
        //private void project_costingDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        //{
        //    project_event project_costing = project_costingViewSource.View.CurrentItem as project_event;
        //    if (project_costing != null && project_costing.contact != null)
        //        contactComboBox.Text = project_costing.contact.name;
        //    else
        //        contactComboBox.Text = string.Empty;
        //    EstimateCost();
        //}

        private void id_template_designerComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (id_template_designerComboBox.SelectedItem != null)
            {
                project_event_template template_designer = id_template_designerComboBox.SelectedItem as project_event_template;
                itemViewSource.Source = EventDB.items.Where(x => EventDB.item_tag_detail.Where(y => y.id_tag == template_designer.id_tag).Select(z => z.id_item).Contains(x.id_item) && x.is_active).ToList();
            }
        }
示例#3
0
 private void toolBar_btnDelete_Click(object sender)
 {
     if (MessageBox.Show("Are you sure want to Delete?", "Cognitivo", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
     {
         project_event_template project_event_template = template_designerViewSource.View.CurrentItem as project_event_template;
         project_event_template.is_active = false;
         toolBar_btnSave_Click(sender);
         template_designerViewSource.View.Refresh();
     }
 }
示例#4
0
        private void toolBar_btnNew_Click(object sender)
        {
            project_event_template project_event_template = new project_event_template();

            project_event_template.IsSelected = true;
            project_event_template.State      = EntityState.Added;

            ProjectTemplateDB.project_event_template.Add(project_event_template);
            template_designerViewSource.View.MoveCurrentToLast();
        }
示例#5
0
        private void GetServices(object sender, RoutedEventArgs e)
        {
            toolBar_btnSave_Click(sender);
            toolBar_btnEdit_Click(sender);

            if (project_costingViewSource != null)
            {
                project_event project_event = project_costingViewSource.View.CurrentItem as project_event;
                //if (project_event.project_event_fixed.Count()==0)
                //{


                if (project_event != null && id_template_designerComboBox.SelectedItem != null)
                {
                    project_event_template project_event_template = id_template_designerComboBox.SelectedItem as project_event_template;
                    if (project_event_template.project_event_template_variable != null && project_event_template.project_event_template_variable.Count > 0)
                    {
                        // EventDB.project_event_variable.RemoveRange(project_event.project_event_variable);
                        foreach (project_event_template_variable person_service in project_event_template.project_event_template_variable)
                        {
                            item_tag item_tag = person_service.item_tag;
                            foreach (item_tag_detail tag_detail in item_tag.item_tag_detail)
                            {
                                if (tag_detail.item.is_active)
                                {
                                    if (project_event.project_event_variable.Where(x => x.id_item == tag_detail.item.id_item).Any())
                                    {
                                        project_event_variable project_event_variable = project_event.project_event_variable.Where(x => x.id_item == tag_detail.item.id_item).FirstOrDefault();
                                        project_event_variable.adult_consumption = person_service.adult_consumption * project_event.quantity_adult;
                                        project_event_variable.child_consumption = person_service.child_consumption * project_event.quantity_child;
                                    }
                                    else
                                    {
                                        project_event_variable project_event_variable = new project_event_variable();
                                        project_event_variable.item              = tag_detail.item;
                                        project_event_variable.id_item           = tag_detail.id_item;
                                        project_event_variable.item_tag          = tag_detail.item_tag;
                                        project_event_variable.id_tag            = tag_detail.id_tag;
                                        project_event_variable.adult_consumption = person_service.adult_consumption * project_event.quantity_adult;
                                        project_event_variable.child_consumption = person_service.child_consumption * project_event.quantity_child;
                                        project_event_variable.is_included       = false;
                                        project_event.project_event_variable.Add(project_event_variable);
                                    }
                                }
                            }
                        }
                        project_costingproject_event_template_variable_detailsViewSource.View.Refresh();
                    }
                }

                if (project_event != null && id_template_designerComboBox.SelectedItem != null)
                {
                    project_event_template project_event_template = id_template_designerComboBox.SelectedItem as project_event_template;
                    if (project_event_template.project_event_template_fixed != null && project_event_template.project_event_template_fixed.Count > 0)
                    {
                        // EventDB.project_event_fixed.RemoveRange(project_event.project_event_fixed);
                        foreach (project_event_template_fixed project_event_template_fixed in project_event_template.project_event_template_fixed)
                        {
                            item_tag item_tag = project_event_template_fixed.item_tag;
                            foreach (item_tag_detail tag_detail in item_tag.item_tag_detail)
                            {
                                if (tag_detail.item.is_active)
                                {
                                    if (project_event.project_event_fixed.Where(x => x.id_item == tag_detail.item.id_item).Any())
                                    {
                                        project_event_fixed services_per_event_details = project_event.project_event_fixed.Where(x => x.id_item == tag_detail.item.id_item).FirstOrDefault();

                                        services_per_event_details.consumption = services_per_event_details.consumption;
                                    }
                                    else
                                    {
                                        project_event_fixed services_per_event_details = new project_event_fixed();
                                        services_per_event_details.item        = tag_detail.item;
                                        services_per_event_details.id_item     = tag_detail.id_item;
                                        services_per_event_details.item_tag    = tag_detail.item_tag;
                                        services_per_event_details.id_tag      = tag_detail.id_tag;
                                        services_per_event_details.consumption = 1;
                                        services_per_event_details.is_included = false;
                                        project_event.project_event_fixed.Add(services_per_event_details);
                                    }
                                }
                            }
                        }
                        project_costingservices_per_event_detailsViewSource.View.Refresh();
                    }
                }
                //}
                EstimateCost();
            }
        }