Ejemplo n.º 1
0
        public Addfac()
        {
            fac    = new Faculty();
            acc    = new Account();
            ass    = new Assignment();
            stumng = new Studmng();
            facmng = new Facmng();
            accmng = new Accmng();
            images = new Images();
            InitializeComponent();

            cmbxgen.DataSource = facmng.gender();
            cmbxqua.DataSource = facmng.qualification();
            if (accmng.readkey() != null)
            {
                fac = facmng.get(Convert.ToInt32(accmng.readkey()));
                if (fac == null)
                {
                    throw new Exception("Access Denied");
                }
                else
                {
                    facmng.Email(Convert.ToInt32(accmng.readkey()));
                    string[] a = accmng.annoucements().Split('\n');
                    foreach (string s in a)
                    {
                        listBox2.Items.Add(s);
                    }
                    panel6.Visible = false;
                    phome.Visible  = true;
                    acc            = accmng.getfacpass(Convert.ToInt32(accmng.readkey()));
                    FillForm(fac, acc);
                    comboBox1.DataSource        = facmng.studentids(Convert.ToInt32(accmng.readkey()));
                    dataGridView1.DataSource    = facmng.getAll(Convert.ToInt32(accmng.readkey()));
                    dtmarks.DataSource          = facmng.getmarks(Convert.ToInt32(accmng.readkey()));
                    dtmarks.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                    dtmarks.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.AllCells;
                    ass = facmng.getassign(Convert.ToInt32(accmng.readkey()));
                    if (ass != null)
                    {
                        lblnote.Text      = "Assignment Uploaded";
                        btnsubmit.Enabled = false;
                        btndelete.Enabled = true;
                        Fillexistassign(ass);
                    }
                    else if (ass == null)
                    {
                        lblnote.Text      = "Assignment Not Uploaded";
                        btnsubmit.Enabled = true;
                        btnbrowse.Enabled = true;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public Addmain()
        {
            ad       = new Admin();
            accmng   = new Accmng();
            facmng   = new Facmng();
            ad       = new Admin();
            acc      = new Account();
            images   = new Images();
            adminmng = new Adminmng();
            InitializeComponent();
            if (accmng.readkey() != null)
            {
                ad = adminmng.get(Convert.ToInt32(accmng.readkey()));
                if (ad == null)
                {
                    throw new Exception("Access Denied");
                }
                else
                {
                    if (ad.ID.Equals(Convert.ToInt32(accmng.readkey())))
                    {
                        acc = accmng.getadminpass(Convert.ToInt32(accmng.readkey()));

                        string[] a = accmng.annoucements().Split('\n');
                        foreach (string s in a)
                        {
                            listBox1.Items.Add(s);
                        }

                        panel1.Visible = false;

                        phome.Visible                     = true;
                        dataGridView1.DataSource          = adminmng.getprogram();
                        dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                        dataGridView1.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.AllCells;
                        dataGridView2.DataSource          = adminmng.getcourse();
                        dataGridView2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                        dataGridView2.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.AllCells;
                        dataGridView3.DataSource          = adminmng.getStudent();
                        comboBox1.DataSource              = adminmng.teachernames();
                        FillForm(ad, acc);
                    }
                    else
                    {
                        throw new Exception("Access Denied");
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public Addstu()
        {
            stu    = new Student();
            facmng = new Facmng();
            stumng = new Studmng();
            accmng = new Accmng();
            images = new Images();
            InitializeComponent();

            cmbxgen.DataSource = facmng.gender();
            if (accmng.readkey() != null)
            {
                stu = stumng.get(Convert.ToInt32(accmng.readkey()));
                if (stu.ID.Equals(Convert.ToInt32(accmng.readkey())))
                {
                    string[] a = accmng.annoucements().Split('\n');
                    foreach (string s in a)
                    {
                        listBox1.Items.Add(s);
                    }

                    panel6.Visible = false;
                    phome.Visible  = true;
                    acc            = accmng.getstupass(Convert.ToInt32(accmng.readkey()));
                    FillForm(stu, acc);
                    comboBox1.DataSource              = stumng.teachernames(Convert.ToInt32(accmng.readkey()));
                    comboBox2.DataSource              = stumng.teachernames(Convert.ToInt32(accmng.readkey()));
                    dataGridView1.DataSource          = stumng.getcourse(Convert.ToInt32(accmng.readkey()));
                    dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                    dataGridView1.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.AllCells;
                }
                else
                {
                    throw new Exception("Access Denied");
                }
            }
        }
Ejemplo n.º 4
0
        public void Scan(string email, string apiKey)
        {
            Facmng mng    = new Facmng();
            Accmng accmng = new Accmng();
            string path   = @"E:\cscolor\result.txt";
            var    file   = File.CreateText(path);

            file.Close();
            StreamWriter sw = new StreamWriter(path);

            CopyleaksCloud   copyleaks = new CopyleaksCloud(eProduct.Businesses);
            CopyleaksProcess createdProcess;
            ProcessOptions   scanOptions = new ProcessOptions();

            scanOptions.SandboxMode = true; // Sandbox mode --> Read more https://api.copyleaks.com/documentation/headers/sandbox
            ResultRecord[] results;
            try
            {
                #region Login to Copyleaks cloud

                //Console.Write("Login to Copyleaks cloud...");
                copyleaks.Login(email, apiKey);
                //Console.WriteLine("Done!");

                #endregion

                #region Checking account balance

                //Console.Write("Checking account balance...");
                uint creditsBalance = copyleaks.Credits;
                //Console.WriteLine("Done ({0} credits)!", creditsBalance);
                if (!scanOptions.SandboxMode && creditsBalance == 0)
                {
                    MessageBox.Show("ERROR: You do not have enough credits to complete this scan. Your balance is {0}).", Convert.ToString(creditsBalance));

                    Environment.Exit(2);
                }

                #endregion

                #region callbacks

                // add a URL address to get notified using callbacks once the scan results are ready.
                //Read more https://api.copyleaks.com/documentation/headers/http-callback
                //scanOptions.HttpCallback = new Uri("http://callbackurl.com?pid={PID}");
                //scanOptions.InProgressResultsCallback = new Uri("http://callbackurl.com?pid={PID}");

                #endregion

                #region Submitting a new scan process to the server

                // Insert here the URL that you'd like to scan for plagiarism
                createdProcess = copyleaks.CreateByUrl(new Uri("http://cnn.com/"), scanOptions);

                // Insert here the file that you'd like to scan for plagiarism
                Addfac add = new Addfac();
                createdProcess = copyleaks.CreateByFile(new FileInfo(add.ansreturn()), scanOptions);


                //Console.WriteLine("Done (PID={0})!", createdProcess.PID);

                #endregion

                #region Waiting for server's process completion

                // Use this if you are not using callback
                sw.WriteLine("Scanning... ");
                ushort currentProgress;
                while (!createdProcess.IsCompleted(out currentProgress))
                {
                    sw.WriteLine(currentProgress + "%");
                    Thread.Sleep(5000);
                }
                sw.WriteLine("Done.");

                #endregion

                #region Processing finished. Getting results

                results = createdProcess.GetResults();
                if (results.Length == 0)
                {
                    sw.WriteLine("No results.");
                }
                else
                {
                    for (int i = 0; i < results.Length; ++i)
                    {
                        if (results[i].URL != null)
                        {
                            sw.WriteLine("Url: {0}", results[i].URL);
                        }
                        sw.WriteLine("Information: {0} copied words ({1}%)", results[i].NumberOfCopiedWords, results[i].Percents);
                        sw.WriteLine("Comparison report: {0}", results[i].ComparisonReport);
                        //Console.WriteLine("Title: {0}", results[i].Title);
                        //Console.WriteLine("Introduction: {0}", results[i].Introduction);
                        ////Console.WriteLine("Embeded comparison: {0}", results[i].EmbededComparison);
                        //Console.ReadKey();
                    }
                }

                #endregion
            }
            catch (UnauthorizedAccessException)
            {
                sw.WriteLine("Failed!");
                sw.WriteLine("Authentication with the server failed!");
                sw.WriteLine("Possible reasons:");
                sw.WriteLine("* You did not log in to Copyleaks cloud");
                sw.WriteLine("* Your login token has expired");
                Console.ReadKey();
            }
            catch (CommandFailedException theError)
            {
                sw.WriteLine("Failed!");
                sw.WriteLine("*** Error {0}:", theError.CopyleaksErrorCode);
                sw.WriteLine("{0}", theError.Message);
                Console.ReadKey();
            }

            sw.Close();
        }
Ejemplo n.º 5
0
 public Accmng()
 {
     facmng = new Facmng();
     acc    = new Account();
     conobj = connect.getconnect();
 }