Beispiel #1
0
    public void female()
    {
        string query1 = "select COUNT(*) AS females from prisoner where gender = 'Female'";

        dt        = dbconnect.databaseReturnDt(query1);
        msg1.Text = dt.Rows[0]["females"].ToString();
    }
    public void Load_Form()
    {
        string str = "SELECT * FROM prisoner" + " where id = '" + ID + "'";

        dt = dbconnect.databaseReturnDt(str);

        lblname.Text      = dt.Rows[0]["names"].ToString();
        lblgender.Text    = dt.Rows[0]["gender"].ToString();
        lblage.Text       = dt.Rows[0]["age"].ToString();
        lbleducation.Text = dt.Rows[0]["education"].ToString();
        lblstate.Text     = dt.Rows[0]["state_origin"].ToString();
        lblnation.Text    = dt.Rows[0]["nationality"].ToString();
        lblmarital.Text   = dt.Rows[0]["marital"].ToString();
        lbloffence.Text   = dt.Rows[0]["offence"].ToString();
        lbljudge.Text     = dt.Rows[0]["date_judgement"].ToString();
        lblconvict.Text   = dt.Rows[0]["date_convicted"].ToString();
        lblprisonN.Text   = dt.Rows[0]["prison_name"].ToString();
        lblsentence.Text  = dt.Rows[0]["sentence"].ToString();
        lblfile.Text      = dt.Rows[0]["file_no"].ToString();


        transTime.Text = DateTime.Now.ToString();
        dataTime.Text  = dt.Rows[0]["Ditem_time"].ToString();

        string image = dt.Rows[0]["imagename"].ToString();

        if (image == "NoImage")
        {
            Image9.ImageUrl = "image/nill.jpg";
        }
        else
        {
            Image9.ImageUrl = "~/UserImage/" + image;
        }
    }
Beispiel #3
0
    public void loadgrid()
    {
        string query = "select * from prisoner ORDER BY names ASC";

        dt = dbconnect.databaseReturnDt(query);
        GridView2.DataSource = dt;
        GridView2.DataBind();
    }
    public void loadgrid()
    {
        string query = "select * from users ORDER BY id ASC";

        dt = dbconnect.databaseReturnDt(query);
        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
Beispiel #5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string username = uname.Text;
        string password = pwd.Text;

        bool ValidRecord = true;

        if (ValidRecord == true)
        {
            string query = "SELECT * FROM users WHERE username='******'", "\''") + "' and password='******'", "\''") + "'";
            dt = dbconnect.databaseReturnDt(query);
            if (dt.Rows.Count > 0)
            {
                Session["user_id"] = int.Parse(dt.Rows[0]["ID"].ToString());
                Response.Redirect("userdashboard.aspx");
            }
        }
        if (ValidRecord == true)
        {
            string query = "SELECT * FROM admin WHERE username='******'", "\''") + "' and password='******'", "\''") + "'";
            dt = dbconnect.databaseReturnDt(query);
            if (dt.Rows.Count > 0)
            {
                Session["user_id"] = int.Parse(dt.Rows[0]["ID"].ToString());
                Response.Redirect("dashboard.aspx");
            }
        }
        if (ValidRecord == true)
        {
            string query = "SELECT * FROM warder WHERE username='******'", "\''") + "' and password='******'", "\''") + "'";
            dt = dbconnect.databaseReturnDt(query);
            if (dt.Rows.Count > 0)
            {
                Session["user_id"] = int.Parse(dt.Rows[0]["ID"].ToString());
                Response.Redirect("dashboard.aspx");
            }
            else if (uname.Text == "")
            {
                Panel1.Visible = true;
                msg.Text       = "Enter Username";
            }
            else if (pwd.Text == "")
            {
                Panel1.Visible = true;
                msg.Text       = "Enter Password";
            }
            else
            {
                Panel1.Visible = true;
                msg.Text       = "Wrong Username or Password";
            }
        }
    }
    public void Load_Form()
    {
        string str = "SELECT * FROM users" + " where id = '" + ID + "'";

        dt = dbconnect.databaseReturnDt(str);



        name.Text  = dt.Rows[0]["names"].ToString();
        phone.Text = dt.Rows[0]["phone"].ToString();
        email.Text = dt.Rows[0]["email"].ToString();
        pwd.Text   = dt.Rows[0]["password"].ToString();
    }
    protected void search_Click(object sender, EventArgs e)
    {
        string names = txtSearch.Text;
        string ages  = txtAge.Text;

        string query = "SELECT * FROM prisoner WHERE names='" + names.Replace("'", "\''") + "' and age='" + ages.Replace("'", "\''") + "'";

        dt = dbconnect.databaseReturnDt(query);
        if (dt.Rows.Count > 0)
        {
            lblname.Text      = dt.Rows[0]["names"].ToString();
            lblgender.Text    = dt.Rows[0]["gender"].ToString();
            lblage.Text       = dt.Rows[0]["age"].ToString();
            lbleducation.Text = dt.Rows[0]["education"].ToString();
            lblstate.Text     = dt.Rows[0]["state_origin"].ToString();
            lblnation.Text    = dt.Rows[0]["nationality"].ToString();
            lblmarital.Text   = dt.Rows[0]["marital"].ToString();
            lbloffence.Text   = dt.Rows[0]["offence"].ToString();
            lbljudge.Text     = dt.Rows[0]["date_judgement"].ToString();
            lblconvict.Text   = dt.Rows[0]["date_convicted"].ToString();
            lblprison.Text    = dt.Rows[0]["prison_name"].ToString();
            lblsentence.Text  = dt.Rows[0]["sentence"].ToString();
            lblfile.Text      = dt.Rows[0]["file_no"].ToString();


            transTime.Text = DateTime.Now.ToString();
            //dataTime.Text = dt.Rows[0]["Ditem_time"].ToString();

            string image = dt.Rows[0]["imagename"].ToString();

            if (image == "NoImage")
            {
                Image9.ImageUrl = "image/nill.jpg";
            }
            else
            {
                Image9.ImageUrl = "~/UserImage/" + image;
            }


            Panel3.Visible  = true;
            Panel10.Visible = false;
            Panel2.Visible  = false;
        }
        else if (txtSearch.Text == "")
        {
            Panel10.Visible = true;
            msg22.Text      = "Enter inmate names";
        }
        else if (txtAge.Text == "")
        {
            Panel10.Visible = true;
            msg22.Text      = "Enter inmate Age";
        }
        else
        {
            Panel10.Visible = true;
            msg22.Text      = "No records found for the search criteria";
        }
    }
Beispiel #8
0
    protected void signUp_Click(object sender, EventArgs e)
    {
        bool   Validrecord = true;
        string query1      = "SELECT * FROM users WHERE email='" + email.Text.Replace("'", "\''") + "' and phone='" + phone.Text.Replace("'", "\''") + "'";

        dt = dbconnect.databaseReturnDt(query1);
        if (dt.Rows.Count > 0)
        {
            Validrecord = false;

            msgfal.Text = "Email Or PhoneNo already exsist";
            name.Focus();
            Panel1.Visible = true;
            Panel2.Visible = false;
            //return;
        }

        if (Validrecord == true)
        {
            string query = "insert into users(names,phone,email,password,confirm,regdate) values ("
                           + "'" + name.Text.Replace("'", "\''") + "',"
                           + "'" + phone.Text.Replace("'", "\''") + "',"
                           + "'" + email.Text.Replace("'", "\''") + "',"
                           + "'" + pwd.Text.Replace("'", "\''") + "',"
                           + "'" + confirm.Text.Replace("'", "\''") + "',"
                           + "'" + DateTime.Now.ToString() + "')";
            dbconnect.databaseInsert(query);

            msgsucc.Text = "Successful Registration ";

            Panel1.Visible = false;
            Panel2.Visible = true;
        }
        else
        {
            msgfal.Text = "Something went wrong";

            Panel1.Visible = true;
            Panel2.Visible = false;
        }

        name.Text    = "";
        phone.Text   = "";
        email.Text   = "";
        pwd.Text     = "";
        confirm.Text = "";
        msgsucc.Text = "";
        msgfal.Text  = "";

        Panel1.Visible = false;
        Panel2.Visible = false;
    }
Beispiel #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user_id"] == null || Session["user_id"].ToString() == "")
        {
            Response.Redirect("Default.aspx");
        }


        bool ValidRecord = true;

        if (ValidRecord == true)
        {
            string query = "select names from admin where ID ='" + Session["user_id"] + "'";
            dt = dbconnect.databaseReturnDt(query);


            if (dt.Rows.Count > 0)
            {
                //LastLogin.Text = dt.Rows[0]["LastLogin"].ToString();
                string names = dt.Rows[0]["names"].ToString();

                welcom_admin.Text = " Court Register <br />" + names;
            }
        }
        if (ValidRecord == true)
        {
            string query = "select names from warder where ID ='" + Session["user_id"] + "'";
            dt = dbconnect.databaseReturnDt(query);


            if (dt.Rows.Count > 0)
            {
                //LastLogin.Text = dt.Rows[0]["LastLogin"].ToString();
                string names = dt.Rows[0]["names"].ToString();
                welcom_admin.Text = " Warden Officer <br />" + names;
            }
        }
    }
Beispiel #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        /*if (Session["user_id"] == null || Session["user_id"].ToString() == "")
         * {
         *  Response.Redirect("Default.aspx");
         * }*/


        bool ValidRecord = true;

        if (ValidRecord == true)
        {
            string query = "select names from users where ID ='" + Session["user_id"] + "'";
            dt = dbconnect.databaseReturnDt(query);


            if (dt.Rows.Count > 0)
            {
                string names = dt.Rows[0]["names"].ToString();
                welcom_admin.Text = " <br />" + names;
            }
        }

        if (ValidRecord == true)
        {
            string query = "select names from admin where admin_id ='" + Session["user_id"] + "'";
            dt = dbconnect.databaseReturnDt(query);


            if (dt.Rows.Count > 0)
            {
                string names = dt.Rows[0]["names"].ToString();
                welcom_admin.Text = " <br />" + names;
            }
        }
    }
Beispiel #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bool ValidRecord = true;

        if (ValidRecord == true)
        {
            string query = "select names from users where ID ='" + Session["user_id"] + "'";
            dt = dbconnect.databaseReturnDt(query);


            if (dt.Rows.Count > 0)
            {
                string names = dt.Rows[0]["names"].ToString();
                welcom_admin.Text = " <br />" + names;
            }
        }
    }
Beispiel #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["user_id"] == null || Session["user_id"].ToString() == "")
        {
            Response.Redirect("Default.aspx");
        }

        string query = "select names from users where ID ='" + Session["user_id"] + "'";

        dt = dbconnect.databaseReturnDt(query);



        //LastLogin.Text = dt.Rows[0]["LastLogin"].ToString();
        string names = dt.Rows[0]["names"].ToString();

        welcom_user.Text = names;
    }
Beispiel #13
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        bool   Validrecord = true;
        string query1      = "SELECT * FROM users WHERE name='" + name.Text.Replace("'", "\''") + "' and phone='" + phone.Text.Replace("'", "\''") + "'";

        dt = dbconnect.databaseReturnDt(query1);
        if (dt.Rows.Count > 0)
        {
            Validrecord = false;

            msgfal.Text = name.Text + "already exsist";
            name.Focus();
            Panel1.Visible = true;
            Panel2.Visible = false;
            return;
        }

        if (Validrecord == true)
        {
            string query = "insert into users(name,address,gender,state,phone,email,username,password) values ("
                           + "'" + name.Text.Replace("'", "\''") + "',"
                           + "'" + address.Text.Replace("'", "\''") + "',"
                           + "'" + gender.Text.Replace("'", "\''") + "',"
                           + "'" + state.Text.Replace("'", "\''") + "',"
                           + "'" + phone.Text.Replace("'", "\''") + "',"
                           + "'" + email.Text.Replace("'", "\''") + "',"
                           + "'" + username.Text.Replace("'", "\''") + "',"
                           + "'" + pwd.Text.Replace("'", "\''") + "')";
            dbconnect.databaseInsert(query);

            msgsucc.Text = "Successful Registration ";

            Panel1.Visible = false;
            Panel2.Visible = true;
        }
    }
Beispiel #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadgrid();
            numberOfcustomer();
            numberOffile();
            totalStorage();
        }

        bool ValidRecord = true;

        if (ValidRecord == true)
        {
            string query = "select names from users where ID ='" + Session["user_id"] + "'";
            dt = dbconnect.databaseReturnDt(query);


            if (dt.Rows.Count > 0)
            {
                string names = dt.Rows[0]["names"].ToString();
                welcom_admin.Text = " <br />" + names;
            }
        }

        if (ValidRecord == true)
        {
            string query = "select names from admin where admin_id ='" + Session["user_id"] + "'";
            dt = dbconnect.databaseReturnDt(query);


            if (dt.Rows.Count > 0)
            {
                string names = dt.Rows[0]["names"].ToString();
                welcom_admin.Text = " <br />" + names;
            }
        }
    }
Beispiel #15
0
    protected void save_Click(object sender, EventArgs e)
    {
        bool   Validrecord  = true;
        string Selectstring = "SELECT * FROM prisoner " + "WHERE name='" + fName.Text.Replace("'", "\''") + "' and age='" + age.Text.Replace("'", "\''") + "'";

        dt = dbconnect.databaseReturnDt(Selectstring);



        if (dt.Rows.Count > 0)
        {
            Validrecord = false;

            msg2.Text = fName.Text + " " + age.Text + " already exsist";
            fName.Focus();
            age.Focus();
            Panel3.Visible = true;
            Panel2.Visible = false;
            return;
        }

        if (Validrecord == true)
        {
            if (pic.HasFile == false)
            {
                string PicName = "NoImage";
                string query   = "insert into prisoner(name,gender,age,education,state_origin,nationality,marital,offence,date_convicted,date_judgement,prison_name,sentence,Ditem_time,file_no) values ("
                                 + "'" + fName.Text.Replace("'", "\''") + "',"
                                 + "'" + gender.Text.Replace("'", "\''") + "',"
                                 + "'" + age.Text.Replace("'", "\''") + "',"
                                 + "'" + education.Text.Replace("'", "\''") + "',"
                                 + "'" + state.Text.Replace("'", "\''") + "',"
                                 + "'" + nation.Text.Replace("'", "\''") + "',"
                                 + "'" + marital.Text.Replace("'", "\''") + "',"
                                 + "'" + offence.Text.Replace("'", "\''") + "',"
                                 + "'" + judge.Text.Replace("'", "\''") + "',"
                                 + "'" + convict.Text.Replace("'", "\''") + "',"
                                 + "'" + prisonN.Text.Replace("'", "\''") + "',"
                                 + "'" + sentence.Text.Replace("'", "\''") + "',"
                                 + "'" + DateTime.Now.ToString() + "',"
                                 + "'" + file.Text.Replace("'", "\''") + "')";
                dbconnect.databaseInsert(query);

                msg1.Text = "Successful Registration ";

                Panel1.Visible = true;
                Panel2.Visible = false;
            }
            else if (pic.HasFile == true)
            {
                string myMap     = MapPath("~/").ToLower();
                Random r         = new Random();
                int    next      = r.Next();
                string ImageName = pic.PostedFile.FileName;

                sImageFileExtension = ImageName.Substring(ImageName.LastIndexOf(".")).ToLower();
                if (sImageFileExtension == ".gif" || sImageFileExtension == ".png" || sImageFileExtension == ".jpg" || sImageFileExtension == ".jpeg" || sImageFileExtension == ".bmp")
                {
                    string ImageSaveURL = myMap + "UserImage/" + next + sImageFileExtension;

                    pic.PostedFile.SaveAs(ImageSaveURL);
                    string query = "insert into prisoner(name,gender,age,education,state_origin,nationality,marital,offence,date_convicted,date_judgement,prison_name,sentence,Ditem_time,imagename,file_no) values ("
                                   + "'" + fName.Text.Replace("'", "\''") + "',"
                                   + "'" + gender.Text.Replace("'", "\''") + "',"
                                   + "'" + age.Text.Replace("'", "\''") + "',"
                                   + "'" + education.Text.Replace("'", "\''") + "',"
                                   + "'" + state.Text.Replace("'", "\''") + "',"
                                   + "'" + nation.Text.Replace("'", "\''") + "',"
                                   + "'" + marital.Text.Replace("'", "\''") + "',"
                                   + "'" + offence.Text.Replace("'", "\''") + "',"
                                   + "'" + judge.Text.Replace("'", "\''") + "',"
                                   + "'" + convict.Text.Replace("'", "\''") + "',"
                                   + "'" + prisonN.Text.Replace("'", "\''") + "',"
                                   + "'" + sentence.Text.Replace("'", "\''") + "',"
                                   + "'" + DateTime.Now.ToString() + "',"
                                   + "'" + next + sImageFileExtension + "',"
                                   + "'" + file.Text.Replace("'", "\''") + "')";

                    dbconnect.databaseInsert(query);


                    msg1.Text      = "Successful Registration ";
                    Panel1.Visible = true;
                    Panel2.Visible = false;
                }
                else
                {
                }
            }
        }
    }