Esempio n. 1
0
 public StudentViewModel()
 {
     Name            = "";
     Study           = "";
     Attributes      = "";
     StudyAttributes = "";
     SeeksGroup      = true;
     Neighbors       = "";
     AllNodes        = StudentGraph.GetAll();
 }
        public ActionResult Create(StudentViewModel studentViewModel)
        {
            if (StudentGraph.Students.Contains(studentViewModel.ToStudent().Name))
            {
                ModelState.AddModelError("Name", "Det angivne navn findes allerede.");
                return(View());
            }

            StudentGraph.Add(studentViewModel.ToStudentNode());
            return(RedirectToAction("Index"));
        }
 public ActionResult Details(string name)
 {
     return(View(StudentGraph.Get(name)));
 }
 // GET: Student
 public ActionResult Index()
 {
     return(View(StudentGraph.GetAll()));
 }
        public StudentGraph GetStudentGraph(int cId)
        {
            try
            {
                using (SqlConnection con = new SqlConnection(strcon))
                {
                    string         strcmd = "select c_first_name,c_last_name,c_middle_Name,c_age_years,c_username,c_email_id from tbl_candidate_master where c_id = " + cId;
                    SqlDataAdapter sda    = new SqlDataAdapter(strcmd, con);
                    con.Open();
                    DataSet ds = new DataSet();
                    sda.Fill(ds);
                    StudentGraph SG = new StudentGraph();
                    SG.name        = ds.Tables[0].Rows[0][0].ToString() + " " + ds.Tables[0].Rows[0][2].ToString() + " " + ds.Tables[0].Rows[0][1].ToString();
                    SG.UserName    = ds.Tables[0].Rows[0][4].ToString();
                    SG.CandEmailID = ds.Tables[0].Rows[0][5].ToString();
                    SG.CandAge     = Convert.ToInt32(ds.Tables[0].Rows[0][3]);
                    int id = GD.get_values_maintest(cId);

                    BlueM  = GD.BLUEM;
                    BlueL  = GD.BLUEL;
                    RedM   = GD.REDM;
                    BlackM = GD.BLACKM;
                    RedL   = GD.REDL;
                    BlackL = GD.BLACKL;
                    GreenM = GD.GREENM;
                    GreenL = GD.GREENL;
                    Hole   = GD.HOLE;

                    DiffB  = BlueM - BlueL;
                    DiffR  = RedM - RedL;
                    DiffBl = BlackM - BlackL;
                    DiffG  = GreenM - GreenL;

                    SG.lblBM     = Convert.ToString(BlueM);
                    SG.lblBL     = Convert.ToString(BlueL);
                    SG.lblRM     = Convert.ToString(RedM);
                    SG.lblRL     = Convert.ToString(RedL);
                    SG.lblBlM    = Convert.ToString(BlackM);
                    SG.lblBlL    = Convert.ToString(BlackL);
                    SG.lblGM     = Convert.ToString(GreenM);
                    SG.lblGL     = Convert.ToString(GreenL);
                    SG.lblDiffB  = Convert.ToString(DiffB);
                    SG.lblDiffR  = Convert.ToString(DiffR);
                    SG.lblDiffBl = Convert.ToString(DiffBl);
                    SG.lblDiffG  = Convert.ToString(DiffG);
                    SG.lblTotal  = Convert.ToString(Hole);

                    //  CreateChart1();
                    /////////////////// het function in side///

                    GD.set_values_maintest();

                    BlueM  = GD.DM;
                    RedM   = GD.IM;
                    BlackM = GD.SM;
                    GreenM = GD.CM;

                    //RAPD GRAPH 1 information
                    SG.R1 = BlueM;
                    SG.A1 = RedM;
                    SG.P1 = BlackM;
                    SG.D1 = GreenM;


                    GD.set_values_maintest();

                    BlueL  = GD.DL;
                    RedL   = GD.IL;
                    BlackL = GD.SL;
                    GreenL = GD.CL;

                    //RAPD GRAPH 2 information

                    SG.R2 = BlueL;
                    SG.A2 = RedL;
                    SG.P2 = BlackL;
                    SG.D2 = GreenL;

                    GD.set_values_maintest();
                    DiffB  = GD.DD;
                    DiffR  = GD.ID;
                    DiffBl = GD.SD;
                    DiffG  = GD.CD;

                    //RAPD GRAPH 3 information
                    SG.R3 = DiffB;
                    SG.A3 = DiffR;
                    SG.P3 = DiffBl;
                    SG.D3 = DiffG;


                    String StrSql = "";
                    StrSql = "SELECT * FROM tbl_candidate_RAPD_Score WHERE c_id='" + cId + "'";
                    SqlCommand    cmd1 = new SqlCommand(StrSql, con);
                    SqlDataReader sdr  = cmd1.ExecuteReader();
                    if (sdr.HasRows)
                    {
                        sdr.Close();
                        StrSql = "INSERT INTO tbl_candidate_RAPD_Score VALUES ( " + cId + "," + DiffB + ", " + DiffR + "," + DiffBl + "," + DiffG + ")";
                        SqlCommand cmd2 = new SqlCommand(StrSql, con);
                        int        i    = cmd2.ExecuteNonQuery();
                        //cccc++;
                    }
                    else
                    {
                        sdr.Close();
                        StrSql = "update tbl_candidate_RAPD_Score set Rscore=" + DiffB + ", Ascore=" + DiffR + ",Pscore=" + DiffBl + ",Dscore=" + DiffG + " where c_id=" + cId;
                        SqlCommand cmd3 = new SqlCommand(StrSql, con);
                        int        i    = cmd3.ExecuteNonQuery();
                    }
                    return(SG);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                return(null);
            }
        }
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     StudentGraph.Load();
 }