public static void insertSwitchDetails(List <clsSwitchSchemeDetails> listSwitchDetails, string strUserID, int intSwitchID, Boolean isContribution)
            {
                SqlConnection con = new clsSwitchScheme().con;

                con.Open();

                foreach (clsSwitchSchemeDetails SwitchDetail in listSwitchDetails)
                {
                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection = con;

                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "[SWITCHScheme_DetailsInsert]";

                    cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value             = intSwitchID;
                    cmd.Parameters.Add("@param_intFundID", System.Data.SqlDbType.Int).Value               = SwitchDetail.propFund.propFundID;
                    cmd.Parameters.Add("@param_fAllocation", System.Data.SqlDbType.Float).Value           = SwitchDetail.propAllocation;
                    cmd.Parameters.Add("@param_strCreated_By", System.Data.SqlDbType.NVarChar).Value      = strUserID;
                    cmd.Parameters.Add("@param_strUpdated_By", System.Data.SqlDbType.NVarChar).Value      = strUserID;
                    cmd.Parameters.Add("@param_intSwitchDetailsID", System.Data.SqlDbType.Int).Value      = SwitchDetail.intSwitchDetailsID;
                    cmd.Parameters.Add("@param_sintIsDeletable", System.Data.SqlDbType.SmallInt).Value    = SwitchDetail.propIsDeletable == true ? 1 : 0;
                    cmd.Parameters.Add("@param_sintIsContribution", System.Data.SqlDbType.SmallInt).Value = isContribution == true ? 1 : 0;

                    cmd.ExecuteNonQuery();
                }
            }
        public static void deleteSwitch(int intSwitchID)
        {
            SqlConnection con = new clsSwitchScheme().con;
            SqlCommand    cmd = new SqlCommand();

            con.Open();
            cmd.Connection  = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "[SWITCHScheme_Delete]";

            cmd.Parameters.Add("@param_SwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;

            cmd.ExecuteNonQuery();
        }
        public static int insertSwitchHeader(clsScheme Scheme, string strUserID, clsSwitch.enumSwitchStatus SwitchStatus, Nullable <int> intSwitchID, string strDescription)
        {
            SqlConnection con = new clsSwitchScheme().con;
            SqlCommand    cmd = new SqlCommand();

            con.Open();
            cmd.Connection  = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "[SWITCHScheme_HeaderInsert]";

            cmd.Parameters.Add("@param_strSchemeID", System.Data.SqlDbType.NVarChar).Value    = Scheme.propSchemeID;
            cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value    = Scheme.propClient.propClientID;
            cmd.Parameters.Add("@param_intStatus", System.Data.SqlDbType.SmallInt).Value      = SwitchStatus;
            cmd.Parameters.Add("@param_strCreated_By", System.Data.SqlDbType.NVarChar).Value  = strUserID;
            cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value         = intSwitchID;
            cmd.Parameters.Add("@param_strDescription", System.Data.SqlDbType.NVarChar).Value = strDescription;

            return(int.Parse(cmd.ExecuteScalar().ToString()));
        }
            public static void deleteAllDetails(Nullable <int> intSwitchID)
            {
                if (intSwitchID == null)
                {
                    return;
                }

                SqlConnection con = new clsSwitchScheme().con;

                con.Open();

                SqlCommand cmd = new SqlCommand();

                cmd.Connection = con;

                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.CommandText = "[SWITCHScheme_DetailsDeleteAll]";

                cmd.Parameters.Add("@param_SwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;
                cmd.ExecuteNonQuery();
            }
            public static void deleteAllDetails(Nullable<int> intSwitchID)
            {
                if (intSwitchID == null) { return; }

                SqlConnection con = new clsSwitchScheme().con;
                con.Open();

                SqlCommand cmd = new SqlCommand();
                cmd.Connection = con;

                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.CommandText = "[SWITCHScheme_DetailsDeleteAll]";

                cmd.Parameters.Add("@param_SwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;
                cmd.ExecuteNonQuery();
                
            }
            public static void insertSwitchDetails(List<clsSwitchSchemeDetails> listSwitchDetails, string strUserID, int intSwitchID, Boolean isContribution)
            {
                SqlConnection con = new clsSwitchScheme().con;
                con.Open();

                foreach (clsSwitchSchemeDetails SwitchDetail in listSwitchDetails)
                {
                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection = con;

                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "[SWITCHScheme_DetailsInsert]";

                    cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;
                    cmd.Parameters.Add("@param_intFundID", System.Data.SqlDbType.Int).Value = SwitchDetail.propFund.propFundID;
                    cmd.Parameters.Add("@param_fAllocation", System.Data.SqlDbType.Float).Value = SwitchDetail.propAllocation;
                    cmd.Parameters.Add("@param_strCreated_By", System.Data.SqlDbType.NVarChar).Value = strUserID;
                    cmd.Parameters.Add("@param_strUpdated_By", System.Data.SqlDbType.NVarChar).Value = strUserID;
                    cmd.Parameters.Add("@param_intSwitchDetailsID", System.Data.SqlDbType.Int).Value = SwitchDetail.intSwitchDetailsID;
                    cmd.Parameters.Add("@param_sintIsDeletable", System.Data.SqlDbType.SmallInt).Value = SwitchDetail.propIsDeletable == true ? 1 : 0;
                    cmd.Parameters.Add("@param_sintIsContribution", System.Data.SqlDbType.SmallInt).Value = isContribution == true ? 1 : 0;

                    cmd.ExecuteNonQuery();
                }
            }
        public static void deleteSwitch(int intSwitchID)
        {

            SqlConnection con = new clsSwitchScheme().con;
            SqlCommand cmd = new SqlCommand();

            con.Open();
            cmd.Connection = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "[SWITCHScheme_Delete]";

            cmd.Parameters.Add("@param_SwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;

            cmd.ExecuteNonQuery();

        }
        public static int insertSwitchHeader(clsScheme Scheme, string strUserID, clsSwitch.enumSwitchStatus SwitchStatus, Nullable<int> intSwitchID, string strDescription)
        {
            SqlConnection con = new clsSwitchScheme().con;
            SqlCommand cmd = new SqlCommand();

            con.Open();
            cmd.Connection = con;
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.CommandText = "[SWITCHScheme_HeaderInsert]";

            cmd.Parameters.Add("@param_strSchemeID", System.Data.SqlDbType.NVarChar).Value = Scheme.propSchemeID;
            cmd.Parameters.Add("@param_strClientID", System.Data.SqlDbType.NVarChar).Value = Scheme.propClient.propClientID;
            cmd.Parameters.Add("@param_intStatus", System.Data.SqlDbType.SmallInt).Value = SwitchStatus;
            cmd.Parameters.Add("@param_strCreated_By", System.Data.SqlDbType.NVarChar).Value = strUserID;
            cmd.Parameters.Add("@param_intSwitchID", System.Data.SqlDbType.Int).Value = intSwitchID;
            cmd.Parameters.Add("@param_strDescription", System.Data.SqlDbType.NVarChar).Value = strDescription;

            return int.Parse(cmd.ExecuteScalar().ToString());

        }