Пример #1
0
        //add attandence
        private void btnAddAttendance_Click(object sender, EventArgs e)
        {
            int    t           = ajdbClass.TRec("select * from ClassAttendance");
            string _DataFields = "AttendanceDate";
            string _Values     = "'" + dtpAttendance.Value + "'";
            string Result      = ajdbClass.InsertIntoDatabase("ClassAttendance", _DataFields, _Values);

            System.Threading.Thread.Sleep(1000);
            DataSet ds = new DataSet();

            ds = ajdbClass.GetRecords("tbl", "SELECT TOP (1) Id, AttendanceDate FROM  ClassAttendance order by id desc");
            string _lastid = "";

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                _lastid = dr["id"].ToString().Trim();
            }
            DataSet dsStudents = new DataSet();

            dsStudents = ajdbClass.GetRecords("tbl", "select * from Student where status='5'");
            foreach (DataRow dr in dsStudents.Tables[0].Rows)
            {
                string _atid = _lastid;
                string stid  = dr["id"].ToString();
                _DataFields = "AttendanceId, studentid,AttendanceStatus";
                _Values     = "'" + _lastid.Replace("'", "''") + "','" + stid + "','1'";
                Result      = ajdbClass.InsertIntoDatabase("StudentAttendance", _DataFields, _Values);
                System.Threading.Thread.Sleep(500);
            }
            ajdbClass.popList(lstAttendace, "select * from ClassAttendance order by AttendanceDate desc", "AttendanceDate");
            gvAttandance.DataSource = GetAttendanceRecord();
            MessageBox.Show("Attandance Taken!!!");
        }
Пример #2
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            AJ_DataClass ajdbClass = new AJ_DataClass();

            string _name    = txtName.Text;
            string _email   = txtEmail.Text;
            string _contact = txtcontact.Text;
            string _addr    = txtaddr.Text;
            string _utype   = cboUtype.SelectedItem.ToString();
            string _pwd     = txtPwd.Text;

            // Check if user already have an account. *email
            int trec = ajdbClass.TRec("select * from [User] where UEmail='" + txtEmail.Text.Trim() + "'");

            if (trec != 0)
            {
                lblmsg.Text = " Email already exists !"; txtEmail.Focus(); return;
            }
            else
            {
                lblmsg.Text = "";
            }

            if (txtPwd.Text.Trim() != txtPwd2.Text.Trim())
            {
                lblmsg.Text = "Password MissMatched !"; txtPwd2.Focus(); return;
            }
            else
            {
                lblmsg.Text = "";
            }
            string _DataFields = "UName,UAddress,UCellNo,UEmail, Utype,UPwd";
            string _Values     = "'" + _name + "','"
                                 + _addr + "','" + _contact + "','"

                                 + _email + "','" + _utype + "','" + _pwd + "'";



            string Result = ajdbClass.InsertIntoDatabase("[User]", _DataFields, _Values);

            lblmsg.Text = Result;
            if (Result == "Record(s) Added Successfully")
            {
                txtName.Text    = "";
                txtEmail.Text   = "";
                txtcontact.Text = "";
                txtaddr.Text    = "";
                txtPwd.Text     = "";
            }
        }
Пример #3
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        AJ_DataClass ajdbClass = new AJ_DataClass();

        // check if request is already has been sent to donor by this user
        string qryCheck = "select * from tblRequestForBlood where tAcceptor_id ='" + _UserID + "' and tDonor_id='" + hfdnrid.Value + "' and tRejected ='false'";
        int    trec     = ajdbClass.TRec(qryCheck);

        if (trec != 0)
        {
            lblmsg.Text = "You already have sent a request for this donor."; return;
        }
        else
        {
            lblmsg.Text = "";
        }

        string _DataFields = "tAcceptor_id,tDonor_id,tBloodGroup_id,tRequestDate ";
        string _Values     = "'" + _UserID + "','" + hfdnrid.Value + "','" + cbodBGroup.SelectedValue + "','" + DateTime.Now.ToShortDateString() + "'";
        string Result      = ajdbClass.InsertIntoDatabase("tblRequestForBlood", _DataFields, _Values);

        lblmsg.Text = Result + " Your request has been sent ";
    }
Пример #4
0
    protected void btnRegister_Click(object sender, EventArgs e)
    {
        AJ_DataClass ajdbClass = new AJ_DataClass();

        string _name    = txtName.Text;
        string _bgid    = cboBGroup.SelectedValue;
        string _email   = txtEmail.Text;
        string _ctid    = cboCities.SelectedValue;
        string _gender  = cboGender.SelectedValue;
        string _contact = txtcontact.Text;
        string _addr    = txtaddr.Text;
        string _pwd     = txtPwd.Text;

        string _isAcceptor = "false";
        string _isDonor    = "false";

        if (chkAcceptor.Checked == true)
        {
            _isAcceptor = "True";
        }
        if (chkDonor.Checked == true)
        {
            _isDonor = "True";
        }

        // Check if user alread have an account. *email
        int trec = ajdbClass.TRec("select * from tblRegister where Remail='" + txtEmail.Text.Trim() + "'");

        if (trec != 0)
        {
            lblmsg.Text = "User's Email already exists !"; txtEmail.Focus(); return;
        }
        else
        {
            lblmsg.Text = "";
        }

        if (txtPwd.Text.Trim() != txtPwd2.Text.Trim())
        {
            lblmsg.Text = "Password MissMatched !"; txtPwd2.Focus(); return;
        }
        else
        {
            lblmsg.Text = "";
        }


        string _DataFields = "rname,rbl_id,risAcceptor," +
                             "risdonor,remail,rct_id,rgender,rcontact," +
                             "raddress,rpassword,rDate";
        string _Values = "'" + _name + "','" + _bgid + "','" + _isAcceptor + "','"

                         + _isDonor + "','" + _email + "','" + _ctid + "','" + _gender + "','" + _contact + "','"

                         + _addr + "','" + _pwd + "','" + DateTime.Now.ToShortDateString() + "'";



        string Result = ajdbClass.InsertIntoDatabase("tblRegister", _DataFields, _Values);

        lblmsg.Text = Result;
        if (Result == "Record(s) Added Succfully")
        {
            txtName.Text        = "";
            txtEmail.Text       = "";
            txtcontact.Text     = "";
            txtaddr.Text        = "";
            txtPwd.Text         = "";
            chkAcceptor.Checked = false;
            chkDonor.Checked    = false;
        }
    }