TechEthical CEHP

Current Path : G:/PleskVhosts/megamind.net.in/careercentre360.com/admin/
Upload File :
Current File : G:/PleskVhosts/megamind.net.in/careercentre360.com/admin/CompanyRegistration.aspx.cs

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Directory.admin
{
    public partial class WebForm2 : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {

                connection_sql obj = new connection_sql();
                obj.MakeConnection();


                DataSet dd = new DataSet();
                dd = obj.getDataSet(@"SELECT *  FROM [contact_book] ");

                grid_place.DataSource = dd;
                grid_place.DataBind();


                DataTable ds = new DataTable();

                ds = obj.getDataTable(@"SELECT Name  FROM[dbo].[tblCategory] order by name ");
                int a = 0;
                while (a < ds.Rows.Count)
                {
                    cmbCategory.Items.Add(ds.Rows[a]["Name"].ToString());
                    a++;
                }
            }
        }

        protected void butSubmit_Click(object sender, EventArgs e)
        {

            connection_sql obj = new connection_sql();
            obj.MakeConnection();
            string sqlQry = "";
            sqlQry = @"INSERT INTO [dbo].[contact_book]
               ([name], ContactPerson, rank, [category], [subcategory]
               [phone],[mobile_1],[mobile_2],[mobile_3]
               ,[website],[email],[area], [address], [description])
         VALUES
               ('" + txtCompany.Text.Trim() + "', '" + txtContactPerson.Text.Trim() + "', '"
           + cmbRank.Text.Trim() + "', '" + cmbCategory.Text.Trim() + "', '"
           + cmbSubcategory.Text.Trim() + "', '" + txtPhone.Text.Trim() + "', '"
           + txtMobile1.Text.Trim() + "', '" + txtMobile2.Text.Trim() + "', '"
           + txtMobile3.Text.Trim() + "', '" + txtWebsite.Text.Trim() + "', '"
           + txtEmail.Text.Trim() + "', '" + txtArea.Text.Trim() + "', '"
           + txtAddress.Text.Trim() + "', '" + txtDescription.Text.Trim() + "')";

            int x = obj.ExcuteCommand(sqlQry);

            obj.CloseConnection();
            if (x > 0)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "set", "alert('Save Successfully');", true);
                txtAddress.Text = "";
                txtArea.Text = "";
                txtEmail.Text = "";
                txtCompany.Text = "";
                txtDescription.Text = "";
                txtMobile1.Text = "";
                txtMobile2.Text = "";
                txtMobile3.Text = "";
                txtPhone.Text = "";
                txtWebsite.Text = "";

            }
        }



        protected void cmbCategory_SelectedIndexChanged(object sender, EventArgs e)
        {

            connection_sql obj = new connection_sql();
            obj.MakeConnection();

            DataTable dt = obj.getDataTable(@"SELECT sc.Name  FROM [tblSubcategory] sc inner join tblCategory c on sc.category_id = c.id
                    where c.name ='" + cmbCategory.Text + "'");
            cmbSubcategory.Items.Clear();
            int a = 0;
            while (a < dt.Rows.Count)
            {
                cmbSubcategory.Items.Add(dt.Rows[a]["Name"].ToString());
                a++;
            }
        }

    }
}

TechEthical Mini WebShell Version 1.0, Coded By The_M@T3