4
Answers

n tier Architecture using C#

Jagjit Saini

Jagjit Saini

13y
2k
1
Hi

namespace nsBo
{
    public interface intorg
    {
        Int32 p_orgcod
        {
            get;
            set;
        }
        string p_orgnam
        {
            get;
            set;
        }
        DateTime p_orgcrtdat
        {
            get;
            set;
        }
    }

    public class clsorgprp : intorg
    {
        private Int32 prvorgcod;
        private string  prvorgnam;
        private DateTime prvorgcrtdat;

        public int p_orgcod
        {
            get
            {
                return prvorgcod;
            }
            set
            {
                prvorgcod = value;
            }
        }
        public string p_orgnam
        {
            get
            {
                return prvorgnam;
            }
            set
            {
                prvorgnam = value;
            }
        }
        public DateTime p_orgcrtdat
        {
            get
            {
                return prvorgcrtdat;
            }
            set
            {
                prvorgcrtdat = value;
            }
        }
    }
}


namespace nsDal
{
    public abstract class clscon
    {
        protected SqlConnection con = new SqlConnection();
        public clscon()
        {
            con.ConnectionString = ConfigurationManager.ConnectionStrings["cn"].ConnectionString;
        }
    }

    public class clsorg : clscon
    {
        public int save_rec(nsBo.clsorgprp p)
        {
            if (con.State == ConnectionState.Closed)
            {
                con.Open();
            }

            SqlCommand cmd = new SqlCommand("insemp", con);
            cmd.CommandType = CommandType.StoredProcedure;
            try
            {
                cmd.Parameters.Add("@orgcod", SqlDbType.Int).Value = p.p_orgcod;
                cmd.Parameters.Add("@orgam", SqlDbType.VarChar, 100).Value = p.p_orgnam;
                cmd.Parameters.Add("@orgcrtdat", SqlDbType.DateTime).Value = p.p_orgcrtdat;
                return cmd.ExecuteNonQuery();
            }
            catch
            {
                throw;
            }
            finally
            {
                cmd.Dispose();
                con.Close();
            }
        }
    }
}

I want to know what does this line in DAL actually do

public void save_rec(nsBo.clsorgprp p) & what (nsBo.clsorgprp) p means & what this method will return

Thanks


Answers (4)