Exemple #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            int       studentId    = ((MainInterface)this.MdiParent).Services.GetStudentId();
            int       serviceId    = ((ServiceID)cboname.SelectedItem).Id;
            int       type         = -1;
            ServiceID selectedItem = (ServiceID)cboname.SelectedItem;

            if (selectedItem.recur == 4)
            {
                type = cbojoiningterm.SelectedIndex + 1;
            }
            sql.addprams("@stu_id", studentId);
            sql.addprams("@serv_id", serviceId);
            sql.addprams("@term", type);
            sql.addprams("@amount", selectedItem.Amount);
            sql.ExecProc("EXEC [dbo].[Insert_Sub]  @stu_id,@serv_id,@term,@amount");
            if (sql.exep != "")
            {
                MessageBox.Show(sql.exep, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            MessageBox.Show("Associated service", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            ((MainInterface)this.MdiParent).Services.Cboname_SelectedIndexChanged(sender, e);
            this.Close();
        }
Exemple #2
0
        private void StudentsAt_Load(System.Object sender, System.EventArgs e)
        {
            this.Icon         = Utils.GetIcon(SchoolManagementApplciation.Properties.Resources._1459676288_cmyk_04);
            dtp.Value         = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
            grphidden.Visible = true;
            grpbox.Visible    = false;
            SqlControl sql = new SqlControl();

            sql.ExecSql("select class as [class] ,section as [section] from class");
            if (sql.exep != "")
            {
                MessageBox.Show(sql.exep);
                return;
            }
            foreach (DataRow r in sql.data.Tables[0].Rows)
            {
                if (cboclass.Items.Contains(r["class"]) == false)
                {
                    cboclass.Items.Add(r["class"]);
                }
                if (cbosection.Items.Contains(r["section"]) == false)
                {
                    cbosection.Items.Add(r["section"]);
                }
            }
            sql.ExecProc("exec update_leaves");
        }
Exemple #3
0
        private void DataGridView1_CellEndEdit(System.Object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
        {
            SqlControl sql = new SqlControl();

            if (this.DataGridView1.CurrentCell.ColumnIndex == 2)
            {
                Type numberType = this.DataGridView1.CurrentCell.Value.IsNumber();
                if (numberType == null)
                {
                    MessageBox.Show("Please Enter A Number", "Wrong input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                double value = Convert.ToDouble(this.DataGridView1.CurrentCell.Value);
                if (value < 0 || value > 100)
                {
                    MessageBox.Show("Enter a number between 1 to 100", "Wrong input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    bnload_Click(sender, e);
                    return;
                }
                sql.addprams("@name", this.DataGridView1.Rows[this.DataGridView1.CurrentCell.RowIndex].Cells[0].Value);
                sql.addprams("@sub", this.DataGridView1.Rows[this.DataGridView1.CurrentCell.RowIndex].Cells[1].Value);
                sql.addprams("@date", dtp.Value);
                sql.addprams("@mark", this.DataGridView1.CurrentCell.Value);
                sql.ExecProc("exec update_marks @name,@sub,@date,@mark");
                bnload_Click(sender, e);
                if (sql.exep != "")
                {
                    MessageBox.Show(sql.exep);
                    return;
                }
            }
        }
Exemple #4
0
        private void bnload_Click(System.Object sender, System.EventArgs e)
        {
            SqlControl sql = new SqlControl();

            if (cboname.Text != "" & cbosub.Text != "")
            {
                sql.addprams("@name", cboname.Text);
                sql.addprams("@sub", cbosub.Text);
                sql.addprams("@date", dtp.Value);
                sql.ExecSql("select *from dbo.show_marks(@name,@sub,@date)");
                if (sql.count <= 0)
                {
                    sql.addprams("@name", cboname.Text);
                    sql.addprams("@sub", cbosub.Text);
                    sql.addprams("@date", dtp.Value);
                    sql.ExecProc("Exec insert_marks @date,NULL,@sub,@name");
                    bnload_Click(sender, e);
                    return;
                }
                bind.DataSource          = sql.data.Tables[0];
                DataGridView1.DataSource = bind;
                if (sql.exep != "")
                {
                    MessageBox.Show(sql.exep);
                    return;
                }
                return;
            }
            if (cboname.Text != "" & cbosub.Text == "")
            {
                sql.addprams("@name", cboname.Text);
                sql.addprams("@date", dtp.Value);
                sql.ExecSql("select * From dbo.show_marks(@name,default,@date)");
                bind.DataSource          = sql.data.Tables[0];
                DataGridView1.DataSource = bind;
                if (sql.exep != "")
                {
                    MessageBox.Show(sql.exep);
                    return;
                }
                return;
            }
            if (cboname.Text == "" & cbosub.Text != "")
            {
                sql.addprams("@sub", cbosub.Text);
                sql.addprams("@date", dtp.Value);
                sql.ExecSql("select * from dbo.show_marks(default,@sub,@date)");
                bind.DataSource          = sql.data.Tables[0];
                DataGridView1.DataSource = bind;
                if (sql.exep != "")
                {
                    MessageBox.Show(sql.exep);
                    return;
                }
                return;
            }
        }
Exemple #5
0
 private void bnclear_Click(System.Object sender, System.EventArgs e)
 {
     try
     {
         SqlControl sql = new SqlControl();
         sql.addprams("@name", this.DataGridView1.Rows[this.DataGridView1.CurrentCell.RowIndex].Cells[0].Value);
         sql.addprams("@sub", this.DataGridView1.Rows[this.DataGridView1.CurrentCell.RowIndex].Cells[1].Value);
         sql.addprams("@date", dtp.Value);
         sql.ExecProc("exec delete_marks @name,@sub,@date");
         MessageBox.Show("The Mark Details Has Been Deleted", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         bnload_Click(sender, e);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Please Select A Mark Info first In The Grid", "Success", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }
Exemple #6
0
        public void saves(System.Object sender, System.EventArgs e)
        {
            SqlControl sqls = new SqlControl();

            sqls.ExecSql("select * from teacher");
            if (sqls.exep != "")
            {
                MessageBox.Show(sqls.exep);
                return;
            }
            int num    = 1;
            var loopTo = sqls.count;

            for (var j = 1; j <= loopTo; j++)
            {
                if (pan.Controls["Combos" + num.ToString()].Text == "")
                {
                    MessageBox.Show("You cannot leave a field blank", "Fill all up", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                num += 1;
            }


            num = 1;
            var loopTo1 = sqls.count;

            for (var j = 1; j <= loopTo1; j++)
            {
                SqlControl sql = new SqlControl();
                sql.addprams("@name", sqls.data.Tables[0].Rows[j - 1]["name"]);
                sql.addprams("@date", dtp.Value);
                ComboBox combo = new ComboBox();
                combo = (ComboBox)pan.Controls["Combos" + num.ToString()];
                sql.addprams("@at", combo.SelectedIndex + 1);
                sql.ExecProc("exec insert_Tat @name,@date,@at");
                if (sql.exep != "")
                {
                    MessageBox.Show(sql.exep);
                    return;
                }
                num += 1;
            }
            see();
        }
Exemple #7
0
        private void MainInterface_Load(System.Object sender, System.EventArgs e)
        {
            if (DateTime.Now.Day == 1)
            {
                this.FeesStructures.CreateOrShow();
                this.FeesStructures.MdiParent = this;
            }

            sqlm.ExecSql("select id from students where due>0");
            if (sqlm.count != 0)
            {
                NotifyIcon1.BalloonTipText  = sqlm.count + "  Students have to pay the fees";
                NotifyIcon1.BalloonTipTitle = "Fee Info";
                NotifyIcon1.ShowBalloonTip(100);
            }
            sqlm.ExecProc("exec update_leaves");
            sqlm.ExecSql("");
        }
Exemple #8
0
 public void saves(System.Object sender, System.EventArgs e)
 {
     if (cboclass.Text != "" & cbosection.Text != "")
     {
         SqlControl sql = new SqlControl();
         sql.addprams("@class", cboclass.Text);
         sql.addprams("@section", cbosection.Text);
         sql.ExecSql("select * from dbo.show_atclass(@class,@section) order by name asc");
         if (sql.exep != "")
         {
             MessageBox.Show(sql.exep);
             return;
         }
         int num    = 1;
         var loopTo = sql.count;
         for (var j = 1; j <= loopTo; j++)
         {
             if (pan.Controls["Combos" + num.ToString()].Text == "")
             {
                 MessageBox.Show("You cannot leave a field blank", "Fill all up", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
             num += 1;
         }
         num = 1;
         var loopTo1 = sql.count;
         for (var j = 1; j <= loopTo1; j++)
         {
             SqlControl sql1 = new SqlControl();
             sql1.addprams("@name", pan.Controls["Names" + num.ToString()].Text);
             sql1.addprams("@date", dtp.Value);
             ComboBox combo = (ComboBox)pan.Controls["Combos" + num.ToString()];
             sql1.addprams("@at", combo.SelectedIndex + 1);
             sql1.ExecProc("exec insert_at @name,@date,@at");
             if (sql1.exep != "")
             {
                 MessageBox.Show(sql1.exep);
                 return;
             }
             num += 1;
         }
         see();
     }
 }
        private void bnsave_Click(System.Object sender, System.EventArgs e)
        {
            if (txtemail.Text == "" | txtfullname.Text == "" | txtphone.Text == "" | txtaddress.Text == "" | cbodesignation.Text == "" | cbogender.Text == "" | txtqua.Text == "")
            {
                MessageBox.Show("No fields must be left blank", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            if (long.Parse(txtphone.Text) < 10000000)
            {
                MessageBox.Show("Invalid Phone number!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            sql.addprams("@name", txtfullname.Text);
            sql.ExecSql("select name from teacher where name = @name");
            if (sql.count != 0)
            {
                MessageBox.Show("There is already a student with exact name please make a little adjustment to help the software :) ", "Same Full names", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            sql.addprams("@name", txtfullname.Text);
            sql.addprams("@gender", cbogender.SelectedIndex + 1);
            sql.addprams("@dob", DateTimePicker1.Value);
            sql.addprams("@desig", cbodesignation.Text);
            sql.addprams("@qua", txtqua.Text);
            sql.addprams("@add", txtaddress.Text);
            sql.addprams("@phone", txtphone.Text);
            sql.addprams("@email", txtemail.Text);
            sql.addprams("@fee", double.Parse(ComboBox1.Text));
            sql.addprams("@join", dtp.Value);
            sql.addprams("@pic", imageT.ImageLocation);
            sql.ExecProc("exec insert_teacher @name,@gender,@dob,@desig,@qua,@add,@phone,@email,@fee,@join,@pic");
            if (sql.exep != "")
            {
                MessageBox.Show(sql.exep);
                return;
            }
            MessageBox.Show("The details about the teacher is stored", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            bnclear_Click(sender, e);
            ((MainInterface)this.MdiParent).ManageTeacher.bnrefresh_Click(sender, e);
            this.Close();
        }
 private void Button3_Click(System.Object sender, System.EventArgs e)
 {
     sql.addprams("@id", ids);
     sql.addprams("@name", txtname.Text);
     sql.addprams("@gender", cbogender.SelectedIndex + 1);
     sql.addprams("@add", txtaddress.Text);
     sql.addprams("@phone", txtphone.Text);
     sql.addprams("@class", cboclass.Text);
     sql.addprams("@section", cbostream.Text);
     sql.addprams("@email", txtemail.Text);
     sql.addprams("@pic", PictureBox1.ImageLocation);
     sql.ExecProc("exec Insert_studing @id,@name,@gender,@add,@phone,@class,@section,@email,@pic");
     if (sql.exep != "")
     {
         MessageBox.Show(sql.exep);
         return;
     }
     MessageBox.Show("The Changes Has Been Made", "Done", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     this.Close();
 }
        private void loadpay_Click(System.Object sender, System.EventArgs e)
        {
            if (txtpay.Text == "" | txtrange.Text == "")
            {
                MessageBox.Show("Please Enter An Amount and Fill The Range", "Fill Up", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            DialogResult mess;

            mess = MessageBox.Show("Are You sure the amount is collected?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
            if (mess == DialogResult.No)
            {
                return;
            }
            SqlControl sql = new SqlControl();

            sql.addprams("@name", cboname.Text);
            sql.addprams("@date", DateTime.Now.Date);
            sql.addprams("@amount", double.Parse(txtpay.Text));
            sql.ExecProc("exec insert_transaction @name,@date,@amount");
            if (sql.exep != "")
            {
                MessageBox.Show(sql.exep);
                return;
            }
            mess = MessageBox.Show("The Payment is Done! Do you want a Bill?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
            if (mess == DialogResult.Yes)
            {
                PrintDocument1.Print();
                mess = MessageBox.Show("Do You Want To Print Another Copy?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (mess == DialogResult.Yes)
                {
                    PrintDocument1.Print();
                }
            }
            cboname_SelectedIndexChanged(sender, e);
            loadcan_Click(sender, e);
            txtpay.Text   = "";
            txtrange.Text = "";
        }
        private void bnsave_Click(System.Object sender, System.EventArgs e)
        {
            if (txtaddress.Text == "" | txtemail.Text == "" | txtfullname.Text == "" | txtphone.Text == "" | txtregno.Text == "" | cboclass.Text == "" | cbogender.Text == "" | cbostream.Text == "")
            {
                MessageBox.Show("No fields must be left blank!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            try
            {
                if (txtphone.Text.Length < 8)
                {
                    MessageBox.Show("The phone number is not valid!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            sql.addprams("@name", txtfullname.Text);
            sql.ExecSql("select name from students where name = @name");
            if (sql.exep != "")
            {
                MessageBox.Show(sql.exep);
                return;
            }

            if (sql.count != 0)
            {
                MessageBox.Show("There is already a student with exact name please add initial to the name", "Same Full names", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            DialogResult res = MessageBox.Show("Are you sure you all the student details are entered correctly?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (res == DialogResult.No)
            {
                return;
            }
            sql.addprams("@name", txtfullname.Text);
            sql.addprams("@Fname", Ftxt.Text);
            sql.addprams("@Mname", Mtxt.Text);
            sql.addprams("@Rnum", txtregno.Text);
            sql.addprams("@date", dtp.Value);
            sql.addprams("@add", txtaddress.Text);
            sql.addprams("@phone", txtphone.Text);
            sql.addprams("@pic", PictureBox1.ImageLocation);
            sql.addprams("@email", txtemail.Text);
            sql.addprams("@gender", cbogender.SelectedIndex + 1);
            sql.addprams("@class", cboclass.Text);
            sql.addprams("@section", cbostream.Text);
            sql.ExecProc("exec Insert_class @gender,@name,@Fname,@Mname,@Rnum,@add,@phone,@pic,@email ,@date ,@class,@section");
            if (sql.exep != "")
            {
                MessageBox.Show(sql.exep);
                return;
            }
            bnclear_Click(sender, e);
            MessageBox.Show("The Student is saved in vinu ", "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            ManageStudents manageStudents = ((MainInterface)this.MdiParent).ManageStudents;

            if (manageStudents.IsHandleCreated)
            {
                manageStudents.bnrefresh_Click(sender, e);
            }
            this.Close();
        }
Exemple #13
0
        private void see()
        {
            SqlControl sql2 = new SqlControl();

            sql2.ExecProc("exec update_leaves");
            if (cotn > 0)
            {
                int numm   = 1;
                var loopTo = cotn;
                for (var j = 1; j <= loopTo; j++)
                {
                    pan.Controls["Combos" + numm.ToString()].Dispose();
                    pan.Controls["Names" + numm.ToString()].Dispose();
                    numm += 1;
                }
            }
            cotn = 0;
            try
            {
                pan.Controls["bnload"].Dispose();
            }
            catch (Exception ex)
            {
            }
            SqlControl sql = new SqlControl();

            sql.addprams("@class", cboclass.Text);
            sql.addprams("@section", cbosection.Text);
            sql.addprams("@date", dtp.Value);
            sql.ExecSql("select * from dbo.show_stuat(@class,@section,@date) order by name asc");
            if (sql.exep != "")
            {
                MessageBox.Show(sql.exep);
                return;
            }
            if (sql.count != 0)
            {
                int arraysize;
                arraysize = sql.count;
                ComboBox[] combos  = new ComboBox[arraysize + 1];
                Label[]    lables  = new Label[arraysize + 1];
                Font       fonts   = new Font("Arial", 12);
                int        num     = 1;
                int        yy      = 100;
                var        loopTo1 = sql.count;
                for (var j = 1; j <= loopTo1; j++)
                {
                    combos[j]          = new ComboBox();
                    combos[j].Name     = "Combos" + num.ToString();
                    combos[j].Location = new Point(300, yy);
                    combos[j].Size     = new Size(140, 24);
                    combos[j].Text     = sql.data.Tables[0].Rows[j - 1]["at"].ToString();
                    pan.Controls.Add(combos[j]);

                    lables[j]          = new Label();
                    lables[j].Name     = "Names" + num.ToString();
                    lables[j].Location = new Point(50, yy);
                    lables[j].Size     = new Size(140, 24);
                    lables[j].Font     = fonts;
                    lables[j].Text     = sql.data.Tables[0].Rows[j - 1]["name"].ToString();
                    pan.Controls.Add(lables[j]);
                    lables[j].Click += clicky;

                    yy   += 50;
                    num  += 1;
                    cotn += 1;
                }
                cbofill.Enabled = false;
            }
            else
            {
                sql.addprams("@class", cboclass.Text);
                sql.addprams("@section", cbosection.Text);
                sql.ExecSql("select * from dbo.show_atclass(@class,@section) order by name asc");
                if (sql.exep != "")
                {
                    MessageBox.Show(sql.exep);
                    return;
                }

                int arraysize;
                arraysize = sql.count;
                ComboBox[] combos = new ComboBox[arraysize + 1];
                Label[]    lables = new Label[arraysize + 1];
                Font       fonts  = new Font("Arial", 12);
                int        num    = 1;
                Button     butt;
                Font       buttfont = new Font("Arial", 22);
                int        yy       = 100;
                var        loopTo2  = sql.count;
                for (var j = 1; j <= loopTo2; j++)
                {
                    combos[j]          = new ComboBox();
                    combos[j].Name     = "Combos" + num.ToString();
                    combos[j].Location = new Point(300, yy);
                    combos[j].Size     = new Size(140, 24);
                    combos[j].Items.Add("Present");
                    combos[j].Items.Add("Absent");
                    pan.Controls.Add(combos[j]);

                    lables[j]          = new Label();
                    lables[j].Name     = "Names" + num.ToString();
                    lables[j].Location = new Point(50, yy);
                    lables[j].Size     = new Size(140, 24);
                    lables[j].Font     = fonts;
                    lables[j].Text     = sql.data.Tables[0].Rows[j - 1]["name"].ToString();
                    pan.Controls.Add(lables[j]);
                    lables[j].Click += clicky;

                    yy   += 50;
                    num  += 1;
                    cotn += 1;
                }

                butt          = new Button();
                butt.Name     = "bnload";
                butt.Text     = "Save";
                butt.Font     = buttfont;
                butt.Location = new Point(75, yy + 50);
                butt.Size     = new Size(400, 100);
                butt.Click   += saves;
                pan.Controls.Add(butt);

                grphidden.Visible = true;
                grpbox.Visible    = false;

                boons           = true;
                cbofill.Enabled = true;
            }
        }