public byte[] GetCustomerImagePhoto(string Id, string boid)
        {
            byte[]    image = null;
            DataTable dt    = new DataTable();

            CustomerInfoBAL bal        = new CustomerInfoBAL();
            string          Cust_Code  = Id != string.Empty ? Convert.ToString(bal.GetCustomerCode(boid).Rows[0][0]) : Id;
            string          query      = "";
            string          queryImage = "";


            if (Id != "")
            {
                query      = @" select [Photo]  FROM [SBP_Cust_Image] where [Cust_Code]='" + Id + "'";
                queryImage = @" select [Photo]  FROM [SBP_Cust_Image_ImgExt] where [Cust_Code]='" + Id + "'";
            }
            else
            {
                query      = @"select [Photo]  FROM [SBP_Cust_Image] where [Cust_Code]=(select [Cust_Code] from [SBP_Customers] where [BO_ID]='" + boid + "')";
                queryImage = @"select [Photo]  FROM [SBP_Cust_Image_ImgExt] where [Cust_Code]='" + Cust_Code + @"'";
            }

            try
            {
                _dbconneciton.ConnectDatabase_ImageExt();
                dt = _dbconneciton.ExecuteQuery_ImageExt(queryImage);
            }
            catch (Exception ex)
            {
                try
                {
                    _dbconneciton.ConnectDatabase();
                    dt = _dbconneciton.ExecuteQuery(query);
                }
                catch (Exception ext)
                {
                    throw new Exception(ex.Message);
                }
                finally
                {
                    _dbconneciton.CloseDatabase();
                }
            }
            finally
            {
                _dbconneciton.CloseDatabase_ImageExt();
            }

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0][0] != DBNull.Value)
                {
                    image = (byte[])dt.Rows[0][0];
                }
            }

            return(image);
        }
        public byte[] jointholderSignature(string id)
        {
            byte[]          image      = null;
            DataTable       dt         = new DataTable();
            CustomerInfoBAL bal        = new CustomerInfoBAL();
            string          Cust_Code  = id.Length > 7 ? Convert.ToString(bal.GetCustomerCode(id).Rows[0][0]) : id;
            string          queryImage = "";
            string          query      = "";

            if (id.Length > 7)
            {
                query      = @"select [Signature] from [SBP_Joint_holder_Image] where cust_code=(select [Cust_Code] from [SBP_Customers] where [BO_ID]='" + id + "')";
                queryImage = @" select [Signature]  FROM [SBP_Joint_holder_Image_ImgExt] where [Cust_Code]='" + Cust_Code + "'";
            }
            else
            {
                query      = @"select [Signature] from [SBP_Joint_holder_Image] where cust_code='" + Cust_Code + "'";
                queryImage = @" select [Signature]  FROM [SBP_Joint_holder_Image_ImgExt] where [Cust_Code]='" + Cust_Code + "'";
            }

            try
            {
                _dbconneciton.ConnectDatabase_ImageExt();
                dt = _dbconneciton.ExecuteQuery_ImageExt(queryImage);
            }
            catch (Exception ex)
            {
                try
                {
                    _dbconneciton.ConnectDatabase();
                    dt = _dbconneciton.ExecuteQuery(query);
                }
                catch (Exception ext)
                {
                    throw new Exception(ex.Message);
                }
                finally
                {
                    _dbconneciton.CloseDatabase();
                }
            }
            finally
            {
                _dbconneciton.CloseDatabase_ImageExt();
            }

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0][0] != DBNull.Value)
                {
                    image = (byte[])dt.Rows[0][0];
                }
            }

            return(image);
        }