Ejemplo n.º 1
0
 private void cbSections_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Model.Sections sec = (Model.Sections)((ComboBox)sender).SelectedItem;
     expQuestion.Header       = string.Empty;
     expQuestion.Content      = null;
     expQuestion.IsEnabled    = false;
     cbQuestions.SelectedItem = null;
     cbQuestions.ItemsSource  = model.Questions.Where(p => p.SectionId == sec.SectionId && p.IsDeleted == false).ToList();
 }
Ejemplo n.º 2
0
 private void cbSections_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     Model.Sections sec = (Model.Sections)((ComboBox)sender).SelectedItem;
     cbQuestions.ItemsSource = model.Questions.Where(p => p.SectionId == sec.SectionId && p.IsDeleted == false).ToList();
     if (cbQuestions.Items.Count > 0)
     {
         cbQuestions.SelectedItem = cbQuestions.Items.GetItemAt(0);
     }
 }
Ejemplo n.º 3
0
        public List <FAMA.AP.Model.Sections> SelectAll()
        {
            SqlConnection con = null;
            DataSet       ds  = null;
            List <FAMA.AP.Model.Sections> sectionList = null;

            try
            {
                con = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConn"].ToString());
                SqlCommand cmd = new SqlCommand("PR_AP_SEL_SECTIONS", con);

                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = cmd;

                ds = new DataSet();
                da.Fill(ds);
                sectionList = new List <FAMA.AP.Model.Sections>();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    FAMA.AP.Model.Sections sobj = new Model.Sections();
                    sobj.idActiveSections = int.Parse(ds.Tables[0].Rows[i]["idActiveSections"].ToString());
                    sobj.active           = Convert.ToBoolean(ds.Tables[0].Rows[i]["bActive"].ToString());
                    sectionList.Add(sobj);
                }
                System.Console.WriteLine(sectionList);
                return(sectionList);
            }

            catch (Exception ex)
            {
                System.Console.WriteLine(ex);
                return(sectionList);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }
Ejemplo n.º 4
0
        public FAMA.AP.Model.Sections SelectSectionById(int idSection)
        {
            SqlConnection con = null;
            DataSet       ds  = null;

            FAMA.AP.Model.Sections sobj = new Model.Sections();
            try
            {
                con = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConn"].ToString());
                SqlCommand cmd = new SqlCommand("PR_AP_SEL_SECTIONS_BY_ID", con);
                cmd.CommandType = CommandType.StoredProcedure;
                con.Open();
                cmd.Parameters.AddWithValue("@idSection", idSection);

                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = cmd;
                ds = new DataSet();
                da.Fill(ds);

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    sobj.idActiveSections = int.Parse(ds.Tables[0].Rows[i]["idActiveSections"].ToString());
                    sobj.idProcessType    = int.Parse(ds.Tables[0].Rows[i]["idProcessType"].ToString());
                    sobj.idProcess        = int.Parse(ds.Tables[0].Rows[i]["idProcess"].ToString());
                    sobj.name             = ds.Tables[0].Rows[i]["Section"].ToString();
                    sobj.active           = Convert.ToBoolean(ds.Tables[0].Rows[i]["bActive"].ToString());
                }
                return(sobj);
            }
            catch (Exception ex)
            {
                System.Console.WriteLine(ex);
                return(sobj);
            }
            finally
            {
                con.Close();
                con.Dispose();
            }
        }