/*--(1):-This Function is work as Get Data From dataBase And Return Dataset*/
        public clsBgDataSetFunction DAGetDataSet(params object[] Param)
        {
            SqlDataAdapter       DataAdaptor   = null;
            string               strGivenQuery = Param[0].ToString();
            clsBgDataSetFunction RetVal        = new clsBgDataSetFunction();

            System.DateTime StartAccess = DateTime.MinValue;
            int             Count       = 0;

            for (Count = 1; Count <= Param.GetUpperBound(0); Count++)
            {
                if (Param[Count].ToString() == "'")
                {
                    Param[Count] = "";
                }
                strGivenQuery = strGivenQuery.Replace("%%Param" + System.Convert.ToString(Count) + "%%", System.Convert.ToString(Param[Count]));
            }
            try
            {
                CheckConnection();
                DataAdaptor = new SqlDataAdapter(strGivenQuery, bgDataConn);
                DataAdaptor.Fill(RetVal);
            }
            catch (Exception)
            {
                RetVal = new clsBgDataSetFunction();
                RetVal = null;
            }
            bgDataConn.Close();
            // Program.bgDataConn.Close();
            return(RetVal);
        }
        public clsBgDataSetFunction DAGetDataSet(SqlTransaction Tran, SqlConnection conn, params object[] Param)
        {
            SqlDataAdapter       DataAdaptor   = null;
            string               strGivenQuery = Param[0].ToString();
            clsBgDataSetFunction RetVal        = new clsBgDataSetFunction();

            System.DateTime StartAccess = DateTime.MinValue;
            int             Count       = 0;

            for (Count = 1; Count <= Param.GetUpperBound(0); Count++)
            {
                if (Param[Count].ToString() == "'")
                {
                    Param[Count] = "";
                }
                strGivenQuery = strGivenQuery.Replace("%%Param" + System.Convert.ToString(Count) + "%%", System.Convert.ToString(Param[Count]));
            }
            try
            {
                SqlCommand cmd = new SqlCommand(strGivenQuery, conn);
                cmd.Transaction = Tran;
                DataAdaptor     = new SqlDataAdapter(cmd);
                DataAdaptor.Fill(RetVal);
            }
            catch (Exception)
            {
                RetVal = new clsBgDataSetFunction();
                RetVal = null;
            }

            return(RetVal);
        }
        /*--(7):-This function is work as Check Duplicate value*/
        public bool DAIsDuplicate(string strTableName, string strFieldName, string strCheckFild, string strParameterValue)
        {
            clsBgDataSetFunction ExDS = null;

            try
            {
                ExDS = DAGetDataSet(bgQCheckDuplicate, strFieldName, strTableName, strCheckFild, strParameterValue);
            }
            catch (Exception Ex)
            {
                //MessageBox.Show(Ex.Message, Program.Title);
            }
            return(ExDS.RowsCount() > 0);
        }
        /*--(6):-This function is work as get  to table Next Id*/
        public int DAGetNextID(string TableName, string Field)
        {
            clsBgDataSetFunction ExDS = null;

            try
            {
                ExDS = DAGetDataSet(bgQGetNextID, Field, TableName);
            }
            catch (Exception Ex)
            {
                //MessageBox.Show(Ex.Message, Program.Title);
            }
            return(ExDS.NullAsInteger(0, "MaxID"));
        }