Exemple #1
0
        private void SaveMovementStep(Education_MovementType currentMovement, int index, int idTag)
        {
            Education_MovementStep education_MovementStep;
            TextBox tbWhoDyn     = new TextBox();
            TextBox tbActionDyn  = new TextBox();
            TextBox tbSupportDyn = new TextBox();
            bool    isNewRecord  = true;

            if (idTag > 0)
            {
                isNewRecord = false;
            }
            if (index > 1)
            {
                foreach (Control ctrl in this.tabEditSteps.Controls)
                {
                    if (ctrl is Panel)
                    {
                        foreach (Control ctrlOfPanel in ctrl.Controls)
                        {
                            if (ctrlOfPanel is TextBox)
                            {
                                if (ctrlOfPanel.Name == tbWhoStep.Name + "_" + index.ToString())
                                {
                                    tbWhoDyn = ctrlOfPanel as TextBox;
                                }

                                if (ctrlOfPanel.Name == tbAction.Name + "_" + index.ToString())
                                {
                                    tbActionDyn = ctrlOfPanel as TextBox;
                                }

                                if (ctrlOfPanel.Name == tbSupport.Name + "_" + index.ToString())
                                {
                                    tbSupportDyn = ctrlOfPanel as TextBox;
                                }
                            }
                        }
                    }
                }
                education_MovementStep = movementStepRepository
                                         .SaveMovementStep(CurrentMovement, idTag, tbWhoDyn.Text, tbActionDyn.Text, tbSupportDyn.Text, isNewRecord);
                if (education_MovementStep != null)
                {
                    currentMovement.Education_MovementStep.Add(education_MovementStep);
                }
            }
            else
            {
                education_MovementStep = movementStepRepository
                                         .SaveMovementStep(CurrentMovement, idTag, tbWhoStep.Text, tbAction.Text, tbSupport.Text, isNewRecord);
                if (education_MovementStep != null)
                {
                    currentMovement.Education_MovementStep.Add(education_MovementStep);
                }
            }
        }
Exemple #2
0
        private void LoadAllSteps(Education_MovementType currentMovement)
        {
            if (currentMovement.Education_MovementStep.Count > 0)
            {
                RemoveAllDynamicPanels();

                for (int i = 1; i < currentMovement.Education_MovementStep.Count + 1; i++)
                {
                    GeneratePanelStep(currentMovement.Education_MovementStep.ElementAt(i - 1), i);
                }
                panelStepItem.Visible = false;
            }
            else
            {
                RemoveAllDynamicPanels();
                panelStepItem.Visible = true;
            }
        }
        public Education_MovementType AddType(string text)
        {
            var itemdb = db.Education_MovementType.Where(x => x.MovementType_Name == text).FirstOrDefault();

            if (itemdb == null)
            {
                Education_MovementType newRecord = new Education_MovementType()
                {
                    MovementType_Name = text,
                };
                db.Education_MovementType.Add(newRecord);
                db.SaveChanges();
                return(newRecord);
            }
            else
            {
                return(null);
            }
        }