Ejemplo n.º 1
0
 private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (project_costingproject_event_template_variable_detailsViewSource != null)
     {
         if (project_costingproject_event_template_variable_detailsViewSource.View != null)
         {
             project_costingproject_event_template_variable_detailsViewSource.View.Filter = i =>
             {
                 project_event_variable project_event_variable = (project_event_variable)i;
                 if (project_event_variable.item.name.ToUpper().Contains(txtsearch.Text.ToUpper()) || project_event_variable.item_tag.name.ToUpper().Contains(txtsearch.Text.ToUpper()))
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             };
         }
     }
 }
Ejemplo n.º 2
0
        private void item_Select(object sender, RoutedEventArgs e)
        {
            if (sbxItem.ItemID > 0)
            {
                if (project_costingViewSource != null)
                {
                    project_event project_event = project_costingViewSource.View.CurrentItem as project_event;

                    item item = EventDB.items.Where(x => x.id_item == sbxItem.ItemID).FirstOrDefault();
                    project_event_variable project_event_variable = new project_event_variable();
                    project_event_variable.is_included = true;
                    project_event_variable.item        = item;
                    project_event_variable.id_item     = item.id_item;

                    if (item.item_tag_detail.Count() > 0)
                    {
                        if (item.item_tag_detail.FirstOrDefault().item_tag != null)
                        {
                            project_event_variable.item_tag = item.item_tag_detail.FirstOrDefault().item_tag;
                            project_event_variable.id_tag   = item.item_tag_detail.FirstOrDefault().item_tag.id_tag;
                        }
                    }
                    else
                    {
                        toolBar.msgWarning("Item needs Tag");
                        return;
                    }

                    project_event_variable.adult_consumption = 1;
                    project_event_variable.child_consumption = 1;
                    project_event_variable.is_included       = false;
                    project_event.project_event_variable.Add(project_event_variable);
                }
                project_costingproject_event_template_variable_detailsViewSource.View.Refresh();
                toolBar_btnSave_Click(sender);
                toolBar_btnEdit_Click(sender);
                EstimateCost();
            }
        }
Ejemplo n.º 3
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();
            }
        }