Thursday, 2 August 2012

Create Property and method in Class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

namespace Acteon
{
    public class C_Application
    {


        //private System.Int64 _Applicationid;
        private System.String _Name;
        private System.String _Dob;
        private System.String _Gender;
        private System.String _Maritalstatus;
        private System.String _Emailid;
        private System.String _Phoneno;
        private System.String _City;
        private System.String _State;
        private System.String _Mobinno;
        private System.String _Adress;
        private System.String _Currentemployer;
        private System.String _Location;
        private System.String _Totalexperience;
        private System.String _Designation;
        private System.Decimal _Annualsalary;
        private System.String _Resumeurl;
        private Int64 _value;
      
        public System.String Name
        {
            get
            {
                return _Name;
            }
            set
            {
                _Name = value;
            }
        }
        public System.String Dob
        {
            get
            {
                return _Dob;
            }
            set
            {
                _Dob = value;
            }
        }
        public System.String Gender
        {
            get
            {
                return _Gender;
            }
            set
            {
                _Gender = value;
            }
        }
        public System.String Maritalstatus
        {
            get
            {
                return _Maritalstatus;
            }
            set
            {
                _Maritalstatus = value;
            }
        }
        public System.String Emailid
        {
            get
            {
                return _Emailid;
            }
            set
            {
                _Emailid = value;
            }
        }
        public System.String Phoneno
        {
            get
            {
                return _Phoneno;
            }
            set
            {
                _Phoneno = value;
            }
        }
        public System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                _City = value;
            }
        }
        public System.String State
        {
            get
            {
                return _State;
            }
            set
            {
                _State = value;
            }
        }
        public System.String Mobinno
        {
            get
            {
                return _Mobinno;
            }
            set
            {
                _Mobinno = value;
            }
        }
        public System.String Adress
        {
            get
            {
                return _Adress;
            }
            set
            {
                _Adress = value;
            }
        }
        public System.String Currentemployer
        {
            get
            {
                return _Currentemployer;
            }
            set
            {
                _Currentemployer = value;
            }
        }
        public System.String Location
        {
            get
            {
                return _Location;
            }
            set
            {
                _Location = value;
            }
        }
        public System.String Totalexperience
        {
            get
            {
                return _Totalexperience;
            }
            set
            {
                _Totalexperience = value;
            }
        }
        public System.String Designation
        {
            get
            {
                return _Designation;
            }
            set
            {
                _Designation = value;
            }
        }
        public System.Decimal Annualsalary
        {
            get
            {
                return _Annualsalary;
            }
            set
            {
                _Annualsalary = value;
            }
        }
        public System.String Resumeurl
        {
            get
            {
                return _Resumeurl;
            }
            set
            {
                _Resumeurl = value;
            }
        }
        #region Login Property and method

        private string userid;

        public string Userid
        {
            get { return userid; }
            set { userid = value; }
        }
        private string userpass;

        public string Userpass
        {
            get { return userpass; }
            set { userpass = value; }
        }

        private string imagetitle;

        public string Imagetitle
        {
            get { return imagetitle; }
            set { imagetitle = value; }
        }
        private string imagepath;

        public string Imagepath
        {
            get { return imagepath; }
            set { imagepath = value; }
        }
        private Int64 enteredby1;

        public Int64 Enteredby1
        {
            get { return enteredby1; }
            set { enteredby1 = value; }
        }
        private Int64 offerid;

        public Int64 Offerid
        {
            get { return offerid; }
            set { offerid = value; }
        }
        private Int64 counterid;

        public Int64 Counterid
        {
       get { return counterid; }
       set { counterid = value; }
}      
      
        #region MyRegion
        private Int64 _value1;
        private System.Int64 _Qualificationid;
        private System.Int64 _Applicationid;
        private System.String _Coursename;
        private System.String _Universityname;
        private System.String _Passingyear;
        private System.String _Stream;
        private System.Int32 _Isactive;
        private System.DateTime _Enteredon;
        private System.Int64 _Enteredby;
        private System.DateTime _Updatedon;
        private System.Int64 _Updatedby;
        private String _ConnectionString;

        public System.Int64 Qualificationid
        {
            get
            {
                return _Qualificationid;
            }
            set
            {
                _Qualificationid = value;
            }
        }
        public System.Int64 Applicationid
        {
            get
            {
                return _Applicationid;
            }
            set
            {
                _Applicationid = value;
            }
        }
        public System.String Coursename
        {
            get
            {
                return _Coursename;
            }
            set
            {
                _Coursename = value;
            }
        }
        public System.String Universityname
        {
            get
            {
                return _Universityname;
            }
            set
            {
                _Universityname = value;
            }
        }
        public System.String Passingyear
        {
            get
            {
                return _Passingyear;
            }
            set
            {
                _Passingyear = value;
            }
        }
        public System.String Stream
        {
            get
            {
                return _Stream;
            }
            set
            {
                _Stream = value;
            }
        }
        public System.Int32 Isactive
        {
            get
            {
                return _Isactive;
            }
            set
            {
                _Isactive = value;
            }
        }
        public System.DateTime Enteredon
        {
            get
            {
                return _Enteredon;
            }
            set
            {
                _Enteredon = value;
            }
        }
        public System.Int64 Enteredby
        {
            get
            {
                return _Enteredby;
            }
            set
            {
                _Enteredby = value;
            }
        }
        public System.DateTime Updatedon
        {
            get
            {
                return _Updatedon;
            }
            set
            {
                _Updatedon = value;
            }
        }
        public System.Int64 Updatedby
        {
            get
            {
                return _Updatedby;
            }
            set
            {
                _Updatedby = value;
            }
        }
        public String ConnectionString
        {
            get
            {
                return _ConnectionString;
            }
            set
            {
                _ConnectionString = value;
            }
        }
        #endregion



        public DataTable setcounter()
        {

            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "Counter_acteon";
            cmd.CommandType = CommandType.StoredProcedure;

            return Database.getDataTable(cmd);

        }
        public void offer_delete()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "offer_delete";
            cmd.Parameters.AddWithValue("@offerid", offerid);
            try
            {
                Database.ExecuteNonQry(cmd);
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public DataSet Image_show()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandText = "Image_display";
            cmd.CommandType = CommandType.StoredProcedure;
            try
            {
                return Database.getDataSet(cmd);
            }
            catch
            {
                throw;
            }
        }
        public DataSet image_bind()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "image_show";
            try
            {
                return Database.getDataSet(cmd);
            }
            catch
            {
                throw;
            }
        }
        public void image_insert()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "offer_insert";
            cmd.Parameters.AddWithValue("@title", imagetitle);
            cmd.Parameters.AddWithValue("@Imgurl", imagepath);
            cmd.Parameters.AddWithValue("@enteredby", enteredby1);
            try
            {
                Database.insertTable(cmd);
            }
            catch (Exception Ex)
            {
                throw Ex;

            }

        }

        public DataSet Adminlogin()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "admin_logn";
            cmd.Parameters.AddWithValue("@userid", userid);
            cmd.Parameters.AddWithValue("@userpass", userpass);
           
            try
            {
                return Database.getDataSet(cmd);
            }
            catch
            {
                throw;
            }

        }
        public DataSet Grid_reg_bind()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "user_regisshow";
            try
            {
                return Database.getDataSet(cmd);
            }
            catch
            {
                throw;
            }
           
        }
        public DataSet Grid_app_bind()
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "user_appshow";
            try
            {
                return Database.getDataSet(cmd);
            }
            catch
            {
                throw;
            }
        }

        public DataSet Datalist1_bind(int id)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "regis_select";
            cmd.Parameters.AddWithValue("@id", id);
            return Database.getDataSet(cmd);

        }
        public DataSet Datalist2_bind(int id)
        {
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "appi_select";
            cmd.Parameters.AddWithValue("@id", id);
            return Database.getDataSet(cmd);
        }

        public Int64 Insert()
        {

            SqlCommand cmd = new SqlCommand();
          
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "insert_Application";
            cmd.Parameters.AddWithValue("@Name", _Name);
            cmd.Parameters.AddWithValue("@Dob", _Dob);
            cmd.Parameters.AddWithValue("@Gender", _Gender);
            cmd.Parameters.AddWithValue("@Maritalstatus", _Maritalstatus);
            cmd.Parameters.AddWithValue("@Emailid", _Emailid);
            cmd.Parameters.AddWithValue("@Phoneno", _Phoneno);
            cmd.Parameters.AddWithValue("@City", _City);
            cmd.Parameters.AddWithValue("@State", _State);
            cmd.Parameters.AddWithValue("@Mobinno", _Mobinno);
            cmd.Parameters.AddWithValue("@Adress", _Adress);
            cmd.Parameters.AddWithValue("@Currentemployer", _Currentemployer);
            cmd.Parameters.AddWithValue("@Location", _Location);
            cmd.Parameters.AddWithValue("@Totalexperience", _Totalexperience);
            cmd.Parameters.AddWithValue("@Designation", _Designation);
            cmd.Parameters.AddWithValue("@Annualsalary", _Annualsalary);
            cmd.Parameters.AddWithValue("@Resumeurl", _Resumeurl);

            try
            {

                return _value = Convert.ToInt64(Database.insertTable(cmd));
             
            }
            catch (Exception Ex)
            {
              
                throw Ex;

            }
        }

        public void Update()
        {
            SqlCommand cmd = new SqlCommand();
           // cmd.Connection = con;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "Update_Application";
            //cmd.Parameters.Add("@Applicationid", _Applicationid);
            cmd.Parameters.AddWithValue("@Name", _Name);
            cmd.Parameters.AddWithValue("@Dob", _Dob);
            cmd.Parameters.AddWithValue("@Gender", _Gender);
            cmd.Parameters.AddWithValue("@Maritalstatus", _Maritalstatus);
            cmd.Parameters.AddWithValue("@Emailid", _Emailid);
            cmd.Parameters.AddWithValue("@Phoneno", _Phoneno);
            cmd.Parameters.AddWithValue("@City", _City);
            cmd.Parameters.AddWithValue("@State", _State);
            cmd.Parameters.AddWithValue("@Mobinno", _Mobinno);
            cmd.Parameters.AddWithValue("@Adress", _Adress);
            cmd.Parameters.AddWithValue("@Currentemployer", _Currentemployer);
            cmd.Parameters.AddWithValue("@Location", _Location);
            cmd.Parameters.AddWithValue("@Totalexperience", _Totalexperience);
            cmd.Parameters.AddWithValue("@Designation", _Designation);
            cmd.Parameters.AddWithValue("@Annualsalary", _Annualsalary);
            cmd.Parameters.AddWithValue("@Resumeurl", _Resumeurl);
            //cmd.Parameters.Add("@Isative", _Isative);
            //cmd.Parameters.Add("@Enteredon", _Enteredon);
            //cmd.Parameters.Add("@Enteredby", _Enteredby);
            //cmd.Parameters.Add("@Updatedon", _Updatedon);
            //cmd.Parameters.Add("@Updatedby", _Updatedby);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception Ex)
            {
                throw Ex;

            }
        }

        public Int64 Insertqualification()
        {
          
            SqlCommand cmd = new SqlCommand();
           
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "insert_Qualification";
            cmd.Parameters.AddWithValue("@Applicationid", _Applicationid);
            cmd.Parameters.AddWithValue("@Coursename", _Coursename);
            cmd.Parameters.AddWithValue("@Universityname", _Universityname);
            cmd.Parameters.AddWithValue("@Passingyear", _Passingyear);
            cmd.Parameters.AddWithValue("@Stream", _Stream);
            //cmd.Parameters.Add("@Isactive", _Isactive);
            //cmd.Parameters.Add("@Enteredon", _Enteredon);
            //cmd.Parameters.Add("@Enteredby", _Enteredby);
            //cmd.Parameters.Add("@Updatedon", _Updatedon);
            //cmd.Parameters.Add("@Updatedby", _Updatedby);
            try
            {
                return _value1 = Convert.ToInt64(Database.insertTable(cmd));
         
            }
            catch (Exception Ex)
            {
       
                throw Ex;

            }
        }
    }
}

No comments:

Post a Comment